Skip to content

Commit

Permalink
Fixing issue in DboSource test case where buffer would eat all the ou…
Browse files Browse the repository at this point in the history
…tput.

Removing dead tests from TestManager test.
  • Loading branch information
markstory committed Sep 25, 2010
1 parent cd7bc3f commit 26057c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 59 deletions.
19 changes: 11 additions & 8 deletions cake/tests/cases/libs/model/datasources/dbo_source.test.php
Expand Up @@ -4154,18 +4154,21 @@ function testLog() {
$oldDebug = Configure::read('debug');
Configure::write('debug', 2);

$this->testDb->error = true;
$this->expectError();
ob_start();
$this->testDb->showQuery('Error 2');
$contents = ob_get_clean();

$this->assertPattern('/Error 2/s', $contents);

$this->testDb->error = $oldError;
Configure::write('debug', $oldDebug);
}

function testShowQueryError() {
$this->testDb->error = true;
try {
$this->testDb->showQuery('Error 2');
$this->fail('No exception');
} catch (Exception $e) {
$this->assertPattern('/SQL Error/', $e->getMessage());
$this->assertTrue(true, 'Exception thrown');
}
}

/**
* test getting the query log as an array.
*
Expand Down
50 changes: 0 additions & 50 deletions cake/tests/cases/libs/test_manager.test.php
Expand Up @@ -87,20 +87,6 @@ protected function _getAllTestFiles($directory = CORE_TEST_CASES, $type = 'test'
return $files;
}

/**
* testRunAllTests method
*
* @return void
*/
public function testRunAllTests() {
$this->Reporter->params = array('show' => 'cases');
$files = $this->_getAllTestFiles();
$result = $this->TestManager->runAllTests($this->Reporter, true);

$this->assertEquals(count($files), $this->_countFiles);
$this->assertType('PHPUnit_Framework_TestResult', $result);
}

/**
* Tests that trying to run an unexistent file throws an exception
* @expectedException InvalidArgumentException
Expand All @@ -122,40 +108,4 @@ public function testRunTestCase() {
$this->assertType('PHPUnit_Framework_TestResult', $result);
}

/**
* testAddTestCasesFromDirectory method
*
* @return void
*/
public function testAddTestCasesFromDirectory() {
$this->TestManager->addTestCasesFromDirectory($this->testSuiteStub, CORE_TEST_CASES);
$this->assertEquals(count($this->_getAllTestFiles()), $this->_countFiles);
}

/**
* testAddTestFile method
*
* @return void
*/
public function testAddTestFile() {
$file = str_replace(CORE_TEST_CASES, '', __FILE__);
$this->TestManager->addTestFile($this->testSuiteStub, $file);
$this->assertEquals(1, $this->_countFiles);
}

/**
* testGetTestCaseList method
*
* @return void
*/
public function testGetTestCaseList() {
}

/**
* testGetGroupTestList method
*
* @return void
*/
public function testGetGroupTestList() {
}
}
4 changes: 3 additions & 1 deletion cake/tests/lib/cake_test_suite.php
Expand Up @@ -74,7 +74,8 @@ public function addTestDirectoryRecursive($directory = '.') {

/**
* Method that is called before the tests of this test suite are run.
* It will load fixtures accordingly for each test
* It will load fixtures accordingly for each test.
*
* @return void
* @access protected
*/
Expand All @@ -92,6 +93,7 @@ protected function setUp() {

/**
* Method that is called after all the tests of this test suite are run.
*
* @return void
* @access protected
*/
Expand Down

0 comments on commit 26057c5

Please sign in to comment.