.../Value/RelationshipNormalizerValueTest.php | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/src/Unit/Normalizer/Value/RelationshipNormalizerValueTest.php b/tests/src/Unit/Normalizer/Value/RelationshipNormalizerValueTest.php index 27e4675..cd3ea58 100644 --- a/tests/src/Unit/Normalizer/Value/RelationshipNormalizerValueTest.php +++ b/tests/src/Unit/Normalizer/Value/RelationshipNormalizerValueTest.php @@ -91,7 +91,7 @@ class RelationshipNormalizerValueTest extends UnitTestCase { 'related' => 'dummy_entity_link', ]; return [ - [[$uid1->reveal()], 1, [ + 'single cardinality' => [[$uid1->reveal()], 1, [ 'data' => ['type' => 'user', 'id' => 1], 'links' => $links, ], @@ -100,7 +100,7 @@ class RelationshipNormalizerValueTest extends UnitTestCase { ->setCacheTags(['ctfoo', 'relationship:foo']) ->setCacheMaxAge(15), ], - [ + 'multiple cardinality' => [ [$uid1->reveal(), $uid2->reveal()], 2, [ 'data' => [ ['type' => 'user', 'id' => 1], @@ -113,6 +113,31 @@ class RelationshipNormalizerValueTest extends UnitTestCase { ->setCacheTags(['ctbar', 'ctfoo', 'relationship:foo']) ->setCacheMaxAge(10), ], + 'multiple cardinality, all same values' => [ + [$uid1->reveal(), $uid1->reveal()], 2, [ + 'data' => [ + ['type' => 'user', 'id' => 1, 'meta' => ['arity' => 2]], + ], + 'links' => $links, + ], + (new CacheableMetadata()) + ->setCacheContexts(['ccfoo', 'user']) + ->setCacheTags(['ctfoo', 'relationship:foo']) + ->setCacheMaxAge(15), + ], + 'multiple cardinality, some same values' => [ + [$uid1->reveal(), $uid2->reveal(), $uid1->reveal()], 2, [ + 'data' => [ + ['type' => 'user', 'id' => 1, 'meta' => ['arity' => 2]], + ['type' => 'user', 'id' => 2], + ], + 'links' => $links, + ], + (new CacheableMetadata()) + ->setCacheContexts(['ccbar', 'ccfoo', 'user']) + ->setCacheTags(['ctbar', 'ctfoo', 'relationship:foo']) + ->setCacheMaxAge(10), + ], ]; }