Code: Select all
function testSomeQuery(){
// some db code here..
// get the result from the db
$result = $stmt->execute(); // this returns TRUE or FALSE
// by my mistake I assumed the above returned the amount of rows, so I tested for that
$this->assertEqual($result, '2'); // and this gives a green bar!
}
There's also the test method assertIdentical(), which is the one I should have used.
Thinking some more about it I realized that in PHP
Code: Select all
'2' == TRUE returns true
2 == TRUE returns true
2 === TRUE returns false
Still an easy mistake to make, isn't it?