@@ 66-92 (lines=27) @@ | ||
63 | self::assertSame([':id' => \PDO::PARAM_INT], $log->context['types']); |
|
64 | } |
|
65 | ||
66 | public function testLogsDuration() |
|
67 | { |
|
68 | self::assertCount(0, $this->logger->records); |
|
69 | ||
70 | $this->sut->startQuery( |
|
71 | $this->sql, |
|
72 | [ |
|
73 | ':id' => 1234, |
|
74 | ], |
|
75 | [ |
|
76 | ':id' => \PDO::PARAM_INT, |
|
77 | ] |
|
78 | ); |
|
79 | ||
80 | $this->sut->stopQuery(); |
|
81 | ||
82 | self::assertCount(2, $this->logger->records); |
|
83 | ||
84 | $log = $this->getRecordByIndex(1); |
|
85 | ||
86 | self::assertSame(LogLevel::INFO, (string) $log->level); |
|
87 | self::assertSame('Query finished', (string) $log->message); |
|
88 | self::assertNotEmpty($log->context['query_id']); |
|
89 | self::assertIsFloat($log->context['start']); |
|
90 | self::assertIsFloat($log->context['stop']); |
|
91 | self::assertIsFloat($log->context['duration_s']); |
|
92 | } |
|
93 | ||
94 | public function testSharedQueryId() |
|
95 | { |
@@ 68-95 (lines=28) @@ | ||
65 | self::assertSame([':id' => \PDO::PARAM_INT], $log->context['types']); |
|
66 | } |
|
67 | ||
68 | public function testLogsDuration() |
|
69 | { |
|
70 | self::assertCount(0, $this->logger->records); |
|
71 | ||
72 | $this->sut->startQuery( |
|
73 | $this->sql, |
|
74 | [ |
|
75 | ':id' => 1234, |
|
76 | ], |
|
77 | [ |
|
78 | ':id' => \PDO::PARAM_INT, |
|
79 | ] |
|
80 | ); |
|
81 | ||
82 | $this->sut->stopQuery(); |
|
83 | ||
84 | self::assertCount(2, $this->logger->records); |
|
85 | ||
86 | $log = $this->getRecordByIndex(1); |
|
87 | ||
88 | self::assertInstanceOf(\stdClass::class, $log); |
|
89 | self::assertSame(LogLevel::INFO, (string) $log->level); |
|
90 | self::assertSame('Query finished', (string) $log->message); |
|
91 | self::assertNotEmpty($log->context['query_id']); |
|
92 | self::assertIsFloat($log->context['start']); |
|
93 | self::assertIsFloat($log->context['stop']); |
|
94 | self::assertIsFloat($log->context['duration_s']); |
|
95 | } |
|
96 | ||
97 | public function testSharedQueryId() |
|
98 | { |