ApiPlatform\Core\Tests\Metadata\Property\Factory\InheritedPropertyMetadataFactoryTest::testCreate PHP Method

testCreate() public method

public testCreate ( )
    public function testCreate()
    {
        $resourceNameCollectionFactory = $this->prophesize(ResourceNameCollectionFactoryInterface::class);
        $resourceNameCollectionFactory->create()->willReturn(new ResourceNameCollection([DummyTableInheritance::class, DummyTableInheritanceChild::class]))->shouldBeCalled();
        $type = new Type(Type::BUILTIN_TYPE_STRING);
        $nicknameMetadata = new PropertyMetadata($type, 'nickname', true, true, false, false, true, false, 'http://example.com/foo', null, ['foo' => 'bar']);
        $propertyMetadataFactory = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory->create(DummyTableInheritance::class, 'nickname', [])->willReturn($nicknameMetadata)->shouldBeCalled();
        $propertyMetadataFactory->create(DummyTableInheritanceChild::class, 'nickname', [])->willReturn($nicknameMetadata)->shouldBeCalled();
        $factory = new InheritedPropertyMetadataFactory($resourceNameCollectionFactory->reveal(), $propertyMetadataFactory->reveal());
        $metadata = $factory->create(DummyTableInheritance::class, 'nickname');
        $shouldBe = new PropertyMetadata($type, 'nickname', true, true, false, false, true, false, 'http://example.com/foo', DummyTableInheritanceChild::class, ['foo' => 'bar']);
        $this->assertEquals($metadata, $shouldBe);
    }
InheritedPropertyMetadataFactoryTest