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 . '\''); }