/** * This method initializes the test environment, it configures the files * directory and sets the include_path for svn versions. * * @return void */ public static function init() { self::$_filesDirectory = realpath(dirname(__FILE__) . '/../../../resources/files'); // file can contain test rule implementations. $include = self::$_filesDirectory; if (is_int($index = array_search('--include-path', $_SERVER['argv']))) { $ext = pathinfo($_SERVER['argv'][$index + 1], PATHINFO_EXTENSION); if (0 === strpos($ext, 'phar')) { include realpath($_SERVER['argv'][$index + 1]); } } else { if (strpos('@package_version@', '@package_version') === 0) { $include .= PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../../../main/php') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../../../../lib/pdepend/src/main/php'); } } // Configure include path set_include_path($include . PATH_SEPARATOR . get_include_path()); // Init PHP_Depend autoloader include_once 'PHP/Depend/Autoload.php'; $autoload = new PHP_Depend_Autoload(); $autoload->register(); // Prevent timezone warnings if no default TZ is set (PHP > 5.1.0) date_default_timezone_set('UTC'); }
/** * This method initializes the test environment, it configures the files * directory and sets the include_path for svn versions. * * @return void */ public static function init() { self::$_filesDirectory = dirname(__FILE__) . '/_files'; // file can contain test rule implementations. $include = self::$_filesDirectory; // Check pear installation if (strpos('@package_version@', '@package_version') === 0) { $include .= PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../../source') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../../lib/pdepend'); } // Configure include path set_include_path($include . PATH_SEPARATOR . get_include_path()); // Include PHP_PMD main file to get the whitelist directory include_once 'PHP/PMD.php'; $ref = new ReflectionClass('PHP_PMD'); // Set source whitelist PHPUnit_Util_Filter::addDirectoryToWhitelist(dirname($ref->getFileName())); }