From 8c57b0e4fc0e2fe956d8aef7f2da7e39b811314b Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 23 May 2013 22:31:27 -0400 Subject: [PATCH] Update syslog to use namespaces. --- lib/Cake/Log/Engine/SyslogLog.php | 7 +++---- .../Log/Engine/SyslogLogTest.php | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) rename lib/Cake/Test/{Case => TestCase}/Log/Engine/SyslogLogTest.php (84%) diff --git a/lib/Cake/Log/Engine/SyslogLog.php b/lib/Cake/Log/Engine/SyslogLog.php index cc233c3f304..dafd086daf0 100644 --- a/lib/Cake/Log/Engine/SyslogLog.php +++ b/lib/Cake/Log/Engine/SyslogLog.php @@ -17,20 +17,19 @@ * @since CakePHP(tm) v 2.4 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +namespace Cake\Log\Engine; -App::uses('BaseLog', 'Log/Engine'); +use Cake\Log\Engine\BaseLog; /** * Syslog stream for Logging. Writes logs to the system logger - * - * @package Cake.Log.Engine */ class SyslogLog extends BaseLog { /** * * By default messages are formatted as: - * type: message + * type: message * * To override the log format (e.g. to add your own info) define the format key when configuring * this logger diff --git a/lib/Cake/Test/Case/Log/Engine/SyslogLogTest.php b/lib/Cake/Test/TestCase/Log/Engine/SyslogLogTest.php similarity index 84% rename from lib/Cake/Test/Case/Log/Engine/SyslogLogTest.php rename to lib/Cake/Test/TestCase/Log/Engine/SyslogLogTest.php index ca6c0055e3a..9aa49c39da0 100644 --- a/lib/Cake/Test/Case/Log/Engine/SyslogLogTest.php +++ b/lib/Cake/Test/TestCase/Log/Engine/SyslogLogTest.php @@ -16,14 +16,14 @@ * @since CakePHP(tm) v 2.4 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('SyslogLog', 'Log/Engine'); +namespace Cake\Test\TestCase\Log\Engine; + +use Cake\TestSuite\TestCase; /** * SyslogLogTest class - * - * @package Cake.Test.Case.Log.Engine */ -class SyslogLogTest extends CakeTestCase { +class SyslogLogTest extends TestCase { /** * Tests that the connection to the logger is open with the right arguments @@ -31,11 +31,11 @@ class SyslogLogTest extends CakeTestCase { * @return void */ public function testOpenLog() { - $log = $this->getMock('SyslogLog', array('_open', '_write')); + $log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write')); $log->expects($this->once())->method('_open')->with('', LOG_ODELAY, LOG_USER); $log->write('debug', 'message'); - $log = $this->getMock('SyslogLog', array('_open', '_write')); + $log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write')); $log->config(array( 'prefix' => 'thing', 'flag' => LOG_NDELAY, @@ -54,7 +54,7 @@ public function testOpenLog() { * @return void */ public function testWriteOneLine($type, $expected) { - $log = $this->getMock('SyslogLog', array('_open', '_write')); + $log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write')); $log->expects($this->once())->method('_write')->with($expected, $type . ': Foo'); $log->write($type, 'Foo'); } @@ -65,7 +65,7 @@ public function testWriteOneLine($type, $expected) { * @return void */ public function testWriteMultiLine() { - $log = $this->getMock('SyslogLog', array('_open', '_write')); + $log = $this->getMock('Cake\Log\Engine\SyslogLog', array('_open', '_write')); $log->expects($this->at(1))->method('_write')->with(LOG_DEBUG, 'debug: Foo'); $log->expects($this->at(2))->method('_write')->with(LOG_DEBUG, 'debug: Bar'); $log->expects($this->exactly(2))->method('_write');