From 386be52c71a34621d60373a29c19f178864f0223 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 22 Mar 2013 21:01:20 -0400 Subject: [PATCH] Be compatible with PHPUnit installed with composer. Doing a class_exists() check is a simple way to check for PHPUnit being installed via an autoloader. It also keeps things compatible with a Vendor dir installation. Fixes #3721 --- lib/Cake/TestSuite/CakeTestSuiteDispatcher.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php b/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php index 214cdb859..636f13b57 100644 --- a/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php +++ b/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php @@ -137,6 +137,9 @@ class CakeTestSuiteDispatcher { * @return boolean true if found, false otherwise */ public function loadTestFramework() { + if (class_exists('PHPUnit_Framework_TestCase')) { + return true; + } foreach (App::path('vendors') as $vendor) { $vendor = rtrim($vendor, DS); if (is_dir($vendor . DS . 'PHPUnit')) { @@ -144,8 +147,8 @@ class CakeTestSuiteDispatcher { break; } } - - return (include ('PHPUnit' . DS . 'Autoload.php')) !== false; + include 'PHPUnit' . DS . 'Autoload.php'; + return class_exists('PHPUnit_Framework_TestCase'); } /**