Skip to content

Commit cca2caf

Browse files
committed
Add tests proving equals() handles problematic values
1 parent 6f18cce commit cca2caf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/EnumTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,19 @@ public function testEquals()
227227
$this->assertFalse($foo->equals($number));
228228
$this->assertTrue($foo->equals($anotherFoo));
229229
}
230+
231+
/**
232+
* equals()
233+
*/
234+
public function testEqualsComparesProblematicValuesProperly()
235+
{
236+
$false = new EnumFixture(EnumFixture::PROBLEMATIC_BOOLEAN_FALSE);
237+
$emptyString = new EnumFixture(EnumFixture::PROBLEMATIC_EMPTY_STRING);
238+
$null = new EnumFixture(EnumFixture::PROBLEMATIC_NULL);
239+
240+
$this->assertTrue($false->equals($false));
241+
$this->assertFalse($false->equals($emptyString));
242+
$this->assertFalse($emptyString->equals($null));
243+
$this->assertFalse($null->equals($false));
244+
}
230245
}

0 commit comments

Comments
 (0)