ApiPlatform\Core\Tests\Metadata\Property\Factory\InheritedPropertyNameCollectionFactoryTest::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();
        $propertyNameCollectionFactory = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory->create(DummyTableInheritance::class, [])->willReturn(new PropertyNameCollection(['name']))->shouldBeCalled();
        $propertyNameCollectionFactory->create(DummyTableInheritanceChild::class, [])->willReturn(new PropertyNameCollection(['nickname']))->shouldBeCalled();
        $factory = new InheritedPropertyNameCollectionFactory($resourceNameCollectionFactory->reveal(), $propertyNameCollectionFactory->reveal());
        $metadata = $factory->create(DummyTableInheritance::class);
        $this->assertEquals($metadata, new PropertyNameCollection(['name', 'nickname']));
    }
InheritedPropertyNameCollectionFactoryTest