1
0
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:
Chris Forrence
2017-03-21 10:14:16 -04:00
parent 59355d5ce3
commit 85250d3c72
4 changed files with 6 additions and 6 deletions

View File

@@ -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');
} }

View File

@@ -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()));

View File

@@ -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');
} }
} }

View File

@@ -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());
} }