you could also put this into your bootstrap:
/**
* Can compare two float values
* @link http://php.net/manual/en/language.types.float.php
* @return boolean
*/
function isFloatEqual($x, $y, $precision = 0.001) {
return ($x+$precision >= $y) && ($x-$precision <= $y);
}
On 21 Dez.,
Comparing floats in PHP is super annoying, go to the line that is comparing
those 2 numbers and cast both values as string.
$this->assertEqual((string) $value1, (string) $value2);
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Qu
Those queries are generated by the fixtures in your app, those classes
generate fake model data in separate tables in order to test the features
safely. Although if you did not know about it, then those queries are being
run on your main database!! (with a table prefix in order to preserve the
One more thing, I noticed this just now. When running the tests, these are
the results that I have found.
- FAILED
Equal expectation fails with member [0] with member [0] with member
[floatvalue] at character 14 with [3.1415926535898] and [3.14159265358979]
at
[D:\Inetpub\wwwroot
I am going through unit test portion of the cookbook (I am using CakePHP
1.3), I go to the test.php page and click on the controller link there and
wait...
Then I see a page displayed with a slew of SQL at the bottom, which I
copied to show below:
http://bin.cakephp.org/view/2008902189
Why is tha