codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.4k stars 1.9k forks source link

`TimerTest::testLongExecutionTime` failed #6823

Closed kenjis closed 2 years ago

kenjis commented 2 years ago
 1) CodeIgniter\Debug\TimerTest::testLongExecutionTime
Failed asserting that 3600 is equal to 1 or is less than 1.

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/CIUnitTestCase.php:436
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Debug/TimerTest.php:98
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97

https://github.com/codeigniter4/CodeIgniter4/actions/runs/3402855272/jobs/5660114944

kenjis commented 2 years ago
        d(strtotime('-110 minutes')); // 1667713787
        d(strtotime('now'));          // 1667723987

1667723987 - 1667713787 = 10,200 (= 170 minutes) 110 * 60 = 6,600 10,200 - 6,600 = 3,600 (= 60 minutes)

This is likely due to daylight savings time. See #6818

kenjis commented 2 years ago

I do not know if this is a bug or not. But it is not intuitive that this test fails. https://github.com/codeigniter4/CodeIgniter4/blob/4a748b935e7594d2e7b1dedd6dab800dd3f96b1e/tests/system/Debug/TimerTest.php#L94-L99

paulbalandan commented 2 years ago

Fixed by #6826