Author: Adrien Brault (adrien.brault@gmail.com)
Inheritance: implements Metadata\Driver\DriverInterface
Example #1
0
 public function testDelegateReturnsNullAndExtensionsAddRelations()
 {
     $reflectionClass = new \ReflectionClass(get_class($this));
     $extensionProphecy = $this->prophesize('Hateoas\\Configuration\\Metadata\\ConfigurationExtensionInterface');
     $extensionProphecy->decorate(Argument::type('Hateoas\\Configuration\\Metadata\\ClassMetadataInterface'))->will(function ($args) {
         $args[0]->addRelation(new Relation('foo', 'bar'));
     })->shouldBeCalledTimes(1);
     $delegateDriverProphecy = $this->prophesize('Metadata\\Driver\\DriverInterface');
     $delegateDriverProphecy->loadMetadataForClass($reflectionClass)->willReturn(null);
     $extensionDriver = new ExtensionDriver($delegateDriverProphecy->reveal(), array($extensionProphecy->reveal()));
     $this->assertInstanceOf('Hateoas\\Configuration\\Metadata\\ClassMetadataInterface', $extensionDriver->loadMetadataForClass($reflectionClass));
 }