Thursday, January 6, 2011

SimpleTest: assertEquals does not work with DateInterval objects! --psybear

After debugging for 2 hours or so, I finally found the problem why my
tests work (but shouldn't)...

$x = new DateInterval('P36Y');
$y = new DateInterval('P34Y');
$this->assertEqual($x, $y);

This passes (and it clearly shouldn't in my opinion)!

To prove:

debug($x);
debug($y);

results in:

app/tests/cases/libs/diensttage_calculator.test.php (line 96)

DateInterval Object
(
[y] => 36
[m] => 0
[d] => 0
[h] => 0
[i] => 0
[s] => 0
[invert] => 0
[days] =>
)


app/tests/cases/libs/diensttage_calculator.test.php (line 97)

DateInterval Object
(
[y] => 34
[m] => 0
[d] => 0
[h] => 0
[i] => 0
[s] => 0
[invert] => 0
[days] =>
)

This is *really* frustrating. Is this problem known??

Thanks,
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: