Example #1
0
 public function testSetBinaryPath()
 {
     $this->given($php = new atoum\php(null, $adapter = new atoum\test\adapter()))->if($adapter->defined = function ($constant) {
         return $constant == 'PHP_BINARY';
     })->and($adapter->constant = function ($constant) use(&$phpBinary) {
         return $constant != 'PHP_BINARY' ? null : ($phpBinary = uniqid());
     })->then->object($php->setBinaryPath())->isIdenticalTo($php)->string($php->getBinaryPath())->isEqualTo($phpBinary)->if($adapter->defined = false)->and($adapter->constant = null)->and($adapter->getenv = function ($variable) use(&$pearBinaryPath) {
         return $variable != 'PHP_PEAR_PHP_BIN' ? false : ($pearBinaryPath = uniqid());
     })->then->object($php->setBinaryPath())->isIdenticalTo($php)->string($php->getBinaryPath())->isEqualTo($pearBinaryPath)->if($adapter->getenv = function ($variable) use(&$phpBinPath) {
         switch ($variable) {
             case 'PHPBIN':
                 return $phpBinPath = uniqid();
             default:
                 return false;
         }
     })->then->object($php->setBinaryPath())->isIdenticalTo($php)->string($php->getBinaryPath())->isEqualTo($phpBinPath)->if($adapter->constant = function ($constant) use(&$phpBinDir) {
         return $constant != 'PHP_BINDIR' ? null : ($phpBinDir = uniqid());
     })->and($adapter->getenv = false)->then->object($php->setBinaryPath())->isIdenticalTo($php)->string($php->getBinaryPath())->isEqualTo($phpBinDir . '/php')->object($php->setBinaryPath($phpPath = uniqid()))->isIdenticalTo($php)->string($php->getBinaryPath())->isEqualTo($phpPath);
 }