From 1981dd80168bacea4d909436e458a29dafa498a9 Mon Sep 17 00:00:00 2001 From: uwetews Date: Thu, 31 Dec 2015 05:04:07 +0100 Subject: [PATCH] replace __DIR__ --- tests/Bootstrap.php | 22 +++++++++++----------- tests/PHPUnit_Smarty.php | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index c7eef438..56411c5d 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -6,24 +6,24 @@ /* * Smarty PHPUnit Bootstrap */ -include_once __DIR__ . '/Config.php'; +include_once dirname(__FILE__) . '/Config.php'; // Locate Autoloader or SmartyBC class and load it -if (is_file(__DIR__ . '/../smarty/libs/Autoloader.php')) { - require_once __DIR__ . '/../smarty/libs/Autoloader.php'; +if (is_file(dirname(__FILE__) . '/../smarty/libs/Autoloader.php')) { + require_once dirname(__FILE__) . '/../smarty/libs/Autoloader.php'; Smarty_Autoloader::register(true); -} elseif (is_file(__DIR__ . '/../libs/Autoloader.php')) { - require_once __DIR__ . '/../libs/Autoloader.php'; +} elseif (is_file(dirname(__FILE__) . '/../libs/Autoloader.php')) { + require_once dirname(__FILE__) . '/../libs/Autoloader.php'; Smarty_Autoloader::register(true); -} elseif (is_file(__DIR__ . '/../smarty/libs/SmartyBC.class.php')) { - require_once __DIR__ . '/../smarty/libs/SmartyBC.class.php'; -} elseif (is_file(__DIR__ . '/../libs/SmartyBC.class.php')) { - require_once __DIR__ . '/../libs/SmartyBC.class.php'; +} elseif (is_file(dirname(__FILE__) . '/../smarty/libs/SmartyBC.class.php')) { + require_once dirname(__FILE__) . '/../smarty/libs/SmartyBC.class.php'; +} elseif (is_file(dirname(__FILE__) . '/../libs/SmartyBC.class.php')) { + require_once dirname(__FILE__) . '/../libs/SmartyBC.class.php'; } else { throw new Exception('can not locate Smarty distribution'); } if (!defined('SMARTY_COMPOSER_INSTALL')) { - foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', - __DIR__ . '/vendor/autoload.php') as $file) { + foreach (array(dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../vendor/autoload.php', + dirname(__FILE__) . '/vendor/autoload.php') as $file) { if (file_exists($file)) { define('SMARTY_COMPOSER_INSTALL', $file); break; diff --git a/tests/PHPUnit_Smarty.php b/tests/PHPUnit_Smarty.php index 3dcc73f2..c71d2ef5 100644 --- a/tests/PHPUnit_Smarty.php +++ b/tests/PHPUnit_Smarty.php @@ -132,7 +132,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase $this->cleanDir($dir . '/cache'); $s_dir[ $dir ] = true; } - $dir = __DIR__; + $dir = dirname(__FILE__); } if (!is_dir($dir . '/templates_c')) { mkdir($dir . '/templates_c'); @@ -149,16 +149,16 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase if ($this->loadSmarty) { $this->smarty = new Smarty; if (individualFolders != 'true') { - $this->smarty->setCompileDir(__DIR__ . '/templates_c'); - $this->smarty->setCacheDir(__DIR__ . '/cache'); + $this->smarty->setCompileDir(dirname(__FILE__) . '/templates_c'); + $this->smarty->setCacheDir(dirname(__FILE__) . '/cache'); } } // instance SmartyBC class if ($this->loadSmartyBC) { $this->smartyBC = new SmartyBC; if (individualFolders != 'true') { - $this->smartyBC->setCompileDir(__DIR__ . '/templates_c'); - $this->smartyBC->setCacheDir(__DIR__ . '/cache'); + $this->smartyBC->setCompileDir(dirname(__FILE__) . '/templates_c'); + $this->smartyBC->setCacheDir(dirname(__FILE__) . '/cache'); } } }