Skip to content

Commit

Permalink
insert test again
Browse files Browse the repository at this point in the history
testNormalizeDoesntReplaceWhenTargetEntityIsMissing
  • Loading branch information
pmattmann committed Dec 23, 2024
1 parent 43ede76 commit 95595fd
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,28 @@ public function testNormalizeDoesntReplaceWhenNoFilters() {
$this->shouldNotReplaceChildren($result);
}

public function testNormalizeDoesntReplaceWhenTargetEntityIsMissing() {
// given
$resource = new ParentEntity();
$this->mockDecoratedNormalizer();
$this->mockNameConverter();
$this->mockAssociationMetadata(OneToManyAssociationMapping::fromMappingArray([
'targetEntity' => '',
'mappedBy' => 'parent',
'fieldName' => 'children',
'sourceEntity' => ParentEntity::class,
]));
$this->mockRelatedResourceMetadata(['filters' => ['attribute_filter_something_something']]);
$this->mockRelatedFilterDescription(['parent' => ['strategy' => 'exact']]);
$this->mockGeneratedRoute();

// when
$result = $this->normalizer->normalize($resource, null, ['resource_class' => ParentEntity::class]);

// then
$this->shouldNotReplaceChildren($result);
}

public function testNormalizeDoesntReplaceWhenNotADoctrineAssociation() {
// given
$resource = new ParentEntity();
Expand Down

0 comments on commit 95595fd

Please sign in to comment.