mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
more coding standards fixes, minor rectaoring of testcase
This commit is contained in:
parent
89100f9476
commit
99fba8c601
2 changed files with 25 additions and 12 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue