Exemple #1
0
 public function testVerbose()
 {
     $this->if($script = new mock\script(uniqid()))->and($script->setInfoWriter($infoWriter = new mock\writers\std\out()))->and($this->calling($infoWriter)->write->doesNothing())->then->object($script->verbose($message = uniqid()))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message . PHP_EOL)->never()->if($script->increaseVerbosityLevel())->then->object($script->verbose($message = uniqid()))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message)->once()->object($script->verbose($message, 1))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message)->twice()->object($script->verbose($message, rand(2, PHP_INT_MAX)))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message)->twice()->object($script->verbose($message = uniqid(), 0))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message)->never()->object($script->verbose($message, 1))->isIdenticalTo($script)->mock($infoWriter)->call('write')->withIdenticalArguments($message)->once();
 }
Exemple #2
0
 public function testVerbose()
 {
     $this->if($stdOut = new mock\writers\std\out())->and($stdOut->getMockCOntroller()->write = function () {
     })->and($script = new mock\script(uniqid()))->and($script->setInfoWriter($stdOut))->then->object($script->verbose($message = uniqid()))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message . PHP_EOL)->never()->if($script->increaseVerbosityLevel())->then->object($script->verbose($message = uniqid()))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message . PHP_EOL)->once()->object($script->verbose($message, 1))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message . PHP_EOL)->twice()->object($script->verbose($message, rand(2, PHP_INT_MAX)))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message . PHP_EOL)->twice()->object($script->verbose($message, 0, false))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message)->never()->object($script->verbose($message, 1, false))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments($message)->once();
 }