mageekguy\atoum\test\engines\concurrent::setPhp PHP Method

setPhp() public method

public setPhp ( mageekguy\atoum\php $php = null )
$php mageekguy\atoum\php
    public function setPhp(atoum\php $php = null)
    {
        $this->php = $php ?: new atoum\php();
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 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);
 }