Why PHPUnit test doesn't fail?
- by JohnM2
I have a test method which looks like that:
$row = $this->GetRowFromUserTable($id);
$this->asserLessThan(time(), time($row['last_update']));
When $row is null access to $row['last_update'] should trigger a NOTICE and this test should fail, but it doesn't.
This code fails on first assert, so I know $db_row is null (fixture is the same):
$row = $this->GetRowFromUserTable($id);
$this->asserNotNull($row);
$this->asserLessThan(time(), time($row['last_update']));
When I write this:
$row = $this->GetRowFromUserTable($id);
$this->assertEquals(E_ALL, error_reporting());
$this->asserLessThan(time(), time($row['last_update']));
it successes, so I am also sure that error_reproting is right and this situation must have something to do with PHPUnit.
I use PHPUnit 3.5.6
I read this question:
Can I make PHPUnit fail if the code throws a notice?
but the answer suggests to use newer version of PHPUnit, but that answer is from 2009, so it's not it.
EDIT: I use NetBeans IDE 6.9.1 to run my test.