Browse Source

Updating tests

Jose Lorenzo Rodriguez 11 years ago
parent
commit
df1e4e004b

+ 3 - 3
tests/TestCase/Database/Log/QueryLoggerTest.php

@@ -90,13 +90,13 @@ class QueryLoggerTest extends \Cake\TestSuite\TestCase {
 		$query->query = 'SELECT a FROM b where a = ? AND b = ? AND c = ?';
 		$query->params = ['string', '3', null];
 
-		$engine = $this->getMock('\Cake\Log\Engine\BaseLog', ['write'], ['scopes' => ['queriesLog']]);
+		$engine = $this->getMock('\Cake\Log\Engine\BaseLog', ['log'], ['scopes' => ['queriesLog']]);
 		Log::engine('queryLoggerTest', $engine);
 
-		$engine2 = $this->getMock('\Cake\Log\Engine\BaseLog', ['write'], ['scopes' => ['foo']]);
+		$engine2 = $this->getMock('\Cake\Log\Engine\BaseLog', ['log'], ['scopes' => ['foo']]);
 		Log::engine('queryLoggerTest2', $engine2);
 
-		$engine2->expects($this->never())->method('write');
+		$engine2->expects($this->never())->method('log');
 		$logger->log($query);
 	}
 

+ 5 - 5
tests/TestCase/Error/DebuggerTest.php

@@ -447,18 +447,18 @@ TEXT;
  * @return void
  */
 	public function testLog() {
-		$mock = $this->getMock('Cake\Log\Engine\BaseLog', ['write']);
+		$mock = $this->getMock('Cake\Log\Engine\BaseLog', ['log']);
 		Log::config('test', ['engine' => $mock]);
 
 		$mock->expects($this->at(0))
-			->method('write')
+			->method('log')
 			->with('debug', $this->logicalAnd(
 				$this->stringContains('DebuggerTest::testLog'),
 				$this->stringContains('cool')
 			));
 
 		$mock->expects($this->at(1))
-			->method('write')
+			->method('log')
 			->with('debug', $this->logicalAnd(
 				$this->stringContains('DebuggerTest::testLog'),
 				$this->stringContains('[main]'),
@@ -478,11 +478,11 @@ TEXT;
  * @return void
  */
 	public function testLogDepth() {
-		$mock = $this->getMock('Cake\Log\Engine\BaseLog', ['write']);
+		$mock = $this->getMock('Cake\Log\Engine\BaseLog', ['log']);
 		Log::config('test', ['engine' => $mock]);
 
 		$mock->expects($this->at(0))
-			->method('write')
+			->method('log')
 			->with('debug', $this->logicalAnd(
 				$this->stringContains('DebuggerTest::testLog'),
 				$this->stringContains('test'),

+ 7 - 7
tests/TestCase/Error/ErrorHandlerTest.php

@@ -82,7 +82,7 @@ class ErrorHandlerTest extends TestCase {
 		Router::setRequestInfo($request);
 		Configure::write('debug', true);
 
-		$this->_logger = $this->getMock('Cake\Log\LogInterface');
+		$this->_logger = $this->getMock('Psr\Log\LoggerInterface');
 
 		Log::reset();
 		Log::config('error_test', [
@@ -183,7 +183,7 @@ class ErrorHandlerTest extends TestCase {
 		$this->_restoreError = true;
 
 		$this->_logger->expects($this->once())
-			->method('write')
+			->method('log')
 			->with(
 				$this->matchesRegularExpression('(notice|debug)'),
 				'Notice (8): Undefined variable: out in [' . __FILE__ . ', line ' . (__LINE__ + 3) . ']' . "\n\n"
@@ -204,7 +204,7 @@ class ErrorHandlerTest extends TestCase {
 		$this->_restoreError = true;
 
 		$this->_logger->expects($this->once())
-			->method('write')
+			->method('log')
 			->with(
 				$this->matchesRegularExpression('(notice|debug)'),
 				$this->logicalAnd(
@@ -243,7 +243,7 @@ class ErrorHandlerTest extends TestCase {
 		$error = new NotFoundException('Kaboom!');
 
 		$this->_logger->expects($this->once())
-			->method('write')
+			->method('log')
 			->with('error', $this->logicalAnd(
 				$this->stringContains('[Cake\Network\Exception\NotFoundException] Kaboom!'),
 				$this->stringContains('ErrorHandlerTest->testHandleExceptionLog')
@@ -263,7 +263,7 @@ class ErrorHandlerTest extends TestCase {
 		$forbidden = new ForbiddenException('Fooled you!');
 
 		$this->_logger->expects($this->once())
-			->method('write')
+			->method('log')
 			->with(
 				'error',
 				$this->stringContains('[Cake\Network\Exception\ForbiddenException] Fooled you!')
@@ -332,14 +332,14 @@ class ErrorHandlerTest extends TestCase {
  */
 	public function testHandleFatalErrorLog() {
 		$this->_logger->expects($this->at(0))
-			->method('write')
+			->method('log')
 			->with('error', $this->logicalAnd(
 				$this->stringContains(__FILE__ . ', line ' . (__LINE__ + 9)),
 				$this->stringContains('Fatal Error (1)'),
 				$this->stringContains('Something wrong')
 			));
 		$this->_logger->expects($this->at(1))
-			->method('write')
+			->method('log')
 			->with('error', $this->stringContains('[Cake\Error\FatalErrorException] Something wrong'));
 
 		$errorHandler = new TestErrorHandler(['log' => true]);

+ 4 - 4
tests/TestCase/Network/Email/EmailTest.php

@@ -1277,12 +1277,12 @@ class EmailTest extends TestCase {
  * @return void
  */
 	public function testSendWithLog() {
-		$log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], [['scopes' => 'email']]);
+		$log = $this->getMock('Cake\Log\Engine\BaseLog', ['log'], [['scopes' => 'email']]);
 
 		$message = 'Logging This';
 
 		$log->expects($this->once())
-			->method('write')
+			->method('log')
 			->with(
 				'debug',
 				$this->logicalAnd(
@@ -1310,9 +1310,9 @@ class EmailTest extends TestCase {
 	public function testSendWithLogAndScope() {
 		$message = 'Logging This';
 
-		$log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], ['scopes' => ['email']]);
+		$log = $this->getMock('Cake\Log\Engine\BaseLog', ['log'], ['scopes' => ['email']]);
 		$log->expects($this->once())
-			->method('write')
+			->method('log')
 			->with(
 				'debug',
 				$this->logicalAnd(