/**
  * @test
  */
 public function testBasicNode()
 {
     $node = new DependencyNode('Foobar');
     $this->assertEquals('Foobar', $node->getElement());
     $this->assertNull($node->getName());
     $node->setElement('Foo');
     $node->setName('Bar');
     $this->assertEquals('Foo', $node->getElement());
     $this->assertEquals('Bar', $node->getName());
 }
 /**
  * Tests whether the declaration of dependencies directly on the nodes works correctly
  * and the dependencies are detected by the graph.
  *
  * @test
  */
 public function testDeclarationOnNodes()
 {
     $graph = new DependencyGraph();
     $nodeA = new DependencyNode('A');
     $nodeB = new DependencyNode('B');
     $nodeC = new DependencyNode('C');
     $nodeD = new DependencyNode('D');
     $nodeE = new DependencyNode('E');
     $nodeA->dependsOn($nodeB);
     $nodeA->dependsOn($nodeD);
     $nodeB->dependsOn($nodeC);
     $nodeB->dependsOn($nodeE);
     $nodeC->dependsOn($nodeD);
     $nodeC->dependsOn($nodeE);
     $graph->addNode($nodeA);
     $dependencies = $graph->getDependencies();
     $this->assertEquals(array($nodeB, $nodeD), $dependencies[$nodeA]->getArrayCopy());
     $this->assertEquals(array($nodeC, $nodeE), $dependencies[$nodeB]->getArrayCopy());
     $this->assertEquals(array($nodeD, $nodeE), $dependencies[$nodeC]->getArrayCopy());
     $this->assertEquals(array(), $dependencies[$nodeD]->getArrayCopy());
     $this->assertEquals(array(), $dependencies[$nodeE]->getArrayCopy());
 }