more coding standards fixes, minor rectaoring of testcase

This commit is contained in:
Ceeram 2013-03-18 11:38:50 +01:00
parent 89100f9476
commit 99fba8c601
2 changed files with 25 additions and 12 deletions

View file

@ -22,37 +22,50 @@
class CakeTestSuiteDispatcherTest extends CakeTestCase {
/**
* setUp method
*
* @return void
*/
public function setUp() {
$this->vendors = App::path('vendors');
$this->includePath = ini_get('include_path');
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
App::build(array('Vendor' => $this->vendors), App::RESET);
ini_set('include_path', $this->includePath);
}
protected function clearPaths() {
/**
* Helper method to set vendor path
*
* @return void
*/
protected function _clearPaths() {
App::build(array('Vendor' => array('junk')), App::RESET);
ini_set('include_path', 'junk');
}
/**
* testLoadTestFramework method
*
* @return void
*/
public function testLoadTestFramework() {
$dispatcher = new CakeTestSuiteDispatcher();
$this->assertTrue($dispatcher->loadTestFramework());
$this->clearPaths();
$this->_clearPaths();
$exception = null;
try {
$dispatcher->loadTestFramework();
} catch (Exception $ex) {
$exception = $ex;
}
$this->assertEquals(get_class($exception), "PHPUnit_Framework_Error_Warning");
$this->setExpectedException('PHPUnit_Framework_Error_Warning');
$dispatcher->loadTestFramework();
}
}

View file

@ -138,7 +138,7 @@ class CakeTestSuiteDispatcher {
*/
public function loadTestFramework() {
foreach (App::path('vendors') as $vendor) {
$vendor = rtrim($vendor, DS);
$vendor = rtrim($vendor, DS);
if (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;