public function testEntity() { $entity = new Entity('foo'); $entity->addProperty(new Property('type', 'name', 'value')); $xml = simplexml_load_string($this->serializer->serialize($entity, "xml")); $this->assertEquals($xml->getName(), 'entity'); $this->assertEquals($xml['name'], 'foo'); $this->assertEquals(1, count($xml->properties)); }
public function testEntity() { $entity = new EntityElement('bar'); $entity->addProperty(new Property('a', 'b', 'c')); $property = new EntityProperty(new String('foo'), new EntityType($entity), new String('zoo')); $xml = simplexml_load_string($this->serializer->serialize($property, "xml")); $this->assertEquals('property', $xml->getName()); $this->assertEquals('entity', $xml['type']); $this->assertEquals('foo', $xml['name']); $this->assertEquals('zoo', $xml['title']); $this->assertEquals('bar', $xml['entityname']); $this->assertEquals(1, $xml->children()->count()); foreach ($xml->children() as $child) { $this->assertEquals('entity', $child->getName()); $this->assertEquals('bar', $child['name']); $this->assertEquals(1, $child->properties->count()); } }
public function testHasProperty() { $entity = new Entity('foo'); $entity->addProperty(new Property('a', 'b', 'c')); $this->assertTrue($entity->hasProperty('b')); }