mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 20:57:36 +02:00
Make SocketHandlerTest PHPUnit 3.5+ compatible
This commit is contained in:
@@ -133,14 +133,17 @@ class SocketHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->setMockHandler(array('fwrite'));
|
$this->setMockHandler(array('fwrite'));
|
||||||
|
|
||||||
|
$callback = function($arg) {
|
||||||
$map = array(
|
$map = array(
|
||||||
array('Hello world', 6),
|
'Hello world' => 6,
|
||||||
array('world', false),
|
'world' => false,
|
||||||
);
|
);
|
||||||
|
return $map[$arg];
|
||||||
|
};
|
||||||
|
|
||||||
$this->handler->expects($this->exactly(2))
|
$this->handler->expects($this->exactly(2))
|
||||||
->method('fwrite')
|
->method('fwrite')
|
||||||
->will($this->returnValueMap($map));
|
->will($this->returnCallback($callback));
|
||||||
|
|
||||||
$this->writeRecord('Hello world');
|
$this->writeRecord('Hello world');
|
||||||
}
|
}
|
||||||
@@ -152,14 +155,17 @@ class SocketHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->setMockHandler(array('fwrite', 'stream_get_meta_data'));
|
$this->setMockHandler(array('fwrite', 'stream_get_meta_data'));
|
||||||
|
|
||||||
|
$callback = function($arg) {
|
||||||
$map = array(
|
$map = array(
|
||||||
array('Hello world', 6),
|
'Hello world' => 6,
|
||||||
array('world', 5),
|
'world' => 5,
|
||||||
);
|
);
|
||||||
|
return $map[$arg];
|
||||||
|
};
|
||||||
|
|
||||||
$this->handler->expects($this->exactly(1))
|
$this->handler->expects($this->exactly(1))
|
||||||
->method('fwrite')
|
->method('fwrite')
|
||||||
->will($this->returnValueMap($map));
|
->will($this->returnCallback($callback));
|
||||||
$this->handler->expects($this->exactly(1))
|
$this->handler->expects($this->exactly(1))
|
||||||
->method('stream_get_meta_data')
|
->method('stream_get_meta_data')
|
||||||
->will($this->returnValue(array('timed_out' => true)));
|
->will($this->returnValue(array('timed_out' => true)));
|
||||||
@@ -205,14 +211,17 @@ class SocketHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->setMockHandler(array('fwrite'));
|
$this->setMockHandler(array('fwrite'));
|
||||||
|
|
||||||
|
$callback = function($arg) {
|
||||||
$map = array(
|
$map = array(
|
||||||
array('Hello world', 6),
|
'Hello world' => 6,
|
||||||
array('world', 5),
|
'world' => 5,
|
||||||
);
|
);
|
||||||
|
return $map[$arg];
|
||||||
|
};
|
||||||
|
|
||||||
$this->handler->expects($this->exactly(2))
|
$this->handler->expects($this->exactly(2))
|
||||||
->method('fwrite')
|
->method('fwrite')
|
||||||
->will($this->returnValueMap($map));
|
->will($this->returnCallback($callback));
|
||||||
|
|
||||||
$this->writeRecord('Hello world');
|
$this->writeRecord('Hello world');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user