Merge pull request #1174 from psparrow/master

Fixed issue with including including PHPUnit's Autoload script.
This commit is contained in:
Mark Story 2013-03-14 14:36:16 -07:00
commit 76ea0803d5
2 changed files with 41 additions and 2 deletions

View file

@ -0,0 +1,38 @@
<?php
class CakeTestSuiteDispatcherTest extends CakeTestCase {
public function setUp() {
$this->vendors = App::path('vendors');
$this->includePath = ini_get('include_path');
}
public function tearDown() {
App::build(array('Vendor' => $this->vendors), App::RESET);
ini_set('include_path', $this->includePath);
}
protected function clearPaths() {
App::build(array('Vendor' => array('junk')), App::RESET);
ini_set('include_path', 'junk');
}
public function testLoadTestFramework() {
$dispatcher = new CakeTestSuiteDispatcher();
$this->assertTrue($dispatcher->loadTestFramework());
$this->clearPaths();
$exception = null;
try {
$dispatcher->loadTestFramework();
} catch (Exception $ex) {
$exception = $ex;
}
$this->assertEquals(get_class($exception), "PHPUnit_Framework_Error_Warning");
}
}

View file

@ -138,13 +138,14 @@ class CakeTestSuiteDispatcher {
*/
public function loadTestFramework() {
foreach (App::path('vendors') as $vendor) {
if (is_dir($vendor . 'PHPUnit')) {
$vendor = rtrim($vendor, DS);
if (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;
}
}
return include 'PHPUnit' . DS . 'Autoload.php';
return (include('PHPUnit' . DS . 'Autoload.php')) !== false;
}
/**