mirror of
https://github.com/Seldaek/monolog.git
synced 2025-07-31 18:30:15 +02:00
Replace deprecated setExpectedException methods with expectException
This commit is contained in:
@@ -115,7 +115,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testFormatToStringExceptionHandle()
|
public function testFormatToStringExceptionHandle()
|
||||||
{
|
{
|
||||||
$formatter = new NormalizerFormatter('Y-m-d');
|
$formatter = new NormalizerFormatter('Y-m-d');
|
||||||
$this->setExpectedException('RuntimeException', 'Could not convert to string');
|
$this->expectException('RuntimeException', 'Could not convert to string');
|
||||||
$formatter->format([
|
$formatter->format([
|
||||||
'myObject' => new TestToStringError(),
|
'myObject' => new TestToStringError(),
|
||||||
]);
|
]);
|
||||||
@@ -313,7 +313,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$reflMethod = new \ReflectionMethod($formatter, 'handleJsonError');
|
$reflMethod = new \ReflectionMethod($formatter, 'handleJsonError');
|
||||||
$reflMethod->setAccessible(true);
|
$reflMethod->setAccessible(true);
|
||||||
|
|
||||||
$this->setExpectedException('RuntimeException', $msg);
|
$this->expectException('RuntimeException', $msg);
|
||||||
$reflMethod->invoke($formatter, $code, 'faked');
|
$reflMethod->invoke($formatter, $code, 'faked');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -134,7 +134,7 @@ class ElasticSearchHandlerTest extends TestCase
|
|||||||
$handler = new ElasticSearchHandler($client, $handlerOpts);
|
$handler = new ElasticSearchHandler($client, $handlerOpts);
|
||||||
|
|
||||||
if ($expectedError) {
|
if ($expectedError) {
|
||||||
$this->setExpectedException($expectedError[0], $expectedError[1]);
|
$this->expectException($expectedError[0], $expectedError[1]);
|
||||||
$handler->handle($this->getRecord());
|
$handler->handle($this->getRecord());
|
||||||
} else {
|
} else {
|
||||||
$this->assertFalse($handler->handle($this->getRecord()));
|
$this->assertFalse($handler->handle($this->getRecord()));
|
||||||
|
@@ -38,7 +38,7 @@ class SyslogHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructInvalidFacility()
|
public function testConstructInvalidFacility()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('UnexpectedValueException');
|
$this->expectException('UnexpectedValueException');
|
||||||
$handler = new SyslogHandler('test', 'unknown');
|
$handler = new SyslogHandler('test', 'unknown');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
|
|||||||
Registry::addLogger(new Logger('test1'), 'log');
|
Registry::addLogger(new Logger('test1'), 'log');
|
||||||
Registry::clear();
|
Registry::clear();
|
||||||
|
|
||||||
$this->setExpectedException('\InvalidArgumentException');
|
$this->expectException('\InvalidArgumentException');
|
||||||
Registry::getInstance('log');
|
Registry::getInstance('log');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
|
|||||||
Registry::addLogger($loggerToAdd);
|
Registry::addLogger($loggerToAdd);
|
||||||
Registry::removeLogger($remove);
|
Registry::removeLogger($remove);
|
||||||
|
|
||||||
$this->setExpectedException('\InvalidArgumentException');
|
$this->expectException('\InvalidArgumentException');
|
||||||
Registry::getInstance($loggerToAdd->getName());
|
Registry::getInstance($loggerToAdd->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user