PHP Classes

File: vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Double.php

Recommend this page to a friend!
  Classes of Adrian M   upMVC   vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Double.php   Download  
File: vendor/gabordemooij/redbean/testing/RedUNIT/Mysql/Double.php
Role: Class source
Content type: text/plain
Description: Class source
Class: upMVC
Pure PHP web development without other frameworks
Author: By
Last change:
Date: 1 month ago
Size: 1,356 bytes
 

Contents

Class file image Download
<?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' );
    }
}