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

testCreate() public method

public testCreate ( Prophecy\Prophecy\ProphecyInterface $decorated = null, array $results )
$decorated Prophecy\Prophecy\ProphecyInterface
$results array
    public function testCreate(ProphecyInterface $decorated = null, array $results)
    {
        $reader = $this->prophesize(Reader::class);
        $reader->getPropertyAnnotation(new \ReflectionProperty(Dummy::class, 'name'), ApiProperty::class)->willReturn(new ApiProperty())->shouldBeCalled();
        $reader->getPropertyAnnotation(Argument::type(\ReflectionProperty::class), ApiProperty::class)->willReturn(null)->shouldBeCalled();
        $reader->getMethodAnnotation(new \ReflectionMethod(Dummy::class, 'getName'), ApiProperty::class)->willReturn(new ApiProperty())->shouldBeCalled();
        $reader->getMethodAnnotation(new \ReflectionMethod(Dummy::class, 'getAlias'), ApiProperty::class)->willReturn(new ApiProperty())->shouldBeCalled();
        $reader->getMethodAnnotation(Argument::type(\ReflectionMethod::class), ApiProperty::class)->willReturn(null)->shouldBeCalled();
        $factory = new AnnotationPropertyNameCollectionFactory($reader->reveal(), $decorated ? $decorated->reveal() : null);
        $metadata = $factory->create(Dummy::class, []);
        $this->assertEquals($results, iterator_to_array($metadata));
    }
AnnotationPropertyNameCollectionFactoryTest