/** * Creates a full filename for a test content in the <em>_files</b> directory. * * @param string $localPath The local path within the <em>_files</b> dir. * * @return string */ protected static function createFileUri($localPath = '') { $trace = debug_backtrace(); $ticket = ''; if (preg_match('(\\D(\\d+)Test$)', $trace[1]['class'], $match)) { $ticket = $match[1]; } if ($localPath === '') { $localPath = $trace[1]['function'] . '.php'; } return parent::createFileUri('Regression/' . $ticket . '/' . $localPath); }
/** * Includes the write stub class. * * @return void */ protected function setUp() { parent::setUp(); // Import writer stub include_once self::createFileUri('stubs/WriterStub.php'); }
/** * Changes the working directory for a single test. * * @param string $localPath The temporary working directory. * * @return void */ protected static function changeWorkingDirectory($localPath = '') { self::$_originalWorkingDirectory = getcwd(); if (0 === preg_match('(^([A-Z]:|/))', $localPath)) { $localPath = self::createFileUri($localPath); } chdir($localPath); }
/** * Changes the working directory for a single test. * * @param string $localPath The temporary working directory. * * @return void */ protected static function changeWorkingDirectory($localPath = '') { self::$_originalWorkingDirectory = getcwd(); chdir(self::createFileUri($localPath)); }