3 namespace RedUNIT\Mysql;
5 use RedUNIT\Mysql as Mysql;
6 use RedBeanPHP\Facade as R;
11 * Tests whether double precision values are correctly stored and
14 * @file RedUNIT/Mysql/Double.php
15 * @desc Tests handling of double precision values.
16 * @author Gabor de Mooij and the RedBeanPHP Community
17 * @license New BSD/GPLv2
19 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
20 * This source file is subject to the New BSD/GPLv2 License that is bundled
21 * with this source code in the file license.txt.
23 class Double extends Mysql
26 * Test storage of doubles.
30 public function testDouble()
32 $toolbox = R::getToolBox();
33 $adapter = $toolbox->getDatabaseAdapter();
34 $writer = $toolbox->getWriter();
35 $redbean = $toolbox->getRedBean();
36 $pdo = $adapter->getDatabase();
37 $largeDouble = 999999888889999922211111; //8.88889999922211e+17;
38 $page = $redbean->dispense( "page" );
39 $page->weight = $largeDouble;
40 $id = $redbean->store( $page );
41 $cols = $writer->getColumns( 'page' );
42 asrt( $cols['weight'], 'double' );
43 $page = $redbean->load( 'page', $id );
44 $page->name = 'dont change the numbers!';
45 $redbean->store( $page );
46 $page = $redbean->load( 'page', $id );
47 $cols = $writer->getColumns( 'page' );
48 asrt( $cols['weight'], 'double' );