3 namespace RedUNIT\Base;
5 use RedUNIT\Base as Base;
6 use RedBeanPHP\Facade as R;
7 use RedBeanPHP\OODBBean as OODBBean;
12 * Tests whether we can use keywords as bean types and
13 * property names without running into security or stablity issues.
14 * RedBeanPHP should properly escape all bean types and properties
15 * so we may use whatever string we want.
17 * @file RedUNIT/Base/Keywords.php
18 * @desc Tests for possible keyword clashes.
19 * @author Gabor de Mooij and the RedBeanPHP Community
20 * @license New BSD/GPLv2
22 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
23 * This source file is subject to the New BSD/GPLv2 License that is bundled
24 * with this source code in the file license.txt.
26 class Keywords extends Base
29 * What drivers should be loaded for this test pack?
31 * CUBRID has inescapable keywords :/
35 public function getTargetDrivers()
37 return array( 'mysql', 'pgsql', 'sqlite' ); // CUBRID excluded for now.
41 * Test if RedBeanPHP can properly handle keywords.
45 public function testKeywords()
48 'anokeyword', 'znokeyword', 'group', 'drop',
49 'inner', 'join', 'select', 'table',
50 'int', 'cascade', 'float', 'call',
51 'in', 'status', 'order', 'limit',
52 'having', 'else', 'if', 'while',
55 foreach ( $keywords as $k ) {
57 $bean = R::dispense( $k );
59 $id = R::store( $bean );
60 $bean = R::load( $k, $id );
61 $bean2 = R::dispense( 'other' );
64 $bean->ownBean[] = $bean2;
65 $bean->sharedBean[] = $bean2;
66 $id = R::store( $bean );