Author: Kévin Dunglas (dunglas@gmail.com)
Inheritance: implements ContextBuilderInterface
Exemplo n.º 1
0
 public function testResourceContextWithReverse()
 {
     $this->resourceMetadataFactoryProphecy->create($this->entityClass)->willReturn(new ResourceMetadata('DummyEntity'));
     $this->propertyNameCollectionFactoryProphecy->create($this->entityClass)->willReturn(new PropertyNameCollection(['dummyPropertyA']));
     $this->propertyMetadataFactoryProphecy->create($this->entityClass, 'dummyPropertyA')->willReturn(new PropertyMetadata(new Type(Type::BUILTIN_TYPE_STRING), 'Dummy property A', true, true, true, true, false, false, null, null, ['jsonld_context' => ['@reverse' => 'parent']]));
     $contextBuilder = new ContextBuilder($this->resourceNameCollectionFactoryProphecy->reveal(), $this->resourceMetadataFactoryProphecy->reveal(), $this->propertyNameCollectionFactoryProphecy->reveal(), $this->propertyMetadataFactoryProphecy->reveal(), $this->urlGeneratorProphecy->reveal());
     $expected = ['@vocab' => '#', 'hydra' => 'http://www.w3.org/ns/hydra/core#', 'dummyPropertyA' => ['@id' => '#DummyEntity/dummyPropertyA', '@reverse' => 'parent']];
     $this->assertEquals($expected, $contextBuilder->getResourceContext($this->entityClass));
 }