diff --git a/tests/Rules/PHPUnit/data/assert-same-boolean-expected.php b/tests/Rules/PHPUnit/data/assert-same-boolean-expected.php index dccd2ceb..d6f7f14a 100644 --- a/tests/Rules/PHPUnit/data/assert-same-boolean-expected.php +++ b/tests/Rules/PHPUnit/data/assert-same-boolean-expected.php @@ -75,6 +75,26 @@ public function testNonLowercase(): void \PHPUnit\Framework\Assert::assertSame(False, 'foo'); } + public function testMaybeTrueFalse(): void + { + $a = rand(0, 1) ? true : 'foo'; + \PHPUnit\Framework\Assert::assertSame($a, 'foo'); + $a = rand(0, 1) ? false : 'foo'; + \PHPUnit\Framework\Assert::assertSame($a, 'foo'); + } + + public function testConstMaybeTrueFalse(): void + { + if ( + !defined('MY_TEST_CONST') + ) { + return; + } + if (MY_TEST_CONST !== true && MY_TEST_CONST !== false) { + return; + } + \PHPUnit\Framework\Assert::assertSame(MY_TEST_CONST, 'foo'); + } } const PHPSTAN_PHPUNIT_TRUE = true;