示例#1
0
 public function testRun()
 {
     $this->if($locale = new mock\locale())->and($this->calling($locale)->_ = function ($string) {
         return $string;
     })->and($helpWriter = new mock\writers\std\out())->and($this->calling($helpWriter)->write = function () {
     })->and($errorWriter = new mock\writers\std\err())->and($this->calling($errorWriter)->clear = $errorWriter)->and($this->calling($errorWriter)->write = $errorWriter)->and($runner = new mock\runner())->and($this->calling($runner)->getTestPaths = array())->and($this->calling($runner)->getDeclaredTestClasses = array())->and($this->calling($runner)->run = function () {
     })->and($script = new testedClass($name = uniqid()))->and($script->setLocale($locale))->and($script->setHelpWriter($helpWriter))->and($script->setErrorWriter($errorWriter))->and($script->setRunner($runner))->then->object($script->run())->isIdenticalTo($script)->mock($locale)->call('_')->withArguments('No test found')->once()->mock($errorWriter)->call('write')->withArguments('No test found')->once();
 }
示例#2
0
 public function testUseConfigFile()
 {
     $this->if($runner = new scripts\runner(uniqid()))->and($runner->setLocale($locale = new \mock\mageekguy\atoum\locale()))->then->exception(function () use($runner, &$file) {
         $runner->useConfigFile($file = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\includer\\exception')->hasMessage('Unable to find configuration file \'' . $file . '\'')->mock($locale)->call('_')->withArguments('Unable to find configuration file \'%s\'')->once()->if($configFile = stream::get())->and($configFile->file_get_contents = '<?php $runner->disableCodeCoverage(); ?>')->then->boolean($runner->getRunner()->codeCoverageIsEnabled())->isTrue()->object($runner->useConfigFile((string) $configFile))->isIdenticalTo($runner)->boolean($runner->getRunner()->codeCoverageIsEnabled())->isFalse();
 }