Exemple #1
0
 public function testAddManyDeps()
 {
     $package = ["test/package" => "dev-master"];
     $node = new Node($package);
     $this->assertEquals($node->getPackage(), $package);
     $dep = ["first/package" => "dev-master"];
     $dep1 = ["second/package" => "dev-master"];
     $node->setDeps($dep, $node);
     $node->setDeps($dep1, $node);
     $this->assertEquals($node->getDependencies(), [new Node($dep, $node), new Node($dep1, $node)]);
 }
Exemple #2
0
 public function testSetDeepNode()
 {
     $base_package = ["base/package" => "dev-master"];
     $graph = new Graph($base_package);
     $this->assertEquals(new Node($base_package), $graph->getCurrent());
     $dep = ["second/package" => "dev-master"];
     $graph->set($dep);
     $parent_node = new Node($base_package);
     $parent_node->setDeps($dep, $parent_node);
     $child_node = new Node($dep, $parent_node);
     $this->assertEquals($graph->getCurrent()->getDependency("second/package"), $child_node);
     $graph->advance("second/package");
     $this->assertEquals($graph->getCurrent(), $child_node);
     $deep_node = ['deep/node' => "dev-master"];
     $graph->set($deep_node);
     $child_node = $parent_node->getDependency("second/package")->setDeps($deep_node);
     $deep_node = new Node($deep_node, $child_node);
     $this->assertEquals($graph->getCurrent()->getDependency("deep/node"), $deep_node);
 }