From 7417a00de79c01b1b761bfb90e43475e440948b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Tue, 4 May 2010 13:40:50 -0430 Subject: [PATCH] Initial step to replace simpletest for PHPUnit This is probably temporary, still needed to see if PHPUnit is already in path (installed with pear or something) --- cake/tests/lib/cake_test_suite_dispatcher.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cake/tests/lib/cake_test_suite_dispatcher.php b/cake/tests/lib/cake_test_suite_dispatcher.php index d0d128786..2b4ee4250 100644 --- a/cake/tests/lib/cake_test_suite_dispatcher.php +++ b/cake/tests/lib/cake_test_suite_dispatcher.php @@ -17,7 +17,6 @@ * @since CakePHP(tm) v 1.3 * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -require_once CAKE_TESTS_LIB . 'test_manager.php'; /** * CakeTestSuiteDispatcher handles web requests to the test suite and runs the correct action. @@ -116,7 +115,18 @@ class CakeTestSuiteDispatcher { * @return void */ function _checkSimpleTest() { - if (!App::import('Vendor', 'simpletest/reporter')) { + $found = $path = null; + foreach (App::path('vendors') as $vendor) { + if (is_dir($vendor . 'PHPUnit')) { + $path = $vendor; + } + } + + if ($path && ini_set('include_path', $path . PATH_SEPARATOR . ini_get('include_path'))) { + $found = include 'PHPUnit' . DS . 'Framework.php'; + } + + if (!$found) { $baseDir = $this->_baseDir; include CAKE_TESTS_LIB . 'templates/simpletest.php'; exit(); @@ -171,6 +181,7 @@ class CakeTestSuiteDispatcher { */ function &getManager() { if (empty($this->Manager)) { + require_once CAKE_TESTS_LIB . 'test_manager.php'; $this->Manager = new $this->_managerClass(); } return $this->Manager;