Skip to content

Commit a4abfc1

Browse files
authored
Use TypeSystem in AssertSameBooleanExpectedRule
1 parent 36cb9a6 commit a4abfc1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Rules/PHPUnit/data/assert-same-boolean-expected.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,26 @@ public function testNonLowercase(): void
7575
\PHPUnit\Framework\Assert::assertSame(False, 'foo');
7676
}
7777

78+
public function testMaybeTrueFalse(): void
79+
{
80+
$a = rand(0, 1) ? true : 'foo';
81+
\PHPUnit\Framework\Assert::assertSame($a, 'foo');
82+
$a = rand(0, 1) ? false : 'foo';
83+
\PHPUnit\Framework\Assert::assertSame($a, 'foo');
84+
}
85+
86+
public function testConstMaybeTrueFalse(): void
87+
{
88+
if (
89+
!defined('MY_TEST_CONST')
90+
) {
91+
return;
92+
}
93+
if (MY_TEST_CONST !== true && MY_TEST_CONST !== false) {
94+
return;
95+
}
96+
\PHPUnit\Framework\Assert::assertSame(MY_TEST_CONST, 'foo');
97+
}
7898
}
7999

80100
const PHPSTAN_PHPUNIT_TRUE = true;

0 commit comments

Comments
 (0)