]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/database/Bug61885Test.php
Release 6.5.13
[Github/sugarcrm.git] / tests / include / database / Bug61885Test.php
1 <?php
2 /*********************************************************************************
3  * By installing or using this file, you are confirming on behalf of the entity
4  * subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
5  * the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
6  * http://www.sugarcrm.com/master-subscription-agreement
7  *
8  * If Company is not bound by the MSA, then by installing or using this file
9  * you are agreeing unconditionally that Company will be bound by the MSA and
10  * certifying that you have authority to bind Company accordingly.
11  *
12  * Copyright (C) 2004-2013 SugarCRM Inc.  All rights reserved.
13  ********************************************************************************/
14
15 require_once 'include/database/DBManagerFactory.php';
16
17 class Bug61885Test extends Sugar_PHPUnit_Framework_TestCase
18 {
19     /**
20      * DataProvider function for test
21      * @static
22      * @return array
23      */
24     public static function provideVarDefs()
25     {
26         $returnArray = array(
27             array(
28                 array(
29                     'name' => 'FOO',
30                     'type' => 'VARCHAR',
31                     'len' => '255',
32                 ),
33                 array(
34                     'name' => 'foo',
35                     'type' => 'varchar',
36                     'len' => '255',
37                 ),
38                 true,
39             ),
40             array(
41                 array(
42                     'name' => 'foo',
43                     'type' => 'varchar',
44                     'len' => '255',
45                 ),
46                 array(
47                     'name' => 'FOO',
48                     'type' => 'VARCHAR',
49                     'len' => '255',
50                 ),
51                 true,
52             ),
53             array(
54                 array(
55                     'name' => 'idx_ACCNT_id_del',
56                     'type' => 'index',
57                     'fields' => array('ID', 'deleted'),
58                 ),
59                 array(
60                     'name' => 'idx_accnt_id_del',
61                     'type' => 'index',
62                     'fields' => array('id', 'deleted'),
63                 ),
64                 true,
65             ),
66             array(
67                 array(
68                     'name' => 'idx_ACCNT_id_del',
69                     'type' => 'index',
70                     'fields' => array('ID', 'DELETED'),
71                 ),
72                 array(
73                     'name' => 'idx_accnt_id_del',
74                     'type' => 'index',
75                     'fields' => array('id', 'deleted'),
76                 ),
77                 true,
78             ),
79             array(
80                 array(
81                     'name' => 'idx_ACCNT_id_del',
82                     'type' => 'index',
83                     'fields' => array('IDxxx', 'DELETED'),
84                 ),
85                 array(
86                     'name' => 'idx_accnt_id_del',
87                     'type' => 'index',
88                     'fields' => array('id', 'deleted'),
89                 ),
90                 false,
91             ),
92             array(
93                 array(
94                     'name' => 'idx_ACCNT_id_del',
95                     'type' => 'index',
96                     'fields' => array('IDxxx', 'deletedxxx'),
97                 ),
98                 array(
99                     'name' => 'idx_accnt_id_del',
100                     'type' => 'index',
101                     'fields' => array('id', 'deleted'),
102                 ),
103                 false,
104             ),
105             array(
106                 array(
107                     'name' => 'idx_accnt_id_del',
108                     'type' => 'index',
109                     'fields' => array('id', 'deleted'),
110                 ),
111                 array(
112                     'name' => 'idx_ACCNT_id_del',
113                     'type' => 'index',
114                     'fields' => array('ID', 'DELETED'),
115                 ),
116                 true,
117             ),
118         );
119
120         return $returnArray;
121     }
122
123     /**
124      * @dataProvider provideVarDefs
125      * @group 61885
126      */
127     public function testCompareVarDefsNotCaseSensitive($fieldDef1, $fieldDef2, $expectedResult)
128     {
129         $DBManager = DBManagerFactory::getInstance();
130
131         if ($expectedResult)
132         {
133             $this->assertTrue($DBManager->compareVarDefs($fieldDef1, $fieldDef2));
134         }
135         else
136         {
137             $this->assertFalse($DBManager->compareVarDefs($fieldDef1, $fieldDef2));
138         }
139     }
140 }