Skip to content

Commit 64c15aa

Browse files
committed
PHPLIB-1577: Test for liberal numeric comparisons in Matches
1 parent c08b966 commit 64c15aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/UnifiedSpecTests/Constraint/MatchesTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public function testFlexibleNumericComparison(): void
3030
$this->assertResult(true, $c, ['x' => 1.0, 'y' => 1.0], 'Float instead of expected int matches');
3131
$this->assertResult(true, $c, ['x' => 1, 'y' => 1], 'Int instead of expected float matches');
3232
$this->assertResult(false, $c, ['x' => 'foo', 'y' => 1.0], 'Different type does not match');
33+
34+
/* Matches uses PHPUnit's comparators, which follow PHP behavior. This
35+
* is more liberal than the comparison logic called for by the unified
36+
* test format. This test can be removed when PHPLIB-1577 is addressed.
37+
*/
38+
$this->assertResult(true, $c, ['x' => '1.0', 'y' => '1'], 'Numeric strings may match ints and floats');
3339
}
3440

3541
public function testDoNotAllowExtraRootKeys(): void

0 commit comments

Comments
 (0)