Skip to content

Commit

Permalink
Remove use of TestCase::getMock() from "Log" namepace tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jun 5, 2016
1 parent 352d01d commit 6f37ab7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/TestCase/Log/Engine/SyslogLogTest.php
Expand Up @@ -29,11 +29,15 @@ class SyslogLogTest extends TestCase
*/
public function testOpenLog()
{
$log = $this->getMock('Cake\Log\Engine\SyslogLog', ['_open', '_write']);
$log = $this->getMockBuilder('Cake\Log\Engine\SyslogLog')
->setMethods(['_open', '_write'])
->getMock();
$log->expects($this->once())->method('_open')->with('', LOG_ODELAY, LOG_USER);
$log->log('debug', 'message');

$log = $this->getMock('Cake\Log\Engine\SyslogLog', ['_open', '_write']);
$log = $this->getMockBuilder('Cake\Log\Engine\SyslogLog')
->setMethods(['_open', '_write'])
->getMock();
$log->config([
'prefix' => 'thing',
'flag' => LOG_NDELAY,
Expand All @@ -53,7 +57,9 @@ public function testOpenLog()
*/
public function testWriteOneLine($type, $expected)
{
$log = $this->getMock('Cake\Log\Engine\SyslogLog', ['_open', '_write']);
$log = $this->getMockBuilder('Cake\Log\Engine\SyslogLog')
->setMethods(['_open', '_write'])
->getMock();
$log->expects($this->once())->method('_write')->with($expected, $type . ': Foo');
$log->log($type, 'Foo');
}
Expand All @@ -65,7 +71,9 @@ public function testWriteOneLine($type, $expected)
*/
public function testWriteMultiLine()
{
$log = $this->getMock('Cake\Log\Engine\SyslogLog', ['_open', '_write']);
$log = $this->getMockBuilder('Cake\Log\Engine\SyslogLog')
->setMethods(['_open', '_write'])
->getMock();
$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');
Expand Down

0 comments on commit 6f37ab7

Please sign in to comment.