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'); }
public function testRunnerVeryVerboseOutput() { $argv = ['placeholder', 'test:verbosity', '-vv']; $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->doNotSeeInOutput('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->doNotSeeInOutput(' [debug] This is a debug log message.'); $this->assertEquals(0, $result); }