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