Skip to content

Commit

Permalink
Updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 20, 2014
1 parent 0634efb commit df1e4e0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions tests/TestCase/Database/Log/QueryLoggerTest.php
Expand Up @@ -90,13 +90,13 @@ public function testLogFunction() {
$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);
}

Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Error/DebuggerTest.php
Expand Up @@ -447,18 +447,18 @@ public function testExportVarZero() {
* @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]'),
Expand All @@ -478,11 +478,11 @@ public function testLog() {
* @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'),
Expand Down
14 changes: 7 additions & 7 deletions tests/TestCase/Error/ErrorHandlerTest.php
Expand Up @@ -82,7 +82,7 @@ public function setUp() {
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', [
Expand Down Expand Up @@ -183,7 +183,7 @@ public function testHandleErrorDebugOff() {
$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"
Expand All @@ -204,7 +204,7 @@ public function testHandleErrorLoggingTrace() {
$this->_restoreError = true;

$this->_logger->expects($this->once())
->method('write')
->method('log')
->with(
$this->matchesRegularExpression('(notice|debug)'),
$this->logicalAnd(
Expand Down Expand Up @@ -243,7 +243,7 @@ public function testHandleExceptionLog() {
$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')
Expand All @@ -263,7 +263,7 @@ public function testHandleExceptionLogSkipping() {
$forbidden = new ForbiddenException('Fooled you!');

$this->_logger->expects($this->once())
->method('write')
->method('log')
->with(
'error',
$this->stringContains('[Cake\Network\Exception\ForbiddenException] Fooled you!')
Expand Down Expand Up @@ -332,14 +332,14 @@ public function testHandleFatalErrorPage() {
*/
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]);
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Network/Email/EmailTest.php
Expand Up @@ -1277,12 +1277,12 @@ public function testSendWithNoContentDispositionAttachments() {
* @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(
Expand Down Expand Up @@ -1310,9 +1310,9 @@ public function testSendWithLog() {
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(
Expand Down

0 comments on commit df1e4e0

Please sign in to comment.