public function testGetScore() { $this->if($engine = new engines\concurrent())->then->variable($engine->getScore())->isNull()->if($engine = new engines\concurrent())->and($engine->setAdapter($adapter = new atoum\test\adapter()))->and($engine->run($test = new \mock\mageekguy\atoum\test()))->then->variable($engine->getScore())->isNull()->if($test->getMockController()->getCurrentMethod = $method = uniqid())->and($test->getMockController()->getPath = $testPath = uniqid())->and($test->getMockController()->getPhpPath = $phpPath = uniqid())->and($test->getMockController()->codeCoverageIsEnabled = false)->and($test->getMockController()->getBootstrapFile = null)->and($adapter->proc_open = function ($command, array $descriptors, array &$pipes) use(&$resource, &$stdIn, &$stdOut, &$stdErr) { $pipes = array($stdIn = uniqid(), $stdOut = uniqid(), $stdErr = uniqid()); return $resource = uniqid(); })->and($adapter->proc_close = function () { })->and($adapter->proc_get_status = array('running' => true))->and($adapter->fwrite = function () { })->and($adapter->fclose = function () { })->and($adapter->stream_set_blocking = function () { })->and($adapter->stream_get_contents = $output = uniqid())->and($engine->run($test))->then->variable($engine->getScore())->isNull()->if($adapter->proc_get_status = array('running' => false, 'exitcode' => $exitCode = rand(1, PHP_INT_MAX)))->then->object($score = $engine->getScore())->isInstanceOf('mageekguy\\atoum\\score')->array($score->getUncompletedMethods())->isEqualTo(array(array('class' => get_class($test), 'method' => $method, 'exitCode' => $exitCode, 'output' => $output . $output)))->if($adapter->stream_get_contents = serialize($score))->and($engine->run($test))->then->object($score = $engine->getScore())->isEqualTo($score); }
public function run(atoum\test $test) { parent::run($test); $this->score = parent::getScore(); while ($this->score === null) { $this->score = parent::getScore(); } return $this; }
public function testGetScore() { $this->if($engine = new testedClass())->and($engine->setPhp($php = new \mock\mageekguy\atoum\php()))->and($this->calling($php)->run = $php)->and($this->calling($php)->isRunning = false)->then->variable($engine->getScore())->isNull()->if($engine->run($test = new \mock\mageekguy\atoum\test()))->and($this->calling($php)->isRunning = true)->then->variable($engine->getScore())->isNull()->if($this->calling($test)->getCurrentMethod = $method = uniqid())->and($this->calling($test)->getPath = $testPath = uniqid())->and($this->calling($test)->getPhpPath = $phpPath = uniqid())->and($this->calling($test)->codeCoverageIsEnabled = false)->and($this->calling($test)->getBootstrapFile = null)->and($this->calling($php)->isRunning = false)->and($this->calling($php)->getStdOut = $output = uniqid())->and($this->calling($php)->getExitCode = $exitCode = uniqid())->and($engine->run($test))->then->object($score = $engine->getScore())->isInstanceOf('mageekguy\\atoum\\score')->array($score->getUncompletedMethods())->isEqualTo(array(array('file' => $testPath, 'class' => get_class($test), 'method' => $method, 'exitCode' => $exitCode, 'output' => $output)))->if($this->calling($php)->getStdOut = serialize($score))->and($engine->run($test))->then->object($score = $engine->getScore())->isEqualTo($score); }