mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 12:17:35 +02:00
Merge pull request #1133 from DQNEO/compat-phpunit6
Compatible to phpunit6
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
"psr/log": "^1.0.1"
|
"psr/log": "^1.0.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^5.7",
|
"phpunit/phpunit": "^6.5",
|
||||||
"graylog2/gelf-php": "^1.4.2",
|
"graylog2/gelf-php": "^1.4.2",
|
||||||
"sentry/sentry": "^0.13",
|
"sentry/sentry": "^0.13",
|
||||||
"ruflin/elastica": ">=0.90 <3.0",
|
"ruflin/elastica": ">=0.90 <3.0",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<phpunit bootstrap="tests/bootstrap.php" colors="true">
|
<phpunit bootstrap="tests/bootstrap.php" colors="true" beStrictAboutTestsThatDoNotTestAnything="false">
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Monolog Test Suite">
|
<testsuite name="Monolog Test Suite">
|
||||||
<directory>tests/Monolog/</directory>
|
<directory>tests/Monolog/</directory>
|
||||||
|
@@ -17,7 +17,7 @@ class LogstashFormatterTest extends \PHPUnit\Framework\TestCase
|
|||||||
{
|
{
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
\PHPUnit\Framework\Error\Warning::$enabled = true;
|
||||||
|
|
||||||
return parent::tearDown();
|
return parent::tearDown();
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
|
|||||||
{
|
{
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
\PHPUnit\Framework\Error\Warning::$enabled = true;
|
||||||
|
|
||||||
return parent::tearDown();
|
return parent::tearDown();
|
||||||
}
|
}
|
||||||
|
@@ -77,7 +77,7 @@ class ProcessHandlerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructWithInvalidCommandThrowsInvalidArgumentException($invalidCommand, $expectedExcep)
|
public function testConstructWithInvalidCommandThrowsInvalidArgumentException($invalidCommand, $expectedExcep)
|
||||||
{
|
{
|
||||||
$this->setExpectedException($expectedExcep);
|
$this->expectException($expectedExcep);
|
||||||
new ProcessHandler($invalidCommand, Logger::DEBUG);
|
new ProcessHandler($invalidCommand, Logger::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ class ProcessHandlerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructWithInvalidCwdThrowsInvalidArgumentException($invalidCwd, $expectedExcep)
|
public function testConstructWithInvalidCwdThrowsInvalidArgumentException($invalidCwd, $expectedExcep)
|
||||||
{
|
{
|
||||||
$this->setExpectedException($expectedExcep);
|
$this->expectException($expectedExcep);
|
||||||
new ProcessHandler(self::DUMMY_COMMAND, Logger::DEBUG, true, $invalidCwd);
|
new ProcessHandler(self::DUMMY_COMMAND, Logger::DEBUG, true, $invalidCwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ class ProcessHandlerTest extends TestCase
|
|||||||
->method('selectErrorStream')
|
->method('selectErrorStream')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
$this->setExpectedException('\UnexpectedValueException');
|
$this->expectException('\UnexpectedValueException');
|
||||||
/** @var ProcessHandler $handler */
|
/** @var ProcessHandler $handler */
|
||||||
$handler->handle($this->getRecord(Logger::WARNING, 'stream failing, whoops'));
|
$handler->handle($this->getRecord(Logger::WARNING, 'stream failing, whoops'));
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ class ProcessHandlerTest extends TestCase
|
|||||||
public function testStartupWithErrorsThrowsUnexpectedValueException()
|
public function testStartupWithErrorsThrowsUnexpectedValueException()
|
||||||
{
|
{
|
||||||
$handler = new ProcessHandler('>&2 echo "some fake error message"');
|
$handler = new ProcessHandler('>&2 echo "some fake error message"');
|
||||||
$this->setExpectedException('\UnexpectedValueException');
|
$this->expectException('\UnexpectedValueException');
|
||||||
$handler->handle($this->getRecord(Logger::WARNING, 'some warning in the house'));
|
$handler->handle($this->getRecord(Logger::WARNING, 'some warning in the house'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ class ProcessHandlerTest extends TestCase
|
|||||||
->method('readProcessErrors')
|
->method('readProcessErrors')
|
||||||
->willReturnOnConsecutiveCalls('', $this->returnValue('some fake error message here'));
|
->willReturnOnConsecutiveCalls('', $this->returnValue('some fake error message here'));
|
||||||
|
|
||||||
$this->setExpectedException('\UnexpectedValueException');
|
$this->expectException('\UnexpectedValueException');
|
||||||
/** @var ProcessHandler $handler */
|
/** @var ProcessHandler $handler */
|
||||||
$handler->handle($this->getRecord(Logger::WARNING, 'some test stuff'));
|
$handler->handle($this->getRecord(Logger::WARNING, 'some test stuff'));
|
||||||
}
|
}
|
||||||
|
@@ -134,7 +134,8 @@ class RotatingFileHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$this->setExpectedExceptionRegExp(InvalidArgumentException::class, '~^Invalid date format~');
|
$this->expectException(InvalidArgumentException::class);
|
||||||
|
$this->expectExceptionMessageRegExp('~^Invalid date format~');
|
||||||
}
|
}
|
||||||
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
@@ -174,7 +175,8 @@ class RotatingFileHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$this->setExpectedExceptionRegExp(InvalidArgumentException::class, '~^Invalid filename format~');
|
$this->expectException(InvalidArgumentException::class);
|
||||||
|
$this->expectExceptionMessageRegExp('~^Invalid filename format~');
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
|
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
|
||||||
|
@@ -12,3 +12,9 @@
|
|||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
require __DIR__.'/../vendor/autoload.php';
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
|
// B.C. for PSR Log's old inheritance
|
||||||
|
// see https://github.com/php-fig/log/pull/52
|
||||||
|
if (!class_exists('\\PHPUnit_Framework_TestCase', true)) {
|
||||||
|
class_alias('\\PHPUnit\\Framework\\TestCase', '\\PHPUnit_Framework_TestCase');
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user