コード例 #1
0
ファイル: TaskRepositoryTest.php プロジェクト: pago/pantr
 /**
  * it should handle alias
  * @author Patrick Gotthardt
  * @test
  */
 public function it_should_handle_alias()
 {
     $repo = new TaskRepository();
     $repo->registerTask($this->task('a'));
     $repo->alias('a', 'b');
     $this->assertEquals('a', $repo->getTask('b')->getName());
 }
コード例 #2
0
ファイル: ExecutionStrategyTest.php プロジェクト: pago/pantr
 /**
  * it should sort tasks
  * @author Patrick Gotthardt
  * @test
  */
 public function it_should_sort_tasks()
 {
     $repo = new TaskRepository();
     $repo->registerTask($this->task('a')->dependsOn('c'));
     $repo->registerTask($this->task('b')->dependsOn('e', 'f'));
     $repo->registerTask($this->task('c'));
     $repo->registerTask($this->task('d')->dependsOn('a', 'b', 'c'));
     $repo->registerTask($this->task('e'));
     $repo->registerTask($this->task('f')->dependsOn('c'));
     $strat = new ExecutionStrategy($repo, $repo->getTask('d'));
     // c -> a -> e -> f -> b -> d
     $path = array('c', 'a', 'e', 'f', 'b', 'd');
     $i = 0;
     foreach ($strat as $task) {
         $this->assertEquals($path[$i++], $task);
     }
     $this->assertEquals(count($path), $i);
 }