phpunit
phpunit copied to clipboard
assertNotEquals not type-safe
class NullTest extends PHPUnit_Framework_TestCase
{
public function testNullEqualsFalse()
{
$this->assertNotEquals(FALSE,NULL);
}
}
greg@debian:~$ phpunit NullTest.php PHPUnit 3.5.15 by Sebastian Bergmann. F Time: 0 seconds, Memory: 3.50Mb There was 1 failure: 1) NullTest::testNullEqualsFalse Failed asserting that <null> is not equal to <boolean:false>. /home/greg/NullTest.php:7 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
This should not fail.
@gregbair assertEquals does not use the strict comparison in PHPUnit. What you want to use in your case is assertNotSame
Yeah thats by design as @stof said :)