Exemplo n.º 1
0
 public function testPropertyCreationFromEntity()
 {
     $self = new Property('self');
     $self->setRoute('resource', ['id' => 123]);
     $docs = new Property('describedby');
     $docs->setRoute('docs');
     $entity = new Entity([], 123);
     $entity->getProperties()->add($self)->add($docs);
     $properties = $this->plugin->fromResource($entity);
     $this->assertInternalType('array', $properties);
     $this->assertArrayHasKey('self', $properties, var_export($properties, 1));
     $this->assertArrayHasKey('describedby', $properties, var_export($properties, 1));
     $selfProperty = $properties['self'];
     $this->assertInternalType('string', $selfProperty);
     $this->assertEquals('http://localhost.localdomain/resource/123', $selfProperty);
     $docsProperty = $properties['describedby'];
     $this->assertInternalType('string', $docsProperty);
     $this->assertEquals('http://localhost.localdomain/help', $docsProperty);
 }