public function version() { $this->writeInfo(sprintf($this->locale->_('atoum version %s by %s (%s)'), atoum\version, atoum\author, \phar::running())); return $this->stopRun(); }
public function testVersion() { $this->given($this->newTestedInstance(uniqid()), $writer = new \mock\mageekguy\atoum\writer())->if($this->testedInstance->setInfoWriter($writer))->then->object($this->testedInstance->version())->isTestedInstance->mock($writer)->call('write')->withArguments(sprintf('atoum version %s by %s (%s)', atoum\version, atoum\author, \phar::running()))->once; }
protected static function extractFilesTo(\recursiveDirectoryIterator $fromPharDirectory, $toDirectory) { $directory = rtrim($directory, DIRECTORY_SEPARATOR); $pharName = \phar::running(); foreach (new \recursiveIteratorIterator($fromPharDirectory) as $pharFile) { $pharFilePath = ltrim(str_replace($pharName, '', $pharFile), DIRECTORY_SEPARATOR); if (strpos($pharFilePath, $versions['current']) === 0) { $path = $directory . '/' . ltrim(substr($pharFilePath, strlen($versions['current'])), DIRECTORY_SEPARATOR); $pathDirectory = dirname($path); @mkdir($pathDirectory, 0777, true); if (is_dir($pathDirectory) === false) { throw new exceptions\runtime('Unable to create directory \'' . $pathDirectory . '\''); } $data = file_get_contents($pharFile); if (file_put_contents($path, $data) != strlen($data)) { throw new exceptions\runtime('Unable to extract file \'' . $pharFilePath . '\' in directory \'' . $pathDirectory . '\''); } } } return $this; }
public function testAddDirectory() { $this->if($autoloader = new atoum\autoloader())->then->object($autoloader->addDirectory($namespace = uniqid(), $directory = uniqid()))->isIdenticalTo($autoloader)->array($autoloader->getDirectories())->isEqualTo(array('mageekguy\\atoum\\' => array(atoum\directory . (\phar::running() ? '/' : DIRECTORY_SEPARATOR) . 'classes' . DIRECTORY_SEPARATOR), $namespace . '\\' => array($directory . DIRECTORY_SEPARATOR)))->object($autoloader->addDirectory($otherNamespace = uniqid() . '\\', $otherDirectory = uniqid() . DIRECTORY_SEPARATOR))->isIdenticalTo($autoloader)->array($autoloader->getDirectories())->isEqualTo(array('mageekguy\\atoum\\' => array(atoum\directory . (\phar::running() ? '/' : DIRECTORY_SEPARATOR) . 'classes' . DIRECTORY_SEPARATOR), $namespace . '\\' => array($directory . DIRECTORY_SEPARATOR), $otherNamespace => array($otherDirectory)))->object($autoloader->addDirectory($namespace, $secondDirectory = uniqid() . DIRECTORY_SEPARATOR))->isIdenticalTo($autoloader)->array($autoloader->getDirectories())->isEqualTo(array('mageekguy\\atoum\\' => array(atoum\directory . (\phar::running() ? '/' : DIRECTORY_SEPARATOR) . 'classes' . DIRECTORY_SEPARATOR), $namespace . '\\' => array($directory . DIRECTORY_SEPARATOR, $secondDirectory), $otherNamespace => array($otherDirectory))); }