/** * Precondition: Request component has already been created. If it hasn't, infinite recursion * will occur when Yii::app()->getRequest () is called implicitly by self::app()->request. */ private static function getRootPath() { if (YII_UNIT_TESTING) { // resets root path to the webroot so that custom files can be detected $path = array(); exec('pwd', $path); self::$rootPath = dirname(preg_replace('/\\/tests/', '', $path[0])); } elseif (!isset(self::$rootPath)) { self::$rootPath = dirname(self::getScriptFile()); } return self::$rootPath; }