Skip to content
Permalink
Browse files

Updating tests

  • Loading branch information...
lorenzo committed Sep 20, 2014
1 parent 0634efb commit df1e4e004b742ec034d915df9f85b5df92f2fb2f
@@ -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);
}
@@ -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]'),
@@ -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'),
@@ -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', [
@@ -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"
@@ -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(
@@ -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')
@@ -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!')
@@ -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]);
@@ -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(
@@ -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(

0 comments on commit df1e4e0

Please sign in to comment.
You can’t perform that action at this time.