|
@@ 65-79 (lines=15) @@
|
| 62 |
|
return (object) $record; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function testFallbackToDefaultLogLevel() : void |
| 66 |
|
{ |
| 67 |
|
$defaultLogLevel = LogLevel::CRITICAL; |
| 68 |
|
$psrSqlLoggerConfigurableLogLevels = new PsrSqlLoggerConfigurableLogLevels( |
| 69 |
|
$this->logger, |
| 70 |
|
new LogLevelConfiguration([]), |
| 71 |
|
$defaultLogLevel |
| 72 |
|
); |
| 73 |
|
|
| 74 |
|
$psrSqlLoggerConfigurableLogLevels->startQuery($this->sql); |
| 75 |
|
$psrSqlLoggerConfigurableLogLevels->stopQuery(); |
| 76 |
|
|
| 77 |
|
self::assertSame($defaultLogLevel, (string) $this->getRecordByIndex(0)->level); |
| 78 |
|
self::assertSame($defaultLogLevel, (string) $this->getRecordByIndex(1)->level); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
public function testFallbackToDefaultLogLevelWhenNoThresholdIsReached() : void |
| 82 |
|
{ |
|
@@ 81-97 (lines=17) @@
|
| 78 |
|
self::assertSame($defaultLogLevel, (string) $this->getRecordByIndex(1)->level); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
public function testFallbackToDefaultLogLevelWhenNoThresholdIsReached() : void |
| 82 |
|
{ |
| 83 |
|
$defaultLogLevel = LogLevel::DEBUG; |
| 84 |
|
$psrSqlLoggerConfigurableLogLevels = new PsrSqlLoggerConfigurableLogLevels( |
| 85 |
|
$this->logger, |
| 86 |
|
new LogLevelConfiguration([ |
| 87 |
|
LogLevel::CRITICAL => 1000 * 60, //Use a huge threshold of one minute which should never be reached |
| 88 |
|
]), |
| 89 |
|
$defaultLogLevel |
| 90 |
|
); |
| 91 |
|
|
| 92 |
|
$psrSqlLoggerConfigurableLogLevels->startQuery($this->sql); |
| 93 |
|
$psrSqlLoggerConfigurableLogLevels->stopQuery(); |
| 94 |
|
|
| 95 |
|
self::assertSame($defaultLogLevel, (string) $this->getRecordByIndex(0)->level); |
| 96 |
|
self::assertSame($defaultLogLevel, (string) $this->getRecordByIndex(1)->level); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
public function testInvalidConfiguration() : void |
| 100 |
|
{ |