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()
|
public function testErrorGetLast()
|
||||||
{
|
{
|
||||||
$handler = ErrorHandler::register();
|
|
||||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||||
|
$handler = ErrorHandler::register();
|
||||||
$handler->setDefaultLogger($logger);
|
$handler->setDefaultLogger($logger);
|
||||||
$handler->screamAt(E_ALL);
|
$handler->screamAt(E_ALL);
|
||||||
|
|
||||||
@ -143,9 +143,8 @@ class ErrorHandlerTest extends TestCase
|
|||||||
public function testDefaultLogger()
|
public function testDefaultLogger()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$handler = ErrorHandler::register();
|
|
||||||
|
|
||||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||||
|
$handler = ErrorHandler::register();
|
||||||
|
|
||||||
$handler->setDefaultLogger($logger, E_NOTICE);
|
$handler->setDefaultLogger($logger, E_NOTICE);
|
||||||
$handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]);
|
$handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]);
|
||||||
@ -334,12 +333,11 @@ class ErrorHandlerTest extends TestCase
|
|||||||
public function testHandleException()
|
public function testHandleException()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||||
$handler = ErrorHandler::register();
|
$handler = ErrorHandler::register();
|
||||||
|
|
||||||
$exception = new \Exception('foo');
|
$exception = new \Exception('foo');
|
||||||
|
|
||||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
|
||||||
|
|
||||||
$logArgCheck = function ($level, $message, $context) {
|
$logArgCheck = function ($level, $message, $context) {
|
||||||
$this->assertSame('Uncaught Exception: foo', $message);
|
$this->assertSame('Uncaught Exception: foo', $message);
|
||||||
$this->assertArrayHasKey('exception', $context);
|
$this->assertArrayHasKey('exception', $context);
|
||||||
@ -483,6 +481,7 @@ class ErrorHandlerTest extends TestCase
|
|||||||
public function testHandleFatalError()
|
public function testHandleFatalError()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||||
$handler = ErrorHandler::register();
|
$handler = ErrorHandler::register();
|
||||||
|
|
||||||
$error = [
|
$error = [
|
||||||
@ -492,8 +491,6 @@ class ErrorHandlerTest extends TestCase
|
|||||||
'line' => 123,
|
'line' => 123,
|
||||||
];
|
];
|
||||||
|
|
||||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
|
||||||
|
|
||||||
$logArgCheck = function ($level, $message, $context) {
|
$logArgCheck = function ($level, $message, $context) {
|
||||||
$this->assertEquals('Fatal Parse Error: foo', $message);
|
$this->assertEquals('Fatal Parse Error: foo', $message);
|
||||||
$this->assertArrayHasKey('exception', $context);
|
$this->assertArrayHasKey('exception', $context);
|
||||||
|
Reference in New Issue
Block a user