Skip to content

Commit a11bdd9

Browse files
committed
Skip FactorTest edge cases on PHP 8.5
1 parent 872c9c4 commit a11bdd9

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/unit/Rules/FactorTest.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use function uniqid;
1919

2020
use const PHP_INT_MAX;
21+
use const PHP_VERSION_ID;
2122

2223
/**
2324
* @group rule
@@ -31,6 +32,32 @@
3132
*/
3233
final class FactorTest extends RuleTestCase
3334
{
35+
/**
36+
* Some edge cases emit E_DEPRECATED on PHP >= 8.5.
37+
*
38+
* @test
39+
*
40+
* @dataProvider providerForInvalidInputEdgeCases
41+
*/
42+
public function shouldFailOnInvalidInputEdgeCases(Factor $rule, mixed $input): void
43+
{
44+
if (PHP_VERSION_ID >= 80500) {
45+
$this->markTestSkipped('This test emits E_DEPRECATED on PHP >= 8.5');
46+
}
47+
48+
self::assertInvalidInput($rule, $input);
49+
}
50+
51+
/**
52+
* @return array<string, array{0:Factor, 1:mixed}>
53+
*/
54+
public static function providerForInvalidInputEdgeCases(): array
55+
{
56+
return [
57+
'mt_rand is not factor PHP_INT_MAX + 1' => [new Factor(mt_rand()), PHP_INT_MAX + 1],
58+
];
59+
}
60+
3461
/**
3562
* {@inheritDoc}
3663
*/
@@ -93,7 +120,6 @@ public static function providerForInvalidInput(): array
93120
'mt_rand is not factor 1.5' => [new Factor(mt_rand()), 1.5],
94121
'mt_rand is not factor -0.5' => [new Factor(mt_rand()), -0.5],
95122
'mt_rand is not factor -1.5' => [new Factor(mt_rand()), -1.5],
96-
'mt_rand is not factor PHP_INT_MAX + 1' => [new Factor(mt_rand()), PHP_INT_MAX + 1],
97123
'mt_rand is not factor calc' => [new Factor(mt_rand()), mt_rand(1, mt_getrandmax() - 1) / mt_getrandmax()],
98124
'mt_rand is not factor -calc' => [
99125
new Factor(mt_rand()),

0 commit comments

Comments
 (0)