Yaffs site version 1.1
[yaffs-website] / vendor / gabordemooij / redbean / testing / RedUNIT / CUBRID / Writer.php
1 <?php
2 namespace RedUNIT\CUBRID;
3 use RedBeanPHP\Facade as R;
4 use \RedBeanPHP\QueryWriter\CUBRID as CUBRID;
5
6 /**
7  * Writer
8  *
9  * Tests for CUBRID Query Writer.
10  * This test class contains Query Writer specific tests.
11  * Use this class to add tests to test Query Writer specific
12  * behaviours, quirks and issues.
13  *
14  * @file    RedUNIT/CUBRID/Writer.php
15  * @desc    A collection of database specific writer functions.
16  * @author  Gabor de Mooij and the RedBeanPHP Community
17  * @license New BSD/GPLv2
18  *
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.
22  */
23 class Writer extends \RedUNIT\CUBRID
24 {
25         /**
26          * Test scanning and coding of values.
27          *
28          * @return void
29          */
30         public function testScanningAndCoding()
31         {
32                 $toolbox = R::getToolBox();
33                 $adapter = $toolbox->getDatabaseAdapter();
34                 $writer  = $toolbox->getWriter();
35                 $redbean = $toolbox->getRedBean();
36                 $pdo     = $adapter->getDatabase();
37
38                 $writer->createTable( "testtable" );
39
40                 $writer->addColumn( "testtable", "special", CUBRID::C_DATATYPE_SPECIAL_DATE );
41
42                 $cols = $writer->getColumns( "testtable" );
43
44                 asrt( $writer->code( $cols['special'], TRUE ), CUBRID::C_DATATYPE_SPECIAL_DATE );
45
46                 asrt( $writer->code( $cols['special'], FALSE ), CUBRID::C_DATATYPE_SPECIFIED );
47
48                 $writer->addColumn( "testtable", "special2", CUBRID::C_DATATYPE_SPECIAL_DATETIME );
49
50                 $cols = $writer->getColumns( "testtable" );
51
52                 asrt( $writer->code( $cols['special2'], TRUE ), CUBRID::C_DATATYPE_SPECIAL_DATETIME );
53
54                 asrt( $writer->code( $cols['special'], FALSE ), CUBRID::C_DATATYPE_SPECIFIED );
55
56         }
57
58 }