diff --git a/lib/Cake/Test/TestCase/Log/Engine/ConsoleLogTest.php b/lib/Cake/Test/TestCase/Log/Engine/ConsoleLogTest.php index 6db6bf8d147..cbd8fcad4b1 100644 --- a/lib/Cake/Test/TestCase/Log/Engine/ConsoleLogTest.php +++ b/lib/Cake/Test/TestCase/Log/Engine/ConsoleLogTest.php @@ -16,13 +16,17 @@ * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('ConsoleLog', 'Log/Engine'); + +namespace Cake\Test\TestCase\Log\Engine; +use Cake\TestSuite\TestCase; +use Cake\Log\Engine\ConsoleLog; +use Cake\Log\Log; class TestConsoleLog extends ConsoleLog { } -class TestCakeLog extends CakeLog { +class TestCakeLog extends Log { public static function replace($key, &$engine) { self::$_Collection->{$key} = $engine; @@ -35,17 +39,17 @@ public static function replace($key, &$engine) { * * @package Cake.Test.Case.Log.Engine */ -class ConsoleLogTest extends CakeTestCase { +class ConsoleLogTest extends TestCase { public function setUp() { parent::setUp(); - CakeLog::config('debug', array( - 'engine' => 'FileLog', + Log::config('debug', array( + 'engine' => 'Cake\Log\Engine\FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug', )); - CakeLog::config('error', array( - 'engine' => 'FileLog', + Log::config('error', array( + 'engine' => 'Cake\Log\Engine\FileLog', 'types' => array('error', 'warning'), 'file' => 'error', )); @@ -66,10 +70,10 @@ public function tearDown() { */ public function testConsoleOutputWrites() { TestCakeLog::config('test_console_log', array( - 'engine' => 'TestConsoleLog', + 'engine' => __NAMESPACE__ . '\TestConsoleLog', )); - $mock = $this->getMock('TestConsoleLog', array('write'), array( + $mock = $this->getMock(__NAMESPACE__ . '\TestConsoleLog', array('write'), array( array('types' => 'error'), )); TestCakeLog::replace('test_console_log', $mock); @@ -85,9 +89,9 @@ public function testConsoleOutputWrites() { */ public function testCombinedLogWriting() { TestCakeLog::config('test_console_log', array( - 'engine' => 'TestConsoleLog', + 'engine' => __NAMESPACE__ . '\TestConsoleLog', )); - $mock = $this->getMock('TestConsoleLog', array('write'), array( + $mock = $this->getMock(__NAMESPACE__ . '\TestConsoleLog', array('write'), array( array('types' => 'error'), )); TestCakeLog::replace('test_console_log', $mock); diff --git a/lib/Cake/Test/TestCase/Log/Engine/FileLogTest.php b/lib/Cake/Test/TestCase/Log/Engine/FileLogTest.php index b4c13c8a881..c4a73329cd4 100644 --- a/lib/Cake/Test/TestCase/Log/Engine/FileLogTest.php +++ b/lib/Cake/Test/TestCase/Log/Engine/FileLogTest.php @@ -16,14 +16,16 @@ * @since CakePHP(tm) v 1.3 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('FileLog', 'Log/Engine'); +namespace Cake\Test\TestCase\Log\Engine; +use Cake\TestSuite\TestCase, + Cake\Log\Engine\FileLog; /** * CakeLogTest class * * @package Cake.Test.Case.Log.Engine */ -class FileLogTest extends CakeTestCase { +class FileLogTest extends TestCase { /** * testLogFileWriting method diff --git a/lib/Cake/Test/TestCase/Log/CakeLogTest.php b/lib/Cake/Test/TestCase/Log/LogTest.php similarity index 75% rename from lib/Cake/Test/TestCase/Log/CakeLogTest.php rename to lib/Cake/Test/TestCase/Log/LogTest.php index 7e0f05abba6..56a8d06975d 100644 --- a/lib/Cake/Test/TestCase/Log/CakeLogTest.php +++ b/lib/Cake/Test/TestCase/Log/LogTest.php @@ -1,6 +1,6 @@ array(CAKE . 'Test' . DS . 'test_app' . DS . 'Lib' . DS), - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) + 'Lib' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Lib' . DS), + 'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS) ), App::RESET); - CakePlugin::load('TestPlugin'); + Configure::write('App.namespace', 'TestApp'); + Plugin::load('TestPlugin'); - $result = CakeLog::config('libtest', array( + $result = Log::config('libtest', array( 'engine' => 'TestAppLog' )); $this->assertTrue($result); - $this->assertEquals(CakeLog::configured(), array('libtest')); + $this->assertEquals(Log::configured(), array('libtest')); - $result = CakeLog::config('plugintest', array( + $result = Log::config('plugintest', array( 'engine' => 'TestPlugin.TestPluginLog' )); $this->assertTrue($result); - $this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest')); + $this->assertEquals(Log::configured(), array('libtest', 'plugintest')); - CakeLog::write(LOG_INFO, 'TestPluginLog is not a BaseLog descendant'); + Log::write(LOG_INFO, 'TestPluginLog is not a BaseLog descendant'); App::build(); - CakePlugin::unload(); + Plugin::unload(); } /** * test all the errors from failed logger imports * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException * @return void */ public function testImportingLoggerFailure() { - CakeLog::config('fail', array()); + Log::config('fail', array()); } /** @@ -86,34 +91,34 @@ public function testImportingLoggerFailure() { * @return void */ public function testValidKeyName() { - CakeLog::config('valid', array('engine' => 'FileLog')); - $stream = CakeLog::stream('valid'); - $this->assertInstanceOf('FileLog', $stream); - CakeLog::drop('valid'); + Log::config('valid', array('engine' => 'FileLog')); + $stream = Log::stream('valid'); + $this->assertInstanceOf('Cake\Log\Engine\FileLog', $stream); + Log::drop('valid'); } /** * test config() with invalid key name * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException * @return void */ public function testInvalidKeyName() { - CakeLog::config('1nv', array('engine' => 'FileLog')); + Log::config('1nv', array('engine' => 'FileLog')); } /** * test that loggers have to implement the correct interface. * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException * @return void */ public function testNotImplementingInterface() { - CakeLog::config('fail', array('engine' => 'stdClass')); + Log::config('fail', array('engine' => '\stdClass')); } /** - * Test that CakeLog autoconfigures itself to use a FileLogger with the LOGS dir. + * Test that Log autoconfigures itself to use a FileLogger with the LOGS dir. * When no streams are there. * * @return void @@ -122,14 +127,14 @@ public function testAutoConfig() { if (file_exists(LOGS . 'error.log')) { unlink(LOGS . 'error.log'); } - CakeLog::write(LOG_WARNING, 'Test warning'); + Log::write(LOG_WARNING, 'Test warning'); $this->assertTrue(file_exists(LOGS . 'error.log')); - $result = CakeLog::configured(); + $result = Log::configured(); $this->assertEquals(array('default'), $result); $testMessage = 'custom message'; - CakeLog::write('custom', $testMessage); + Log::write('custom', $testMessage); $content = file_get_contents(LOGS . 'custom.log'); $this->assertContains($testMessage, $content); unlink(LOGS . 'error.log'); @@ -142,17 +147,17 @@ public function testAutoConfig() { * @return void */ public function testConfig() { - CakeLog::config('file', array( + Log::config('file', array( 'engine' => 'FileLog', 'path' => LOGS )); - $result = CakeLog::configured(); + $result = Log::configured(); $this->assertEquals(array('file'), $result); if (file_exists(LOGS . 'error.log')) { @unlink(LOGS . 'error.log'); } - CakeLog::write(LOG_WARNING, 'Test warning'); + Log::write(LOG_WARNING, 'Test warning'); $this->assertTrue(file_exists(LOGS . 'error.log')); $result = file_get_contents(LOGS . 'error.log'); @@ -166,15 +171,15 @@ public function testConfig() { * @return void **/ public function testDrop() { - CakeLog::config('file', array( + Log::config('file', array( 'engine' => 'FileLog', 'path' => LOGS )); - $result = CakeLog::configured(); + $result = Log::configured(); $this->assertEquals(array('file'), $result); - CakeLog::drop('file'); - $result = CakeLog::configured(); + Log::drop('file'); + $result = Log::configured(); $this->assertEquals(array(), $result); } @@ -187,13 +192,13 @@ public function testLogFileWriting() { if (file_exists(LOGS . 'error.log')) { unlink(LOGS . 'error.log'); } - $result = CakeLog::write(LOG_WARNING, 'Test warning'); + $result = Log::write(LOG_WARNING, 'Test warning'); $this->assertTrue($result); $this->assertTrue(file_exists(LOGS . 'error.log')); unlink(LOGS . 'error.log'); - CakeLog::write(LOG_WARNING, 'Test warning 1'); - CakeLog::write(LOG_WARNING, 'Test warning 2'); + Log::write(LOG_WARNING, 'Test warning 1'); + Log::write(LOG_WARNING, 'Test warning 2'); $result = file_get_contents(LOGS . 'error.log'); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1/', $result); $this->assertRegExp('/2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 2$/', $result); @@ -212,24 +217,24 @@ public function testSelectiveLoggingByLevel() { if (file_exists(LOGS . 'eggs.log')) { unlink(LOGS . 'eggs.log'); } - CakeLog::config('spam', array( + Log::config('spam', array( 'engine' => 'FileLog', 'types' => 'info', 'file' => 'spam', )); - CakeLog::config('eggs', array( + Log::config('eggs', array( 'engine' => 'FileLog', 'types' => array('eggs', 'info', 'error', 'warning'), 'file' => 'eggs', )); $testMessage = 'selective logging'; - CakeLog::write(LOG_WARNING, $testMessage); + Log::write(LOG_WARNING, $testMessage); $this->assertTrue(file_exists(LOGS . 'eggs.log')); $this->assertFalse(file_exists(LOGS . 'spam.log')); - CakeLog::write(LOG_INFO, $testMessage); + Log::write(LOG_INFO, $testMessage); $this->assertTrue(file_exists(LOGS . 'spam.log')); $contents = file_get_contents(LOGS . 'spam.log'); @@ -248,60 +253,60 @@ public function testSelectiveLoggingByLevel() { /** * test enable * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException */ public function testStreamEnable() { - CakeLog::config('spam', array( + Log::config('spam', array( 'engine' => 'FileLog', 'file' => 'spam', )); - $this->assertTrue(CakeLog::enabled('spam')); - CakeLog::drop('spam'); - CakeLog::enable('bogus_stream'); + $this->assertTrue(Log::enabled('spam')); + Log::drop('spam'); + Log::enable('bogus_stream'); } /** * test disable * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException */ public function testStreamDisable() { - CakeLog::config('spam', array( + Log::config('spam', array( 'engine' => 'FileLog', 'file' => 'spam', )); - $this->assertTrue(CakeLog::enabled('spam')); - CakeLog::disable('spam'); - $this->assertFalse(CakeLog::enabled('spam')); - CakeLog::drop('spam'); - CakeLog::enable('bogus_stream'); + $this->assertTrue(Log::enabled('spam')); + Log::disable('spam'); + $this->assertFalse(Log::enabled('spam')); + Log::drop('spam'); + Log::enable('bogus_stream'); } /** * test enabled() invalid stream * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException */ public function testStreamEnabledInvalid() { - CakeLog::enabled('bogus_stream'); + Log::enabled('bogus_stream'); } /** * test disable invalid stream * - * @expectedException CakeLogException + * @expectedException Cake\Error\LogException */ public function testStreamDisableInvalid() { - CakeLog::disable('bogus_stream'); + Log::disable('bogus_stream'); } protected function _resetLogConfig() { - CakeLog::config('debug', array( + Log::config('debug', array( 'engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug', )); - CakeLog::config('error', array( + Log::config('error', array( 'engine' => 'FileLog', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error', @@ -336,21 +341,21 @@ public function testScopedLoggingBC() { $this->_deleteLogs(); $this->_resetLogConfig(); - CakeLog::config('shops', array( + Log::config('shops', array( 'engine' => 'FileLog', 'types' => array('info', 'notice', 'warning'), 'scopes' => array('transactions', 'orders'), 'file' => 'shops', )); - CakeLog::write('info', 'info message'); + Log::write('info', 'info message'); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertTrue(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::write('transactions', 'transaction message'); + Log::write('transactions', 'transaction message'); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertFalse(file_exists(LOGS . 'transactions.log')); $this->assertFalse(file_exists(LOGS . 'error.log')); @@ -358,14 +363,14 @@ public function testScopedLoggingBC() { $this->_deleteLogs(); - CakeLog::write('error', 'error message'); + Log::write('error', 'error message'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->assertFalse(file_exists(LOGS . 'shops.log')); $this->_deleteLogs(); - CakeLog::write('orders', 'order message'); + Log::write('orders', 'order message'); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->assertFalse(file_exists(LOGS . 'orders.log')); @@ -373,14 +378,14 @@ public function testScopedLoggingBC() { $this->_deleteLogs(); - CakeLog::write('warning', 'warning message'); + Log::write('warning', 'warning message'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::drop('shops'); + Log::drop('shops'); } /** @@ -400,21 +405,21 @@ public function testScopedLogging() { } $this->_resetLogConfig(); - CakeLog::config('shops', array( + Log::config('shops', array( 'engine' => 'FileLog', 'types' => array('info', 'notice', 'warning'), 'scopes' => array('transactions', 'orders'), 'file' => 'shops', )); - CakeLog::write('info', 'info message', 'transactions'); + Log::write('info', 'info message', 'transactions'); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertTrue(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::write('transactions', 'transaction message', 'orders'); + Log::write('transactions', 'transaction message', 'orders'); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertFalse(file_exists(LOGS . 'transactions.log')); $this->assertFalse(file_exists(LOGS . 'error.log')); @@ -422,14 +427,14 @@ public function testScopedLogging() { $this->_deleteLogs(); - CakeLog::write('error', 'error message', 'orders'); + Log::write('error', 'error message', 'orders'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->assertFalse(file_exists(LOGS . 'shops.log')); $this->_deleteLogs(); - CakeLog::write('orders', 'order message', 'transactions'); + Log::write('orders', 'order message', 'transactions'); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->assertFalse(file_exists(LOGS . 'orders.log')); @@ -437,14 +442,14 @@ public function testScopedLogging() { $this->_deleteLogs(); - CakeLog::write('warning', 'warning message', 'orders'); + Log::write('warning', 'warning message', 'orders'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::drop('shops'); + Log::drop('shops'); } /** @@ -455,19 +460,19 @@ public function testBogusTypeAndScope() { $this->_resetLogConfig(); $this->_deleteLogs(); - CakeLog::write('bogus', 'bogus message'); + Log::write('bogus', 'bogus message'); $this->assertTrue(file_exists(LOGS . 'bogus.log')); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::write('bogus', 'bogus message', 'bogus'); + Log::write('bogus', 'bogus message', 'bogus'); $this->assertTrue(file_exists(LOGS . 'bogus.log')); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::write('error', 'bogus message', 'bogus'); + Log::write('error', 'bogus message', 'bogus'); $this->assertFalse(file_exists(LOGS . 'bogus.log')); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); @@ -489,35 +494,35 @@ public function testConvenienceScopedLogging() { } $this->_resetLogConfig(); - CakeLog::config('shops', array( + Log::config('shops', array( 'engine' => 'FileLog', 'types' => array('info', 'notice', 'warning'), 'scopes' => array('transactions', 'orders'), 'file' => 'shops', )); - CakeLog::info('info message', 'transactions'); + Log::info('info message', 'transactions'); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertTrue(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::error('error message', 'orders'); + Log::error('error message', 'orders'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->assertFalse(file_exists(LOGS . 'shops.log')); $this->_deleteLogs(); - CakeLog::warning('warning message', 'orders'); + Log::warning('warning message', 'orders'); $this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'shops.log')); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); - CakeLog::drop('shops'); + Log::drop('shops'); } /** @@ -526,68 +531,68 @@ public function testConvenienceScopedLogging() { public function testConvenienceMethods() { $this->_deleteLogs(); - CakeLog::config('debug', array( + Log::config('debug', array( 'engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug', )); - CakeLog::config('error', array( + Log::config('error', array( 'engine' => 'FileLog', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning'), 'file' => 'error', )); $testMessage = 'emergency message'; - CakeLog::emergency($testMessage); + Log::emergency($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Emergency: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'alert message'; - CakeLog::alert($testMessage); + Log::alert($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Alert: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'critical message'; - CakeLog::critical($testMessage); + Log::critical($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Critical: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'error message'; - CakeLog::error($testMessage); + Log::error($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Error: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'warning message'; - CakeLog::warning($testMessage); + Log::warning($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Warning: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'debug.log')); $this->_deleteLogs(); $testMessage = 'notice message'; - CakeLog::notice($testMessage); + Log::notice($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertContains('Notice: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->_deleteLogs(); $testMessage = 'info message'; - CakeLog::info($testMessage); + Log::info($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertContains('Info: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); $this->_deleteLogs(); $testMessage = 'debug message'; - CakeLog::debug($testMessage); + Log::debug($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertContains('Debug: ' . $testMessage, $contents); $this->assertFalse(file_exists(LOGS . 'error.log')); @@ -600,27 +605,27 @@ public function testConvenienceMethods() { public function testLevelCustomization() { $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Log level tests not supported on Windows.'); - $levels = CakeLog::defaultLevels(); + $levels = Log::defaultLevels(); $this->assertNotEmpty($levels); $result = array_keys($levels); $this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7), $result); - $levels = CakeLog::levels(array('foo', 'bar')); - CakeLog::defaultLevels(); + $levels = Log::levels(array('foo', 'bar')); + Log::defaultLevels(); $this->assertEquals('foo', $levels[8]); $this->assertEquals('bar', $levels[9]); - $levels = CakeLog::levels(array(11 => 'spam', 'bar' => 'eggs')); - CakeLog::defaultLevels(); + $levels = Log::levels(array(11 => 'spam', 'bar' => 'eggs')); + Log::defaultLevels(); $this->assertEquals('spam', $levels[8]); $this->assertEquals('eggs', $levels[9]); - $levels = CakeLog::levels(array(11 => 'spam', 'bar' => 'eggs'), false); - CakeLog::defaultLevels(); + $levels = Log::levels(array(11 => 'spam', 'bar' => 'eggs'), false); + Log::defaultLevels(); $this->assertEquals(array('spam', 'eggs'), $levels); - $levels = CakeLog::levels(array('ham', 9 => 'spam', '12' => 'fam'), false); - CakeLog::defaultLevels(); + $levels = Log::levels(array('ham', 9 => 'spam', '12' => 'fam'), false); + Log::defaultLevels(); $this->assertEquals(array('ham', 'spam', 'fam'), $levels); } @@ -631,44 +636,44 @@ public function testCustomLevelWrites() { $this->_deleteLogs(); $this->_resetLogConfig(); - $levels = CakeLog::levels(array('spam', 'eggs')); + $levels = Log::levels(array('spam', 'eggs')); $testMessage = 'error message'; - CakeLog::write('error', $testMessage); - CakeLog::defaultLevels(); + Log::write('error', $testMessage); + Log::defaultLevels(); $this->assertTrue(file_exists(LOGS . 'error.log')); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Error: ' . $testMessage, $contents); - CakeLog::config('spam', array( + Log::config('spam', array( 'engine' => 'FileLog', 'file' => 'spam.log', 'types' => 'spam', )); - CakeLog::config('eggs', array( + Log::config('eggs', array( 'engine' => 'FileLog', 'file' => 'eggs.log', 'types' => array('spam', 'eggs'), )); $testMessage = 'spam message'; - CakeLog::write('spam', $testMessage); - CakeLog::defaultLevels(); + Log::write('spam', $testMessage); + Log::defaultLevels(); $this->assertTrue(file_exists(LOGS . 'spam.log')); $this->assertTrue(file_exists(LOGS . 'eggs.log')); $contents = file_get_contents(LOGS . 'spam.log'); $this->assertContains('Spam: ' . $testMessage, $contents); $testMessage = 'egg message'; - CakeLog::write('eggs', $testMessage); - CakeLog::defaultLevels(); + Log::write('eggs', $testMessage); + Log::defaultLevels(); $contents = file_get_contents(LOGS . 'spam.log'); $this->assertNotContains('Eggs: ' . $testMessage, $contents); $contents = file_get_contents(LOGS . 'eggs.log'); $this->assertContains('Eggs: ' . $testMessage, $contents); - CakeLog::drop('spam'); - CakeLog::drop('eggs'); + Log::drop('spam'); + Log::drop('eggs'); $this->_deleteLogs(); }