From 6bca9f836836f4bea2112cd6635a384e862b4db2 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:55:36 +0700 Subject: get vfsStream via composer if its PEAR package not exists --- tests/Bootstrap.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 9f89d1be8..c14a4dee2 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,8 +12,17 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); +// Get vfsStream either via pear or composer +if (file_exists('vfsStream/vfsStream.php')) +{ + require_once 'vfsStream/vfsStream.php'; +} +else +{ + include_once '../vendor/autoload.php'; +} + // Prep our test environment -require_once 'vfsStream/vfsStream.php'; include_once $dir.'/mocks/core/common.php'; include_once $dir.'/mocks/autoloader.php'; spl_autoload_register('autoload'); -- cgit v1.2.3-24-g4f1b From e13511a1368adb9914a4252d98cb2d0165138e0d Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 02:15:42 +0700 Subject: Global class aliasing, at least until namespace introduced into further release --- tests/Bootstrap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index c14a4dee2..71394720a 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,14 +12,17 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); -// Get vfsStream either via pear or composer +// Get vfsStream either via PEAR or composer if (file_exists('vfsStream/vfsStream.php')) { require_once 'vfsStream/vfsStream.php'; } else { - include_once '../vendor/autoload.php'; + include_once PROJECT_BASE.'vendor/autoload.php'; + class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); + class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); + class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); } // Prep our test environment -- cgit v1.2.3-24-g4f1b From eeca6d265c4e104e3a6b34b8581180d2926b3dba Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 03:15:19 +0700 Subject: Backward compatibility, in case someone already has vfsStream in their PEAR or other include_path --- tests/Bootstrap.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 71394720a..1dbd178ca 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -13,11 +13,16 @@ define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer -if (file_exists('vfsStream/vfsStream.php')) +foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - require_once 'vfsStream/vfsStream.php'; + if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.phps')) + { + require_once 'vfsStream/vfsStream.php'; + break; + } } -else + +if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php')) { include_once PROJECT_BASE.'vendor/autoload.php'; class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); -- cgit v1.2.3-24-g4f1b From 2d57445ba66f8b6e5fef526b932d691b0e5690db Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 04:03:56 +0700 Subject: Escape like tests, #136 verification --- tests/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 1dbd178ca..38615dd89 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -15,7 +15,7 @@ define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.phps')) + if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php')) { require_once 'vfsStream/vfsStream.php'; break; -- cgit v1.2.3-24-g4f1b From 4912f8b25cd8fa1b88b4babd1bad2b6bf29dd235 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 26 May 2012 22:09:58 +0700 Subject: Allowing main constants defined via phpunit config or other bootstraper --- tests/Bootstrap.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 38615dd89..5216038c6 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -7,10 +7,10 @@ error_reporting(E_ALL | E_STRICT); $dir = realpath(dirname(__FILE__)); // Path constants -define('PROJECT_BASE', realpath($dir.'/../').'/'); -define('BASEPATH', PROJECT_BASE.'system/'); -define('APPPATH', PROJECT_BASE.'application/'); -define('VIEWPATH', PROJECT_BASE.''); +defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/'); +defined('BASEPATH') OR define('BASEPATH', PROJECT_BASE.'system/'); +defined('APPPATH') OR define('APPPATH', PROJECT_BASE.'application/'); +defined('VIEWPATH') OR define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) -- cgit v1.2.3-24-g4f1b