Exemple #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();
 }
 public function test__construct()
 {
     $this->if($script = new atoum\scripts\runner(uniqid()))->and($script->setArgumentsParser($parser = new \mock\mageekguy\atoum\script\arguments\parser()))->and($configurator = new \mock\mageekguy\atoum\configurator($script))->then->object($extension = new testedClass())->if($this->resetMock($parser))->and($extension = new testedClass($configurator))->then->mock($parser)->call('addHandler')->twice();
 }
Exemple #3
0
 public function should_construct_and_set_test_command_line_handlers()
 {
     $this->given($script = new atoum\scripts\runner(uniqid()), $parser = new \mock\mageekguy\atoum\script\arguments\parser(), $configurator = new \mock\mageekguy\atoum\configurator($script), $script->setArgumentsParser($parser), $this->resetMock($parser))->if($this->newTestedInstance($configurator))->then->mock($parser)->call('addHandler')->twice()->boolean($parser->argumentHasHandler('--test-it'))->isTrue()->boolean($parser->argumentHasHandler('--test-ext'))->isTrue();
 }