Skip to content

Commit 95595fd

Browse files
committed
insert test again
testNormalizeDoesntReplaceWhenTargetEntityIsMissing
1 parent 43ede76 commit 95595fd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

api/tests/Serializer/Normalizer/RelatedCollectionLinkNormalizerTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,28 @@ public function testNormalizeDoesntReplaceWhenNoFilters() {
325325
$this->shouldNotReplaceChildren($result);
326326
}
327327

328+
public function testNormalizeDoesntReplaceWhenTargetEntityIsMissing() {
329+
// given
330+
$resource = new ParentEntity();
331+
$this->mockDecoratedNormalizer();
332+
$this->mockNameConverter();
333+
$this->mockAssociationMetadata(OneToManyAssociationMapping::fromMappingArray([
334+
'targetEntity' => '',
335+
'mappedBy' => 'parent',
336+
'fieldName' => 'children',
337+
'sourceEntity' => ParentEntity::class,
338+
]));
339+
$this->mockRelatedResourceMetadata(['filters' => ['attribute_filter_something_something']]);
340+
$this->mockRelatedFilterDescription(['parent' => ['strategy' => 'exact']]);
341+
$this->mockGeneratedRoute();
342+
343+
// when
344+
$result = $this->normalizer->normalize($resource, null, ['resource_class' => ParentEntity::class]);
345+
346+
// then
347+
$this->shouldNotReplaceChildren($result);
348+
}
349+
328350
public function testNormalizeDoesntReplaceWhenNotADoctrineAssociation() {
329351
// given
330352
$resource = new ParentEntity();

0 commit comments

Comments
 (0)