Esempio n. 1
0
 public function testParallelExec()
 {
     $result = $this->taskParallelExec()->process('ls 1')->process('ls 2')->process('ls 3')->run();
     $this->process->verifyInvokedMultipleTimes('start', 3);
     verify($result->getExitCode())->equals(0);
     $this->guy->seeInOutput("3 processes ended in 0.00 s");
 }
Esempio n. 2
0
 public function testParallelExec()
 {
     $task = new \Robo\Task\Base\ParallelExec();
     $task->setLogger($this->guy->logger());
     $result = $task->process('ls 1')->process('ls 2')->process('ls 3')->run();
     $this->process->verifyInvokedMultipleTimes('start', 3);
     verify($result->getExitCode())->equals(0);
     $this->guy->seeInOutput("3 processes finished");
 }
Esempio n. 3
0
 public function testBasics()
 {
     $task = new ResultDummyTask();
     $result = new Result($task, 1, 'The foo barred', ['time' => 0]);
     $this->guy->seeInOutput('The foo barred');
     $this->guy->seeInOutput('Error');
     $this->guy->seeInOutput('[ResultDummyTask]');
     $this->assertSame($task, $result->getTask());
     $this->assertEquals(1, $result->getExitCode());
     $this->assertEquals('The foo barred', $result->getMessage());
     $this->assertEquals(['time' => 0], $result->getData());
     $taskClone = $result->cloneTask();
     $this->assertNotSame($task, $taskClone);
     $this->assertInstanceOf('Robo\\Task\\Shared\\TaskInterface', $taskClone);
 }
Esempio n. 4
0
 public function testAddCodeRollbackAndCompletion()
 {
     $collection = new Collection();
     $rollback1 = new CountingTask();
     $rollback2 = new CountingTask();
     $completion1 = new CountingTask();
     $completion2 = new CountingTask();
     $collection->progressMessage("start collection tasks")->rollback($rollback1)->completion($completion1)->rollbackCode(function () use($rollback1) {
         $rollback1->run();
     })->completionCode(function () use($completion1) {
         $completion1->run();
     })->addCode(function () {
         return 42;
     })->progressMessage("not reached")->rollback($rollback2)->completion($completion2)->addCode(function () {
         return 13;
     });
     $collection->setLogger($this->guy->logger());
     $result = $collection->run();
     // Execution stops on the first error.
     // Confirm that status code is converted to a Result object.
     verify($result->getExitCode())->equals(42);
     verify($rollback1->getCount())->equals(2);
     verify($rollback2->getCount())->equals(0);
     verify($completion1->getCount())->equals(2);
     verify($completion2->getCount())->equals(0);
     $this->guy->seeInOutput('start collection tasks');
     $this->guy->doNotSeeInOutput('not reached');
 }
Esempio n. 5
0
 public function testTasksStopOnFail()
 {
     $argv = ['placeholder', 'test:stop-on-fail'];
     $result = $this->runner->execute($argv, Robo::output());
     $this->guy->seeInOutput('[');
     $this->assertTrue($result > 0);
 }
Esempio n. 6
0
 public function testRunnerDebugOutput()
 {
     $argv = ['placeholder', 'test:verbosity', '-vvv'];
     $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
     $this->guy->seeInOutput('This command will print more information at higher verbosity levels');
     $this->guy->seeInOutput('This is a verbose message (-v).');
     $this->guy->seeInOutput('This is a very verbose message (-vv).');
     $this->guy->seeInOutput('This is a debug message (-vvv).');
     $this->guy->seeInOutput(' [warning] This is a warning log message.');
     $this->guy->seeInOutput(' [notice] This is a notice log message.');
     $this->guy->seeInOutput(' [debug] This is a debug log message.');
     $this->assertEquals(0, $result);
 }
Esempio n. 7
0
 public function testYell()
 {
     $this->yell('Buuuu!');
     $this->guy->seeInOutput('Buuuu!');
 }