public function testGetRunningDuration() { $this->if($adapter = new atoum\test\adapter())->and($adapter->microtime = function () { static $call = 0; return ++$call * 100; })->and($adapter->get_declared_classes = array())->and($runner = new testedClass())->and($runner->setAdapter($adapter))->then->variable($runner->getRunningDuration())->isNull()->if($runner->run())->then->integer($runner->getRunningDuration())->isEqualTo(100)->if(eval('namespace ' . __NAMESPACE__ . ' { class forTestGetRunningDuration extends \\mageekguy\\atoum\\test { public function testSomething() {} public function run(array $runTestMethods = array(), array $tags = array()) { return $this; } } }'))->and($adapter->get_declared_classes = array(__NAMESPACE__ . '\\forTestGetRunningDuration'))->and($runner->run())->then->integer($runner->getRunningDuration())->isEqualTo(100); }
public function testGetRunningDuration() { $this->if($adapter = new atoum\test\adapter())->and($adapter->get_declared_classes = array())->and($adapter->proc_open = function () { })->and($adapter->stream_get_contents = '')->and($adapter->getenv = function ($variable) { return $variable != 'PHP_PEAR_PHP_BIN' ? false : 'PHP_PEAR_PHP_BIN'; })->and($adapter->realpath = function ($path) { return $path; })->and($adapter->fclose = function () { })->and($adapter->proc_get_status = array('exitcode' => 0, 'running' => false))->and($adapter->proc_close = function () { })->and($adapter->proc_terminate = function () { })->and($adapter->microtime = function () { static $call = 0; return ++$call * 100; })->and($adapter->get_declared_classes = function () { return array(); })->and($runner = new atoum\runner())->and($runner->setAdapter($adapter))->then->variable($runner->getRunningDuration())->isNull()->if($runner->run())->then->integer($runner->getRunningDuration())->isEqualTo(100); }