From ceb7826db09287f44be849438dfb2aef0d071825 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 4 Nov 2009 18:07:39 -0500 Subject: [PATCH] Adding test case for CakeLog stream autoconfiguration. --- cake/tests/cases/libs/cake_log.test.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cake/tests/cases/libs/cake_log.test.php b/cake/tests/cases/libs/cake_log.test.php index 8c95cb70c..764265d5c 100644 --- a/cake/tests/cases/libs/cake_log.test.php +++ b/cake/tests/cases/libs/cake_log.test.php @@ -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 *