mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-10 09:18:33 +01:00
Use a enum for level in LogEntries
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user