Use a enum for level in LogEntries

This commit is contained in:
Jan Böhmer 2023-06-18 17:25:55 +02:00
parent 4a644d8712
commit 2da7463edf
18 changed files with 322 additions and 149 deletions

View file

@ -60,22 +60,6 @@ use PHPUnit\Framework\TestCase;
class AbstractLogEntryTest extends TestCase
{
public function levelDataProvider(): array
{
return [
[0, 'emergency'],
[1, 'alert'],
[2, 'critical'],
[3, 'error'],
[4, 'warning'],
[5, 'notice'],
[6, 'info'],
[7, 'debug'],
[8, 'blabla', true],
[-1, 'test', true],
];
}
public function targetTypeDataProvider(): array
{
return [
@ -95,28 +79,6 @@ class AbstractLogEntryTest extends TestCase
];
}
/**
* @dataProvider levelDataProvider
*/
public function testLevelIntToString(int $int, string $expected_string, bool $expect_exception = false): void
{
if ($expect_exception) {
$this->expectException(\InvalidArgumentException::class);
}
$this->assertSame($expected_string, AbstractLogEntry::levelIntToString($int));
}
/**
* @dataProvider levelDataProvider
*/
public function testLevelStringToInt(int $expected_int, string $string, bool $expect_exception = false): void
{
if ($expect_exception) {
$this->expectException(\InvalidArgumentException::class);
}
$this->assertSame($expected_int, AbstractLogEntry::levelStringToInt($string));
}
/**
* @dataProvider targetTypeDataProvider
*/