Exemple #1
0
 /**
  * Tests the removal of node types from the graph.
  */
 public function testNodeTypeRemoval()
 {
     // Remove nodeType
     $node1 = $this->graph->getNode('http://example.com/node/1');
     $node3 = $this->graph->getNode('/node/3');
     $nodeType = $this->graph->getNode('http://vocab.com/type/node');
     $this->assertTrue($this->graph->containsNode('http://vocab.com/type/node'), 'node type in graph?');
     $this->assertSame($nodeType, $node1->getType(), 'n1 type');
     $this->assertSame($nodeType, $node3->getType(), 'n3 type');
     $this->assertSame(array(Node::TYPE => array($node1, $node3)), $nodeType->getReverseProperties(), 'Check node type\'s reverse properties');
     $this->graph->removeNode($nodeType);
     $this->assertSame(array(), $nodeType->getReverseProperties(), 'node type\'s reverse properties');
     $this->assertSame(array(), $nodeType->getNodesWithThisType(), 'n1+n3 <-type- node type removed');
     $this->assertNull($node1->getType(), 'n1 type removed');
     $this->assertNull($node3->getType(), 'n3 type removed');
     $this->assertFalse($this->graph->containsNode('http://vocab.com/type/node'), 'node type still in graph?');
 }