Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3.4: Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)" [Workflow] Fixed dumping when many transition with same name exist fix ConsoleFormatter - call to a member function format() on string
- Loading branch information
Showing
7 changed files
with
138 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\Monolog\Tests\Formatter; | ||
|
||
use Monolog\Logger; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; | ||
|
||
class ConsoleFormatterTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider providerFormatTests | ||
*/ | ||
public function testFormat(array $record, $expectedMessage) | ||
{ | ||
$formatter = new ConsoleFormatter(); | ||
self::assertSame($expectedMessage, $formatter->format($record)); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function providerFormatTests() | ||
{ | ||
$currentDateTime = new \DateTime(); | ||
|
||
return [ | ||
'record with DateTime object in datetime field' => [ | ||
'record' => [ | ||
'message' => 'test', | ||
'context' => [], | ||
'level' => Logger::WARNING, | ||
'level_name' => Logger::getLevelName(Logger::WARNING), | ||
'channel' => 'test', | ||
'datetime' => $currentDateTime, | ||
'extra' => [], | ||
], | ||
'expectedMessage' => sprintf( | ||
"%s <fg=cyan>WARNING </> <comment>[test]</> test\n", | ||
$currentDateTime->format(ConsoleFormatter::SIMPLE_DATE) | ||
), | ||
], | ||
'record with string in datetime field' => [ | ||
'record' => [ | ||
'message' => 'test', | ||
'context' => [], | ||
'level' => Logger::WARNING, | ||
'level_name' => Logger::getLevelName(Logger::WARNING), | ||
'channel' => 'test', | ||
'datetime' => '2019-01-01T00:42:00+00:00', | ||
'extra' => [], | ||
], | ||
'expectedMessage' => "2019-01-01T00:42:00+00:00 <fg=cyan>WARNING </> <comment>[test]</> test\n", | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters