class RelationshipItemNormalizerValueTest in JSON:API 8
@coversDefaultClass \Drupal\jsonapi\Normalizer\Value\RelationshipItemNormalizerValue @group jsonapi
@internal
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\jsonapi\Unit\Normalizer\Value\RelationshipItemNormalizerValueTest
Expanded class hierarchy of RelationshipItemNormalizerValueTest
File
- tests/
src/ Unit/ Normalizer/ Value/ RelationshipItemNormalizerValueTest.php, line 16
Namespace
Drupal\Tests\jsonapi\Unit\Normalizer\ValueView source
class RelationshipItemNormalizerValueTest extends UnitTestCase {
/**
* @covers ::rasterizeValue
* @dataProvider rasterizeValueProvider
*/
public function testRasterizeValue($values, $entity_type_id, $bundle, $expected) {
$object = new RelationshipItemNormalizerValue($values, new CacheableMetadata(), new ResourceType($entity_type_id, $bundle, NULL), NULL);
$this
->assertEquals($expected, $object
->rasterizeValue());
}
/**
* Data provider for testRasterizeValue.
*/
public function rasterizeValueProvider() {
return [
[
[
'target_id' => 1,
],
'node',
'article',
[
'type' => 'node--article',
'id' => 1,
],
],
[
[
'value' => 1,
],
'node',
'page',
[
'type' => 'node--page',
'id' => 1,
],
],
[
[
1,
],
'node',
'foo',
[
'type' => 'node--foo',
'id' => 1,
],
],
[
[],
'node',
'bar',
[],
],
[
[
NULL,
],
'node',
'baz',
NULL,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RelationshipItemNormalizerValueTest:: |
public | function | Data provider for testRasterizeValue. | |
RelationshipItemNormalizerValueTest:: |
public | function | @covers ::rasterizeValue @dataProvider rasterizeValueProvider | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 340 |