Browse Source

Added test for using a callable in Log::config()

Jose Lorenzo Rodriguez 11 years ago
parent
commit
58b985110c
1 changed files with 14 additions and 1 deletions
  1. 14 1
      tests/TestCase/Log/LogTest.php

+ 14 - 1
tests/TestCase/Log/LogTest.php

@@ -537,7 +537,7 @@ class LogTest extends TestCase {
 /**
  * Test that write() returns false on an unhandled message.
  *
- * @return false
+ * @return void
  */
 	public function testWriteUnhandled() {
 		Log::drop('error');
@@ -547,4 +547,17 @@ class LogTest extends TestCase {
 		$this->assertFalse($result);
 	}
 
+/**
+ * Tests using a callable for creating a Log engine
+ *
+ * @return void
+ */
+	public function testCreateLoggerWithCallable() {
+		$instance = new FileLog;
+		Log::config('default', function () use ($instance) {
+			return $instance;
+		});
+		$this->assertSame($instance, Log::engine('default'));
+	}
+
 }