@@ -3,49 +3,49 @@ discard block |
||
3 | 3 | require_once 'modules/AOR_Charts/lib/pChart/pChart.php'; |
4 | 4 | class AOR_ChartTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAOR_Chart(){ |
|
6 | + public function testAOR_Chart(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aorChart = new AOR_Chart(); |
|
10 | - $this->assertInstanceOf('AOR_Chart',$aorChart); |
|
11 | - $this->assertInstanceOf('Basic',$aorChart); |
|
12 | - $this->assertInstanceOf('SugarBean',$aorChart); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aorChart = new AOR_Chart(); |
|
10 | + $this->assertInstanceOf('AOR_Chart',$aorChart); |
|
11 | + $this->assertInstanceOf('Basic',$aorChart); |
|
12 | + $this->assertInstanceOf('SugarBean',$aorChart); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOR_Charts', 'module_dir', $aorChart); |
|
15 | - $this->assertAttributeEquals('AOR_Chart', 'object_name', $aorChart); |
|
16 | - $this->assertAttributeEquals('aor_charts', 'table_name', $aorChart); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aorChart); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aorChart); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $aorChart); |
|
14 | + $this->assertAttributeEquals('AOR_Charts', 'module_dir', $aorChart); |
|
15 | + $this->assertAttributeEquals('AOR_Chart', 'object_name', $aorChart); |
|
16 | + $this->assertAttributeEquals('aor_charts', 'table_name', $aorChart); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aorChart); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aorChart); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $aorChart); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | public function testsave_lines(){ |
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aorChart = new AOR_Chart(); |
|
27 | + $aorChart = new AOR_Chart(); |
|
28 | 28 | |
29 | - //preset the required data |
|
30 | - $post = array(); |
|
31 | - $post['chartid'] = array('test'=>''); |
|
32 | - $post['charttitle'] = array('test'=>'test'); |
|
33 | - $post['charttype'] = array('test'=>'bar'); |
|
34 | - $post['chartx_field'] = array('test'=>'1'); |
|
35 | - $post['charty_field'] = array('test'=>'2'); |
|
29 | + //preset the required data |
|
30 | + $post = array(); |
|
31 | + $post['chartid'] = array('test'=>''); |
|
32 | + $post['charttitle'] = array('test'=>'test'); |
|
33 | + $post['charttype'] = array('test'=>'bar'); |
|
34 | + $post['chartx_field'] = array('test'=>'1'); |
|
35 | + $post['charty_field'] = array('test'=>'2'); |
|
36 | 36 | |
37 | - $postKey = "chart"; |
|
37 | + $postKey = "chart"; |
|
38 | 38 | |
39 | - $bean = new AOR_Report(); |
|
39 | + $bean = new AOR_Report(); |
|
40 | 40 | |
41 | - //execute the method and test if it works and does not throws an exception. |
|
42 | - try { |
|
43 | - $result = $aorChart->save_lines($post, $bean, $postKey); |
|
44 | - $this->assertTrue(true); |
|
45 | - } |
|
46 | - catch (Exception $e) { |
|
47 | - $this->fail(); |
|
48 | - } |
|
41 | + //execute the method and test if it works and does not throws an exception. |
|
42 | + try { |
|
43 | + $result = $aorChart->save_lines($post, $bean, $postKey); |
|
44 | + $this->assertTrue(true); |
|
45 | + } |
|
46 | + catch (Exception $e) { |
|
47 | + $this->fail(); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | 51 | } |
@@ -54,116 +54,116 @@ discard block |
||
54 | 54 | public function testbuildChartImageBar(){ |
55 | 55 | |
56 | 56 | |
57 | - $aorChart = new AOR_Chart(); |
|
57 | + $aorChart = new AOR_Chart(); |
|
58 | 58 | |
59 | - $chartData = new pData(); |
|
60 | - $chartData->addPoints(10,'data'); |
|
61 | - $chartData->addPoints(10,'Labels'); |
|
59 | + $chartData = new pData(); |
|
60 | + $chartData->addPoints(10,'data'); |
|
61 | + $chartData->addPoints(10,'Labels'); |
|
62 | 62 | |
63 | 63 | |
64 | - //execute with recordImageMap true and verify that the chartPicture is changed |
|
65 | - $chartPicture = new pImage(700,700,$chartData); |
|
66 | - $aorChart->buildChartImageBar($chartPicture,true); |
|
67 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
64 | + //execute with recordImageMap true and verify that the chartPicture is changed |
|
65 | + $chartPicture = new pImage(700,700,$chartData); |
|
66 | + $aorChart->buildChartImageBar($chartPicture,true); |
|
67 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
68 | 68 | |
69 | 69 | |
70 | - //execute with recordImageMap false and verify that the chartPicture is changed |
|
71 | - $chartPicture = new pImage(700,700,$chartData); |
|
72 | - $aorChart->buildChartImageBar($chartPicture,false); |
|
73 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
70 | + //execute with recordImageMap false and verify that the chartPicture is changed |
|
71 | + $chartPicture = new pImage(700,700,$chartData); |
|
72 | + $aorChart->buildChartImageBar($chartPicture,false); |
|
73 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
74 | 74 | |
75 | - unset($chartData); |
|
76 | - unset($chartPicture); |
|
75 | + unset($chartData); |
|
76 | + unset($chartPicture); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function testbuildChartImagePie(){ |
80 | 80 | |
81 | 81 | |
82 | - $aorChart = new AOR_Chart(); |
|
82 | + $aorChart = new AOR_Chart(); |
|
83 | 83 | |
84 | - $chartData = new pData(); |
|
85 | - $chartData->addPoints(10,'data'); |
|
86 | - $chartData->addPoints(10,'Labels'); |
|
84 | + $chartData = new pData(); |
|
85 | + $chartData->addPoints(10,'data'); |
|
86 | + $chartData->addPoints(10,'Labels'); |
|
87 | 87 | |
88 | 88 | |
89 | - //execute with recordImageMap false and verify that the chartPicture is changed |
|
90 | - $chartPicture = new pImage(700,700,$chartData); |
|
91 | - $aorChart->buildChartImagePie($chartPicture,$chartData,array(array('x'=>10), array('x'=>20)),700, 700, 'x',false); |
|
92 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
89 | + //execute with recordImageMap false and verify that the chartPicture is changed |
|
90 | + $chartPicture = new pImage(700,700,$chartData); |
|
91 | + $aorChart->buildChartImagePie($chartPicture,$chartData,array(array('x'=>10), array('x'=>20)),700, 700, 'x',false); |
|
92 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
93 | 93 | |
94 | 94 | |
95 | - //execute with recordImageMap true and verify that the chartPicture is changed |
|
96 | - $chartPicture = new pImage(700,700,$chartData); |
|
97 | - $aorChart->buildChartImagePie($chartPicture,$chartData,array(array('x'=>10), array('x'=>20)),700, 700, 'x',true); |
|
98 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
95 | + //execute with recordImageMap true and verify that the chartPicture is changed |
|
96 | + $chartPicture = new pImage(700,700,$chartData); |
|
97 | + $aorChart->buildChartImagePie($chartPicture,$chartData,array(array('x'=>10), array('x'=>20)),700, 700, 'x',true); |
|
98 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
99 | 99 | |
100 | - unset($chartData); |
|
101 | - unset($chartPicture); |
|
100 | + unset($chartData); |
|
101 | + unset($chartPicture); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
105 | 105 | public function testbuildChartImageLine(){ |
106 | 106 | |
107 | - $aorChart = new AOR_Chart(); |
|
107 | + $aorChart = new AOR_Chart(); |
|
108 | 108 | |
109 | - $chartData = new pData(); |
|
110 | - $chartData->addPoints(10,'data'); |
|
111 | - $chartData->addPoints(10,'Labels'); |
|
109 | + $chartData = new pData(); |
|
110 | + $chartData->addPoints(10,'data'); |
|
111 | + $chartData->addPoints(10,'Labels'); |
|
112 | 112 | |
113 | 113 | |
114 | - //execute with recordImageMap true and verify that the chartPicture is changed |
|
115 | - $chartPicture = new pImage(700,700,$chartData); |
|
116 | - $aorChart->buildChartImageLine($chartPicture,true); |
|
117 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
114 | + //execute with recordImageMap true and verify that the chartPicture is changed |
|
115 | + $chartPicture = new pImage(700,700,$chartData); |
|
116 | + $aorChart->buildChartImageLine($chartPicture,true); |
|
117 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
118 | 118 | |
119 | - //execute with recordImageMap false and verify that the chartPicture is changed |
|
120 | - $chartPicture = new pImage(700,700,$chartData); |
|
121 | - $aorChart->buildChartImageLine($chartPicture,false); |
|
122 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
119 | + //execute with recordImageMap false and verify that the chartPicture is changed |
|
120 | + $chartPicture = new pImage(700,700,$chartData); |
|
121 | + $aorChart->buildChartImageLine($chartPicture,false); |
|
122 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
123 | 123 | |
124 | 124 | |
125 | - unset($chartData); |
|
126 | - unset($chartPicture); |
|
125 | + unset($chartData); |
|
126 | + unset($chartPicture); |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | public function testbuildChartImageRadar(){ |
131 | 131 | |
132 | 132 | |
133 | - $aorChart = new AOR_Chart(); |
|
133 | + $aorChart = new AOR_Chart(); |
|
134 | 134 | |
135 | - //preset the required objects and properties |
|
136 | - $chartData = new pData(); |
|
137 | - $chartData->loadPalette("modules/AOR_Charts/lib/pChart/palettes/navy.color", TRUE); |
|
138 | - $chartData->addPoints(10,'data'); |
|
139 | - $chartData->addPoints('10','Labels'); |
|
140 | - $chartData->addPoints(120,'data'); |
|
141 | - $chartData->addPoints('120','Labels'); |
|
135 | + //preset the required objects and properties |
|
136 | + $chartData = new pData(); |
|
137 | + $chartData->loadPalette("modules/AOR_Charts/lib/pChart/palettes/navy.color", TRUE); |
|
138 | + $chartData->addPoints(10,'data'); |
|
139 | + $chartData->addPoints('10','Labels'); |
|
140 | + $chartData->addPoints(120,'data'); |
|
141 | + $chartData->addPoints('120','Labels'); |
|
142 | 142 | |
143 | - $chartData->setSerieDescription("Months","Month"); |
|
144 | - $chartData->setAbscissa("Labels"); |
|
143 | + $chartData->setSerieDescription("Months","Month"); |
|
144 | + $chartData->setAbscissa("Labels"); |
|
145 | 145 | |
146 | - $imageWidth = 700; |
|
147 | - $imageHeight = 700; |
|
146 | + $imageWidth = 700; |
|
147 | + $imageHeight = 700; |
|
148 | 148 | |
149 | 149 | |
150 | - //execute with recordImageMap true and verify that the chartPicture is changed |
|
151 | - $chartPicture = new pImage($imageWidth,$imageHeight,$chartData); |
|
152 | - $chartPicture->setGraphArea(60,60,$imageWidth-60,$imageHeight-100); |
|
153 | - $aorChart->buildChartImageRadar($chartPicture,$chartData,true); |
|
154 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
150 | + //execute with recordImageMap true and verify that the chartPicture is changed |
|
151 | + $chartPicture = new pImage($imageWidth,$imageHeight,$chartData); |
|
152 | + $chartPicture->setGraphArea(60,60,$imageWidth-60,$imageHeight-100); |
|
153 | + $aorChart->buildChartImageRadar($chartPicture,$chartData,true); |
|
154 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
155 | 155 | |
156 | 156 | |
157 | 157 | |
158 | - //execute with recordImageMap false and verify that the chartPicture is changed |
|
159 | - $chartPicture = new pImage(700,700,$chartData); |
|
160 | - $chartPicture->setGraphArea(60,60,$imageWidth-60,$imageHeight-100); |
|
161 | - $aorChart->buildChartImageRadar($chartPicture,$chartData,false); |
|
162 | - $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
158 | + //execute with recordImageMap false and verify that the chartPicture is changed |
|
159 | + $chartPicture = new pImage(700,700,$chartData); |
|
160 | + $chartPicture->setGraphArea(60,60,$imageWidth-60,$imageHeight-100); |
|
161 | + $aorChart->buildChartImageRadar($chartPicture,$chartData,false); |
|
162 | + $this->assertNotEquals($chartPicture, new pImage(700,700,$chartData) ); |
|
163 | 163 | |
164 | 164 | |
165 | - unset($chartData); |
|
166 | - unset($chartPicture); |
|
165 | + unset($chartData); |
|
166 | + unset($chartPicture); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -171,74 +171,74 @@ discard block |
||
171 | 171 | |
172 | 172 | $this->markTestSkipped("Skipping testing chart image"); |
173 | 173 | |
174 | - global $current_user; |
|
174 | + global $current_user; |
|
175 | 175 | |
176 | - $current_user->id = "1"; |
|
176 | + $current_user->id = "1"; |
|
177 | 177 | |
178 | - $aorChart = new AOR_Chart(); |
|
178 | + $aorChart = new AOR_Chart(); |
|
179 | 179 | |
180 | - //preset the required objects and properties |
|
180 | + //preset the required objects and properties |
|
181 | 181 | |
182 | - $aorChart->x_field = 'x'; |
|
183 | - $aorChart->y_field = 'y'; |
|
182 | + $aorChart->x_field = 'x'; |
|
183 | + $aorChart->y_field = 'y'; |
|
184 | 184 | |
185 | - $fields = Array(); |
|
186 | - $fields['x'] = json_decode('{"label": "x"}'); |
|
187 | - $fields['y'] = json_decode('{"label": "y"}'); |
|
185 | + $fields = Array(); |
|
186 | + $fields['x'] = json_decode('{"label": "x"}'); |
|
187 | + $fields['y'] = json_decode('{"label": "y"}'); |
|
188 | 188 | |
189 | - $reportData = array(array('xx'=>10,'yy'=>10), array('xx'=>20, 'yy'=>20)); |
|
189 | + $reportData = array(array('xx'=>10,'yy'=>10), array('xx'=>20, 'yy'=>20)); |
|
190 | 190 | |
191 | - //execute the method and verify it returns expected results |
|
192 | - $aorChart->type = 'bar'; |
|
193 | - $result = $aorChart->buildChartImage($reportData, $fields); |
|
194 | - $this->assertEquals('data:image/png;base64,',$result); |
|
191 | + //execute the method and verify it returns expected results |
|
192 | + $aorChart->type = 'bar'; |
|
193 | + $result = $aorChart->buildChartImage($reportData, $fields); |
|
194 | + $this->assertEquals('data:image/png;base64,',$result); |
|
195 | 195 | |
196 | 196 | |
197 | - //execute the method and verify it returns expected results |
|
198 | - $aorChart->type = 'Line'; |
|
199 | - $result = $aorChart->buildChartImage($reportData, $fields); |
|
200 | - $this->assertEquals('',$result); |
|
197 | + //execute the method and verify it returns expected results |
|
198 | + $aorChart->type = 'Line'; |
|
199 | + $result = $aorChart->buildChartImage($reportData, $fields); |
|
200 | + $this->assertEquals('',$result); |
|
201 | 201 | |
202 | 202 | |
203 | - //execute the method and verify it returns expected results |
|
204 | - $aorChart->type = 'pie'; |
|
205 | - $result = $aorChart->buildChartImage($reportData, $fields); |
|
206 | - $this->assertEquals('data:image/png;base64,',$result); |
|
203 | + //execute the method and verify it returns expected results |
|
204 | + $aorChart->type = 'pie'; |
|
205 | + $result = $aorChart->buildChartImage($reportData, $fields); |
|
206 | + $this->assertEquals('data:image/png;base64,',$result); |
|
207 | 207 | |
208 | 208 | |
209 | - //execute the method and verify it returns expected results |
|
210 | - $aorChart->type = 'radar'; |
|
211 | - $result = $aorChart->buildChartImage($reportData, $fields,true); |
|
212 | - $this->assertEquals('data:image/png;base64,',$result); |
|
209 | + //execute the method and verify it returns expected results |
|
210 | + $aorChart->type = 'radar'; |
|
211 | + $result = $aorChart->buildChartImage($reportData, $fields,true); |
|
212 | + $this->assertEquals('data:image/png;base64,',$result); |
|
213 | 213 | |
214 | 214 | |
215 | 215 | } |
216 | 216 | |
217 | 217 | public function testbuildChartHTML(){ |
218 | 218 | $this->markTestSkipped("Skipping testing chart HTML"); |
219 | - $aorChart = new AOR_Chart(); |
|
219 | + $aorChart = new AOR_Chart(); |
|
220 | 220 | |
221 | - //preset the required objects and properties |
|
222 | - $aorChart->x_field = 'x'; |
|
223 | - $aorChart->y_field = 'y'; |
|
221 | + //preset the required objects and properties |
|
222 | + $aorChart->x_field = 'x'; |
|
223 | + $aorChart->y_field = 'y'; |
|
224 | 224 | |
225 | - $fields = Array(); |
|
226 | - $fields['x'] = json_decode('{"label": "x"}'); |
|
227 | - $fields['y'] = json_decode('{"label": "y"}'); |
|
225 | + $fields = Array(); |
|
226 | + $fields['x'] = json_decode('{"label": "x"}'); |
|
227 | + $fields['y'] = json_decode('{"label": "y"}'); |
|
228 | 228 | |
229 | - $reportData = array(array('xx'=>10,'yy'=>10), array('xx'=>20, 'yy'=>20)); |
|
229 | + $reportData = array(array('xx'=>10,'yy'=>10), array('xx'=>20, 'yy'=>20)); |
|
230 | 230 | |
231 | - $aorChart->type = 'bar'; |
|
231 | + $aorChart->type = 'bar'; |
|
232 | 232 | |
233 | - //test with type CHART_TYPE_PCHART and verify it returns expected results |
|
234 | - $expected = "<img id='_img' src='data:image/png;base64,'><script>\nSUGAR.util.doWhen(\"typeof addImage != 'undefined'\", function(){\n addImage('_img','_img_map','index.php?module=AOR_Charts&action=getImageMap&to_pdf=1&imageMapId=0');\n});\n</script>"; |
|
235 | - $result = $aorChart->buildChartHTML($reportData, $fields); |
|
236 | - $this->assertSame($expected, $result); |
|
233 | + //test with type CHART_TYPE_PCHART and verify it returns expected results |
|
234 | + $expected = "<img id='_img' src='data:image/png;base64,'><script>\nSUGAR.util.doWhen(\"typeof addImage != 'undefined'\", function(){\n addImage('_img','_img_map','index.php?module=AOR_Charts&action=getImageMap&to_pdf=1&imageMapId=0');\n});\n</script>"; |
|
235 | + $result = $aorChart->buildChartHTML($reportData, $fields); |
|
236 | + $this->assertSame($expected, $result); |
|
237 | 237 | |
238 | - //test with type CHART_TYPE_CHARTJS verify it returns expected results |
|
239 | - $expected = "<h3></h3><canvas id='chart' width='400' height='400'></canvas> <script>\n \$(document).ready(function(){\n SUGAR.util.doWhen(\"typeof Chart != 'undefined'\", function(){\n var data = {\"labels\":[\"10 [a]\",\"20 [e]\"],\"datasets\":[{\"fillColor\":\"rgba(151,187,205,0.2)\",\"strokeColor\":\"rgba(151,187,205,1)\",\"pointColor\":\"rgba(151,187,205,1)\",\"pointStrokeColor\":\"#fff\",\"pointHighlightFill\":\"#fff\",\"pointHighlightStroke\":\"rgba(151,187,205,1)4\",\"data\":[10,20]}]};\n var ctx = document.getElementById(\"chart\").getContext(\"2d\");\n console.log('Creating new chart');\n var config = [];\n var chart = new Chart(ctx).Bar(data, config);\n var legend = chart.generateLegend();\n $('#chart').after(legend);\n });\n });\n </script>" ; |
|
240 | - $result = $aorChart->buildChartHTML($reportData, $fields,0, AOR_Report::CHART_TYPE_CHARTJS); |
|
241 | - $this->assertSame($expected, $result); |
|
238 | + //test with type CHART_TYPE_CHARTJS verify it returns expected results |
|
239 | + $expected = "<h3></h3><canvas id='chart' width='400' height='400'></canvas> <script>\n \$(document).ready(function(){\n SUGAR.util.doWhen(\"typeof Chart != 'undefined'\", function(){\n var data = {\"labels\":[\"10 [a]\",\"20 [e]\"],\"datasets\":[{\"fillColor\":\"rgba(151,187,205,0.2)\",\"strokeColor\":\"rgba(151,187,205,1)\",\"pointColor\":\"rgba(151,187,205,1)\",\"pointStrokeColor\":\"#fff\",\"pointHighlightFill\":\"#fff\",\"pointHighlightStroke\":\"rgba(151,187,205,1)4\",\"data\":[10,20]}]};\n var ctx = document.getElementById(\"chart\").getContext(\"2d\");\n console.log('Creating new chart');\n var config = [];\n var chart = new Chart(ctx).Bar(data, config);\n var legend = chart.generateLegend();\n $('#chart').after(legend);\n });\n });\n </script>" ; |
|
240 | + $result = $aorChart->buildChartHTML($reportData, $fields,0, AOR_Report::CHART_TYPE_CHARTJS); |
|
241 | + $this->assertSame($expected, $result); |
|
242 | 242 | |
243 | 243 | |
244 | 244 | } |
@@ -4,282 +4,282 @@ |
||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | - public function testRelationship() { |
|
7 | + public function testRelationship() { |
|
8 | 8 | |
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $relationship = new Relationship(); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $relationship = new Relationship(); |
|
12 | 12 | |
13 | - $this->assertInstanceOf('Relationship',$relationship); |
|
14 | - $this->assertInstanceOf('SugarBean',$relationship); |
|
13 | + $this->assertInstanceOf('Relationship',$relationship); |
|
14 | + $this->assertInstanceOf('SugarBean',$relationship); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('Relationships', 'module_dir', $relationship); |
|
17 | - $this->assertAttributeEquals('Relationship', 'object_name', $relationship); |
|
18 | - $this->assertAttributeEquals('relationships', 'table_name', $relationship); |
|
16 | + $this->assertAttributeEquals('Relationships', 'module_dir', $relationship); |
|
17 | + $this->assertAttributeEquals('Relationship', 'object_name', $relationship); |
|
18 | + $this->assertAttributeEquals('relationships', 'table_name', $relationship); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $relationship); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $relationship); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - public function testis_self_referencing() { |
|
25 | + public function testis_self_referencing() { |
|
26 | 26 | |
27 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
28 | - global $db; |
|
29 | - unset ($db->database); |
|
30 | - $db->checkConnection(); |
|
27 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
28 | + global $db; |
|
29 | + unset ($db->database); |
|
30 | + $db->checkConnection(); |
|
31 | 31 | |
32 | - //test without setting any attributes |
|
33 | - $relationship = new Relationship(); |
|
32 | + //test without setting any attributes |
|
33 | + $relationship = new Relationship(); |
|
34 | 34 | |
35 | - $result = $relationship->is_self_referencing(); |
|
36 | - $this->assertEquals(true, $result); |
|
35 | + $result = $relationship->is_self_referencing(); |
|
36 | + $this->assertEquals(true, $result); |
|
37 | 37 | |
38 | 38 | |
39 | - //test with attributes set to different values |
|
40 | - $relationship = new Relationship(); |
|
39 | + //test with attributes set to different values |
|
40 | + $relationship = new Relationship(); |
|
41 | 41 | |
42 | - $relationship->lhs_table = "lhs_table"; |
|
43 | - $relationship->rhs_table = "rhs_table"; |
|
44 | - $relationship->lhs_key = "lhs_key"; |
|
45 | - $relationship->rhs_key = "rhs_key"; |
|
42 | + $relationship->lhs_table = "lhs_table"; |
|
43 | + $relationship->rhs_table = "rhs_table"; |
|
44 | + $relationship->lhs_key = "lhs_key"; |
|
45 | + $relationship->rhs_key = "rhs_key"; |
|
46 | 46 | |
47 | - $result = $relationship->is_self_referencing(); |
|
48 | - $this->assertEquals(false, $result); |
|
47 | + $result = $relationship->is_self_referencing(); |
|
48 | + $this->assertEquals(false, $result); |
|
49 | 49 | |
50 | 50 | |
51 | - //test with attributes set to same values |
|
52 | - $relationship = new Relationship(); |
|
51 | + //test with attributes set to same values |
|
52 | + $relationship = new Relationship(); |
|
53 | 53 | |
54 | - $relationship->lhs_table = "table"; |
|
55 | - $relationship->rhs_table = "table"; |
|
56 | - $relationship->lhs_key = "key"; |
|
57 | - $relationship->rhs_key = "key"; |
|
54 | + $relationship->lhs_table = "table"; |
|
55 | + $relationship->rhs_table = "table"; |
|
56 | + $relationship->lhs_key = "key"; |
|
57 | + $relationship->rhs_key = "key"; |
|
58 | 58 | |
59 | - $result = $relationship->is_self_referencing(); |
|
60 | - $this->assertEquals(true, $result); |
|
59 | + $result = $relationship->is_self_referencing(); |
|
60 | + $this->assertEquals(true, $result); |
|
61 | 61 | |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - public function testexists() { |
|
65 | + public function testexists() { |
|
66 | 66 | |
67 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
68 | - global $db; |
|
69 | - unset ($db->database); |
|
70 | - $db->checkConnection(); |
|
67 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
68 | + global $db; |
|
69 | + unset ($db->database); |
|
70 | + $db->checkConnection(); |
|
71 | 71 | |
72 | 72 | |
73 | - $relationship = new Relationship(); |
|
73 | + $relationship = new Relationship(); |
|
74 | 74 | |
75 | - //test with invalid relationship |
|
76 | - $result = $relationship->exists("test_test", $db); |
|
77 | - $this->assertEquals(false, $result); |
|
75 | + //test with invalid relationship |
|
76 | + $result = $relationship->exists("test_test", $db); |
|
77 | + $this->assertEquals(false, $result); |
|
78 | 78 | |
79 | - //test with valid relationship |
|
80 | - $result = $relationship->exists("roles_users", $db); |
|
81 | - $this->assertEquals(true, $result); |
|
79 | + //test with valid relationship |
|
80 | + $result = $relationship->exists("roles_users", $db); |
|
81 | + $this->assertEquals(true, $result); |
|
82 | 82 | |
83 | 83 | |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - public function testdelete() { |
|
86 | + public function testdelete() { |
|
87 | 87 | |
88 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
89 | - global $db; |
|
90 | - unset ($db->database); |
|
91 | - $db->checkConnection(); |
|
88 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
89 | + global $db; |
|
90 | + unset ($db->database); |
|
91 | + $db->checkConnection(); |
|
92 | 92 | |
93 | - //execute the method and test if it works and does not throws an exception. |
|
94 | - try { |
|
95 | - Relationship::delete("test_test", $db); |
|
96 | - $this->assertTrue(true); |
|
97 | - } |
|
98 | - catch (Exception $e) { |
|
99 | - $this->fail(); |
|
100 | - } |
|
93 | + //execute the method and test if it works and does not throws an exception. |
|
94 | + try { |
|
95 | + Relationship::delete("test_test", $db); |
|
96 | + $this->assertTrue(true); |
|
97 | + } |
|
98 | + catch (Exception $e) { |
|
99 | + $this->fail(); |
|
100 | + } |
|
101 | 101 | |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | - public function testget_other_module(){ |
|
105 | + public function testget_other_module(){ |
|
106 | 106 | |
107 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
108 | - global $db; |
|
109 | - unset ($db->database); |
|
110 | - $db->checkConnection(); |
|
107 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
108 | + global $db; |
|
109 | + unset ($db->database); |
|
110 | + $db->checkConnection(); |
|
111 | 111 | |
112 | - $relationship = new Relationship(); |
|
112 | + $relationship = new Relationship(); |
|
113 | 113 | |
114 | - //test with invalid relationship |
|
115 | - $result = $relationship->get_other_module("test_test", "test", $db); |
|
116 | - $this->assertEquals(false, $result); |
|
114 | + //test with invalid relationship |
|
115 | + $result = $relationship->get_other_module("test_test", "test", $db); |
|
116 | + $this->assertEquals(false, $result); |
|
117 | 117 | |
118 | - //test with valid relationship |
|
119 | - $result = $relationship->get_other_module("roles_users", "Roles",$db); |
|
120 | - $this->assertEquals("Users", $result); |
|
118 | + //test with valid relationship |
|
119 | + $result = $relationship->get_other_module("roles_users", "Roles",$db); |
|
120 | + $this->assertEquals("Users", $result); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - public function testretrieve_by_sides(){ |
|
124 | + public function testretrieve_by_sides(){ |
|
125 | 125 | |
126 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
127 | - global $db; |
|
128 | - unset ($db->database); |
|
129 | - $db->checkConnection(); |
|
126 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
127 | + global $db; |
|
128 | + unset ($db->database); |
|
129 | + $db->checkConnection(); |
|
130 | 130 | |
131 | - $relationship = new Relationship(); |
|
131 | + $relationship = new Relationship(); |
|
132 | 132 | |
133 | 133 | |
134 | - //test with invalid relationship |
|
135 | - $result = $relationship->retrieve_by_sides("test1", "test2", $db); |
|
136 | - $this->assertEquals(null, $result); |
|
134 | + //test with invalid relationship |
|
135 | + $result = $relationship->retrieve_by_sides("test1", "test2", $db); |
|
136 | + $this->assertEquals(null, $result); |
|
137 | 137 | |
138 | 138 | |
139 | - //test with valid relationship |
|
140 | - $result = $relationship->retrieve_by_sides("Roles", "Users", $db); |
|
139 | + //test with valid relationship |
|
140 | + $result = $relationship->retrieve_by_sides("Roles", "Users", $db); |
|
141 | 141 | |
142 | - $this->assertEquals("Users", $result['rhs_module']); |
|
143 | - $this->assertEquals("Roles", $result['lhs_module']); |
|
142 | + $this->assertEquals("Users", $result['rhs_module']); |
|
143 | + $this->assertEquals("Roles", $result['lhs_module']); |
|
144 | 144 | |
145 | - $this->assertEquals("id", $result['rhs_key']); |
|
146 | - $this->assertEquals("id", $result['lhs_key']); |
|
145 | + $this->assertEquals("id", $result['rhs_key']); |
|
146 | + $this->assertEquals("id", $result['lhs_key']); |
|
147 | 147 | |
148 | - $this->assertEquals("many-to-many", $result['relationship_type']); |
|
148 | + $this->assertEquals("many-to-many", $result['relationship_type']); |
|
149 | 149 | |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | - public function testretrieve_by_modules(){ |
|
152 | + public function testretrieve_by_modules(){ |
|
153 | 153 | |
154 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
155 | - global $db; |
|
156 | - unset ($db->database); |
|
157 | - $db->checkConnection(); |
|
154 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
155 | + global $db; |
|
156 | + unset ($db->database); |
|
157 | + $db->checkConnection(); |
|
158 | 158 | |
159 | - $relationship = new Relationship(); |
|
159 | + $relationship = new Relationship(); |
|
160 | 160 | |
161 | 161 | |
162 | - //test with invalid relationship |
|
163 | - $result = $relationship->retrieve_by_modules("test1", "test2", $db); |
|
164 | - $this->assertEquals(null, $result); |
|
162 | + //test with invalid relationship |
|
163 | + $result = $relationship->retrieve_by_modules("test1", "test2", $db); |
|
164 | + $this->assertEquals(null, $result); |
|
165 | 165 | |
166 | 166 | |
167 | - //test with valid relationship but incorecct type |
|
168 | - $result = $relationship->retrieve_by_modules("Roles", "Users", $db, 'one-to-many'); |
|
169 | - $this->assertEquals(null, $result); |
|
167 | + //test with valid relationship but incorecct type |
|
168 | + $result = $relationship->retrieve_by_modules("Roles", "Users", $db, 'one-to-many'); |
|
169 | + $this->assertEquals(null, $result); |
|
170 | 170 | |
171 | 171 | |
172 | - //test with valid relationship and valid type |
|
173 | - $result = $relationship->retrieve_by_modules("Roles", "Users", $db, 'many-to-many'); |
|
174 | - $this->assertEquals("roles_users", $result); |
|
172 | + //test with valid relationship and valid type |
|
173 | + $result = $relationship->retrieve_by_modules("Roles", "Users", $db, 'many-to-many'); |
|
174 | + $this->assertEquals("roles_users", $result); |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - public function testretrieve_by_name() { |
|
179 | + public function testretrieve_by_name() { |
|
180 | 180 | |
181 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
182 | - global $db; |
|
183 | - unset ($db->database); |
|
184 | - $db->checkConnection(); |
|
181 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
182 | + global $db; |
|
183 | + unset ($db->database); |
|
184 | + $db->checkConnection(); |
|
185 | 185 | |
186 | - $relationship = new Relationship(); |
|
186 | + $relationship = new Relationship(); |
|
187 | 187 | |
188 | - //test with invalid relationship |
|
189 | - $result = $relationship->retrieve_by_name("test_test"); |
|
190 | - $this->assertEquals(false, $result); |
|
188 | + //test with invalid relationship |
|
189 | + $result = $relationship->retrieve_by_name("test_test"); |
|
190 | + $this->assertEquals(false, $result); |
|
191 | 191 | |
192 | 192 | |
193 | - //test with invalid relationship |
|
194 | - unset($result); |
|
195 | - $result = $relationship->retrieve_by_name("roles_users"); |
|
196 | - $this->assertEquals(null, $result); |
|
193 | + //test with invalid relationship |
|
194 | + unset($result); |
|
195 | + $result = $relationship->retrieve_by_name("roles_users"); |
|
196 | + $this->assertEquals(null, $result); |
|
197 | 197 | |
198 | - $this->assertEquals("Users", $relationship->rhs_module); |
|
199 | - $this->assertEquals("Roles", $relationship->lhs_module); |
|
198 | + $this->assertEquals("Users", $relationship->rhs_module); |
|
199 | + $this->assertEquals("Roles", $relationship->lhs_module); |
|
200 | 200 | |
201 | - $this->assertEquals("id", $relationship->rhs_key); |
|
202 | - $this->assertEquals("id", $relationship->lhs_key); |
|
201 | + $this->assertEquals("id", $relationship->rhs_key); |
|
202 | + $this->assertEquals("id", $relationship->lhs_key); |
|
203 | 203 | |
204 | - $this->assertEquals("many-to-many", $relationship->relationship_type); |
|
204 | + $this->assertEquals("many-to-many", $relationship->relationship_type); |
|
205 | 205 | |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - public function testload_relationship_meta() { |
|
208 | + public function testload_relationship_meta() { |
|
209 | 209 | |
210 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
211 | - global $db; |
|
212 | - unset ($db->database); |
|
213 | - $db->checkConnection(); |
|
210 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
211 | + global $db; |
|
212 | + unset ($db->database); |
|
213 | + $db->checkConnection(); |
|
214 | 214 | |
215 | - $relationship = new Relationship(); |
|
215 | + $relationship = new Relationship(); |
|
216 | 216 | |
217 | - $relationship->load_relationship_meta(); |
|
218 | - $this->assertTrue(isset($GLOBALS['relationships'])); |
|
217 | + $relationship->load_relationship_meta(); |
|
218 | + $this->assertTrue(isset($GLOBALS['relationships'])); |
|
219 | 219 | |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - public function testbuild_relationship_cache() { |
|
222 | + public function testbuild_relationship_cache() { |
|
223 | 223 | |
224 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
225 | - global $db; |
|
226 | - unset ($db->database); |
|
227 | - $db->checkConnection(); |
|
224 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
225 | + global $db; |
|
226 | + unset ($db->database); |
|
227 | + $db->checkConnection(); |
|
228 | 228 | |
229 | - $relationship = new Relationship(); |
|
229 | + $relationship = new Relationship(); |
|
230 | 230 | |
231 | - //execute the method and test if it works and does not throws an exception. |
|
232 | - try { |
|
233 | - $relationship->build_relationship_cache(); |
|
234 | - $this->assertTrue(true); |
|
235 | - } |
|
236 | - catch (Exception $e) { |
|
237 | - $this->fail(); |
|
238 | - } |
|
231 | + //execute the method and test if it works and does not throws an exception. |
|
232 | + try { |
|
233 | + $relationship->build_relationship_cache(); |
|
234 | + $this->assertTrue(true); |
|
235 | + } |
|
236 | + catch (Exception $e) { |
|
237 | + $this->fail(); |
|
238 | + } |
|
239 | 239 | |
240 | - } |
|
240 | + } |
|
241 | 241 | |
242 | 242 | |
243 | - public function testcache_file_dir() { |
|
243 | + public function testcache_file_dir() { |
|
244 | 244 | |
245 | - $result = Relationship::cache_file_dir(); |
|
246 | - $this->assertEquals("cache/modules/Relationships", $result); |
|
245 | + $result = Relationship::cache_file_dir(); |
|
246 | + $this->assertEquals("cache/modules/Relationships", $result); |
|
247 | 247 | |
248 | - } |
|
248 | + } |
|
249 | 249 | |
250 | - public function testcache_file_name_only() { |
|
250 | + public function testcache_file_name_only() { |
|
251 | 251 | |
252 | - $result = Relationship::cache_file_name_only(); |
|
253 | - $this->assertEquals("relationships.cache.php", $result); |
|
252 | + $result = Relationship::cache_file_name_only(); |
|
253 | + $this->assertEquals("relationships.cache.php", $result); |
|
254 | 254 | |
255 | - } |
|
255 | + } |
|
256 | 256 | |
257 | - public function testdelete_cache() { |
|
257 | + public function testdelete_cache() { |
|
258 | 258 | |
259 | - //execute the method and test if it works and does not throws an exception. |
|
260 | - try { |
|
261 | - Relationship::delete_cache(); |
|
262 | - $this->assertTrue(true); |
|
263 | - } |
|
264 | - catch (Exception $e) { |
|
265 | - $this->fail(); |
|
266 | - } |
|
259 | + //execute the method and test if it works and does not throws an exception. |
|
260 | + try { |
|
261 | + Relationship::delete_cache(); |
|
262 | + $this->assertTrue(true); |
|
263 | + } |
|
264 | + catch (Exception $e) { |
|
265 | + $this->fail(); |
|
266 | + } |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | - public function testtrace_relationship_module(){ |
|
271 | + public function testtrace_relationship_module(){ |
|
272 | 272 | |
273 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | - global $db; |
|
275 | - unset ($db->database); |
|
276 | - $db->checkConnection(); |
|
273 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | + global $db; |
|
275 | + unset ($db->database); |
|
276 | + $db->checkConnection(); |
|
277 | 277 | |
278 | - $relationship = new Relationship(); |
|
279 | - $result = $relationship->trace_relationship_module("Roles", "Users"); |
|
280 | - $this->assertInstanceOf('User',$result); |
|
278 | + $relationship = new Relationship(); |
|
279 | + $result = $relationship->trace_relationship_module("Roles", "Users"); |
|
280 | + $this->assertInstanceOf('User',$result); |
|
281 | 281 | |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | 284 | |
285 | 285 |
@@ -6,57 +6,57 @@ |
||
6 | 6 | public function testFavorites() |
7 | 7 | { |
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $favorites = new Favorites(); |
|
11 | - $this->assertInstanceOf('Favorites',$favorites); |
|
12 | - $this->assertInstanceOf('Basic',$favorites); |
|
13 | - $this->assertInstanceOf('SugarBean',$favorites); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $favorites = new Favorites(); |
|
11 | + $this->assertInstanceOf('Favorites',$favorites); |
|
12 | + $this->assertInstanceOf('Basic',$favorites); |
|
13 | + $this->assertInstanceOf('SugarBean',$favorites); |
|
14 | 14 | |
15 | - $this->assertAttributeEquals('Favorites', 'module_dir', $favorites); |
|
16 | - $this->assertAttributeEquals('Favorites', 'object_name', $favorites); |
|
17 | - $this->assertAttributeEquals('favorites', 'table_name', $favorites); |
|
18 | - $this->assertAttributeEquals(true, 'new_schema', $favorites); |
|
15 | + $this->assertAttributeEquals('Favorites', 'module_dir', $favorites); |
|
16 | + $this->assertAttributeEquals('Favorites', 'object_name', $favorites); |
|
17 | + $this->assertAttributeEquals('favorites', 'table_name', $favorites); |
|
18 | + $this->assertAttributeEquals(true, 'new_schema', $favorites); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testdeleteFavorite() |
23 | - { |
|
24 | - error_reporting(E_ERROR | E_PARSE); |
|
23 | + { |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - $favorites = new Favorites(); |
|
26 | + $favorites = new Favorites(); |
|
27 | 27 | |
28 | - //test without any ID. testing with an invalid ID will throw fatal error |
|
29 | - $result = $favorites->deleteFavorite(); |
|
30 | - $this->assertEquals(false,$result); |
|
28 | + //test without any ID. testing with an invalid ID will throw fatal error |
|
29 | + $result = $favorites->deleteFavorite(); |
|
30 | + $this->assertEquals(false,$result); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function testgetFavoriteID() |
35 | 35 | { |
36 | - $favorites = new Favorites(); |
|
36 | + $favorites = new Favorites(); |
|
37 | 37 | |
38 | - //test with blank string parameters |
|
39 | - $result = $favorites->getFavoriteID('',''); |
|
40 | - $this->assertEquals(false,$result); |
|
38 | + //test with blank string parameters |
|
39 | + $result = $favorites->getFavoriteID('',''); |
|
40 | + $this->assertEquals(false,$result); |
|
41 | 41 | |
42 | 42 | |
43 | - //test with string parameters |
|
44 | - $result = $favorites->getFavoriteID('Accounts','1'); |
|
45 | - $this->assertEquals(false,$result); |
|
43 | + //test with string parameters |
|
44 | + $result = $favorites->getFavoriteID('Accounts','1'); |
|
45 | + $this->assertEquals(false,$result); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testgetCurrentUserSidebarFavorites() |
50 | 50 | { |
51 | - $favorites = new Favorites(); |
|
51 | + $favorites = new Favorites(); |
|
52 | 52 | |
53 | - //test with empty string parameter |
|
54 | - $result = $favorites->getCurrentUserSidebarFavorites(); |
|
55 | - $this->assertTrue(is_array($result)); |
|
53 | + //test with empty string parameter |
|
54 | + $result = $favorites->getCurrentUserSidebarFavorites(); |
|
55 | + $this->assertTrue(is_array($result)); |
|
56 | 56 | |
57 | - //test with string |
|
58 | - $result = $favorites->getCurrentUserSidebarFavorites('1'); |
|
59 | - $this->assertTrue(is_array($result)); |
|
57 | + //test with string |
|
58 | + $result = $favorites->getCurrentUserSidebarFavorites('1'); |
|
59 | + $this->assertTrue(is_array($result)); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | } |
@@ -2,35 +2,35 @@ |
||
2 | 2 | |
3 | 3 | class FP_eventsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testFP_events(){ |
|
5 | + public function testFP_events(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $fpEvents = new FP_events(); |
|
9 | - $this->assertInstanceOf('FP_events',$fpEvents); |
|
10 | - $this->assertInstanceOf('Basic',$fpEvents); |
|
11 | - $this->assertInstanceOf('SugarBean',$fpEvents); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $fpEvents = new FP_events(); |
|
9 | + $this->assertInstanceOf('FP_events',$fpEvents); |
|
10 | + $this->assertInstanceOf('Basic',$fpEvents); |
|
11 | + $this->assertInstanceOf('SugarBean',$fpEvents); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('FP_events', 'module_dir', $fpEvents); |
|
14 | - $this->assertAttributeEquals('FP_events', 'object_name', $fpEvents); |
|
15 | - $this->assertAttributeEquals('fp_events', 'table_name', $fpEvents); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $fpEvents); |
|
17 | - $this->assertAttributeEquals(true, 'importable', $fpEvents); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $fpEvents); |
|
13 | + $this->assertAttributeEquals('FP_events', 'module_dir', $fpEvents); |
|
14 | + $this->assertAttributeEquals('FP_events', 'object_name', $fpEvents); |
|
15 | + $this->assertAttributeEquals('fp_events', 'table_name', $fpEvents); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $fpEvents); |
|
17 | + $this->assertAttributeEquals(true, 'importable', $fpEvents); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $fpEvents); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | - public function testemail_templates(){ |
|
22 | + public function testemail_templates(){ |
|
23 | 23 | |
24 | - error_reporting(E_ERROR | E_PARSE); |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - global $app_list_strings; |
|
26 | + global $app_list_strings; |
|
27 | 27 | |
28 | - $fpEvents = new FP_events(); |
|
28 | + $fpEvents = new FP_events(); |
|
29 | 29 | |
30 | - $fpEvents->email_templates(); |
|
31 | - $this->assertTrue(is_array($app_list_strings['email_templet_list'])); |
|
30 | + $fpEvents->email_templates(); |
|
31 | + $this->assertTrue(is_array($app_list_strings['email_templet_list'])); |
|
32 | 32 | |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | ?> |
@@ -3,23 +3,23 @@ |
||
3 | 3 | |
4 | 4 | class AM_ProjectTemplatesTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAM_ProjectTemplates(){ |
|
6 | + public function testAM_ProjectTemplates(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and type attribute |
|
9 | - $am_projectTemplate = new AM_ProjectTemplates(); |
|
10 | - $this->assertInstanceOf('AM_ProjectTemplates',$am_projectTemplate); |
|
11 | - $this->assertInstanceOf('Basic',$am_projectTemplate); |
|
12 | - $this->assertInstanceOf('SugarBean',$am_projectTemplate); |
|
8 | + //execute the contructor and check for the Object type and type attribute |
|
9 | + $am_projectTemplate = new AM_ProjectTemplates(); |
|
10 | + $this->assertInstanceOf('AM_ProjectTemplates',$am_projectTemplate); |
|
11 | + $this->assertInstanceOf('Basic',$am_projectTemplate); |
|
12 | + $this->assertInstanceOf('SugarBean',$am_projectTemplate); |
|
13 | 13 | |
14 | 14 | |
15 | - $this->assertAttributeEquals('AM_ProjectTemplates', 'module_dir', $am_projectTemplate); |
|
16 | - $this->assertAttributeEquals('AM_ProjectTemplates', 'object_name', $am_projectTemplate); |
|
17 | - $this->assertAttributeEquals('am_projecttemplates', 'table_name', $am_projectTemplate); |
|
18 | - $this->assertAttributeEquals(true, 'new_schema', $am_projectTemplate); |
|
19 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $am_projectTemplate); |
|
20 | - $this->assertAttributeEquals(false, 'importable', $am_projectTemplate); |
|
15 | + $this->assertAttributeEquals('AM_ProjectTemplates', 'module_dir', $am_projectTemplate); |
|
16 | + $this->assertAttributeEquals('AM_ProjectTemplates', 'object_name', $am_projectTemplate); |
|
17 | + $this->assertAttributeEquals('am_projecttemplates', 'table_name', $am_projectTemplate); |
|
18 | + $this->assertAttributeEquals(true, 'new_schema', $am_projectTemplate); |
|
19 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $am_projectTemplate); |
|
20 | + $this->assertAttributeEquals(false, 'importable', $am_projectTemplate); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | ?> |
26 | 26 | \ No newline at end of file |
@@ -2,23 +2,23 @@ |
||
2 | 2 | |
3 | 3 | class AM_TaskTemplatesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAM_TaskTemplates(){ |
|
5 | + public function testAM_TaskTemplates(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and type attribute |
|
8 | - $am_taskTemplates = new AM_TaskTemplates(); |
|
9 | - $this->assertInstanceOf('AM_TaskTemplates',$am_taskTemplates); |
|
10 | - $this->assertInstanceOf('Basic',$am_taskTemplates); |
|
11 | - $this->assertInstanceOf('SugarBean',$am_taskTemplates); |
|
7 | + //execute the contructor and check for the Object type and type attribute |
|
8 | + $am_taskTemplates = new AM_TaskTemplates(); |
|
9 | + $this->assertInstanceOf('AM_TaskTemplates',$am_taskTemplates); |
|
10 | + $this->assertInstanceOf('Basic',$am_taskTemplates); |
|
11 | + $this->assertInstanceOf('SugarBean',$am_taskTemplates); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AM_TaskTemplates', 'module_dir', $am_taskTemplates); |
|
14 | - $this->assertAttributeEquals('AM_TaskTemplates', 'object_name', $am_taskTemplates); |
|
15 | - $this->assertAttributeEquals('am_tasktemplates', 'table_name', $am_taskTemplates); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $am_taskTemplates); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $am_taskTemplates); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $am_taskTemplates); |
|
13 | + $this->assertAttributeEquals('AM_TaskTemplates', 'module_dir', $am_taskTemplates); |
|
14 | + $this->assertAttributeEquals('AM_TaskTemplates', 'object_name', $am_taskTemplates); |
|
15 | + $this->assertAttributeEquals('am_tasktemplates', 'table_name', $am_taskTemplates); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $am_taskTemplates); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $am_taskTemplates); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $am_taskTemplates); |
|
19 | 19 | |
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -4,52 +4,52 @@ discard block |
||
4 | 4 | class ACLActionTest extends PHPUnit_Framework_TestCase{ |
5 | 5 | |
6 | 6 | |
7 | - public function testACLAction(){ |
|
7 | + public function testACLAction(){ |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and type attribute |
|
10 | - $aclAction = new ACLAction(); |
|
11 | - $this->assertInstanceOf('ACLAction',$aclAction); |
|
12 | - $this->assertInstanceOf('SugarBean',$aclAction); |
|
9 | + //execute the contructor and check for the Object type and type attribute |
|
10 | + $aclAction = new ACLAction(); |
|
11 | + $this->assertInstanceOf('ACLAction',$aclAction); |
|
12 | + $this->assertInstanceOf('SugarBean',$aclAction); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('ACLActions', 'module_dir', $aclAction); |
|
15 | - $this->assertAttributeEquals('ACLAction', 'object_name', $aclAction); |
|
16 | - $this->assertAttributeEquals('acl_actions', 'table_name', $aclAction); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aclAction); |
|
18 | - $this->assertAttributeEquals(true, 'disable_custom_fields', $aclAction); |
|
14 | + $this->assertAttributeEquals('ACLActions', 'module_dir', $aclAction); |
|
15 | + $this->assertAttributeEquals('ACLAction', 'object_name', $aclAction); |
|
16 | + $this->assertAttributeEquals('acl_actions', 'table_name', $aclAction); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aclAction); |
|
18 | + $this->assertAttributeEquals(true, 'disable_custom_fields', $aclAction); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | public function testaddActions(){ |
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - //take count of actions initially and then after method execution and test if action count increases |
|
28 | - $action_count = count(ACLAction::getDefaultActions()); |
|
29 | - ACLAction::addActions("Test"); |
|
30 | - $actual = ACLAction::getDefaultActions(); |
|
31 | - $this->assertGreaterThan($action_count, count($actual)); |
|
27 | + //take count of actions initially and then after method execution and test if action count increases |
|
28 | + $action_count = count(ACLAction::getDefaultActions()); |
|
29 | + ACLAction::addActions("Test"); |
|
30 | + $actual = ACLAction::getDefaultActions(); |
|
31 | + $this->assertGreaterThan($action_count, count($actual)); |
|
32 | 32 | |
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testremoveActions(){ |
37 | 37 | |
38 | - //take count of actions initially and then after method execution and test if action count decreases |
|
39 | - $action_count = count(ACLAction::getDefaultActions()); |
|
40 | - ACLAction::removeActions("Test"); |
|
41 | - $actual = ACLAction::getDefaultActions(); |
|
42 | - $this->assertLessThan($action_count, count($actual)); |
|
38 | + //take count of actions initially and then after method execution and test if action count decreases |
|
39 | + $action_count = count(ACLAction::getDefaultActions()); |
|
40 | + ACLAction::removeActions("Test"); |
|
41 | + $actual = ACLAction::getDefaultActions(); |
|
42 | + $this->assertLessThan($action_count, count($actual)); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testAccessName(){ |
48 | 48 | |
49 | - error_reporting(E_ERROR | E_PARSE); |
|
49 | + error_reporting(E_ERROR | E_PARSE); |
|
50 | 50 | |
51 | - $this->assertFalse(ACLAction::AccessName('')); //test with invalid value |
|
52 | - $this->assertEquals('All', ACLAction::AccessName(90)); //test with a valid value |
|
51 | + $this->assertFalse(ACLAction::AccessName('')); //test with invalid value |
|
52 | + $this->assertEquals('All', ACLAction::AccessName(90)); //test with a valid value |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -73,144 +73,144 @@ discard block |
||
73 | 73 | |
74 | 74 | public function testgetUserActions(){ |
75 | 75 | |
76 | - $result1 = ACLAction::getUserActions('1'); |
|
77 | - $result2 = ACLAction::getUserActions('1',false,'Accounts'); |
|
78 | - $result3 = ACLAction::getUserActions('1',false,'Accounts','list'); |
|
76 | + $result1 = ACLAction::getUserActions('1'); |
|
77 | + $result2 = ACLAction::getUserActions('1',false,'Accounts'); |
|
78 | + $result3 = ACLAction::getUserActions('1',false,'Accounts','list'); |
|
79 | 79 | |
80 | - //verify that all three results retunred are different |
|
81 | - $this->assertNotSame($result1,$result2); |
|
82 | - $this->assertNotSame($result1,$result3); |
|
83 | - $this->assertNotSame($result2,$result3); |
|
80 | + //verify that all three results retunred are different |
|
81 | + $this->assertNotSame($result1,$result2); |
|
82 | + $this->assertNotSame($result1,$result3); |
|
83 | + $this->assertNotSame($result2,$result3); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | - public function testhasAccess(){ |
|
88 | + public function testhasAccess(){ |
|
89 | 89 | |
90 | - $this->assertFalse(ACLAction::hasAccess()); //check with defaults |
|
91 | - $this->assertTrue(ACLAction::hasAccess(false,false,90)); //access All with is owner false |
|
92 | - $this->assertTrue(ACLAction::hasAccess(true,true,90)); //access All with is owner true |
|
93 | - $this->assertFalse(ACLAction::hasAccess(false,false,-98));// check access disabled |
|
94 | - $this->assertFalse(ACLAction::hasAccess(true,true,89)); //check access enabled |
|
95 | - $this->assertTrue(ACLAction::hasAccess(true,true,75)); //check owner access with is owner true |
|
96 | - $this->assertFalse(ACLAction::hasAccess(false,true,75)); //check owner access with is owner false |
|
90 | + $this->assertFalse(ACLAction::hasAccess()); //check with defaults |
|
91 | + $this->assertTrue(ACLAction::hasAccess(false,false,90)); //access All with is owner false |
|
92 | + $this->assertTrue(ACLAction::hasAccess(true,true,90)); //access All with is owner true |
|
93 | + $this->assertFalse(ACLAction::hasAccess(false,false,-98));// check access disabled |
|
94 | + $this->assertFalse(ACLAction::hasAccess(true,true,89)); //check access enabled |
|
95 | + $this->assertTrue(ACLAction::hasAccess(true,true,75)); //check owner access with is owner true |
|
96 | + $this->assertFalse(ACLAction::hasAccess(false,true,75)); //check owner access with is owner false |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - public function testuserNeedsSecurityGroup(){ |
|
100 | + public function testuserNeedsSecurityGroup(){ |
|
101 | 101 | |
102 | - $this->assertFalse( ACLAction::userNeedsSecurityGroup('1','',''));//test with empty module and action |
|
103 | - $this->assertFalse( ACLAction::userNeedsSecurityGroup('1','Accounts','list')); //test with valid module and action |
|
102 | + $this->assertFalse( ACLAction::userNeedsSecurityGroup('1','',''));//test with empty module and action |
|
103 | + $this->assertFalse( ACLAction::userNeedsSecurityGroup('1','Accounts','list')); //test with valid module and action |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - public function testuserHasAccess(){ |
|
108 | + public function testuserHasAccess(){ |
|
109 | 109 | |
110 | - $this->assertFalse(ACLAction::userHasAccess('', '','')); //test with empty module and action |
|
111 | - $this->assertTrue(ACLAction::userHasAccess('', 'Accounts','list')); //test with e,pty user and valid module and action |
|
112 | - $this->assertTrue(ACLAction::userHasAccess('1', 'Accounts','list')); //test with valid User, module and action |
|
113 | - $this->assertTrue(ACLAction::userHasAccess('1', 'SecurityGroups','list')); //test with valid User, module and action |
|
114 | - $this->assertTrue(ACLAction::userHasAccess('1', 'Users','list')); //test with valid User, module and action |
|
110 | + $this->assertFalse(ACLAction::userHasAccess('', '','')); //test with empty module and action |
|
111 | + $this->assertTrue(ACLAction::userHasAccess('', 'Accounts','list')); //test with e,pty user and valid module and action |
|
112 | + $this->assertTrue(ACLAction::userHasAccess('1', 'Accounts','list')); //test with valid User, module and action |
|
113 | + $this->assertTrue(ACLAction::userHasAccess('1', 'SecurityGroups','list')); //test with valid User, module and action |
|
114 | + $this->assertTrue(ACLAction::userHasAccess('1', 'Users','list')); //test with valid User, module and action |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | 119 | public function testgetUserAccessLevel(){ |
120 | 120 | |
121 | - //tes for accoounts module with two different actions |
|
122 | - $this->assertEquals(90,ACLAction::getUserAccessLevel('1', 'Accounts','list')); |
|
123 | - $this->assertEquals(89,ACLAction::getUserAccessLevel('1', 'Accounts','access')); |
|
121 | + //tes for accoounts module with two different actions |
|
122 | + $this->assertEquals(90,ACLAction::getUserAccessLevel('1', 'Accounts','list')); |
|
123 | + $this->assertEquals(89,ACLAction::getUserAccessLevel('1', 'Accounts','access')); |
|
124 | 124 | |
125 | - //tes for users module with two different actions |
|
126 | - $this->assertEquals(90,ACLAction::getUserAccessLevel('1', 'Users','list')); |
|
127 | - $this->assertEquals(89,ACLAction::getUserAccessLevel('1', 'Users','access')); |
|
125 | + //tes for users module with two different actions |
|
126 | + $this->assertEquals(90,ACLAction::getUserAccessLevel('1', 'Users','list')); |
|
127 | + $this->assertEquals(89,ACLAction::getUserAccessLevel('1', 'Users','access')); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testuserNeedsOwnership(){ |
133 | 133 | |
134 | - //test with invalid values |
|
135 | - $this->assertFalse(ACLAction::userNeedsOwnership('', '','')); |
|
134 | + //test with invalid values |
|
135 | + $this->assertFalse(ACLAction::userNeedsOwnership('', '','')); |
|
136 | 136 | |
137 | - //test with valid values for different module and action combination |
|
138 | - $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Accounts','list')); |
|
139 | - $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Accounts','delete')); |
|
140 | - $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Users','delete')); |
|
141 | - $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Users','list')); |
|
137 | + //test with valid values for different module and action combination |
|
138 | + $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Accounts','list')); |
|
139 | + $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Accounts','delete')); |
|
140 | + $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Users','delete')); |
|
141 | + $this->assertFalse(ACLAction::userNeedsOwnership('1', 'Users','list')); |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | |
145 | 145 | |
146 | 146 | public function testsetupCategoriesMatrix(){ |
147 | 147 | |
148 | - //preset required data |
|
149 | - $categories = Array(); |
|
150 | - $categories["Accounts"]["module"]["list"][] = "list"; |
|
151 | - $categories["Accounts"]["module"]["edit"][] = "edit"; |
|
148 | + //preset required data |
|
149 | + $categories = Array(); |
|
150 | + $categories["Accounts"]["module"]["list"][] = "list"; |
|
151 | + $categories["Accounts"]["module"]["edit"][] = "edit"; |
|
152 | 152 | |
153 | 153 | |
154 | - $names_expected = Array("list"=> "List", "edit"=>"Edit"); |
|
154 | + $names_expected = Array("list"=> "List", "edit"=>"Edit"); |
|
155 | 155 | |
156 | - $categories_expected = array ( |
|
157 | - 'Accounts' => |
|
158 | - array ( |
|
159 | - 'module' => |
|
160 | - array ( |
|
161 | - 'list' => array ( 'list', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array ( 90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None', ), ), |
|
162 | - 'edit' => array ( 'edit', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array ( 90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None' ), ), |
|
163 | - ), |
|
164 | - ), |
|
165 | - ); |
|
156 | + $categories_expected = array ( |
|
157 | + 'Accounts' => |
|
158 | + array ( |
|
159 | + 'module' => |
|
160 | + array ( |
|
161 | + 'list' => array ( 'list', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array ( 90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None', ), ), |
|
162 | + 'edit' => array ( 'edit', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array ( 90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None' ), ), |
|
163 | + ), |
|
164 | + ), |
|
165 | + ); |
|
166 | 166 | |
167 | - //execute the method and verify that it retunrs expected results |
|
168 | - $result = ACLAction::setupCategoriesMatrix($categories); |
|
169 | - $this->assertSame($names_expected, $result); |
|
170 | - $this->assertSame($categories, $categories_expected); |
|
167 | + //execute the method and verify that it retunrs expected results |
|
168 | + $result = ACLAction::setupCategoriesMatrix($categories); |
|
169 | + $this->assertSame($names_expected, $result); |
|
170 | + $this->assertSame($categories, $categories_expected); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | 174 | |
175 | - public function testtoArray(){ |
|
175 | + public function testtoArray(){ |
|
176 | 176 | |
177 | - $aclAction = new ACLAction(); |
|
177 | + $aclAction = new ACLAction(); |
|
178 | 178 | |
179 | - //wihout any fields set |
|
180 | - $expected = Array("id"=> NULL, "aclaccess"=> NULL); |
|
181 | - $actual = $aclAction->toArray(); |
|
182 | - $this->assertSame($expected,$actual); |
|
179 | + //wihout any fields set |
|
180 | + $expected = Array("id"=> NULL, "aclaccess"=> NULL); |
|
181 | + $actual = $aclAction->toArray(); |
|
182 | + $this->assertSame($expected,$actual); |
|
183 | 183 | |
184 | 184 | |
185 | - //with fileds pre populated |
|
186 | - $aclAction->populateFromRow(Array("id"=>"1234","aclaccess"=>"9999")); |
|
187 | - $expected = Array("id"=>"1234","aclaccess"=>"9999"); |
|
188 | - $actual = $aclAction->toArray(); |
|
189 | - $this->assertSame($expected,$actual); |
|
185 | + //with fileds pre populated |
|
186 | + $aclAction->populateFromRow(Array("id"=>"1234","aclaccess"=>"9999")); |
|
187 | + $expected = Array("id"=>"1234","aclaccess"=>"9999"); |
|
188 | + $actual = $aclAction->toArray(); |
|
189 | + $this->assertSame($expected,$actual); |
|
190 | 190 | |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | - public function testfromArray(){ |
|
193 | + public function testfromArray(){ |
|
194 | 194 | |
195 | - $aclAction = new ACLAction(); |
|
196 | - $arr = Array("id"=>"1234","name"=>"test"); |
|
195 | + $aclAction = new ACLAction(); |
|
196 | + $arr = Array("id"=>"1234","name"=>"test"); |
|
197 | 197 | |
198 | - //execute the method and verify that it retunrs expected results |
|
199 | - $aclAction->fromArray($arr); |
|
200 | - $this->assertSame($aclAction->id,"1234"); |
|
201 | - $this->assertSame($aclAction->name,"test"); |
|
202 | - } |
|
198 | + //execute the method and verify that it retunrs expected results |
|
199 | + $aclAction->fromArray($arr); |
|
200 | + $this->assertSame($aclAction->id,"1234"); |
|
201 | + $this->assertSame($aclAction->name,"test"); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | |
205 | - public function testclearSessionCache(){ |
|
205 | + public function testclearSessionCache(){ |
|
206 | 206 | |
207 | - $aclAction = new ACLAction(); |
|
207 | + $aclAction = new ACLAction(); |
|
208 | 208 | |
209 | - //execute the method and verify that it unsets the session cache |
|
210 | - $aclAction->clearSessionCache(); |
|
211 | - $this->assertFalse(isset($_SESSION['ACL'])); |
|
209 | + //execute the method and verify that it unsets the session cache |
|
210 | + $aclAction->clearSessionCache(); |
|
211 | + $this->assertFalse(isset($_SESSION['ACL'])); |
|
212 | 212 | |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | 216 | } |
@@ -5,95 +5,95 @@ |
||
5 | 5 | public function testAOS_Products_Quotes(){ |
6 | 6 | |
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aosProductsQuotes = new AOS_Products_Quotes(); |
|
10 | - $this->assertInstanceOf('AOS_Products_Quotes',$aosProductsQuotes); |
|
11 | - $this->assertInstanceOf('Basic',$aosProductsQuotes); |
|
12 | - $this->assertInstanceOf('SugarBean',$aosProductsQuotes); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aosProductsQuotes = new AOS_Products_Quotes(); |
|
10 | + $this->assertInstanceOf('AOS_Products_Quotes',$aosProductsQuotes); |
|
11 | + $this->assertInstanceOf('Basic',$aosProductsQuotes); |
|
12 | + $this->assertInstanceOf('SugarBean',$aosProductsQuotes); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOS_Products_Quotes', 'module_dir', $aosProductsQuotes); |
|
15 | - $this->assertAttributeEquals('AOS_Products_Quotes', 'object_name', $aosProductsQuotes); |
|
16 | - $this->assertAttributeEquals('aos_products_quotes', 'table_name', $aosProductsQuotes); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aosProductsQuotes); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProductsQuotes); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $aosProductsQuotes); |
|
14 | + $this->assertAttributeEquals('AOS_Products_Quotes', 'module_dir', $aosProductsQuotes); |
|
15 | + $this->assertAttributeEquals('AOS_Products_Quotes', 'object_name', $aosProductsQuotes); |
|
16 | + $this->assertAttributeEquals('aos_products_quotes', 'table_name', $aosProductsQuotes); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aosProductsQuotes); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProductsQuotes); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $aosProductsQuotes); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function testsave_lines(){ |
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aosProductsQuotes = new AOS_Products_Quotes(); |
|
27 | + $aosProductsQuotes = new AOS_Products_Quotes(); |
|
28 | 28 | |
29 | - //populate required values |
|
30 | - $post_data= Array(); |
|
31 | - $post_data["name"] = Array('test1','test2'); |
|
32 | - $post_data["group_number"] = Array('1','2'); |
|
33 | - $post_data["product_id"] = Array('1','1'); |
|
34 | - $post_data["product_unit_price"] = Array(100,200); |
|
29 | + //populate required values |
|
30 | + $post_data= Array(); |
|
31 | + $post_data["name"] = Array('test1','test2'); |
|
32 | + $post_data["group_number"] = Array('1','2'); |
|
33 | + $post_data["product_id"] = Array('1','1'); |
|
34 | + $post_data["product_unit_price"] = Array(100,200); |
|
35 | 35 | |
36 | - //create parent bean |
|
37 | - $aosQuote = new AOS_Quotes(); |
|
38 | - $aosQuote->id = 1; |
|
36 | + //create parent bean |
|
37 | + $aosQuote = new AOS_Quotes(); |
|
38 | + $aosQuote->id = 1; |
|
39 | 39 | |
40 | - $aosProductsQuotes->save_lines($post_data, $aosQuote); |
|
40 | + $aosProductsQuotes->save_lines($post_data, $aosQuote); |
|
41 | 41 | |
42 | - //get the linked beans and verify if records created |
|
43 | - $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
44 | - $this->assertEquals(count($post_data["name"]), count($product_quote_lines) ); |
|
42 | + //get the linked beans and verify if records created |
|
43 | + $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
44 | + $this->assertEquals(count($post_data["name"]), count($product_quote_lines) ); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function testmark_lines_deleted(){ |
49 | 49 | |
50 | - $aosProductsQuotes = new AOS_Products_Quotes(); |
|
50 | + $aosProductsQuotes = new AOS_Products_Quotes(); |
|
51 | 51 | |
52 | - //create parent bean |
|
53 | - $aosQuote = new AOS_Quotes(); |
|
54 | - $aosQuote->id = 1; |
|
52 | + //create parent bean |
|
53 | + $aosQuote = new AOS_Quotes(); |
|
54 | + $aosQuote->id = 1; |
|
55 | 55 | |
56 | 56 | |
57 | - //get the linked beans and get record count before deletion |
|
58 | - $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
59 | - $expected = count($product_quote_lines); |
|
60 | - $product_quote_lines = null; |
|
57 | + //get the linked beans and get record count before deletion |
|
58 | + $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
59 | + $expected = count($product_quote_lines); |
|
60 | + $product_quote_lines = null; |
|
61 | 61 | |
62 | 62 | |
63 | - $aosProductsQuotes->mark_lines_deleted($aosQuote); |
|
64 | - unset($aosQuote); |
|
63 | + $aosProductsQuotes->mark_lines_deleted($aosQuote); |
|
64 | + unset($aosQuote); |
|
65 | 65 | |
66 | 66 | |
67 | - //get the linked beans and get record count after deletion |
|
68 | - $aosQuote = new AOS_Quotes(); |
|
69 | - $aosQuote->id = 1; |
|
70 | - $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
71 | - $actual = count($product_quote_lines); |
|
67 | + //get the linked beans and get record count after deletion |
|
68 | + $aosQuote = new AOS_Quotes(); |
|
69 | + $aosQuote->id = 1; |
|
70 | + $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); |
|
71 | + $actual = count($product_quote_lines); |
|
72 | 72 | |
73 | - $this->assertLessThan($expected,$actual); |
|
73 | + $this->assertLessThan($expected,$actual); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | 77 | public function testsave(){ |
78 | 78 | |
79 | - $aosProductsQuotes = new AOS_Products_Quotes(); |
|
79 | + $aosProductsQuotes = new AOS_Products_Quotes(); |
|
80 | 80 | |
81 | - $aosProductsQuotes->name = 'test'; |
|
82 | - $aosProductsQuotes->product_id= 1; |
|
83 | - $aosProductsQuotes->product_unit_price = 100; |
|
81 | + $aosProductsQuotes->name = 'test'; |
|
82 | + $aosProductsQuotes->product_id= 1; |
|
83 | + $aosProductsQuotes->product_unit_price = 100; |
|
84 | 84 | |
85 | - $aosProductsQuotes->save(); |
|
85 | + $aosProductsQuotes->save(); |
|
86 | 86 | |
87 | 87 | |
88 | - //test for record ID to verify that record is saved |
|
89 | - $this->assertTrue(isset($aosProductsQuotes->id)); |
|
90 | - $this->assertEquals(36, strlen($aosProductsQuotes->id)); |
|
88 | + //test for record ID to verify that record is saved |
|
89 | + $this->assertTrue(isset($aosProductsQuotes->id)); |
|
90 | + $this->assertEquals(36, strlen($aosProductsQuotes->id)); |
|
91 | 91 | |
92 | 92 | |
93 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
94 | - $aosProductsQuotes->mark_deleted($aosProductsQuotes->id); |
|
95 | - $result = $aosProductsQuotes->retrieve($aosProductsQuotes->id); |
|
96 | - $this->assertEquals(null,$result); |
|
93 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
94 | + $aosProductsQuotes->mark_deleted($aosProductsQuotes->id); |
|
95 | + $result = $aosProductsQuotes->retrieve($aosProductsQuotes->id); |
|
96 | + $this->assertEquals(null,$result); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 |
@@ -2,22 +2,22 @@ |
||
2 | 2 | |
3 | 3 | class AOK_KnowledgeBaseTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOK_KnowledgeBase(){ |
|
5 | + public function testAOK_KnowledgeBase(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and type attribute |
|
8 | - $aok_KnowledgeBase = new AOK_KnowledgeBase(); |
|
9 | - $this->assertInstanceOf('AOK_KnowledgeBase',$aok_KnowledgeBase); |
|
10 | - $this->assertInstanceOf('Basic',$aok_KnowledgeBase); |
|
11 | - $this->assertInstanceOf('SugarBean',$aok_KnowledgeBase); |
|
7 | + //execute the contructor and check for the Object type and type attribute |
|
8 | + $aok_KnowledgeBase = new AOK_KnowledgeBase(); |
|
9 | + $this->assertInstanceOf('AOK_KnowledgeBase',$aok_KnowledgeBase); |
|
10 | + $this->assertInstanceOf('Basic',$aok_KnowledgeBase); |
|
11 | + $this->assertInstanceOf('SugarBean',$aok_KnowledgeBase); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOK_KnowledgeBase', 'module_dir', $aok_KnowledgeBase); |
|
14 | - $this->assertAttributeEquals('AOK_KnowledgeBase', 'object_name', $aok_KnowledgeBase); |
|
15 | - $this->assertAttributeEquals('aok_knowledgebase', 'table_name', $aok_KnowledgeBase); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aok_KnowledgeBase); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aok_KnowledgeBase); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $aok_KnowledgeBase); |
|
13 | + $this->assertAttributeEquals('AOK_KnowledgeBase', 'module_dir', $aok_KnowledgeBase); |
|
14 | + $this->assertAttributeEquals('AOK_KnowledgeBase', 'object_name', $aok_KnowledgeBase); |
|
15 | + $this->assertAttributeEquals('aok_knowledgebase', 'table_name', $aok_KnowledgeBase); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aok_KnowledgeBase); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aok_KnowledgeBase); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $aok_KnowledgeBase); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | \ No newline at end of file |