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