array( 'adapter' => 'Memory' ) )); $this->cachelog = new Cache(array( 'key' => 'cachelog_testkey', 'config' => 'cachelog' )); Logger::config(array( 'cachelog' => array( 'adapter' => $this->cachelog, 'key' => 'cachelog_testkey', 'config' => 'cachelog' ) )); } /** * Test the initialization of the cache log adapter. */ public function testConstruct() { $expected = array( 'config' => "cachelog", 'expiry' => "+999 days", 'key' => "cachelog_testkey", 'init' => true ); $result = $this->cachelog->_config; $this->assertEqual($expected, $result); } /** * Test if the configuration is correctly set in the logger. */ public function testConfiguration() { $loggers = Logger::config(); $result = isset($loggers['cachelog']); $this->assertTrue($result); } /** * Tests the correct writing to the cache adapter. In this test we use the * "Memory" cache adapter so that we can easily verify the written message. */ public function testWrite() { $message = "CacheLog test message..."; $result = Logger::write('info', $message, array('name' => 'cachelog')); $this->assertTrue($result); $result = CacheStorage::read('cachelog', 'cachelog_testkey'); $this->assertEqual($message, $result); } } ?>