#66 Add assertIsTrue/False()

open
nobody
5
2009-11-11
2009-11-11
David Harkness
No

I have many tests that need to check that the return value *really is* false without passing 0 or empty string. I'm sick of using

$this->assertIdentical(false, ...);

It works but is less elegant than

$this->assertIsFalse(...);

I admit up front that it may open people up to "false passes" when they forget and use assertFalse(), but you can do that already. If you accidentally use this new API when you mean assertFalse(), the worst that can happen is a "false fail" which you can easily fix.

The other option is to make assertTrue/False() use ===. This is what I would normally expect and had to dig to find out why my test was passing when it should have failed (was returning 0 for getIndex() but was expecting false for not found).

Discussion