Skip to content

Commit

Permalink
Make Debugger test skip instead of fail
Browse files Browse the repository at this point in the history
When there are no write permissions to LOGS, skip the test instead of
failing.
  • Loading branch information
markstory committed Oct 7, 2012
1 parent 7762846 commit 4941bbf
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions lib/Cake/Test/TestCase/Utility/DebuggerTest.php
Expand Up @@ -397,24 +397,20 @@ public function testExportVar() {
* @return void
*/
public function testLog() {
if (file_exists(LOGS . 'debug.log')) {
unlink(LOGS . 'debug.log');
}
$this->skipIf(!is_writable(LOGS), 'Cannot write to logs dir');

Debugger::log('cool');
$result = file_get_contents(LOGS . 'debug.log');
$this->assertRegExp('/DebuggerTest\:\:testLog/i', $result);
$this->assertRegExp("/'cool'/", $result);

unlink(LOGS . 'debug.log');
$this->assertContains('DebuggerTest::testLog', $result);
$this->assertContains("'cool'", $result);

Debugger::log(array('whatever', 'here'));
$result = file_get_contents(LOGS . 'debug.log');
$this->assertRegExp('/DebuggerTest\:\:testLog/i', $result);
$this->assertRegExp('/\[main\]/', $result);
$this->assertRegExp('/array/', $result);
$this->assertRegExp("/'whatever',/", $result);
$this->assertRegExp("/'here'/", $result);
$this->assertContains('DebuggerTest::testLog', $result);
$this->assertContains('[main]', $result);
$this->assertContains('array', $result);
$this->assertContains("'whatever',", $result);
$this->assertContains("'here'", $result);
}

/**
Expand Down

0 comments on commit 4941bbf

Please sign in to comment.