Adding test case for CakeLog stream autoconfiguration.

This commit is contained in:
mark_story 2009-11-04 18:07:39 -05:00
parent 055b5c66aa
commit ceb7826db0

View file

@ -30,6 +30,26 @@ App::import('Core', 'Log');
*/
class CakeLogTest extends CakeTestCase {
/**
* Test that CakeLog autoconfigures itself to use a FileLogger with the LOGS dir.
* When no streams are there.
*
* @return void
**/
function testAutoConfig() {
$streams = CakeLog::streams();
foreach ($streams as $stream) {
CakeLog::removeStream($stream);
}
@unlink(LOGS . 'error.log');
CakeLog::write(LOG_WARNING, 'Test warning');
$this->assertTrue(file_exists(LOGS . 'error.log'));
$result = CakeLog::streams();
$this->assertEqual($result, array('default'));
}
/**
* testLogFileWriting method
*