mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-12-24 00:03:58 -06:00
Begin Refactor
This commit is contained in:
50
vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Double.php
vendored
Normal file
50
vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Double.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace RedUNIT\Mysql;
|
||||
|
||||
use RedUNIT\Mysql as Mysql;
|
||||
use RedBeanPHP\Facade as R;
|
||||
|
||||
/**
|
||||
* Double
|
||||
*
|
||||
* Tests whether double precision values are correctly stored and
|
||||
* preserved.
|
||||
*
|
||||
* @file RedUNIT/Mysql/Double.php
|
||||
* @desc Tests handling of double precision values.
|
||||
* @author Gabor de Mooij and the RedBeanPHP Community
|
||||
* @license New BSD/GPLv2
|
||||
*
|
||||
* (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
|
||||
* This source file is subject to the New BSD/GPLv2 License that is bundled
|
||||
* with this source code in the file license.txt.
|
||||
*/
|
||||
class Double extends Mysql
|
||||
{
|
||||
/**
|
||||
* Test storage of doubles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDouble()
|
||||
{
|
||||
$toolbox = R::getToolBox();
|
||||
$adapter = $toolbox->getDatabaseAdapter();
|
||||
$writer = $toolbox->getWriter();
|
||||
$redbean = $toolbox->getRedBean();
|
||||
$pdo = $adapter->getDatabase();
|
||||
$largeDouble = 999999888889999922211111; //8.88889999922211e+17;
|
||||
$page = $redbean->dispense( "page" );
|
||||
$page->weight = $largeDouble;
|
||||
$id = $redbean->store( $page );
|
||||
$cols = $writer->getColumns( 'page' );
|
||||
asrt( $cols['weight'], 'double' );
|
||||
$page = $redbean->load( 'page', $id );
|
||||
$page->name = 'dont change the numbers!';
|
||||
$redbean->store( $page );
|
||||
$page = $redbean->load( 'page', $id );
|
||||
$cols = $writer->getColumns( 'page' );
|
||||
asrt( $cols['weight'], 'double' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user