Permalink
Browse files

Adding test case for CakeLog stream autoconfiguration.

  • Loading branch information...
1 parent 055b5c6 commit ceb7826db09287f44be849438dfb2aef0d071825 @markstory markstory committed Nov 4, 2009
Showing with 20 additions and 0 deletions.
  1. +20 −0 cake/tests/cases/libs/cake_log.test.php
@@ -30,6 +30,26 @@
*/
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
*

0 comments on commit ceb7826

Please sign in to comment.