Skip to content

Commit

Permalink
fix(metadata): property metadata merging (api-platform#4428)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and vincentchalamon committed Oct 15, 2021
1 parent 3adca4e commit 4c38e81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function createMetadata(ApiProperty $attribute, ApiProperty $propertyMet
preg_match('/^(?:get|is)(.*)/', $method, $matches) &&
null !== $val = $attribute->{$method}()
) {
$propertyMetadata->{"with{$matches[1]}"}($val);
$propertyMetadata = $propertyMetadata->{"with{$matches[1]}"}($val);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testClassFoundAndParentFound()
$factory = new AttributePropertyMetadataFactory($decoratedProphecy->reveal());
$metadata = $factory->create(DummyPhp8ApiPropertyAttribute::class, 'empty');

$this->assertSame($parentPropertyMetadata, $metadata);
$this->assertNotSame($parentPropertyMetadata, $metadata);
$this->assertSame('Desc', $metadata->getDescription());
$this->assertTrue($metadata->isReadable());
$this->assertFalse($metadata->isWritable());
Expand All @@ -86,6 +86,7 @@ public function testClassFoundAndParentFound()
$this->assertFalse($metadata->isIdentifier());
$this->assertSame('Default', $metadata->getDefault());
$this->assertSame('Example', $metadata->getExample());
$this->assertSame(['https://example.com'], $metadata->getTypes());
// TODO need https://github.com/api-platform/core/pull/4422
//$this->assertSame(['https://example.com'], $metadata->getTypes());
}
}

0 comments on commit 4c38e81

Please sign in to comment.