Skip to content

Commit

Permalink
more coding standards fixes, minor rectaoring of testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Mar 18, 2013
1 parent 89100f9 commit 99fba8c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
35 changes: 24 additions & 11 deletions lib/Cake/Test/Case/TestSuite/CakeTestSuiteDispatcherTest.php
Expand Up @@ -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();

$exception = null;

try {
$dispatcher->loadTestFramework();
} catch (Exception $ex) {
$exception = $ex;
}
$this->_clearPaths();

$this->assertEquals(get_class($exception), "PHPUnit_Framework_Error_Warning");
$this->setExpectedException('PHPUnit_Framework_Error_Warning');
$dispatcher->loadTestFramework();
}

}
2 changes: 1 addition & 1 deletion lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
Expand Up @@ -138,7 +138,7 @@ protected function _checkPHPUnit() {
*/
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;
Expand Down

0 comments on commit 99fba8c

Please sign in to comment.