replace __DIR__

This commit is contained in:
uwetews
2015-12-31 05:04:07 +01:00
parent db914a947d
commit 1981dd8016
2 changed files with 16 additions and 16 deletions

View File

@@ -6,24 +6,24 @@
/* /*
* Smarty PHPUnit Bootstrap * Smarty PHPUnit Bootstrap
*/ */
include_once __DIR__ . '/Config.php'; include_once dirname(__FILE__) . '/Config.php';
// Locate Autoloader or SmartyBC class and load it // Locate Autoloader or SmartyBC class and load it
if (is_file(__DIR__ . '/../smarty/libs/Autoloader.php')) { if (is_file(dirname(__FILE__) . '/../smarty/libs/Autoloader.php')) {
require_once __DIR__ . '/../smarty/libs/Autoloader.php'; require_once dirname(__FILE__) . '/../smarty/libs/Autoloader.php';
Smarty_Autoloader::register(true); Smarty_Autoloader::register(true);
} elseif (is_file(__DIR__ . '/../libs/Autoloader.php')) { } elseif (is_file(dirname(__FILE__) . '/../libs/Autoloader.php')) {
require_once __DIR__ . '/../libs/Autoloader.php'; require_once dirname(__FILE__) . '/../libs/Autoloader.php';
Smarty_Autoloader::register(true); Smarty_Autoloader::register(true);
} elseif (is_file(__DIR__ . '/../smarty/libs/SmartyBC.class.php')) { } elseif (is_file(dirname(__FILE__) . '/../smarty/libs/SmartyBC.class.php')) {
require_once __DIR__ . '/../smarty/libs/SmartyBC.class.php'; require_once dirname(__FILE__) . '/../smarty/libs/SmartyBC.class.php';
} elseif (is_file(__DIR__ . '/../libs/SmartyBC.class.php')) { } elseif (is_file(dirname(__FILE__) . '/../libs/SmartyBC.class.php')) {
require_once __DIR__ . '/../libs/SmartyBC.class.php'; require_once dirname(__FILE__) . '/../libs/SmartyBC.class.php';
} else { } else {
throw new Exception('can not locate Smarty distribution'); throw new Exception('can not locate Smarty distribution');
} }
if (!defined('SMARTY_COMPOSER_INSTALL')) { if (!defined('SMARTY_COMPOSER_INSTALL')) {
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', foreach (array(dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php') as $file) { dirname(__FILE__) . '/vendor/autoload.php') as $file) {
if (file_exists($file)) { if (file_exists($file)) {
define('SMARTY_COMPOSER_INSTALL', $file); define('SMARTY_COMPOSER_INSTALL', $file);
break; break;

View File

@@ -132,7 +132,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
$this->cleanDir($dir . '/cache'); $this->cleanDir($dir . '/cache');
$s_dir[ $dir ] = true; $s_dir[ $dir ] = true;
} }
$dir = __DIR__; $dir = dirname(__FILE__);
} }
if (!is_dir($dir . '/templates_c')) { if (!is_dir($dir . '/templates_c')) {
mkdir($dir . '/templates_c'); mkdir($dir . '/templates_c');
@@ -149,16 +149,16 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
if ($this->loadSmarty) { if ($this->loadSmarty) {
$this->smarty = new Smarty; $this->smarty = new Smarty;
if (individualFolders != 'true') { if (individualFolders != 'true') {
$this->smarty->setCompileDir(__DIR__ . '/templates_c'); $this->smarty->setCompileDir(dirname(__FILE__) . '/templates_c');
$this->smarty->setCacheDir(__DIR__ . '/cache'); $this->smarty->setCacheDir(dirname(__FILE__) . '/cache');
} }
} }
// instance SmartyBC class // instance SmartyBC class
if ($this->loadSmartyBC) { if ($this->loadSmartyBC) {
$this->smartyBC = new SmartyBC; $this->smartyBC = new SmartyBC;
if (individualFolders != 'true') { if (individualFolders != 'true') {
$this->smartyBC->setCompileDir(__DIR__ . '/templates_c'); $this->smartyBC->setCompileDir(dirname(__FILE__) . '/templates_c');
$this->smartyBC->setCacheDir(__DIR__ . '/cache'); $this->smartyBC->setCacheDir(dirname(__FILE__) . '/cache');
} }
} }
} }