11<?php
2+
23namespace CodeIgniter \Debug ;
34
45use CodeIgniter \Test \CIUnitTestCase ;
56
6- class TimerTest extends CIUnitTestCase
7+ final class TimerTest extends CIUnitTestCase
78{
8-
9- protected function setUp (): void
10- {
11- }
12-
13- //--------------------------------------------------------------------
14-
15- public function tearDown (): void
16- {
17- }
18-
19- //--------------------------------------------------------------------
20-
219 /**
2210 * We do most of our tests in this one method. While I usually frown
2311 * on this, it's handy here so that we don't stall the tests any
2412 * longer then needed.
13+ *
14+ * @timeLimit 1.5
2515 */
2616 public function testStoresTimers ()
2717 {
@@ -44,8 +34,9 @@ public function testStoresTimers()
4434 $ this ->assertGreaterThanOrEqual (1.0 , $ timers ['test1 ' ]['duration ' ]);
4535 }
4636
47- //--------------------------------------------------------------------
48-
37+ /**
38+ * @timeLimit 1.5
39+ */
4940 public function testAutoCalcsTimerEnd ()
5041 {
5142 $ timer = new Timer ();
@@ -59,8 +50,9 @@ public function testAutoCalcsTimerEnd()
5950 $ this ->assertGreaterThanOrEqual (1.0 , $ timers ['test1 ' ]['duration ' ]);
6051 }
6152
62- //--------------------------------------------------------------------
63-
53+ /**
54+ * @timeLimit 1.5
55+ */
6456 public function testElapsedTimeGivesSameResultAsTimersArray ()
6557 {
6658 $ timer = new Timer ();
@@ -76,8 +68,6 @@ public function testElapsedTimeGivesSameResultAsTimersArray()
7668 $ this ->assertEquals ($ expected , $ timer ->getElapsedTime ('test1 ' ));
7769 }
7870
79- //--------------------------------------------------------------------
80-
8171 public function testThrowsExceptionStoppingNonTimer ()
8272 {
8373 $ this ->expectException ('RunTimeException ' );
@@ -87,26 +77,23 @@ public function testThrowsExceptionStoppingNonTimer()
8777 $ timer ->stop ('test1 ' );
8878 }
8979
90- //--------------------------------------------------------------------
91-
9280 public function testLongExecutionTime ()
9381 {
9482 $ timer = new Timer ();
9583 $ timer ->start ('longjohn ' , strtotime ('-11 minutes ' ));
9684 $ this ->assertCloseEnough (11 * 60 , $ timer ->getElapsedTime ('longjohn ' ));
9785 }
9886
99- //--------------------------------------------------------------------
100-
10187 public function testLongExecutionTimeThroughCommonFunc ()
10288 {
10389 $ timer = new Timer ();
10490 $ timer ->start ('longjohn ' , strtotime ('-11 minutes ' ));
10591 $ this ->assertCloseEnough (11 * 60 , $ timer ->getElapsedTime ('longjohn ' ));
10692 }
10793
108- //--------------------------------------------------------------------
109-
94+ /**
95+ * @timeLimit 1.5
96+ */
11097 public function testCommonStartStop ()
11198 {
11299 timer ('test1 ' );
@@ -116,14 +103,10 @@ public function testCommonStartStop()
116103 $ this ->assertGreaterThanOrEqual (1.0 , timer ()->getElapsedTime ('test1 ' ));
117104 }
118105
119- //--------------------------------------------------------------------
120-
121106 public function testReturnsNullGettingElapsedTimeOfNonTimer ()
122107 {
123108 $ timer = new Timer ();
124109
125110 $ this ->assertNull ($ timer ->getElapsedTime ('test1 ' ));
126111 }
127-
128- //--------------------------------------------------------------------
129112}
0 commit comments