. */ namespace App\Tests\Entity\LogSystem; use App\Entity\LogSystem\LogLevel; use PHPUnit\Framework\TestCase; class LogLevelTest extends TestCase { public function testToPSR3LevelString(): void { $this->assertSame('debug', LogLevel::DEBUG->toPSR3LevelString()); $this->assertSame('info', LogLevel::INFO->toPSR3LevelString()); $this->assertSame('notice', LogLevel::NOTICE->toPSR3LevelString()); $this->assertSame('warning', LogLevel::WARNING->toPSR3LevelString()); $this->assertSame('error', LogLevel::ERROR->toPSR3LevelString()); $this->assertSame('critical', LogLevel::CRITICAL->toPSR3LevelString()); $this->assertSame('alert', LogLevel::ALERT->toPSR3LevelString()); $this->assertSame('emergency', LogLevel::EMERGENCY->toPSR3LevelString()); } public function testFromPSR3LevelString(): void { $this->assertSame(LogLevel::DEBUG, LogLevel::fromPSR3LevelString('debug')); $this->assertSame(LogLevel::INFO, LogLevel::fromPSR3LevelString('info')); $this->assertSame(LogLevel::NOTICE, LogLevel::fromPSR3LevelString('notice')); $this->assertSame(LogLevel::WARNING, LogLevel::fromPSR3LevelString('warning')); $this->assertSame(LogLevel::ERROR, LogLevel::fromPSR3LevelString('error')); $this->assertSame(LogLevel::CRITICAL, LogLevel::fromPSR3LevelString('critical')); $this->assertSame(LogLevel::ALERT, LogLevel::fromPSR3LevelString('alert')); $this->assertSame(LogLevel::EMERGENCY, LogLevel::fromPSR3LevelString('emergency')); } public function testMoreImportOrEqualThan(): void { $this->assertTrue(LogLevel::DEBUG->moreImportOrEqualThan(LogLevel::DEBUG)); $this->assertFalse(LogLevel::DEBUG->moreImportOrEqualThan(LogLevel::INFO)); $this->assertFalse(LogLevel::DEBUG->moreImportOrEqualThan(LogLevel::NOTICE)); $this->assertTrue(LogLevel::EMERGENCY->moreImportOrEqualThan(LogLevel::DEBUG)); } public function testMoreImportThan(): void { $this->assertFalse(LogLevel::DEBUG->moreImportThan(LogLevel::DEBUG)); $this->assertFalse(LogLevel::DEBUG->moreImportThan(LogLevel::INFO)); $this->assertFalse(LogLevel::DEBUG->moreImportThan(LogLevel::NOTICE)); $this->assertTrue(LogLevel::EMERGENCY->moreImportThan(LogLevel::DEBUG)); } public function testLessImportThan(): void { $this->assertFalse(LogLevel::DEBUG->lessImportThan(LogLevel::DEBUG)); $this->assertTrue(LogLevel::DEBUG->lessImportThan(LogLevel::INFO)); $this->assertTrue(LogLevel::DEBUG->lessImportThan(LogLevel::NOTICE)); $this->assertFalse(LogLevel::EMERGENCY->lessImportThan(LogLevel::DEBUG)); } public function testLessImportOrEqualThan(): void { $this->assertTrue(LogLevel::DEBUG->lessImportOrEqualThan(LogLevel::DEBUG)); $this->assertTrue(LogLevel::DEBUG->lessImportOrEqualThan(LogLevel::INFO)); $this->assertTrue(LogLevel::DEBUG->lessImportOrEqualThan(LogLevel::NOTICE)); $this->assertFalse(LogLevel::EMERGENCY->lessImportOrEqualThan(LogLevel::DEBUG)); } }