Skip to content

Commit 9a0ad26

Browse files
committed
PHP version specific test
1 parent 5512618 commit 9a0ad26

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/system/Debug/TimerTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use ArgumentCountError;
1515
use CodeIgniter\Test\CIUnitTestCase;
16+
use ErrorException;
1617
use RuntimeException;
1718

1819
/**
@@ -151,7 +152,7 @@ public function testRecordArrowFunction()
151152
$timer = new Timer();
152153
$returnValue = $timer->record('longjohn', static fn () => strlen('CI4'));
153154

154-
$this->assertLessThanOrEqual(1.0, $timer->getElapsedTime('longjohn'));
155+
$this->assertLessThan(0.1, $timer->getElapsedTime('longjohn'));
155156
$this->assertSame(3, $returnValue);
156157
}
157158

@@ -165,7 +166,11 @@ public function testRecordThrowsException()
165166

166167
public function testRecordThrowsErrorOnCallableWithParams()
167168
{
168-
$this->expectException(ArgumentCountError::class);
169+
if(version_compare(PHP_VERSION, '8.0.0') >= 0) {
170+
$this->expectException(ArgumentCountError::class);
171+
} else {
172+
$this->expectException(ErrorException::class);
173+
}
169174

170175
$timer = new Timer();
171176
$timer->record('error', 'strlen');

0 commit comments

Comments
 (0)