Example #1
0
 public function testHelp()
 {
     $this->if($argumentsParser = new mock\script\arguments\parser())->and($this->calling($argumentsParser)->addHandler = function () {
     })->and($locale = new mock\locale())->and($this->calling($locale)->_ = function ($string) {
         return vsprintf($string, array_slice(func_get_args(), 1));
     })->and($helpWriter = new mock\writers\std\out())->and($this->calling($helpWriter)->write = function () {
     })->and($runner = new testedClass($name = uniqid()))->and($runner->setArgumentsParser($argumentsParser))->and($runner->setLocale($locale))->and($runner->setHelpWriter($helpWriter))->then->object($runner->help())->isIdenticalTo($runner)->mock($helpWriter)->call('write')->atLeastOnce()->withArguments('Usage: ' . $name . ' [path/to/test/file] [options]' . PHP_EOL)->once();
 }