updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -39,7 +39,7 @@ class ConsoleLoggerTest extends TestCase
{
$this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE);
return new ConsoleLogger($this->output, array(
return new ConsoleLogger($this->output, [
LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
@@ -48,7 +48,7 @@ class ConsoleLoggerTest extends TestCase
LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,
LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL,
));
]);
}
/**
@@ -64,7 +64,7 @@ class ConsoleLoggerTest extends TestCase
/**
* @dataProvider provideOutputMappingParams
*/
public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = array())
public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = [])
{
$out = new BufferedOutput($outputVerbosity);
$logger = new ConsoleLogger($out, $addVerbosityLevelMap);
@@ -75,22 +75,22 @@ class ConsoleLoggerTest extends TestCase
public function provideOutputMappingParams()
{
$quietMap = array(LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET);
$quietMap = [LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET];
return array(
array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true),
array(LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true),
array(LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false),
array(LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false),
array(LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false),
array(LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true),
array(LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false),
array(LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true),
array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false),
array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false),
array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap),
array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap),
);
return [
[LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true],
[LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true],
[LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false],
[LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false],
[LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false],
[LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true],
[LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false],
[LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true],
[LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false],
[LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false],
[LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap],
[LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap],
];
}
public function testHasErrored()
@@ -117,28 +117,28 @@ class ConsoleLoggerTest extends TestCase
public function testLogsAtAllLevels($level, $message)
{
$logger = $this->getLogger();
$logger->{$level}($message, array('user' => 'Bob'));
$logger->log($level, $message, array('user' => 'Bob'));
$logger->{$level}($message, ['user' => 'Bob']);
$logger->log($level, $message, ['user' => 'Bob']);
$expected = array(
$expected = [
$level.' message of level '.$level.' with context: Bob',
$level.' message of level '.$level.' with context: Bob',
);
];
$this->assertEquals($expected, $this->getLogs());
}
public function provideLevelsAndMessages()
{
return array(
LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
);
return [
LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'],
LogLevel::ALERT => [LogLevel::ALERT, 'message of level alert with context: {user}'],
LogLevel::CRITICAL => [LogLevel::CRITICAL, 'message of level critical with context: {user}'],
LogLevel::ERROR => [LogLevel::ERROR, 'message of level error with context: {user}'],
LogLevel::WARNING => [LogLevel::WARNING, 'message of level warning with context: {user}'],
LogLevel::NOTICE => [LogLevel::NOTICE, 'message of level notice with context: {user}'],
LogLevel::INFO => [LogLevel::INFO, 'message of level info with context: {user}'],
LogLevel::DEBUG => [LogLevel::DEBUG, 'message of level debug with context: {user}'],
];
}
/**
@@ -153,56 +153,56 @@ class ConsoleLoggerTest extends TestCase
public function testContextReplacement()
{
$logger = $this->getLogger();
$logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
$logger->info('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']);
$expected = array('info {Message {nothing} Bob Bar a}');
$expected = ['info {Message {nothing} Bob Bar a}'];
$this->assertEquals($expected, $this->getLogs());
}
public function testObjectCastToString()
{
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
} else {
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
}
$dummy->method('__toString')->will($this->returnValue('DUMMY'));
$this->getLogger()->warning($dummy);
$expected = array('warning DUMMY');
$expected = ['warning DUMMY'];
$this->assertEquals($expected, $this->getLogs());
}
public function testContextCanContainAnything()
{
$context = array(
$context = [
'bool' => true,
'null' => null,
'string' => 'Foo',
'int' => 0,
'float' => 0.5,
'nested' => array('with object' => new DummyTest()),
'nested' => ['with object' => new DummyTest()],
'object' => new \DateTime(),
'resource' => fopen('php://memory', 'r'),
);
];
$this->getLogger()->warning('Crazy context data', $context);
$expected = array('warning Crazy context data');
$expected = ['warning Crazy context data'];
$this->assertEquals($expected, $this->getLogs());
}
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
{
$logger = $this->getLogger();
$logger->warning('Random message', array('exception' => 'oops'));
$logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
$logger->warning('Random message', ['exception' => 'oops']);
$logger->critical('Uncaught Exception!', ['exception' => new \LogicException('Fail')]);
$expected = array(
$expected = [
'warning Random message',
'critical Uncaught Exception!',
);
];
$this->assertEquals($expected, $this->getLogs());
}
}