File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -258,14 +258,14 @@ abstract class BaseConnection implements ConnectionInterface
258258 *
259259 * @var float
260260 */
261- protected $ connectTime ;
261+ protected $ connectTime = 0.0 ;
262262
263263 /**
264264 * How long it took to establish connection.
265265 *
266266 * @var float
267267 */
268- protected $ connectDuration ;
268+ protected $ connectDuration = 0.0 ;
269269
270270 /**
271271 * If true, no queries will actually be
Original file line number Diff line number Diff line change @@ -123,6 +123,16 @@ public function testStoresConnectionTimings()
123123 $ this ->assertGreaterThan (0.0 , $ db ->getConnectDuration ());
124124 }
125125
126+ /**
127+ * @see https://github.com/codeigniter4/CodeIgniter4/issues/5535
128+ */
129+ public function testStoresConnectionTimingsNotConnected ()
130+ {
131+ $ db = new MockConnection ($ this ->options );
132+
133+ $ this ->assertSame ('0.000000 ' , $ db ->getConnectDuration ());
134+ }
135+
126136 public function testMagicIssetTrue ()
127137 {
128138 $ db = new MockConnection ($ this ->options );
You can’t perform that action at this time.
0 commit comments