wiki.techinc.nl/tests/phpunit/unit/includes/debug/logger/monolog/CeeFormatterTest.php
Ammarpad 56247c2d5c logger: Fix broken Monolog\CeeFormatterTest
If we pass mock datetime in the data to be formatted, the
formatter will use it, so the time string will no longer vary.

Bug: T218688
Change-Id: I4ea846cf1e908de085a551bda2bd944e846f7a36
2021-02-09 00:07:25 +00:00

24 lines
612 B
PHP

<?php
namespace MediaWiki\Logger\Monolog;
/**
* @covers \MediaWiki\Logger\Monolog\CeeFormatter
*/
class CeeFormatterTest extends \MediaWikiUnitTestCase {
public function testV1() {
$ls_formatter = new LogstashFormatter( 'app', 'system', '', 'ctx_' );
$cee_formatter = new CeeFormatter( 'app', 'system', '', 'ctx_' );
$record = [
'extra' => [ 'url' => 1 ],
'context' => [ 'url' => 2 ],
// T218688, Pin time to January 1, 2020
'datetime' => '2020-01-01T00:00:00+00:00'
];
$this->assertSame(
$cee_formatter->format( $record ),
"@cee: " . $ls_formatter->format( $record )
);
}
}