Use mocks before replacing the error handler
We want the bridge to mute the deprecations triggered when building mocks.
This commit is contained in:
parent
04b9ce39ad
commit
f6e0b01f7c
|
@ -70,8 +70,8 @@ class ErrorHandlerTest extends TestCase
|
|||
|
||||
public function testErrorGetLast()
|
||||
{
|
||||
$handler = ErrorHandler::register();
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$handler = ErrorHandler::register();
|
||||
$handler->setDefaultLogger($logger);
|
||||
$handler->screamAt(E_ALL);
|
||||
|
||||
|
@ -143,9 +143,8 @@ class ErrorHandlerTest extends TestCase
|
|||
public function testDefaultLogger()
|
||||
{
|
||||
try {
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$handler->setDefaultLogger($logger, E_NOTICE);
|
||||
$handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]);
|
||||
|
@ -334,12 +333,11 @@ class ErrorHandlerTest extends TestCase
|
|||
public function testHandleException()
|
||||
{
|
||||
try {
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$exception = new \Exception('foo');
|
||||
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logArgCheck = function ($level, $message, $context) {
|
||||
$this->assertSame('Uncaught Exception: foo', $message);
|
||||
$this->assertArrayHasKey('exception', $context);
|
||||
|
@ -483,6 +481,7 @@ class ErrorHandlerTest extends TestCase
|
|||
public function testHandleFatalError()
|
||||
{
|
||||
try {
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$error = [
|
||||
|
@ -492,8 +491,6 @@ class ErrorHandlerTest extends TestCase
|
|||
'line' => 123,
|
||||
];
|
||||
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logArgCheck = function ($level, $message, $context) {
|
||||
$this->assertEquals('Fatal Parse Error: foo', $message);
|
||||
$this->assertArrayHasKey('exception', $context);
|
||||
|
|
Reference in New Issue