Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use constants instead of hardcoded values for PHP_INT_(MAX|MIN) to run tests successfully on 32/64-bit systems #1490

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions tests/phpunit/Mutator/Number/DecrementIntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
namespace Infection\Tests\Mutator\Number;

use Infection\Tests\Mutator\BaseMutatorTestCase;
use const PHP_INT_MIN;

final class DecrementIntegerTest extends BaseMutatorTestCase
{
Expand Down Expand Up @@ -507,11 +508,13 @@ public function mutationsProvider(): iterable
PHP
];

$minInt = PHP_INT_MIN;

yield 'It does not decrement min int' => [
<<<'PHP'
<<<"PHP"
<?php

if ($a === -9223372036854775808) {
if (1 === {$minInt}) {
echo 'bar';
}
PHP
Expand Down
11 changes: 7 additions & 4 deletions tests/phpunit/Mutator/Number/IncrementIntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
namespace Infection\Tests\Mutator\Number;

use Infection\Tests\Mutator\BaseMutatorTestCase;
use const PHP_INT_MAX;

final class IncrementIntegerTest extends BaseMutatorTestCase
{
Expand Down Expand Up @@ -242,17 +243,19 @@ public function mutationsProvider(): iterable
PHP
];

$maxInt = PHP_INT_MAX;

yield 'It does not increment max int' => [
<<<'PHP'
<<<"PHP"
<?php

random_int(10000000, 9223372036854775807);
random_int(10000000, {$maxInt});
PHP
,
<<<'PHP'
<<<"PHP"
<?php

random_int(10000001, 9223372036854775807);
random_int(10000001, {$maxInt});
PHP
];
}
Expand Down