mageekguy\atoum\runner::setPathAndVersionInScore PHP Метод

setPathAndVersionInScore() публичный Метод

    public function setPathAndVersionInScore()
    {
        $this->score->setAtoumVersion($this->adapter->defined(static::atoumVersionConstant) === false ? null : $this->adapter->constant(static::atoumVersionConstant))->setAtoumPath($this->adapter->defined(static::atoumDirectoryConstant) === false ? null : $this->adapter->constant(static::atoumDirectoryConstant));
        if ($this->php->reset()->addOption('--version')->run()->getExitCode() > 0) {
            throw new exceptions\runtime('Unable to get PHP version from \'' . $this->php . '\'');
        }
        $this->score->setPhpPath($this->php->getBinaryPath())->setPhpVersion($this->php->getStdout());
        return $this;
    }

Usage Example

Пример #1
0
 public function testSetPathAndVersionInScore()
 {
     $this->if($php = new \mock\mageekguy\atoum\php())->and($this->calling($php)->getBinaryPath = $phpPath = uniqid())->and($this->calling($php)->run = $php)->and($this->calling($php)->isRunning = false)->and($this->calling($php)->getExitCode = 0)->and($this->calling($php)->getStdout = $phpVersion = uniqid())->and($adapter = new atoum\test\adapter())->and($adapter->defined = true)->and($adapter->constant = function ($constantName) use(&$atoumVersion, &$atoumDirectory) {
         switch ($constantName) {
             case atoum\runner::atoumVersionConstant:
                 return $atoumVersion = uniqid();
             case atoum\runner::atoumDirectoryConstant:
                 return $atoumDirectory = uniqid();
         }
     })->and($runner = new testedClass())->and($runner->setPhp($php))->and($runner->setAdapter($adapter))->and($runner->setScore($score = new \mock\mageekguy\atoum\runner\score()))->then->object($runner->setPathAndVersionInScore())->isIdenticalTo($runner)->mock($score)->call('setAtoumVersion')->withArguments($atoumVersion)->once()->call('setAtoumPath')->withArguments($atoumDirectory)->once()->call('setPhpPath')->withArguments($phpPath)->once()->call('setPhpVersion')->withArguments($phpVersion)->once()->if($adapter->defined = false)->and($runner->setScore($score = new \mock\mageekguy\atoum\runner\score()))->then->object($runner->setPathAndVersionInScore())->isIdenticalTo($runner)->mock($score)->call('setAtoumVersion')->withArguments(null)->once()->call('setAtoumPath')->withArguments(null)->once()->call('setPhpPath')->withArguments($phpPath)->once()->call('setPhpVersion')->withArguments($phpVersion)->once()->if($this->calling($php)->getExitCode = rand(1, PHP_INT_MAX))->and($runner->setScore($score = new \mock\mageekguy\atoum\runner\score()))->then->exception(function () use($runner) {
         $runner->setPathAndVersionInScore();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\runtime')->hasMessage('Unable to get PHP version from \'' . $php . '\'');
 }
All Usage Examples Of mageekguy\atoum\runner::setPathAndVersionInScore
runner