@@ -2,54 +2,54 @@ |
||
2 | 2 | |
3 | 3 | class GroupTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testGroup() { |
|
5 | + public function testGroup() { |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $group = new Group(); |
|
9 | - $this->assertInstanceOf('Group',$group); |
|
10 | - $this->assertInstanceOf('User',$group); |
|
11 | - $this->assertInstanceOf('SugarBean',$group); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $group = new Group(); |
|
9 | + $this->assertInstanceOf('Group',$group); |
|
10 | + $this->assertInstanceOf('User',$group); |
|
11 | + $this->assertInstanceOf('SugarBean',$group); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('Group', 'status', $group); |
|
14 | - $this->assertAttributeEquals('', 'password', $group); |
|
15 | - $this->assertAttributeEquals(false, 'importable', $group); |
|
13 | + $this->assertAttributeEquals('Group', 'status', $group); |
|
14 | + $this->assertAttributeEquals('', 'password', $group); |
|
15 | + $this->assertAttributeEquals(false, 'importable', $group); |
|
16 | 16 | |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public function testmark_deleted() { |
|
19 | + public function testmark_deleted() { |
|
20 | 20 | |
21 | - error_reporting(E_ERROR | E_PARSE); |
|
21 | + error_reporting(E_ERROR | E_PARSE); |
|
22 | 22 | |
23 | - $group = new Group(); |
|
23 | + $group = new Group(); |
|
24 | 24 | |
25 | - //execute the method and test if it works and does not throws an exception. |
|
26 | - try { |
|
27 | - $group->mark_deleted(''); |
|
28 | - $this->assertTrue(true); |
|
29 | - } |
|
30 | - catch (Exception $e) { |
|
31 | - $this->fail(); |
|
32 | - } |
|
25 | + //execute the method and test if it works and does not throws an exception. |
|
26 | + try { |
|
27 | + $group->mark_deleted(''); |
|
28 | + $this->assertTrue(true); |
|
29 | + } |
|
30 | + catch (Exception $e) { |
|
31 | + $this->fail(); |
|
32 | + } |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | - public function testcreate_export_query() |
|
37 | - { |
|
36 | + public function testcreate_export_query() |
|
37 | + { |
|
38 | 38 | |
39 | - $group = new Group(); |
|
39 | + $group = new Group(); |
|
40 | 40 | |
41 | - //test with empty string params |
|
42 | - $expected = "SELECT users.* FROM users WHERE users.deleted = 0 ORDER BY users.user_name"; |
|
43 | - $actual = $group->create_export_query('',''); |
|
44 | - $this->assertSame($expected,$actual); |
|
41 | + //test with empty string params |
|
42 | + $expected = "SELECT users.* FROM users WHERE users.deleted = 0 ORDER BY users.user_name"; |
|
43 | + $actual = $group->create_export_query('',''); |
|
44 | + $this->assertSame($expected,$actual); |
|
45 | 45 | |
46 | 46 | |
47 | - //test with valid string params |
|
48 | - $expected = "SELECT users.* FROM users WHERE users.user_name=\"\" AND users.deleted = 0 ORDER BY users.id"; |
|
49 | - $actual = $group->create_export_query('users.id','users.user_name=""'); |
|
50 | - $this->assertSame($expected,$actual); |
|
47 | + //test with valid string params |
|
48 | + $expected = "SELECT users.* FROM users WHERE users.user_name=\"\" AND users.deleted = 0 ORDER BY users.id"; |
|
49 | + $actual = $group->create_export_query('users.id','users.user_name=""'); |
|
50 | + $this->assertSame($expected,$actual); |
|
51 | 51 | |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
55 | 55 |
@@ -3,114 +3,114 @@ discard block |
||
3 | 3 | class AOD_IndexTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAOD_Index(){ |
|
6 | + public function testAOD_Index(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and type attribute |
|
9 | - $aod_index = new AOD_Index(); |
|
10 | - $this->assertInstanceOf('AOD_Index',$aod_index); |
|
11 | - $this->assertInstanceOf('Basic',$aod_index); |
|
12 | - $this->assertInstanceOf('SugarBean',$aod_index); |
|
8 | + //execute the contructor and check for the Object type and type attribute |
|
9 | + $aod_index = new AOD_Index(); |
|
10 | + $this->assertInstanceOf('AOD_Index',$aod_index); |
|
11 | + $this->assertInstanceOf('Basic',$aod_index); |
|
12 | + $this->assertInstanceOf('SugarBean',$aod_index); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOD_Index', 'module_dir', $aod_index); |
|
15 | - $this->assertAttributeEquals('AOD_Index', 'object_name', $aod_index); |
|
16 | - $this->assertAttributeEquals('aod_index', 'table_name', $aod_index); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aod_index); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aod_index); |
|
19 | - $this->assertAttributeEquals(false, 'importable', $aod_index); |
|
20 | - $this->assertAttributeEquals(false, 'tracker_visibility', $aod_index); |
|
14 | + $this->assertAttributeEquals('AOD_Index', 'module_dir', $aod_index); |
|
15 | + $this->assertAttributeEquals('AOD_Index', 'object_name', $aod_index); |
|
16 | + $this->assertAttributeEquals('aod_index', 'table_name', $aod_index); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aod_index); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aod_index); |
|
19 | + $this->assertAttributeEquals(false, 'importable', $aod_index); |
|
20 | + $this->assertAttributeEquals(false, 'tracker_visibility', $aod_index); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function testisEnabled(){ |
25 | 25 | |
26 | - error_reporting(E_ERROR | E_PARSE); |
|
26 | + error_reporting(E_ERROR | E_PARSE); |
|
27 | 27 | |
28 | - $aod_index = new AOD_Index(); |
|
28 | + $aod_index = new AOD_Index(); |
|
29 | 29 | |
30 | - //execute the method and verify that it returns true |
|
31 | - $result = $aod_index->isEnabled(); |
|
32 | - $this->assertTrue($result); |
|
30 | + //execute the method and verify that it returns true |
|
31 | + $result = $aod_index->isEnabled(); |
|
32 | + $this->assertTrue($result); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function testfind(){ |
37 | 37 | |
38 | 38 | |
39 | - $aod_index = new AOD_Index(); |
|
39 | + $aod_index = new AOD_Index(); |
|
40 | 40 | |
41 | - $aod_index->id = 1; |
|
42 | - $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
41 | + $aod_index->id = 1; |
|
42 | + $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
43 | 43 | |
44 | 44 | |
45 | - //execute the method without parameters and verify that it returns true |
|
46 | - $hits = $aod_index->find(); |
|
47 | - $this->assertTrue(is_array($hits)); |
|
45 | + //execute the method without parameters and verify that it returns true |
|
46 | + $hits = $aod_index->find(); |
|
47 | + $this->assertTrue(is_array($hits)); |
|
48 | 48 | |
49 | 49 | |
50 | - //execute the method with parameters and verify that it returns true |
|
51 | - $hits = $aod_index->find('/'); |
|
52 | - $this->assertTrue(is_array($hits)); |
|
50 | + //execute the method with parameters and verify that it returns true |
|
51 | + $hits = $aod_index->find('/'); |
|
52 | + $this->assertTrue(is_array($hits)); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function testoptimise(){ |
57 | 57 | |
58 | - $aod_index = new AOD_Index(); |
|
59 | - $aod_index->id = 1; |
|
60 | - $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
61 | - $last_optimized = $aod_index->last_optimised; |
|
58 | + $aod_index = new AOD_Index(); |
|
59 | + $aod_index->id = 1; |
|
60 | + $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
61 | + $last_optimized = $aod_index->last_optimised; |
|
62 | 62 | |
63 | 63 | |
64 | - //execute the method and test if the last optimized date is changed to a later date/time. |
|
65 | - $aod_index->optimise(); |
|
66 | - $this->assertGreaterThan($last_optimized, $aod_index->last_optimised); |
|
64 | + //execute the method and test if the last optimized date is changed to a later date/time. |
|
65 | + $aod_index->optimise(); |
|
66 | + $this->assertGreaterThan($last_optimized, $aod_index->last_optimised); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
70 | 70 | public function testgetIndex(){ |
71 | 71 | |
72 | - $aod_index = new AOD_Index(); |
|
73 | - $result = $aod_index->getIndex(); |
|
72 | + $aod_index = new AOD_Index(); |
|
73 | + $result = $aod_index->getIndex(); |
|
74 | 74 | |
75 | 75 | |
76 | - //execute the method and verify it returns a different instance of samme type |
|
77 | - $this->assertInstanceOf('AOD_Index',$result); |
|
78 | - $this->assertNotSame($aod_index, $result); |
|
76 | + //execute the method and verify it returns a different instance of samme type |
|
77 | + $this->assertInstanceOf('AOD_Index',$result); |
|
78 | + $this->assertNotSame($aod_index, $result); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testgetDocumentForBean(){ |
84 | 84 | |
85 | - $user = new User(1); |
|
85 | + $user = new User(1); |
|
86 | 86 | |
87 | - $aod_index = new AOD_Index(); |
|
88 | - $result = $aod_index->getDocumentForBean($user); |
|
87 | + $aod_index = new AOD_Index(); |
|
88 | + $result = $aod_index->getDocumentForBean($user); |
|
89 | 89 | |
90 | 90 | |
91 | - //execute the method and verify that it returns an array |
|
92 | - $this->assertTrue(is_array($result)); |
|
91 | + //execute the method and verify that it returns an array |
|
92 | + $this->assertTrue(is_array($result)); |
|
93 | 93 | |
94 | 94 | |
95 | - //verify that returned array has a valid Zend_Search_Lucene_Document instance |
|
96 | - $this->assertInstanceOf('Zend_Search_Lucene_Document', $result['document']); |
|
95 | + //verify that returned array has a valid Zend_Search_Lucene_Document instance |
|
96 | + $this->assertInstanceOf('Zend_Search_Lucene_Document', $result['document']); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | 100 | public function testcommit(){ |
101 | 101 | |
102 | - $aod_index = new AOD_Index(); |
|
103 | - $aod_index->id = 1; |
|
104 | - $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
105 | - |
|
106 | - //execute the method and test if it works and does not throws an exception. |
|
107 | - try { |
|
108 | - $aod_index->commit(); |
|
109 | - $this->assertTrue(true); |
|
110 | - } |
|
111 | - catch (Exception $e) { |
|
112 | - $this->fail(); |
|
113 | - } |
|
102 | + $aod_index = new AOD_Index(); |
|
103 | + $aod_index->id = 1; |
|
104 | + $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
105 | + |
|
106 | + //execute the method and test if it works and does not throws an exception. |
|
107 | + try { |
|
108 | + $aod_index->commit(); |
|
109 | + $this->assertTrue(true); |
|
110 | + } |
|
111 | + catch (Exception $e) { |
|
112 | + $this->fail(); |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | 116 | } |
@@ -118,43 +118,43 @@ discard block |
||
118 | 118 | public function testisModuleSearchable(){ |
119 | 119 | |
120 | 120 | |
121 | - //test with an invalid module |
|
122 | - $this->assertFalse(AOD_Index::isModuleSearchable('','')); |
|
121 | + //test with an invalid module |
|
122 | + $this->assertFalse(AOD_Index::isModuleSearchable('','')); |
|
123 | 123 | |
124 | 124 | |
125 | - //test for modules that are searchable |
|
126 | - $this->assertTrue(AOD_Index::isModuleSearchable('DocumentRevisions','DocumentRevision')); |
|
127 | - $this->assertTrue(AOD_Index::isModuleSearchable('Cases','Case')); |
|
128 | - $this->assertTrue(AOD_Index::isModuleSearchable('Accounts','Account')); |
|
125 | + //test for modules that are searchable |
|
126 | + $this->assertTrue(AOD_Index::isModuleSearchable('DocumentRevisions','DocumentRevision')); |
|
127 | + $this->assertTrue(AOD_Index::isModuleSearchable('Cases','Case')); |
|
128 | + $this->assertTrue(AOD_Index::isModuleSearchable('Accounts','Account')); |
|
129 | 129 | |
130 | 130 | |
131 | - //test for modules that are not searchable |
|
132 | - $this->assertFalse(AOD_Index::isModuleSearchable('AOD_IndexEvent','AOD_IndexEvent')); |
|
133 | - $this->assertFalse(AOD_Index::isModuleSearchable('AOD_Index','AOD_Index')); |
|
134 | - $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Actions','AOW_Action')); |
|
135 | - $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Conditions','AOW_Condition')); |
|
136 | - $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Processed','AOW_Processed')); |
|
137 | - $this->assertFalse(AOD_Index::isModuleSearchable('SchedulersJobs','SchedulersJob')); |
|
138 | - $this->assertFalse(AOD_Index::isModuleSearchable('Users','User')); |
|
131 | + //test for modules that are not searchable |
|
132 | + $this->assertFalse(AOD_Index::isModuleSearchable('AOD_IndexEvent','AOD_IndexEvent')); |
|
133 | + $this->assertFalse(AOD_Index::isModuleSearchable('AOD_Index','AOD_Index')); |
|
134 | + $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Actions','AOW_Action')); |
|
135 | + $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Conditions','AOW_Condition')); |
|
136 | + $this->assertFalse(AOD_Index::isModuleSearchable('AOW_Processed','AOW_Processed')); |
|
137 | + $this->assertFalse(AOD_Index::isModuleSearchable('SchedulersJobs','SchedulersJob')); |
|
138 | + $this->assertFalse(AOD_Index::isModuleSearchable('Users','User')); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | 143 | public function testindex(){ |
144 | 144 | |
145 | - $aod_index = new AOD_Index(); |
|
146 | - $aod_index->id = 1; |
|
147 | - $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
145 | + $aod_index = new AOD_Index(); |
|
146 | + $aod_index->id = 1; |
|
147 | + $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
148 | 148 | |
149 | 149 | |
150 | - //test with a not searchable module, it will return false |
|
151 | - $result = $aod_index->index("Users", 1); |
|
152 | - $this->assertFalse($result); |
|
150 | + //test with a not searchable module, it will return false |
|
151 | + $result = $aod_index->index("Users", 1); |
|
152 | + $this->assertFalse($result); |
|
153 | 153 | |
154 | 154 | |
155 | - //test with a searchable module but invalid bean id, it will still index it |
|
156 | - $result = $aod_index->index("Accounts", 1); |
|
157 | - $this->assertEquals(Null,$result); |
|
155 | + //test with a searchable module but invalid bean id, it will still index it |
|
156 | + $result = $aod_index->index("Accounts", 1); |
|
157 | + $this->assertEquals(Null,$result); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | } |
@@ -162,67 +162,67 @@ discard block |
||
162 | 162 | |
163 | 163 | public function testremove(){ |
164 | 164 | |
165 | - $aod_index = new AOD_Index(); |
|
166 | - $aod_index->id = 1; |
|
167 | - $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
165 | + $aod_index = new AOD_Index(); |
|
166 | + $aod_index->id = 1; |
|
167 | + $aod_index->location = "modules/AOD_Index/Index/Index"; |
|
168 | 168 | |
169 | 169 | |
170 | - //execute the method and test if it works and does not throws an exception. |
|
171 | - try { |
|
172 | - $aod_index->remove("Accounts", 1); |
|
173 | - $this->assertTrue(true); |
|
174 | - } |
|
175 | - catch (Exception $e) { |
|
176 | - $this->fail(); |
|
177 | - } |
|
170 | + //execute the method and test if it works and does not throws an exception. |
|
171 | + try { |
|
172 | + $aod_index->remove("Accounts", 1); |
|
173 | + $this->assertTrue(true); |
|
174 | + } |
|
175 | + catch (Exception $e) { |
|
176 | + $this->fail(); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
181 | 181 | public function testgetIndexableModules(){ |
182 | 182 | |
183 | 183 | |
184 | - $expected = Array ( |
|
185 | - 'AM_ProjectTemplates' => 'AM_ProjectTemplates', |
|
186 | - 'AM_TaskTemplates' => 'AM_TaskTemplates', |
|
187 | - 'AOK_KnowledgeBase' => 'AOK_KnowledgeBase', |
|
188 | - 'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories', |
|
189 | - 'AOP_Case_Events' => 'AOP_Case_Events', |
|
190 | - 'AOP_Case_Updates' => 'AOP_Case_Updates', |
|
191 | - 'AOR_Charts' => 'AOR_Chart', |
|
192 | - 'AOR_Conditions' => 'AOR_Condition', |
|
193 | - 'AOR_Fields' => 'AOR_Field', |
|
194 | - 'AOR_Reports' => 'AOR_Report', |
|
195 | - 'AOS_Contracts' => 'AOS_Contracts', |
|
196 | - 'AOS_Product_Categories' => 'AOS_Product_Categories', |
|
197 | - 'AOW_WorkFlow' => 'AOW_WorkFlow', |
|
198 | - 'Accounts' => 'Account', |
|
199 | - 'Alerts' => 'Alert', |
|
200 | - 'Bugs' => 'Bug', |
|
201 | - 'Calls' => 'Call', |
|
202 | - 'Calls_Reschedule' => 'Calls_Reschedule', |
|
203 | - 'Campaigns' => 'Campaign', |
|
204 | - 'Cases' => 'aCase', |
|
205 | - 'Contacts' => 'Contact', |
|
206 | - 'DocumentRevisions' => 'DocumentRevision', |
|
207 | - 'Documents' => 'Document', |
|
208 | - 'FP_events' => 'FP_events', |
|
209 | - 'Favorites' => 'Favorites', |
|
210 | - 'Leads' => 'Lead', |
|
211 | - 'Meetings' => 'Meeting', |
|
212 | - 'Notes' => 'Note', |
|
213 | - 'Opportunities' => 'Opportunity', |
|
214 | - 'Project' => 'Project', |
|
215 | - 'ProjectTask' => 'ProjectTask', |
|
216 | - 'ProspectLists' => 'ProspectList', |
|
217 | - 'Prospects' => 'Prospect', |
|
218 | - 'Tasks' => 'Task', |
|
219 | - ); |
|
220 | - |
|
221 | - $aod_index = new AOD_Index(); |
|
222 | - |
|
223 | - //execute the method and verify that it retunrs expected results |
|
224 | - $actual = $aod_index->getIndexableModules(); |
|
225 | - $this->assertSame( $expected, $actual); |
|
184 | + $expected = Array ( |
|
185 | + 'AM_ProjectTemplates' => 'AM_ProjectTemplates', |
|
186 | + 'AM_TaskTemplates' => 'AM_TaskTemplates', |
|
187 | + 'AOK_KnowledgeBase' => 'AOK_KnowledgeBase', |
|
188 | + 'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories', |
|
189 | + 'AOP_Case_Events' => 'AOP_Case_Events', |
|
190 | + 'AOP_Case_Updates' => 'AOP_Case_Updates', |
|
191 | + 'AOR_Charts' => 'AOR_Chart', |
|
192 | + 'AOR_Conditions' => 'AOR_Condition', |
|
193 | + 'AOR_Fields' => 'AOR_Field', |
|
194 | + 'AOR_Reports' => 'AOR_Report', |
|
195 | + 'AOS_Contracts' => 'AOS_Contracts', |
|
196 | + 'AOS_Product_Categories' => 'AOS_Product_Categories', |
|
197 | + 'AOW_WorkFlow' => 'AOW_WorkFlow', |
|
198 | + 'Accounts' => 'Account', |
|
199 | + 'Alerts' => 'Alert', |
|
200 | + 'Bugs' => 'Bug', |
|
201 | + 'Calls' => 'Call', |
|
202 | + 'Calls_Reschedule' => 'Calls_Reschedule', |
|
203 | + 'Campaigns' => 'Campaign', |
|
204 | + 'Cases' => 'aCase', |
|
205 | + 'Contacts' => 'Contact', |
|
206 | + 'DocumentRevisions' => 'DocumentRevision', |
|
207 | + 'Documents' => 'Document', |
|
208 | + 'FP_events' => 'FP_events', |
|
209 | + 'Favorites' => 'Favorites', |
|
210 | + 'Leads' => 'Lead', |
|
211 | + 'Meetings' => 'Meeting', |
|
212 | + 'Notes' => 'Note', |
|
213 | + 'Opportunities' => 'Opportunity', |
|
214 | + 'Project' => 'Project', |
|
215 | + 'ProjectTask' => 'ProjectTask', |
|
216 | + 'ProspectLists' => 'ProspectList', |
|
217 | + 'Prospects' => 'Prospect', |
|
218 | + 'Tasks' => 'Task', |
|
219 | + ); |
|
220 | + |
|
221 | + $aod_index = new AOD_Index(); |
|
222 | + |
|
223 | + //execute the method and verify that it retunrs expected results |
|
224 | + $actual = $aod_index->getIndexableModules(); |
|
225 | + $this->assertSame( $expected, $actual); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 |
@@ -5,134 +5,134 @@ |
||
5 | 5 | class ProspectTest extends PHPUnit_Framework_TestCase { |
6 | 6 | |
7 | 7 | |
8 | - public function testProspect() { |
|
8 | + public function testProspect() { |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $prospect = new Prospect(); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $prospect = new Prospect(); |
|
12 | 12 | |
13 | - $this->assertInstanceOf('Prospect',$prospect); |
|
14 | - $this->assertInstanceOf('Person',$prospect); |
|
15 | - $this->assertInstanceOf('SugarBean',$prospect); |
|
13 | + $this->assertInstanceOf('Prospect',$prospect); |
|
14 | + $this->assertInstanceOf('Person',$prospect); |
|
15 | + $this->assertInstanceOf('SugarBean',$prospect); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals('prospects', 'table_name', $prospect); |
|
18 | - $this->assertAttributeEquals('Prospects', 'module_dir', $prospect); |
|
19 | - $this->assertAttributeEquals('Prospect', 'object_name', $prospect); |
|
17 | + $this->assertAttributeEquals('prospects', 'table_name', $prospect); |
|
18 | + $this->assertAttributeEquals('Prospects', 'module_dir', $prospect); |
|
19 | + $this->assertAttributeEquals('Prospect', 'object_name', $prospect); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $prospect); |
|
22 | - $this->assertAttributeEquals(true, 'importable', $prospect); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $prospect); |
|
22 | + $this->assertAttributeEquals(true, 'importable', $prospect); |
|
23 | 23 | |
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | - public function testfill_in_additional_list_fields(){ |
|
27 | + public function testfill_in_additional_list_fields(){ |
|
28 | 28 | |
29 | - error_reporting(E_ERROR | E_PARSE); |
|
29 | + error_reporting(E_ERROR | E_PARSE); |
|
30 | 30 | |
31 | - $prospect = new Prospect(); |
|
31 | + $prospect = new Prospect(); |
|
32 | 32 | |
33 | - $prospect->salutation = "mr"; |
|
34 | - $prospect->title = "lastn firstn"; |
|
35 | - $prospect->first_name = "first"; |
|
36 | - $prospect->first_name = "last"; |
|
37 | - $prospect->email1 = "[email protected]"; |
|
33 | + $prospect->salutation = "mr"; |
|
34 | + $prospect->title = "lastn firstn"; |
|
35 | + $prospect->first_name = "first"; |
|
36 | + $prospect->first_name = "last"; |
|
37 | + $prospect->email1 = "[email protected]"; |
|
38 | 38 | |
39 | - $prospect->fill_in_additional_list_fields(); |
|
39 | + $prospect->fill_in_additional_list_fields(); |
|
40 | 40 | |
41 | - $this->assertAttributeEquals('last', 'full_name', $prospect); |
|
42 | - $this->assertAttributeEquals('last <[email protected]>', 'email_and_name1', $prospect); |
|
41 | + $this->assertAttributeEquals('last', 'full_name', $prospect); |
|
42 | + $this->assertAttributeEquals('last <[email protected]>', 'email_and_name1', $prospect); |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - public function testfill_in_additional_detail_fields(){ |
|
46 | + public function testfill_in_additional_detail_fields(){ |
|
47 | 47 | |
48 | - $prospect = new Prospect(); |
|
48 | + $prospect = new Prospect(); |
|
49 | 49 | |
50 | - $prospect->salutation = "mr"; |
|
51 | - $prospect->title = "lastn firstn"; |
|
52 | - $prospect->first_name = "first"; |
|
53 | - $prospect->first_name = "last"; |
|
54 | - $prospect->email1 = "[email protected]"; |
|
50 | + $prospect->salutation = "mr"; |
|
51 | + $prospect->title = "lastn firstn"; |
|
52 | + $prospect->first_name = "first"; |
|
53 | + $prospect->first_name = "last"; |
|
54 | + $prospect->email1 = "[email protected]"; |
|
55 | 55 | |
56 | - $prospect->fill_in_additional_detail_fields(); |
|
56 | + $prospect->fill_in_additional_detail_fields(); |
|
57 | 57 | |
58 | - $this->assertAttributeEquals('last', 'full_name', $prospect); |
|
58 | + $this->assertAttributeEquals('last', 'full_name', $prospect); |
|
59 | 59 | |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - public function testbuild_generic_where_clause (){ |
|
63 | + public function testbuild_generic_where_clause (){ |
|
64 | 64 | |
65 | - $prospect = new Prospect(); |
|
65 | + $prospect = new Prospect(); |
|
66 | 66 | |
67 | - //test with empty string params |
|
68 | - $expected = "prospects.last_name like '%' or prospects.first_name like '%' or prospects.assistant like '%'"; |
|
69 | - $actual = $prospect->build_generic_where_clause(''); |
|
70 | - $this->assertSame($expected,$actual); |
|
67 | + //test with empty string params |
|
68 | + $expected = "prospects.last_name like '%' or prospects.first_name like '%' or prospects.assistant like '%'"; |
|
69 | + $actual = $prospect->build_generic_where_clause(''); |
|
70 | + $this->assertSame($expected,$actual); |
|
71 | 71 | |
72 | 72 | |
73 | - //test with valid string params |
|
74 | - $expected = "prospects.last_name like '%' or prospects.first_name like '%' or prospects.assistant like '%'"; |
|
75 | - $actual = $prospect->build_generic_where_clause('1'); |
|
76 | - $this->assertSame($expected,$actual); |
|
73 | + //test with valid string params |
|
74 | + $expected = "prospects.last_name like '%' or prospects.first_name like '%' or prospects.assistant like '%'"; |
|
75 | + $actual = $prospect->build_generic_where_clause('1'); |
|
76 | + $this->assertSame($expected,$actual); |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | public function testconverted_prospect(){ |
81 | 81 | |
82 | - $prospect = new Prospect(); |
|
82 | + $prospect = new Prospect(); |
|
83 | 83 | |
84 | - //execute the method and test if it works and does not throws an exception. |
|
85 | - try { |
|
86 | - //$prospect->converted_prospect('1', '2', '3', '4'); |
|
87 | - $this->assertTrue(true); |
|
88 | - } |
|
89 | - catch (Exception $e) { |
|
90 | - $this->fail(); |
|
91 | - } |
|
84 | + //execute the method and test if it works and does not throws an exception. |
|
85 | + try { |
|
86 | + //$prospect->converted_prospect('1', '2', '3', '4'); |
|
87 | + $this->assertTrue(true); |
|
88 | + } |
|
89 | + catch (Exception $e) { |
|
90 | + $this->fail(); |
|
91 | + } |
|
92 | 92 | |
93 | - $this->markTestIncomplete('Multiple errors in query'); |
|
93 | + $this->markTestIncomplete('Multiple errors in query'); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
97 | - public function testbean_implements(){ |
|
97 | + public function testbean_implements(){ |
|
98 | 98 | |
99 | - $prospect = new Prospect(); |
|
99 | + $prospect = new Prospect(); |
|
100 | 100 | |
101 | - $this->assertEquals(false, $prospect->bean_implements('')); //test with blank value |
|
102 | - $this->assertEquals(false, $prospect->bean_implements('test')); //test with invalid value |
|
103 | - $this->assertEquals(true, $prospect->bean_implements('ACL')); //test with valid value |
|
101 | + $this->assertEquals(false, $prospect->bean_implements('')); //test with blank value |
|
102 | + $this->assertEquals(false, $prospect->bean_implements('test')); //test with invalid value |
|
103 | + $this->assertEquals(true, $prospect->bean_implements('ACL')); //test with valid value |
|
104 | 104 | |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | 107 | |
108 | 108 | public function testretrieveTargetList(){ |
109 | 109 | |
110 | - $prospect = new Prospect(); |
|
110 | + $prospect = new Prospect(); |
|
111 | 111 | |
112 | - $result = $prospect->retrieveTargetList('', array('id','first_name'),0, 1, 1, 0, 'Accounts'); |
|
113 | - $this->assertTrue(is_array($result)); |
|
112 | + $result = $prospect->retrieveTargetList('', array('id','first_name'),0, 1, 1, 0, 'Accounts'); |
|
113 | + $this->assertTrue(is_array($result)); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | 118 | public function testretrieveTarget(){ |
119 | 119 | |
120 | - $prospect = new Prospect(); |
|
120 | + $prospect = new Prospect(); |
|
121 | 121 | |
122 | - $result = $prospect->retrieveTarget(''); |
|
123 | - $this->assertEquals(null, $result); |
|
122 | + $result = $prospect->retrieveTarget(''); |
|
123 | + $this->assertEquals(null, $result); |
|
124 | 124 | |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | 127 | |
128 | - public function testget_unlinked_email_query() { |
|
128 | + public function testget_unlinked_email_query() { |
|
129 | 129 | |
130 | - $prospect = new Prospect(); |
|
130 | + $prospect = new Prospect(); |
|
131 | 131 | |
132 | - $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Prospects' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Prospects' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
133 | - $actual = $prospect->get_unlinked_email_query(); |
|
134 | - $this->assertSame($expected, $actual); |
|
132 | + $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Prospects' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Prospects' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
133 | + $actual = $prospect->get_unlinked_email_query(); |
|
134 | + $this->assertSame($expected, $actual); |
|
135 | 135 | |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | } |
@@ -3,170 +3,170 @@ |
||
3 | 3 | class EAPMTest extends PHPUnit_Framework_TestCase{ |
4 | 4 | |
5 | 5 | |
6 | - public function testEAPM() { |
|
6 | + public function testEAPM() { |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $eapm = new EAPM(); |
|
10 | - $this->assertInstanceOf('EAPM',$eapm); |
|
11 | - $this->assertInstanceOf('Basic',$eapm); |
|
12 | - $this->assertInstanceOf('SugarBean',$eapm); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $eapm = new EAPM(); |
|
10 | + $this->assertInstanceOf('EAPM',$eapm); |
|
11 | + $this->assertInstanceOf('Basic',$eapm); |
|
12 | + $this->assertInstanceOf('SugarBean',$eapm); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('EAPM', 'module_dir', $eapm); |
|
15 | - $this->assertAttributeEquals('EAPM', 'object_name', $eapm); |
|
16 | - $this->assertAttributeEquals('eapm', 'table_name', $eapm); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $eapm); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $eapm); |
|
19 | - $this->assertAttributeEquals(false, 'validated', $eapm); |
|
20 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $eapm); |
|
14 | + $this->assertAttributeEquals('EAPM', 'module_dir', $eapm); |
|
15 | + $this->assertAttributeEquals('EAPM', 'object_name', $eapm); |
|
16 | + $this->assertAttributeEquals('eapm', 'table_name', $eapm); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $eapm); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $eapm); |
|
19 | + $this->assertAttributeEquals(false, 'validated', $eapm); |
|
20 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $eapm); |
|
21 | 21 | |
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testbean_implements() |
|
26 | - { |
|
27 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + public function testbean_implements() |
|
26 | + { |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $eapm = new EAPM(); |
|
30 | - $this->assertEquals(false, $eapm->bean_implements('')); //test with blank value |
|
31 | - $this->assertEquals(false, $eapm->bean_implements('test')); //test with invalid value |
|
32 | - $this->assertEquals(true, $eapm->bean_implements('ACL')); //test with valid value |
|
33 | - } |
|
29 | + $eapm = new EAPM(); |
|
30 | + $this->assertEquals(false, $eapm->bean_implements('')); //test with blank value |
|
31 | + $this->assertEquals(false, $eapm->bean_implements('test')); //test with invalid value |
|
32 | + $this->assertEquals(true, $eapm->bean_implements('ACL')); //test with valid value |
|
33 | + } |
|
34 | 34 | |
35 | - public function testgetLoginInfo() |
|
36 | - { |
|
37 | - $eapm = new EAPM(); |
|
35 | + public function testgetLoginInfo() |
|
36 | + { |
|
37 | + $eapm = new EAPM(); |
|
38 | 38 | |
39 | - //test with default value/false |
|
40 | - $result = $eapm->getLoginInfo(''); |
|
41 | - $this->assertEquals(null,$result); |
|
39 | + //test with default value/false |
|
40 | + $result = $eapm->getLoginInfo(''); |
|
41 | + $this->assertEquals(null,$result); |
|
42 | 42 | |
43 | 43 | |
44 | - //test with true |
|
45 | - $result = $eapm->getLoginInfo('',true); |
|
46 | - $this->assertEquals(null,$result); |
|
44 | + //test with true |
|
45 | + $result = $eapm->getLoginInfo('',true); |
|
46 | + $this->assertEquals(null,$result); |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function testcreate_new_list_query() |
|
51 | - { |
|
52 | - $eapm = new EAPM(); |
|
50 | + public function testcreate_new_list_query() |
|
51 | + { |
|
52 | + $eapm = new EAPM(); |
|
53 | 53 | |
54 | - //test with empty string params |
|
55 | - $expected = " SELECT eapm.* , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM eapm LEFT JOIN users jt0 ON eapm.modified_user_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 LEFT JOIN users jt1 ON eapm.created_by=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 LEFT JOIN users jt2 ON eapm.assigned_user_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where ( eapm.assigned_user_id ='' ) AND eapm.deleted=0"; |
|
56 | - $actual = $eapm->create_new_list_query('',''); |
|
57 | - $this->assertSame($expected,$actual); |
|
54 | + //test with empty string params |
|
55 | + $expected = " SELECT eapm.* , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM eapm LEFT JOIN users jt0 ON eapm.modified_user_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 LEFT JOIN users jt1 ON eapm.created_by=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 LEFT JOIN users jt2 ON eapm.assigned_user_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where ( eapm.assigned_user_id ='' ) AND eapm.deleted=0"; |
|
56 | + $actual = $eapm->create_new_list_query('',''); |
|
57 | + $this->assertSame($expected,$actual); |
|
58 | 58 | |
59 | 59 | |
60 | - //test with valid string params |
|
61 | - $expected = " SELECT eapm.* , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM eapm LEFT JOIN users jt0 ON eapm.modified_user_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 LEFT JOIN users jt1 ON eapm.created_by=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 LEFT JOIN users jt2 ON eapm.assigned_user_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (eapm.name=\"\" AND eapm.assigned_user_id ='' ) AND eapm.deleted=0"; |
|
62 | - $actual = $eapm->create_new_list_query('eapm.id','eapm.name=""'); |
|
63 | - $this->assertSame($expected,$actual); |
|
60 | + //test with valid string params |
|
61 | + $expected = " SELECT eapm.* , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM eapm LEFT JOIN users jt0 ON eapm.modified_user_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 LEFT JOIN users jt1 ON eapm.created_by=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 LEFT JOIN users jt2 ON eapm.assigned_user_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (eapm.name=\"\" AND eapm.assigned_user_id ='' ) AND eapm.deleted=0"; |
|
62 | + $actual = $eapm->create_new_list_query('eapm.id','eapm.name=""'); |
|
63 | + $this->assertSame($expected,$actual); |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - public function testsaveAndMarkDeletedAndValidated() { |
|
67 | + public function testsaveAndMarkDeletedAndValidated() { |
|
68 | 68 | |
69 | - $eapm = new EAPM(); |
|
69 | + $eapm = new EAPM(); |
|
70 | 70 | |
71 | - $eapm->name = "test"; |
|
72 | - $eapm->url ="test_url"; |
|
73 | - $eapm->application = "webex"; |
|
71 | + $eapm->name = "test"; |
|
72 | + $eapm->url ="test_url"; |
|
73 | + $eapm->application = "webex"; |
|
74 | 74 | |
75 | - //test validated method initially |
|
76 | - $this->assertEquals(false, $eapm->validated()); |
|
75 | + //test validated method initially |
|
76 | + $this->assertEquals(false, $eapm->validated()); |
|
77 | 77 | |
78 | 78 | |
79 | - $eapm->save(); |
|
79 | + $eapm->save(); |
|
80 | 80 | |
81 | - //test for record ID to verify that record is saved |
|
82 | - $this->assertTrue(isset($eapm->id)); |
|
83 | - $this->assertEquals(36, strlen($eapm->id)); |
|
81 | + //test for record ID to verify that record is saved |
|
82 | + $this->assertTrue(isset($eapm->id)); |
|
83 | + $this->assertEquals(36, strlen($eapm->id)); |
|
84 | 84 | |
85 | 85 | |
86 | - //test validated method finally after save |
|
87 | - $this->assertEquals(null, $eapm->validated()); |
|
86 | + //test validated method finally after save |
|
87 | + $this->assertEquals(null, $eapm->validated()); |
|
88 | 88 | |
89 | 89 | |
90 | - //retrieve back to test if validated attribute is updated in db |
|
91 | - $eapmValidated = $eapm->retrieve($eapm->id); |
|
92 | - //$this->assertEquals(1, $eapmValidated->validated); |
|
93 | - $this->markTestSkipped('Validated column never gets updated in Db '); |
|
90 | + //retrieve back to test if validated attribute is updated in db |
|
91 | + $eapmValidated = $eapm->retrieve($eapm->id); |
|
92 | + //$this->assertEquals(1, $eapmValidated->validated); |
|
93 | + $this->markTestSkipped('Validated column never gets updated in Db '); |
|
94 | 94 | |
95 | 95 | |
96 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
97 | - $eapm->mark_deleted($eapm->id); |
|
98 | - $result = $eapm->retrieve($eapm->id); |
|
99 | - $this->assertEquals(null,$result); |
|
96 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
97 | + $eapm->mark_deleted($eapm->id); |
|
98 | + $result = $eapm->retrieve($eapm->id); |
|
99 | + $this->assertEquals(null,$result); |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | - public function testfill_in_additional_detail_fields() |
|
105 | - { |
|
106 | - $eapm = new EAPM(); |
|
104 | + public function testfill_in_additional_detail_fields() |
|
105 | + { |
|
106 | + $eapm = new EAPM(); |
|
107 | 107 | |
108 | - //execute the method and test if it works and does not throws an exception. |
|
109 | - try { |
|
110 | - $eapm->fill_in_additional_detail_fields(); |
|
111 | - $this->assertTrue(true); |
|
112 | - } |
|
113 | - catch (Exception $e) { |
|
114 | - $this->fail(); |
|
115 | - } |
|
108 | + //execute the method and test if it works and does not throws an exception. |
|
109 | + try { |
|
110 | + $eapm->fill_in_additional_detail_fields(); |
|
111 | + $this->assertTrue(true); |
|
112 | + } |
|
113 | + catch (Exception $e) { |
|
114 | + $this->fail(); |
|
115 | + } |
|
116 | 116 | |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | - public function testfill_in_additional_list_fields() |
|
120 | - { |
|
121 | - $eapm = new EAPM(); |
|
119 | + public function testfill_in_additional_list_fields() |
|
120 | + { |
|
121 | + $eapm = new EAPM(); |
|
122 | 122 | |
123 | - //execute the method and test if it works and does not throws an exception. |
|
124 | - try { |
|
125 | - $eapm->fill_in_additional_list_fields(); |
|
126 | - $this->assertTrue(true); |
|
127 | - } |
|
128 | - catch (Exception $e) { |
|
129 | - $this->fail(); |
|
130 | - } |
|
123 | + //execute the method and test if it works and does not throws an exception. |
|
124 | + try { |
|
125 | + $eapm->fill_in_additional_list_fields(); |
|
126 | + $this->assertTrue(true); |
|
127 | + } |
|
128 | + catch (Exception $e) { |
|
129 | + $this->fail(); |
|
130 | + } |
|
131 | 131 | |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - public function testsave_cleanup() |
|
135 | - { |
|
136 | - $eapm = new EAPM(); |
|
134 | + public function testsave_cleanup() |
|
135 | + { |
|
136 | + $eapm = new EAPM(); |
|
137 | 137 | |
138 | - //execute the method and verify attributes are set accordingly |
|
139 | - $eapm->save_cleanup(); |
|
138 | + //execute the method and verify attributes are set accordingly |
|
139 | + $eapm->save_cleanup(); |
|
140 | 140 | |
141 | - $this->assertEquals("", $eapm->oauth_token ); |
|
142 | - $this->assertEquals("", $eapm->oauth_secret ); |
|
143 | - $this->assertEquals("", $eapm->api_data ); |
|
141 | + $this->assertEquals("", $eapm->oauth_token ); |
|
142 | + $this->assertEquals("", $eapm->oauth_secret ); |
|
143 | + $this->assertEquals("", $eapm->api_data ); |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | - public function testdelete_user_accounts(){ |
|
148 | + public function testdelete_user_accounts(){ |
|
149 | 149 | |
150 | - $eapm = new EAPM(); |
|
150 | + $eapm = new EAPM(); |
|
151 | 151 | |
152 | - //execute the method and test if it works and does not throws an exception. |
|
153 | - try { |
|
154 | - $eapm->delete_user_accounts(1); |
|
155 | - $this->assertTrue(true); |
|
156 | - } |
|
157 | - catch (Exception $e) { |
|
158 | - $this->fail(); |
|
159 | - } |
|
152 | + //execute the method and test if it works and does not throws an exception. |
|
153 | + try { |
|
154 | + $eapm->delete_user_accounts(1); |
|
155 | + $this->assertTrue(true); |
|
156 | + } |
|
157 | + catch (Exception $e) { |
|
158 | + $this->fail(); |
|
159 | + } |
|
160 | 160 | |
161 | - } |
|
161 | + } |
|
162 | 162 | |
163 | 163 | |
164 | - public function testgetEAPMExternalApiDropDown() { |
|
164 | + public function testgetEAPMExternalApiDropDown() { |
|
165 | 165 | |
166 | - $result = getEAPMExternalApiDropDown(); |
|
167 | - $this->assertEquals(array(""=>""),$result); |
|
166 | + $result = getEAPMExternalApiDropDown(); |
|
167 | + $this->assertEquals(array(""=>""),$result); |
|
168 | 168 | |
169 | - } |
|
169 | + } |
|
170 | 170 | |
171 | 171 | } |
172 | 172 |
@@ -4,232 +4,232 @@ |
||
4 | 4 | class AccountTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testAccount() { |
|
7 | + public function testAccount() { |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and type attribute |
|
10 | - $Account = new Account(); |
|
11 | - $this->assertInstanceOf('Account',$Account); |
|
12 | - $this->assertInstanceOf('Company',$Account); |
|
13 | - $this->assertInstanceOf('SugarBean',$Account); |
|
14 | - $this->assertTrue(is_array($Account->field_name_map)); |
|
15 | - $this->assertTrue(is_array($Account->field_defs)); |
|
9 | + //execute the contructor and check for the Object type and type attribute |
|
10 | + $Account = new Account(); |
|
11 | + $this->assertInstanceOf('Account',$Account); |
|
12 | + $this->assertInstanceOf('Company',$Account); |
|
13 | + $this->assertInstanceOf('SugarBean',$Account); |
|
14 | + $this->assertTrue(is_array($Account->field_name_map)); |
|
15 | + $this->assertTrue(is_array($Account->field_defs)); |
|
16 | 16 | |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | 19 | |
20 | - public function testget_summary_text() |
|
21 | - { |
|
22 | - error_reporting(E_ERROR | E_PARSE); |
|
20 | + public function testget_summary_text() |
|
21 | + { |
|
22 | + error_reporting(E_ERROR | E_PARSE); |
|
23 | 23 | |
24 | - //test without name setting attribute |
|
25 | - $Account = new Account(); |
|
26 | - $name = $Account->get_summary_text(); |
|
27 | - $this->assertEquals(Null,$name); |
|
24 | + //test without name setting attribute |
|
25 | + $Account = new Account(); |
|
26 | + $name = $Account->get_summary_text(); |
|
27 | + $this->assertEquals(Null,$name); |
|
28 | 28 | |
29 | - //test with name attribute set |
|
30 | - $Account->name = "test account"; |
|
31 | - $name = $Account->get_summary_text(); |
|
32 | - $this->assertEquals('test account',$name); |
|
29 | + //test with name attribute set |
|
30 | + $Account->name = "test account"; |
|
31 | + $name = $Account->get_summary_text(); |
|
32 | + $this->assertEquals('test account',$name); |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - public function testget_contacts() { |
|
37 | + public function testget_contacts() { |
|
38 | 38 | |
39 | - $Account = new Account(''); |
|
39 | + $Account = new Account(''); |
|
40 | 40 | |
41 | - //execute the method and verify that it returns an array |
|
42 | - $contacts = $Account->get_contacts(); |
|
43 | - $this->assertTrue(is_array($contacts)); |
|
41 | + //execute the method and verify that it returns an array |
|
42 | + $contacts = $Account->get_contacts(); |
|
43 | + $this->assertTrue(is_array($contacts)); |
|
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - public function testclear_account_case_relationship() |
|
49 | - { |
|
50 | - //This method cannot be tested because Query has a wrong column name which makes the function to die. |
|
48 | + public function testclear_account_case_relationship() |
|
49 | + { |
|
50 | + //This method cannot be tested because Query has a wrong column name which makes the function to die. |
|
51 | 51 | |
52 | - /*$Account = new Account(); |
|
52 | + /*$Account = new Account(); |
|
53 | 53 | $Account->clear_account_case_relationship('','');*/ |
54 | 54 | |
55 | - $this->markTestIncomplete('Can Not be implemented - Query has a wrong column name which makes the function to die'); |
|
56 | - } |
|
55 | + $this->markTestIncomplete('Can Not be implemented - Query has a wrong column name which makes the function to die'); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - public function testremove_redundant_http() |
|
60 | - { |
|
59 | + public function testremove_redundant_http() |
|
60 | + { |
|
61 | 61 | |
62 | - $Account = new Account(); |
|
62 | + $Account = new Account(); |
|
63 | 63 | |
64 | - //this method has no implementation. so test for exceptions only. |
|
65 | - try { |
|
66 | - $Account->remove_redundant_http(); |
|
67 | - $this->assertTrue(true); |
|
68 | - } |
|
69 | - catch (Exception $e) { |
|
70 | - $this->fail(); |
|
71 | - } |
|
64 | + //this method has no implementation. so test for exceptions only. |
|
65 | + try { |
|
66 | + $Account->remove_redundant_http(); |
|
67 | + $this->assertTrue(true); |
|
68 | + } |
|
69 | + catch (Exception $e) { |
|
70 | + $this->fail(); |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | - public function testfill_in_additional_list_fields() |
|
78 | - { |
|
79 | - $Account = new Account(''); |
|
77 | + public function testfill_in_additional_list_fields() |
|
78 | + { |
|
79 | + $Account = new Account(''); |
|
80 | 80 | |
81 | - //execute the method and test if it works and does not throws an exception. |
|
82 | - try { |
|
83 | - $Account->fill_in_additional_list_fields(); |
|
84 | - $this->assertTrue(true); |
|
85 | - } |
|
86 | - catch (Exception $e) { |
|
87 | - $this->fail(); |
|
88 | - } |
|
81 | + //execute the method and test if it works and does not throws an exception. |
|
82 | + try { |
|
83 | + $Account->fill_in_additional_list_fields(); |
|
84 | + $this->assertTrue(true); |
|
85 | + } |
|
86 | + catch (Exception $e) { |
|
87 | + $this->fail(); |
|
88 | + } |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - public function testfill_in_additional_detail_fields() |
|
94 | - { |
|
95 | - $Account = new Account(''); |
|
93 | + public function testfill_in_additional_detail_fields() |
|
94 | + { |
|
95 | + $Account = new Account(''); |
|
96 | 96 | |
97 | - //execute the method and test if it works and does not throws an exception. |
|
98 | - try { |
|
99 | - $Account->fill_in_additional_detail_fields(); |
|
100 | - $this->assertTrue(true); |
|
101 | - } |
|
102 | - catch (Exception $e) { |
|
103 | - $this->fail(); |
|
104 | - } |
|
97 | + //execute the method and test if it works and does not throws an exception. |
|
98 | + try { |
|
99 | + $Account->fill_in_additional_detail_fields(); |
|
100 | + $this->assertTrue(true); |
|
101 | + } |
|
102 | + catch (Exception $e) { |
|
103 | + $this->fail(); |
|
104 | + } |
|
105 | 105 | |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | - public function testget_list_view_data() |
|
110 | - { |
|
109 | + public function testget_list_view_data() |
|
110 | + { |
|
111 | 111 | |
112 | - $expected = array ( |
|
113 | - 'DELETED' => 0, |
|
114 | - 'EMAIL1' => '', |
|
115 | - 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Accounts\\u0026parent_id=\\u0026parent_name=\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Accounts\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Accounts","parent_id":"","parent_name":"","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Accounts","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
116 | - 'ENCODED_NAME' => NULL, |
|
117 | - 'CITY' => NULL, |
|
118 | - 'BILLING_ADDRESS_STREET' => NULL, |
|
119 | - 'SHIPPING_ADDRESS_STREET' => NULL, |
|
120 | - ); |
|
112 | + $expected = array ( |
|
113 | + 'DELETED' => 0, |
|
114 | + 'EMAIL1' => '', |
|
115 | + 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Accounts\\u0026parent_id=\\u0026parent_name=\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Accounts\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Accounts","parent_id":"","parent_name":"","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Accounts","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
116 | + 'ENCODED_NAME' => NULL, |
|
117 | + 'CITY' => NULL, |
|
118 | + 'BILLING_ADDRESS_STREET' => NULL, |
|
119 | + 'SHIPPING_ADDRESS_STREET' => NULL, |
|
120 | + ); |
|
121 | 121 | |
122 | - $Account = new Account(); |
|
122 | + $Account = new Account(); |
|
123 | 123 | |
124 | - //execute the method and verify that it retunrs expected results |
|
125 | - $actual = $Account->get_list_view_data(); |
|
126 | - $this->assertSame($expected, $actual); |
|
124 | + //execute the method and verify that it retunrs expected results |
|
125 | + $actual = $Account->get_list_view_data(); |
|
126 | + $this->assertSame($expected, $actual); |
|
127 | 127 | |
128 | - } |
|
128 | + } |
|
129 | 129 | |
130 | 130 | |
131 | - public function testbuild_generic_where_clause () |
|
132 | - { |
|
133 | - $Account = new Account(); |
|
131 | + public function testbuild_generic_where_clause () |
|
132 | + { |
|
133 | + $Account = new Account(); |
|
134 | 134 | |
135 | - //execute the method with a string as parameter and verify that it retunrs expected results |
|
136 | - $expected = "accounts.name like 'value%'"; |
|
137 | - $actual = $Account->build_generic_where_clause('value'); |
|
138 | - $this->assertSame($expected, $actual); |
|
135 | + //execute the method with a string as parameter and verify that it retunrs expected results |
|
136 | + $expected = "accounts.name like 'value%'"; |
|
137 | + $actual = $Account->build_generic_where_clause('value'); |
|
138 | + $this->assertSame($expected, $actual); |
|
139 | 139 | |
140 | - //execute the method with number as parameter and verify that it retunrs expected results |
|
141 | - $expected = "accounts.name like '1234%' or accounts.phone_alternate like '%1234%' or accounts.phone_fax like '%1234%' or accounts.phone_office like '%1234%'"; |
|
142 | - $actual = $Account->build_generic_where_clause('1234'); |
|
143 | - $this->assertSame($expected, $actual); |
|
140 | + //execute the method with number as parameter and verify that it retunrs expected results |
|
141 | + $expected = "accounts.name like '1234%' or accounts.phone_alternate like '%1234%' or accounts.phone_fax like '%1234%' or accounts.phone_office like '%1234%'"; |
|
142 | + $actual = $Account->build_generic_where_clause('1234'); |
|
143 | + $this->assertSame($expected, $actual); |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | 148 | public function testcreate_export_query() |
149 | 149 | { |
150 | 150 | |
151 | - $Account = new Account(); |
|
151 | + $Account = new Account(); |
|
152 | 152 | |
153 | - //execute the method with empty strings and verify that it retunrs expected results |
|
154 | - $expected = "SELECT\n accounts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM accounts LEFT JOIN users\n ON accounts.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Accounts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where ( accounts.deleted IS NULL OR accounts.deleted=0 )"; |
|
155 | - $actual = $Account->create_export_query('', ''); |
|
156 | - $this->assertSame($expected, $actual); |
|
153 | + //execute the method with empty strings and verify that it retunrs expected results |
|
154 | + $expected = "SELECT\n accounts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM accounts LEFT JOIN users\n ON accounts.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Accounts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where ( accounts.deleted IS NULL OR accounts.deleted=0 )"; |
|
155 | + $actual = $Account->create_export_query('', ''); |
|
156 | + $this->assertSame($expected, $actual); |
|
157 | 157 | |
158 | 158 | |
159 | - //execute the method with valid parameter values and verify that it retunrs expected results |
|
160 | - $expected = "SELECT\n accounts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM accounts LEFT JOIN users\n ON accounts.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Accounts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where (name not null) AND ( accounts.deleted IS NULL OR accounts.deleted=0 ) ORDER BY accounts.name"; |
|
161 | - $actual = $Account->create_export_query('name','name not null'); |
|
162 | - $this->assertSame($expected, $actual); |
|
159 | + //execute the method with valid parameter values and verify that it retunrs expected results |
|
160 | + $expected = "SELECT\n accounts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM accounts LEFT JOIN users\n ON accounts.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Accounts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where (name not null) AND ( accounts.deleted IS NULL OR accounts.deleted=0 ) ORDER BY accounts.name"; |
|
161 | + $actual = $Account->create_export_query('name','name not null'); |
|
162 | + $this->assertSame($expected, $actual); |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | - public function testset_notification_body() |
|
168 | - { |
|
169 | - $Account = new Account(); |
|
167 | + public function testset_notification_body() |
|
168 | + { |
|
169 | + $Account = new Account(); |
|
170 | 170 | |
171 | - //execute the method and test if populates provided sugar_smarty |
|
172 | - $result = $Account->set_notification_body(new Sugar_Smarty(),new Account()); |
|
173 | - $this->assertInstanceOf('Sugar_Smarty',$result); |
|
174 | - $this->assertNotEquals(new Sugar_Smarty(), $result); |
|
171 | + //execute the method and test if populates provided sugar_smarty |
|
172 | + $result = $Account->set_notification_body(new Sugar_Smarty(),new Account()); |
|
173 | + $this->assertInstanceOf('Sugar_Smarty',$result); |
|
174 | + $this->assertNotEquals(new Sugar_Smarty(), $result); |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - public function testbean_implements() |
|
180 | - { |
|
181 | - $Account = new Account(); |
|
179 | + public function testbean_implements() |
|
180 | + { |
|
181 | + $Account = new Account(); |
|
182 | 182 | |
183 | - $this->assertTrue($Account->bean_implements('ACL')); //test with valid value |
|
184 | - $this->assertFalse($Account->bean_implements('')); //test with empty value |
|
185 | - $this->assertFalse($Account->bean_implements('Basic'));//test with invalid value |
|
183 | + $this->assertTrue($Account->bean_implements('ACL')); //test with valid value |
|
184 | + $this->assertFalse($Account->bean_implements('')); //test with empty value |
|
185 | + $this->assertFalse($Account->bean_implements('Basic'));//test with invalid value |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | |
190 | 190 | |
191 | - public function testget_unlinked_email_query() |
|
192 | - { |
|
193 | - $Account = new Account(); |
|
191 | + public function testget_unlinked_email_query() |
|
192 | + { |
|
193 | + $Account = new Account(); |
|
194 | 194 | |
195 | - //without setting type parameter |
|
196 | - $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Accounts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Accounts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
197 | - $actual = $Account->get_unlinked_email_query(); |
|
198 | - $this->assertSame($expected, $actual); |
|
195 | + //without setting type parameter |
|
196 | + $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Accounts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Accounts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
197 | + $actual = $Account->get_unlinked_email_query(); |
|
198 | + $this->assertSame($expected, $actual); |
|
199 | 199 | |
200 | 200 | |
201 | 201 | |
202 | - //with type parameter set |
|
203 | - $expected = array ('select' => 'SELECT emails.id ', |
|
204 | - 'from' => 'FROM emails ', |
|
205 | - 'where' => '', |
|
206 | - 'join' => " JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Accounts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Accounts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id", |
|
207 | - 'join_tables' => array (''), |
|
208 | - ); |
|
202 | + //with type parameter set |
|
203 | + $expected = array ('select' => 'SELECT emails.id ', |
|
204 | + 'from' => 'FROM emails ', |
|
205 | + 'where' => '', |
|
206 | + 'join' => " JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Accounts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Accounts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id", |
|
207 | + 'join_tables' => array (''), |
|
208 | + ); |
|
209 | 209 | |
210 | - $actual = $Account->get_unlinked_email_query(array('return_as_array'=>'true')); |
|
211 | - $this->assertSame($expected, $actual); |
|
210 | + $actual = $Account->get_unlinked_email_query(array('return_as_array'=>'true')); |
|
211 | + $this->assertSame($expected, $actual); |
|
212 | 212 | |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | - public function testgetProductsServicesPurchasedQuery() |
|
217 | - { |
|
216 | + public function testgetProductsServicesPurchasedQuery() |
|
217 | + { |
|
218 | 218 | |
219 | - $Account = new Account(); |
|
219 | + $Account = new Account(); |
|
220 | 220 | |
221 | - //without account id |
|
222 | - $expected = "\n SELECT\n aos_products_quotes.*\n FROM\n aos_products_quotes\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage LIKE 'Closed Accepted' AND aos_quotes.deleted = 0 AND aos_products_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id AND accounts.id = ''\n\n "; |
|
223 | - $actual = $Account->getProductsServicesPurchasedQuery(); |
|
224 | - $this->assertSame($expected, $actual); |
|
221 | + //without account id |
|
222 | + $expected = "\n SELECT\n aos_products_quotes.*\n FROM\n aos_products_quotes\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage LIKE 'Closed Accepted' AND aos_quotes.deleted = 0 AND aos_products_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id AND accounts.id = ''\n\n "; |
|
223 | + $actual = $Account->getProductsServicesPurchasedQuery(); |
|
224 | + $this->assertSame($expected, $actual); |
|
225 | 225 | |
226 | 226 | |
227 | - //with account id |
|
228 | - $expected = "\n SELECT\n aos_products_quotes.*\n FROM\n aos_products_quotes\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage LIKE 'Closed Accepted' AND aos_quotes.deleted = 0 AND aos_products_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id AND accounts.id = '1234'\n\n "; |
|
229 | - $Account->id = '1234'; |
|
230 | - $actual = $Account->getProductsServicesPurchasedQuery(); |
|
231 | - $this->assertSame($expected, $actual); |
|
227 | + //with account id |
|
228 | + $expected = "\n SELECT\n aos_products_quotes.*\n FROM\n aos_products_quotes\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage LIKE 'Closed Accepted' AND aos_quotes.deleted = 0 AND aos_products_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id AND accounts.id = '1234'\n\n "; |
|
229 | + $Account->id = '1234'; |
|
230 | + $actual = $Account->getProductsServicesPurchasedQuery(); |
|
231 | + $this->assertSame($expected, $actual); |
|
232 | 232 | |
233 | - } |
|
233 | + } |
|
234 | 234 | |
235 | 235 | } |
@@ -3,42 +3,42 @@ |
||
3 | 3 | class AOS_InvoicesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAOS_Invoices(){ |
|
6 | + public function testAOS_Invoices(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aosInvoices = new AOS_Invoices(); |
|
10 | - $this->assertInstanceOf('AOS_Invoices',$aosInvoices); |
|
11 | - $this->assertInstanceOf('Basic',$aosInvoices); |
|
12 | - $this->assertInstanceOf('SugarBean',$aosInvoices); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aosInvoices = new AOS_Invoices(); |
|
10 | + $this->assertInstanceOf('AOS_Invoices',$aosInvoices); |
|
11 | + $this->assertInstanceOf('Basic',$aosInvoices); |
|
12 | + $this->assertInstanceOf('SugarBean',$aosInvoices); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOS_Invoices', 'module_dir', $aosInvoices); |
|
15 | - $this->assertAttributeEquals('AOS_Invoices', 'object_name', $aosInvoices); |
|
16 | - $this->assertAttributeEquals('aos_invoices', 'table_name', $aosInvoices); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aosInvoices); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosInvoices); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $aosInvoices); |
|
14 | + $this->assertAttributeEquals('AOS_Invoices', 'module_dir', $aosInvoices); |
|
15 | + $this->assertAttributeEquals('AOS_Invoices', 'object_name', $aosInvoices); |
|
16 | + $this->assertAttributeEquals('aos_invoices', 'table_name', $aosInvoices); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aosInvoices); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosInvoices); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $aosInvoices); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | public function testSaveAndMark_deleted(){ |
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aosInvoices = new AOS_Invoices(); |
|
28 | - $aosInvoices->name = "test"; |
|
27 | + $aosInvoices = new AOS_Invoices(); |
|
28 | + $aosInvoices->name = "test"; |
|
29 | 29 | |
30 | - $aosInvoices->save(); |
|
30 | + $aosInvoices->save(); |
|
31 | 31 | |
32 | - //test for record ID to verify that record is saved |
|
33 | - $this->assertTrue(isset($aosInvoices->id)); |
|
34 | - $this->assertEquals(36, strlen($aosInvoices->id)); |
|
35 | - $this->assertGreaterThan(0, $aosInvoices->number); |
|
32 | + //test for record ID to verify that record is saved |
|
33 | + $this->assertTrue(isset($aosInvoices->id)); |
|
34 | + $this->assertEquals(36, strlen($aosInvoices->id)); |
|
35 | + $this->assertGreaterThan(0, $aosInvoices->number); |
|
36 | 36 | |
37 | 37 | |
38 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
39 | - $aosInvoices->mark_deleted($aosInvoices->id); |
|
40 | - $result = $aosInvoices->retrieve($aosInvoices->id); |
|
41 | - $this->assertEquals(null,$result); |
|
38 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
39 | + $aosInvoices->mark_deleted($aosInvoices->id); |
|
40 | + $result = $aosInvoices->retrieve($aosInvoices->id); |
|
41 | + $this->assertEquals(null,$result); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | } |
@@ -4,976 +4,976 @@ discard block |
||
4 | 4 | class UserTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testUser() { |
|
7 | + public function testUser() { |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $user = new User(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $user = new User(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('User',$user); |
|
13 | - $this->assertInstanceOf('Person',$user); |
|
14 | - $this->assertInstanceOf('SugarBean',$user); |
|
12 | + $this->assertInstanceOf('User',$user); |
|
13 | + $this->assertInstanceOf('Person',$user); |
|
14 | + $this->assertInstanceOf('SugarBean',$user); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('Users', 'module_dir', $user); |
|
17 | - $this->assertAttributeEquals('User', 'object_name', $user); |
|
18 | - $this->assertAttributeEquals('users', 'table_name', $user); |
|
16 | + $this->assertAttributeEquals('Users', 'module_dir', $user); |
|
17 | + $this->assertAttributeEquals('User', 'object_name', $user); |
|
18 | + $this->assertAttributeEquals('users', 'table_name', $user); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $user); |
|
21 | - $this->assertAttributeEquals(false, 'authenticated', $user); |
|
22 | - $this->assertAttributeEquals(true, 'importable', $user); |
|
23 | - $this->assertAttributeEquals(false, 'team_exists', $user); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $user); |
|
21 | + $this->assertAttributeEquals(false, 'authenticated', $user); |
|
22 | + $this->assertAttributeEquals(true, 'importable', $user); |
|
23 | + $this->assertAttributeEquals(false, 'team_exists', $user); |
|
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | public function testgetSystemUser() |
29 | 29 | { |
30 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
31 | - global $db; |
|
32 | - unset ($db->database); |
|
33 | - $db->checkConnection(); |
|
30 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
31 | + global $db; |
|
32 | + unset ($db->database); |
|
33 | + $db->checkConnection(); |
|
34 | 34 | |
35 | - $user = new User(); |
|
35 | + $user = new User(); |
|
36 | 36 | |
37 | - $result = $user->getSystemUser(); |
|
37 | + $result = $user->getSystemUser(); |
|
38 | 38 | |
39 | - $this->assertInstanceOf('User',$result); |
|
40 | - $this->assertEquals(1, $result->id); |
|
39 | + $this->assertInstanceOf('User',$result); |
|
40 | + $this->assertEquals(1, $result->id); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - public function testgetDefaultSignature() |
|
46 | - { |
|
47 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
48 | - global $db; |
|
49 | - unset ($db->database); |
|
50 | - $db->checkConnection(); |
|
45 | + public function testgetDefaultSignature() |
|
46 | + { |
|
47 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
48 | + global $db; |
|
49 | + unset ($db->database); |
|
50 | + $db->checkConnection(); |
|
51 | 51 | |
52 | - $user = new User(); |
|
52 | + $user = new User(); |
|
53 | 53 | |
54 | - $user->retrieve(1); |
|
54 | + $user->retrieve(1); |
|
55 | 55 | |
56 | - $result = $user->getDefaultSignature(); |
|
57 | - $this->assertTrue(is_array($result)); |
|
56 | + $result = $user->getDefaultSignature(); |
|
57 | + $this->assertTrue(is_array($result)); |
|
58 | 58 | |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - public function testgetSignature() |
|
63 | - { |
|
64 | - $user = new User(); |
|
62 | + public function testgetSignature() |
|
63 | + { |
|
64 | + $user = new User(); |
|
65 | 65 | |
66 | - $user->retrieve(1); |
|
66 | + $user->retrieve(1); |
|
67 | 67 | |
68 | - $result = $user->getSignature(1); |
|
69 | - $this->assertEquals(false,$result); |
|
68 | + $result = $user->getSignature(1); |
|
69 | + $this->assertEquals(false,$result); |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function testgetSignaturesArray() { |
|
73 | + public function testgetSignaturesArray() { |
|
74 | 74 | |
75 | - $user = new User(); |
|
75 | + $user = new User(); |
|
76 | 76 | |
77 | - $user->retrieve(1); |
|
77 | + $user->retrieve(1); |
|
78 | 78 | |
79 | - $result = $user->getSignaturesArray(); |
|
80 | - $this->assertTrue(is_array($result)); |
|
79 | + $result = $user->getSignaturesArray(); |
|
80 | + $this->assertTrue(is_array($result)); |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - public function testgetSignatures() |
|
86 | - { |
|
87 | - $user = new User(); |
|
85 | + public function testgetSignatures() |
|
86 | + { |
|
87 | + $user = new User(); |
|
88 | 88 | |
89 | - $user->retrieve(1); |
|
89 | + $user->retrieve(1); |
|
90 | 90 | |
91 | - $expected = "<select onChange='setSigEditButtonVisibility();' id='signature_id' name='signature_id'>\n<OPTION selected value=''>--None--</OPTION></select>"; |
|
92 | - $actual = $user->getSignatures(); |
|
93 | - $this->assertSame($expected, $actual); |
|
91 | + $expected = "<select onChange='setSigEditButtonVisibility();' id='signature_id' name='signature_id'>\n<OPTION selected value=''>--None--</OPTION></select>"; |
|
92 | + $actual = $user->getSignatures(); |
|
93 | + $this->assertSame($expected, $actual); |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | - public function testgetSignatureButtons() |
|
99 | - { |
|
98 | + public function testgetSignatureButtons() |
|
99 | + { |
|
100 | 100 | |
101 | - global $mod_strings; |
|
101 | + global $mod_strings; |
|
102 | 102 | |
103 | - $user = new User(); |
|
103 | + $user = new User(); |
|
104 | 104 | |
105 | - //preset required values |
|
106 | - $user->retrieve(1); |
|
107 | - $mod_strings['LBL_BUTTON_EDIT'] = ""; |
|
108 | - $mod_strings['LBL_BUTTON_CREATE'] = ""; |
|
105 | + //preset required values |
|
106 | + $user->retrieve(1); |
|
107 | + $mod_strings['LBL_BUTTON_EDIT'] = ""; |
|
108 | + $mod_strings['LBL_BUTTON_CREATE'] = ""; |
|
109 | 109 | |
110 | 110 | |
111 | - //test with defaultDisplay false |
|
112 | - $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'> <span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:hidden;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\"> \n </span>"; |
|
113 | - $actual = $user->getSignatureButtons(''); |
|
114 | - $this->assertSame($expected, $actual); |
|
111 | + //test with defaultDisplay false |
|
112 | + $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'> <span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:hidden;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\"> \n </span>"; |
|
113 | + $actual = $user->getSignatureButtons(''); |
|
114 | + $this->assertSame($expected, $actual); |
|
115 | 115 | |
116 | 116 | |
117 | - //test with defaultDisplay true |
|
118 | - $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'> <span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:inherit;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\"> \n </span>"; |
|
119 | - $actual = $user->getSignatureButtons('',true); |
|
120 | - $this->assertSame($expected, $actual); |
|
117 | + //test with defaultDisplay true |
|
118 | + $expected = "<input class='button' onclick='javascript:open_email_signature_form(\"\", \"1\");' value='' type='button'> <span name=\"edit_sig\" id=\"edit_sig\" style=\"visibility:inherit;\"><input class=\"button\" onclick=\"javascript:open_email_signature_form(document.getElementById('signature_id', '').value)\" value=\"\" type=\"button\" tabindex=\"392\"> \n </span>"; |
|
119 | + $actual = $user->getSignatureButtons('',true); |
|
120 | + $this->assertSame($expected, $actual); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | - public function testhasPersonalEmail() |
|
126 | - { |
|
125 | + public function testhasPersonalEmail() |
|
126 | + { |
|
127 | 127 | |
128 | - $user = new User(); |
|
128 | + $user = new User(); |
|
129 | 129 | |
130 | - $user->retrieve(2); |
|
130 | + $user->retrieve(2); |
|
131 | 131 | |
132 | - $result = $user->hasPersonalEmail(); |
|
133 | - $this->assertEquals(false,$result); |
|
132 | + $result = $user->hasPersonalEmail(); |
|
133 | + $this->assertEquals(false,$result); |
|
134 | 134 | |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | 137 | |
138 | - public function testgetUserPrivGuid() |
|
139 | - { |
|
140 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
141 | - global $db; |
|
142 | - unset ($db->database); |
|
143 | - $db->checkConnection(); |
|
138 | + public function testgetUserPrivGuid() |
|
139 | + { |
|
140 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
141 | + global $db; |
|
142 | + unset ($db->database); |
|
143 | + $db->checkConnection(); |
|
144 | 144 | |
145 | - $user = new User(); |
|
145 | + $user = new User(); |
|
146 | 146 | |
147 | - $user->retrieve(1); |
|
147 | + $user->retrieve(1); |
|
148 | 148 | |
149 | - $result = $user->getUserPrivGuid(); |
|
149 | + $result = $user->getUserPrivGuid(); |
|
150 | 150 | |
151 | - $this->assertTrue(isset($result)); |
|
152 | - $this->assertEquals(36, strlen($result)); |
|
151 | + $this->assertTrue(isset($result)); |
|
152 | + $this->assertEquals(36, strlen($result)); |
|
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | - public function testsetUserPrivGuid() |
|
157 | - { |
|
158 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
159 | - global $db; |
|
160 | - unset ($db->database); |
|
161 | - $db->checkConnection(); |
|
156 | + public function testsetUserPrivGuid() |
|
157 | + { |
|
158 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
159 | + global $db; |
|
160 | + unset ($db->database); |
|
161 | + $db->checkConnection(); |
|
162 | 162 | |
163 | 163 | |
164 | - $user = new User(); |
|
164 | + $user = new User(); |
|
165 | 165 | |
166 | - $user->retrieve(1); |
|
166 | + $user->retrieve(1); |
|
167 | 167 | |
168 | - $user->setUserPrivGuid(); |
|
168 | + $user->setUserPrivGuid(); |
|
169 | 169 | |
170 | - $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
170 | + $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
171 | 171 | |
172 | - $this->assertTrue(isset($result)); |
|
173 | - $this->assertEquals(36, strlen($result)); |
|
172 | + $this->assertTrue(isset($result)); |
|
173 | + $this->assertEquals(36, strlen($result)); |
|
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | - public function testSetAndGetAndResetPreference( ) |
|
178 | - { |
|
179 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
180 | - global $db; |
|
181 | - unset ($db->database); |
|
182 | - $db->checkConnection(); |
|
177 | + public function testSetAndGetAndResetPreference( ) |
|
178 | + { |
|
179 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
180 | + global $db; |
|
181 | + unset ($db->database); |
|
182 | + $db->checkConnection(); |
|
183 | 183 | |
184 | - $user = new User(); |
|
184 | + $user = new User(); |
|
185 | 185 | |
186 | - $user->retrieve(1); |
|
186 | + $user->retrieve(1); |
|
187 | 187 | |
188 | 188 | |
189 | - //test setPreference method |
|
190 | - $user->setPreference('userPrivGuid', 'someGuid', 0, 'global', $user); |
|
189 | + //test setPreference method |
|
190 | + $user->setPreference('userPrivGuid', 'someGuid', 0, 'global', $user); |
|
191 | 191 | |
192 | 192 | |
193 | - //test getPreference method |
|
194 | - $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
195 | - $this->assertTrue(isset($result)); |
|
196 | - $this->assertEquals('someGuid', $result); |
|
193 | + //test getPreference method |
|
194 | + $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
195 | + $this->assertTrue(isset($result)); |
|
196 | + $this->assertEquals('someGuid', $result); |
|
197 | 197 | |
198 | 198 | |
199 | - //test resetPreferences method and verify that created preference is no longer available |
|
200 | - $user->resetPreferences(); |
|
201 | - $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
202 | - $this->assertFalse(isset($result)); |
|
199 | + //test resetPreferences method and verify that created preference is no longer available |
|
200 | + $user->resetPreferences(); |
|
201 | + $result = $user->getPreference('userPrivGuid', 'global', $user); |
|
202 | + $this->assertFalse(isset($result)); |
|
203 | 203 | |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | 208 | |
209 | - public function testsavePreferencesToDB() |
|
210 | - { |
|
211 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
212 | - global $db; |
|
213 | - unset ($db->database); |
|
214 | - $db->checkConnection(); |
|
209 | + public function testsavePreferencesToDB() |
|
210 | + { |
|
211 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
212 | + global $db; |
|
213 | + unset ($db->database); |
|
214 | + $db->checkConnection(); |
|
215 | 215 | |
216 | - $user = new User(); |
|
216 | + $user = new User(); |
|
217 | 217 | |
218 | - $user->retrieve(1); |
|
218 | + $user->retrieve(1); |
|
219 | 219 | |
220 | - //execute the method and test if it works and does not throws an exception. |
|
221 | - try { |
|
222 | - $user->savePreferencesToDB(); |
|
223 | - $this->assertTrue(true); |
|
224 | - } |
|
225 | - catch (Exception $e) { |
|
226 | - $this->fail(); |
|
227 | - } |
|
220 | + //execute the method and test if it works and does not throws an exception. |
|
221 | + try { |
|
222 | + $user->savePreferencesToDB(); |
|
223 | + $this->assertTrue(true); |
|
224 | + } |
|
225 | + catch (Exception $e) { |
|
226 | + $this->fail(); |
|
227 | + } |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | 231 | |
232 | - public function testreloadPreferences() |
|
233 | - { |
|
234 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
235 | - global $db; |
|
236 | - unset ($db->database); |
|
237 | - $db->checkConnection(); |
|
232 | + public function testreloadPreferences() |
|
233 | + { |
|
234 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
235 | + global $db; |
|
236 | + unset ($db->database); |
|
237 | + $db->checkConnection(); |
|
238 | 238 | |
239 | - $user = new User(); |
|
239 | + $user = new User(); |
|
240 | 240 | |
241 | - $user->retrieve(1); |
|
241 | + $user->retrieve(1); |
|
242 | 242 | |
243 | - $result = $user->reloadPreferences(); |
|
244 | - $this->assertEquals(true, $result); |
|
243 | + $result = $user->reloadPreferences(); |
|
244 | + $this->assertEquals(true, $result); |
|
245 | 245 | |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | 248 | |
249 | - public function testgetUserDateTimePreferences() |
|
250 | - { |
|
251 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
252 | - global $db; |
|
253 | - unset ($db->database); |
|
254 | - $db->checkConnection(); |
|
249 | + public function testgetUserDateTimePreferences() |
|
250 | + { |
|
251 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
252 | + global $db; |
|
253 | + unset ($db->database); |
|
254 | + $db->checkConnection(); |
|
255 | 255 | |
256 | - $user = new User(); |
|
256 | + $user = new User(); |
|
257 | 257 | |
258 | - $user->retrieve(1); |
|
258 | + $user->retrieve(1); |
|
259 | 259 | |
260 | - $result = $user->getUserDateTimePreferences(); |
|
260 | + $result = $user->getUserDateTimePreferences(); |
|
261 | 261 | |
262 | - $this->assertTrue(is_array($result)); |
|
263 | - $this->assertTrue(isset($result['date'])); |
|
264 | - $this->assertTrue(isset($result['time'])); |
|
265 | - $this->assertTrue(isset($result['userGmt'])); |
|
266 | - $this->assertTrue(isset($result['userGmtOffset'])); |
|
262 | + $this->assertTrue(is_array($result)); |
|
263 | + $this->assertTrue(isset($result['date'])); |
|
264 | + $this->assertTrue(isset($result['time'])); |
|
265 | + $this->assertTrue(isset($result['userGmt'])); |
|
266 | + $this->assertTrue(isset($result['userGmtOffset'])); |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | - public function testloadPreferences( ) |
|
272 | - { |
|
273 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | - global $db; |
|
275 | - unset ($db->database); |
|
276 | - $db->checkConnection(); |
|
271 | + public function testloadPreferences( ) |
|
272 | + { |
|
273 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | + global $db; |
|
275 | + unset ($db->database); |
|
276 | + $db->checkConnection(); |
|
277 | 277 | |
278 | - $user = new User(); |
|
278 | + $user = new User(); |
|
279 | 279 | |
280 | - $user->retrieve(1); |
|
280 | + $user->retrieve(1); |
|
281 | 281 | |
282 | - $result = $user->loadPreferences(); |
|
283 | - $this->assertEquals(true, $result); |
|
282 | + $result = $user->loadPreferences(); |
|
283 | + $this->assertEquals(true, $result); |
|
284 | 284 | |
285 | - } |
|
285 | + } |
|
286 | 286 | |
287 | 287 | |
288 | 288 | public function testGetETagSeedAndIncrementETag(){ |
289 | 289 | |
290 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
291 | - global $db; |
|
292 | - unset ($db->database); |
|
293 | - $db->checkConnection(); |
|
290 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
291 | + global $db; |
|
292 | + unset ($db->database); |
|
293 | + $db->checkConnection(); |
|
294 | 294 | |
295 | - $user = new User(); |
|
295 | + $user = new User(); |
|
296 | 296 | |
297 | - $user->retrieve(1); |
|
297 | + $user->retrieve(1); |
|
298 | 298 | |
299 | - //execute getETagSeed method, get Etag value |
|
300 | - $ETagInitial = $user->getETagSeed('test'); |
|
301 | - $this->assertGreaterThanOrEqual(0,$ETagInitial); |
|
299 | + //execute getETagSeed method, get Etag value |
|
300 | + $ETagInitial = $user->getETagSeed('test'); |
|
301 | + $this->assertGreaterThanOrEqual(0,$ETagInitial); |
|
302 | 302 | |
303 | 303 | |
304 | - //execute incrementETag to increment |
|
305 | - $user->incrementETag('test'); |
|
304 | + //execute incrementETag to increment |
|
305 | + $user->incrementETag('test'); |
|
306 | 306 | |
307 | 307 | |
308 | - //execute getETagSeed method again, get Etag final value and compare final and initial values |
|
309 | - $ETagFinal = $user->getETagSeed('test'); |
|
310 | - $this->assertGreaterThan($ETagInitial, $ETagFinal); |
|
308 | + //execute getETagSeed method again, get Etag final value and compare final and initial values |
|
309 | + $ETagFinal = $user->getETagSeed('test'); |
|
310 | + $this->assertGreaterThan($ETagInitial, $ETagFinal); |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | |
314 | 314 | |
315 | 315 | |
316 | - public function testgetLicensedUsersWhere() |
|
317 | - { |
|
318 | - $expected = "deleted=0 AND status='Active' AND user_name IS NOT NULL AND is_group=0 AND portal_only=0 AND LENGTH(user_name)>0"; |
|
319 | - $actual = User::getLicensedUsersWhere(); |
|
320 | - $this->assertSame($expected, $actual); |
|
316 | + public function testgetLicensedUsersWhere() |
|
317 | + { |
|
318 | + $expected = "deleted=0 AND status='Active' AND user_name IS NOT NULL AND is_group=0 AND portal_only=0 AND LENGTH(user_name)>0"; |
|
319 | + $actual = User::getLicensedUsersWhere(); |
|
320 | + $this->assertSame($expected, $actual); |
|
321 | 321 | |
322 | - } |
|
322 | + } |
|
323 | 323 | |
324 | 324 | public function testget_summary_text() |
325 | 325 | { |
326 | - $user = new User(); |
|
326 | + $user = new User(); |
|
327 | 327 | |
328 | - //test without setting name |
|
329 | - $this->assertEquals(Null,$user->get_summary_text()); |
|
328 | + //test without setting name |
|
329 | + $this->assertEquals(Null,$user->get_summary_text()); |
|
330 | 330 | |
331 | - //test with name set |
|
332 | - $user->name = "test"; |
|
333 | - $this->assertEquals('test',$user->get_summary_text()); |
|
331 | + //test with name set |
|
332 | + $user->name = "test"; |
|
333 | + $this->assertEquals('test',$user->get_summary_text()); |
|
334 | 334 | |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | - public function testbean_implements() |
|
338 | - { |
|
339 | - $user = new User(); |
|
337 | + public function testbean_implements() |
|
338 | + { |
|
339 | + $user = new User(); |
|
340 | 340 | |
341 | - $this->assertEquals(false, $user->bean_implements('')); //test with blank value |
|
342 | - $this->assertEquals(false, $user->bean_implements('test')); //test with invalid value |
|
343 | - $this->assertEquals(true, $user->bean_implements('ACL')); //test with valid value |
|
344 | - } |
|
341 | + $this->assertEquals(false, $user->bean_implements('')); //test with blank value |
|
342 | + $this->assertEquals(false, $user->bean_implements('test')); //test with invalid value |
|
343 | + $this->assertEquals(true, $user->bean_implements('ACL')); //test with valid value |
|
344 | + } |
|
345 | 345 | |
346 | 346 | |
347 | - public function testcheck_role_membership() |
|
348 | - { |
|
349 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
350 | - global $db; |
|
351 | - unset ($db->database); |
|
352 | - $db->checkConnection(); |
|
347 | + public function testcheck_role_membership() |
|
348 | + { |
|
349 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
350 | + global $db; |
|
351 | + unset ($db->database); |
|
352 | + $db->checkConnection(); |
|
353 | 353 | |
354 | - $user = new User(); |
|
354 | + $user = new User(); |
|
355 | 355 | |
356 | - $result = $user->check_role_membership("test", ''); |
|
357 | - $this->assertEquals(false, $result); |
|
356 | + $result = $user->check_role_membership("test", ''); |
|
357 | + $this->assertEquals(false, $result); |
|
358 | 358 | |
359 | 359 | |
360 | - $result = $user->check_role_membership("test", '1'); |
|
361 | - $this->assertEquals(false, $result); |
|
360 | + $result = $user->check_role_membership("test", '1'); |
|
361 | + $this->assertEquals(false, $result); |
|
362 | 362 | |
363 | - } |
|
363 | + } |
|
364 | 364 | |
365 | 365 | |
366 | - public function testsaveAndOthers() |
|
367 | - { |
|
368 | - error_reporting(E_ERROR | E_PARSE); |
|
366 | + public function testsaveAndOthers() |
|
367 | + { |
|
368 | + error_reporting(E_ERROR | E_PARSE); |
|
369 | 369 | |
370 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
371 | - global $db; |
|
372 | - unset ($db->database); |
|
373 | - $db->checkConnection(); |
|
370 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
371 | + global $db; |
|
372 | + unset ($db->database); |
|
373 | + $db->checkConnection(); |
|
374 | 374 | |
375 | 375 | |
376 | - $user = new User(); |
|
376 | + $user = new User(); |
|
377 | 377 | |
378 | - $user->user_name = "test"; |
|
378 | + $user->user_name = "test"; |
|
379 | 379 | |
380 | - $user->first_name = "firstn"; |
|
381 | - $user->last_name = "lastn"; |
|
380 | + $user->first_name = "firstn"; |
|
381 | + $user->last_name = "lastn"; |
|
382 | 382 | |
383 | - $user->email1 = "[email protected]"; |
|
384 | - $user->email2 = "[email protected]"; |
|
383 | + $user->email1 = "[email protected]"; |
|
384 | + $user->email2 = "[email protected]"; |
|
385 | 385 | |
386 | - $result = $user->save(); |
|
386 | + $result = $user->save(); |
|
387 | 387 | |
388 | - //test for record ID to verify that record is saved |
|
389 | - $this->assertTrue(isset($user->id)); |
|
390 | - $this->assertEquals(36, strlen($user->id)); |
|
388 | + //test for record ID to verify that record is saved |
|
389 | + $this->assertTrue(isset($user->id)); |
|
390 | + $this->assertEquals(36, strlen($user->id)); |
|
391 | 391 | |
392 | 392 | |
393 | - //test retrieve method |
|
394 | - $this->retrieve($user->id); |
|
393 | + //test retrieve method |
|
394 | + $this->retrieve($user->id); |
|
395 | 395 | |
396 | 396 | |
397 | - //test retrieve_by_email_address method |
|
398 | - $this->retrieve_by_email_address($user->id); |
|
397 | + //test retrieve_by_email_address method |
|
398 | + $this->retrieve_by_email_address($user->id); |
|
399 | 399 | |
400 | 400 | |
401 | - //test newPassword And findUserPassword methods |
|
402 | - $this->NewPasswordAndFindUserPassword($user->id); |
|
401 | + //test newPassword And findUserPassword methods |
|
402 | + $this->NewPasswordAndFindUserPassword($user->id); |
|
403 | 403 | |
404 | 404 | |
405 | - //test authenticate_user method |
|
406 | - $this->authenticate_user($user->id); |
|
405 | + //test authenticate_user method |
|
406 | + $this->authenticate_user($user->id); |
|
407 | 407 | |
408 | 408 | |
409 | - //test load_user method |
|
410 | - $this->load_user($user->id); |
|
409 | + //test load_user method |
|
410 | + $this->load_user($user->id); |
|
411 | 411 | |
412 | 412 | |
413 | - //test change_password method |
|
414 | - $this->change_password($user->id); |
|
413 | + //test change_password method |
|
414 | + $this->change_password($user->id); |
|
415 | 415 | |
416 | 416 | |
417 | - //test getPreferredEmail method |
|
418 | - $this->getPreferredEmail($user->id); |
|
417 | + //test getPreferredEmail method |
|
418 | + $this->getPreferredEmail($user->id); |
|
419 | 419 | |
420 | 420 | |
421 | - //test getUsersNameAndEmail method |
|
422 | - $this->getUsersNameAndEmail($user->id); |
|
421 | + //test getUsersNameAndEmail method |
|
422 | + $this->getUsersNameAndEmail($user->id); |
|
423 | 423 | |
424 | 424 | |
425 | - //test getEmailInfo method |
|
426 | - $this->getEmailInfo($user->id); |
|
425 | + //test getEmailInfo method |
|
426 | + $this->getEmailInfo($user->id); |
|
427 | 427 | |
428 | 428 | |
429 | - //change username and delete the user to avoid picking it up by password in future |
|
430 | - $user->user_name = "test_deleted"; |
|
431 | - $user->save(); |
|
432 | - $user->mark_deleted($user->id); |
|
429 | + //change username and delete the user to avoid picking it up by password in future |
|
430 | + $user->user_name = "test_deleted"; |
|
431 | + $user->save(); |
|
432 | + $user->mark_deleted($user->id); |
|
433 | 433 | |
434 | - } |
|
434 | + } |
|
435 | 435 | |
436 | - public function retrieve($id) |
|
437 | - { |
|
438 | - $user = new User(); |
|
436 | + public function retrieve($id) |
|
437 | + { |
|
438 | + $user = new User(); |
|
439 | 439 | |
440 | - $user->retrieve($id); |
|
440 | + $user->retrieve($id); |
|
441 | 441 | |
442 | - $this->assertEquals("test", $user->user_name); |
|
442 | + $this->assertEquals("test", $user->user_name); |
|
443 | 443 | |
444 | - $this->assertEquals("firstn", $user->first_name); |
|
445 | - $this->assertEquals("lastn", $user->last_name); |
|
444 | + $this->assertEquals("firstn", $user->first_name); |
|
445 | + $this->assertEquals("lastn", $user->last_name); |
|
446 | 446 | |
447 | - $this->assertEquals("[email protected]", $user->email1); |
|
448 | - $this->assertEquals("[email protected]", $user->email2); |
|
447 | + $this->assertEquals("[email protected]", $user->email1); |
|
448 | + $this->assertEquals("[email protected]", $user->email2); |
|
449 | 449 | |
450 | - } |
|
450 | + } |
|
451 | 451 | |
452 | - public function retrieve_by_email_address($id) |
|
453 | - { |
|
454 | - $user = new User(); |
|
452 | + public function retrieve_by_email_address($id) |
|
453 | + { |
|
454 | + $user = new User(); |
|
455 | 455 | |
456 | - //test with invalid email |
|
457 | - $user->retrieve_by_email_address("[email protected]"); |
|
458 | - $this->assertEquals('', $user->id); |
|
456 | + //test with invalid email |
|
457 | + $user->retrieve_by_email_address("[email protected]"); |
|
458 | + $this->assertEquals('', $user->id); |
|
459 | 459 | |
460 | 460 | |
461 | - //test with valid email and test for record ID to verify that record is same |
|
462 | - $user->retrieve_by_email_address("[email protected]"); |
|
463 | - $this->assertTrue(isset($user->id)); |
|
464 | - $this->assertEquals($id, $user->id); |
|
461 | + //test with valid email and test for record ID to verify that record is same |
|
462 | + $user->retrieve_by_email_address("[email protected]"); |
|
463 | + $this->assertTrue(isset($user->id)); |
|
464 | + $this->assertEquals($id, $user->id); |
|
465 | 465 | |
466 | - } |
|
466 | + } |
|
467 | 467 | |
468 | - public function NewPasswordAndFindUserPassword($id) |
|
469 | - { |
|
470 | - $user = new User(); |
|
468 | + public function NewPasswordAndFindUserPassword($id) |
|
469 | + { |
|
470 | + $user = new User(); |
|
471 | 471 | |
472 | - $user->retrieve($id); |
|
472 | + $user->retrieve($id); |
|
473 | 473 | |
474 | - //set user password and then retrieve user by created password |
|
475 | - $user->setNewPassword("test"); |
|
474 | + //set user password and then retrieve user by created password |
|
475 | + $user->setNewPassword("test"); |
|
476 | 476 | |
477 | - $result = User::findUserPassword("test",md5("test")); |
|
477 | + $result = User::findUserPassword("test",md5("test")); |
|
478 | 478 | |
479 | - $this->assertTrue(isset($result['id'])); |
|
480 | - $this->assertEquals($id, $result['id']); |
|
479 | + $this->assertTrue(isset($result['id'])); |
|
480 | + $this->assertEquals($id, $result['id']); |
|
481 | 481 | |
482 | - } |
|
482 | + } |
|
483 | 483 | |
484 | 484 | |
485 | - public function authenticate_user($id) |
|
486 | - { |
|
487 | - $user = new User(); |
|
485 | + public function authenticate_user($id) |
|
486 | + { |
|
487 | + $user = new User(); |
|
488 | 488 | |
489 | - $user->retrieve($id); |
|
489 | + $user->retrieve($id); |
|
490 | 490 | |
491 | - //test with invalid password |
|
492 | - $result = $user->authenticate_user(md5("pass")); |
|
493 | - $this->assertEquals(false ,$result); |
|
491 | + //test with invalid password |
|
492 | + $result = $user->authenticate_user(md5("pass")); |
|
493 | + $this->assertEquals(false ,$result); |
|
494 | 494 | |
495 | - //test with invalid password |
|
496 | - $result = $user->authenticate_user(md5("test")); |
|
497 | - $this->assertEquals(true ,$result); |
|
495 | + //test with invalid password |
|
496 | + $result = $user->authenticate_user(md5("test")); |
|
497 | + $this->assertEquals(true ,$result); |
|
498 | 498 | |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | 501 | |
502 | - public function load_user($id) |
|
503 | - { |
|
504 | - $user = new User(); |
|
502 | + public function load_user($id) |
|
503 | + { |
|
504 | + $user = new User(); |
|
505 | 505 | |
506 | - $user->retrieve($id); |
|
506 | + $user->retrieve($id); |
|
507 | 507 | |
508 | - $result = $user->load_user("test"); |
|
508 | + $result = $user->load_user("test"); |
|
509 | 509 | |
510 | - $this->assertEquals(true, $result->authenticated); |
|
510 | + $this->assertEquals(true, $result->authenticated); |
|
511 | 511 | |
512 | - } |
|
512 | + } |
|
513 | 513 | |
514 | - public function change_password($id) |
|
515 | - { |
|
516 | - $user = new User(); |
|
514 | + public function change_password($id) |
|
515 | + { |
|
516 | + $user = new User(); |
|
517 | 517 | |
518 | - $user->retrieve($id); |
|
518 | + $user->retrieve($id); |
|
519 | 519 | |
520 | - //execute the method and verifh that it returns true |
|
521 | - $result = $user->change_password("test", "testpass"); |
|
522 | - $this->assertEquals(true, $result); |
|
520 | + //execute the method and verifh that it returns true |
|
521 | + $result = $user->change_password("test", "testpass"); |
|
522 | + $this->assertEquals(true, $result); |
|
523 | 523 | |
524 | 524 | |
525 | - //find the user by new password |
|
526 | - $result = User::findUserPassword("test",md5("testpass")); |
|
525 | + //find the user by new password |
|
526 | + $result = User::findUserPassword("test",md5("testpass")); |
|
527 | 527 | |
528 | - $this->assertTrue(isset($result['id'])); |
|
529 | - $this->assertEquals($id, $result['id']); |
|
528 | + $this->assertTrue(isset($result['id'])); |
|
529 | + $this->assertEquals($id, $result['id']); |
|
530 | 530 | |
531 | - } |
|
531 | + } |
|
532 | 532 | |
533 | - public function getPreferredEmail($id) |
|
534 | - { |
|
535 | - $user = new User(); |
|
533 | + public function getPreferredEmail($id) |
|
534 | + { |
|
535 | + $user = new User(); |
|
536 | 536 | |
537 | - $user->retrieve($id); |
|
537 | + $user->retrieve($id); |
|
538 | 538 | |
539 | - $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
539 | + $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
540 | 540 | |
541 | - $actual = $user->getPreferredEmail(); |
|
541 | + $actual = $user->getPreferredEmail(); |
|
542 | 542 | |
543 | - $this->assertSame($actual,$expected); |
|
543 | + $this->assertSame($actual,$expected); |
|
544 | 544 | |
545 | - } |
|
545 | + } |
|
546 | 546 | |
547 | - public function getUsersNameAndEmail($id) |
|
548 | - { |
|
549 | - $user = new User(); |
|
547 | + public function getUsersNameAndEmail($id) |
|
548 | + { |
|
549 | + $user = new User(); |
|
550 | 550 | |
551 | - $user->retrieve($id); |
|
551 | + $user->retrieve($id); |
|
552 | 552 | |
553 | - $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
553 | + $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
554 | 554 | |
555 | - $actual = $user->getUsersNameAndEmail(); |
|
555 | + $actual = $user->getUsersNameAndEmail(); |
|
556 | 556 | |
557 | - $this->assertEquals($actual,$expected); |
|
558 | - } |
|
557 | + $this->assertEquals($actual,$expected); |
|
558 | + } |
|
559 | 559 | |
560 | 560 | |
561 | - public function getEmailInfo($id) |
|
562 | - { |
|
563 | - $user = new User(); |
|
561 | + public function getEmailInfo($id) |
|
562 | + { |
|
563 | + $user = new User(); |
|
564 | 564 | |
565 | - $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
565 | + $expected = array("name"=>"firstn lastn", "email"=>"[email protected]" ); |
|
566 | 566 | |
567 | - $actual = $user->getEmailInfo($id); |
|
567 | + $actual = $user->getEmailInfo($id); |
|
568 | 568 | |
569 | - $this->assertEquals($actual,$expected); |
|
570 | - } |
|
569 | + $this->assertEquals($actual,$expected); |
|
570 | + } |
|
571 | 571 | |
572 | 572 | |
573 | - public function testencrypt_password() |
|
574 | - { |
|
575 | - $user = new User(); |
|
573 | + public function testencrypt_password() |
|
574 | + { |
|
575 | + $user = new User(); |
|
576 | 576 | |
577 | - $result = $user->encrypt_password("test"); |
|
578 | - $this->assertTrue(isset($result)); |
|
579 | - $this->assertGreaterThan(0,strlen($result)); |
|
577 | + $result = $user->encrypt_password("test"); |
|
578 | + $this->assertTrue(isset($result)); |
|
579 | + $this->assertGreaterThan(0,strlen($result)); |
|
580 | 580 | |
581 | - } |
|
581 | + } |
|
582 | 582 | |
583 | - public function testgetPasswordHash() |
|
584 | - { |
|
583 | + public function testgetPasswordHash() |
|
584 | + { |
|
585 | 585 | |
586 | - $result= User::getPasswordHash("test"); |
|
586 | + $result= User::getPasswordHash("test"); |
|
587 | 587 | |
588 | - $this->assertTrue(isset($result)); |
|
589 | - $this->assertGreaterThan(0,strlen($result)); |
|
588 | + $this->assertTrue(isset($result)); |
|
589 | + $this->assertGreaterThan(0,strlen($result)); |
|
590 | 590 | |
591 | - $this->markTestIncomplete('Error: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.'); |
|
591 | + $this->markTestIncomplete('Error: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash.'); |
|
592 | 592 | |
593 | - } |
|
593 | + } |
|
594 | 594 | |
595 | 595 | |
596 | - public function testcheckPassword() |
|
597 | - { |
|
596 | + public function testcheckPassword() |
|
597 | + { |
|
598 | 598 | |
599 | - //test with empty password and empty hash |
|
600 | - $result = User::checkPassword("", ''); |
|
601 | - $this->assertEquals(false,$result); |
|
599 | + //test with empty password and empty hash |
|
600 | + $result = User::checkPassword("", ''); |
|
601 | + $this->assertEquals(false,$result); |
|
602 | 602 | |
603 | 603 | |
604 | - //test with valid hash and empty password |
|
605 | - $result = User::checkPassword("", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
606 | - $this->assertEquals(false,$result); |
|
604 | + //test with valid hash and empty password |
|
605 | + $result = User::checkPassword("", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
606 | + $this->assertEquals(false,$result); |
|
607 | 607 | |
608 | 608 | |
609 | - //test with valid password and invalid hash |
|
610 | - $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2'); |
|
611 | - $this->assertEquals(false,$result); |
|
609 | + //test with valid password and invalid hash |
|
610 | + $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2'); |
|
611 | + $this->assertEquals(false,$result); |
|
612 | 612 | |
613 | 613 | |
614 | - //test with valid password and valid hash |
|
615 | - $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
616 | - $this->assertEquals(true,$result); |
|
614 | + //test with valid password and valid hash |
|
615 | + $result = User::checkPassword("test", '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
616 | + $this->assertEquals(true,$result); |
|
617 | 617 | |
618 | - } |
|
618 | + } |
|
619 | 619 | |
620 | 620 | |
621 | - public function testcheckPasswordMD5() |
|
622 | - { |
|
621 | + public function testcheckPasswordMD5() |
|
622 | + { |
|
623 | 623 | |
624 | - //test with empty password and empty hash |
|
625 | - $result = User::checkPasswordMD5(md5(""), ''); |
|
626 | - $this->assertEquals(false,$result); |
|
624 | + //test with empty password and empty hash |
|
625 | + $result = User::checkPasswordMD5(md5(""), ''); |
|
626 | + $this->assertEquals(false,$result); |
|
627 | 627 | |
628 | 628 | |
629 | - //test with valid hash and empty password |
|
630 | - $result = User::checkPasswordMD5(md5(""), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
631 | - $this->assertEquals(false,$result); |
|
629 | + //test with valid hash and empty password |
|
630 | + $result = User::checkPasswordMD5(md5(""), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
631 | + $this->assertEquals(false,$result); |
|
632 | 632 | |
633 | 633 | |
634 | - //test with valid password and invalid hash |
|
635 | - $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2'); |
|
636 | - $this->assertEquals(false,$result); |
|
634 | + //test with valid password and invalid hash |
|
635 | + $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la2'); |
|
636 | + $this->assertEquals(false,$result); |
|
637 | 637 | |
638 | 638 | |
639 | - //test with valid password and valid hash |
|
640 | - $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
641 | - $this->assertEquals(true,$result); |
|
639 | + //test with valid password and valid hash |
|
640 | + $result = User::checkPasswordMD5(md5("test"), '$1$Gt0.XI4.$tVVSXgE36sfsVMBNo/9la1'); |
|
641 | + $this->assertEquals(true,$result); |
|
642 | 642 | |
643 | - } |
|
643 | + } |
|
644 | 644 | |
645 | 645 | |
646 | - public function testis_authenticated() |
|
647 | - { |
|
646 | + public function testis_authenticated() |
|
647 | + { |
|
648 | 648 | |
649 | - $user = new User(); |
|
649 | + $user = new User(); |
|
650 | 650 | |
651 | - //test without setting name |
|
652 | - $this->assertEquals(false, $user->is_authenticated()); |
|
651 | + //test without setting name |
|
652 | + $this->assertEquals(false, $user->is_authenticated()); |
|
653 | 653 | |
654 | - //test with name set |
|
655 | - $user->authenticated = true; |
|
656 | - $this->assertEquals(true,$user->is_authenticated()); |
|
654 | + //test with name set |
|
655 | + $user->authenticated = true; |
|
656 | + $this->assertEquals(true,$user->is_authenticated()); |
|
657 | 657 | |
658 | - } |
|
658 | + } |
|
659 | 659 | |
660 | - public function testfill_in_additional_list_fields() |
|
661 | - { |
|
660 | + public function testfill_in_additional_list_fields() |
|
661 | + { |
|
662 | 662 | |
663 | - $user = new User(); |
|
663 | + $user = new User(); |
|
664 | 664 | |
665 | - $user->retrieve(1); |
|
665 | + $user->retrieve(1); |
|
666 | 666 | |
667 | - $user->fill_in_additional_list_fields(); |
|
667 | + $user->fill_in_additional_list_fields(); |
|
668 | 668 | |
669 | - $this->assertEquals("Administrator",$user->full_name); |
|
669 | + $this->assertEquals("Administrator",$user->full_name); |
|
670 | 670 | |
671 | - } |
|
671 | + } |
|
672 | 672 | |
673 | - public function testfill_in_additional_detail_fields() |
|
674 | - { |
|
673 | + public function testfill_in_additional_detail_fields() |
|
674 | + { |
|
675 | 675 | |
676 | - $user = new User(); |
|
676 | + $user = new User(); |
|
677 | 677 | |
678 | - $user->retrieve(1); |
|
678 | + $user->retrieve(1); |
|
679 | 679 | |
680 | - $user->fill_in_additional_detail_fields(); |
|
680 | + $user->fill_in_additional_detail_fields(); |
|
681 | 681 | |
682 | - $this->assertEquals("Administrator",$user->full_name); |
|
682 | + $this->assertEquals("Administrator",$user->full_name); |
|
683 | 683 | |
684 | - } |
|
684 | + } |
|
685 | 685 | |
686 | - public function testretrieve_user_id() |
|
687 | - { |
|
688 | - $user = new User(); |
|
686 | + public function testretrieve_user_id() |
|
687 | + { |
|
688 | + $user = new User(); |
|
689 | 689 | |
690 | - $result = $user->retrieve_user_id("admin"); |
|
691 | - $this->assertEquals(1, $result); |
|
692 | - } |
|
690 | + $result = $user->retrieve_user_id("admin"); |
|
691 | + $this->assertEquals(1, $result); |
|
692 | + } |
|
693 | 693 | |
694 | 694 | |
695 | - public function testverify_data() |
|
696 | - { |
|
695 | + public function testverify_data() |
|
696 | + { |
|
697 | 697 | |
698 | - global $mod_strings; |
|
698 | + global $mod_strings; |
|
699 | 699 | |
700 | - $mod_strings['ERR_EMAIL_NO_OPTS'] = ""; |
|
700 | + $mod_strings['ERR_EMAIL_NO_OPTS'] = ""; |
|
701 | 701 | |
702 | - $user = new User(); |
|
702 | + $user = new User(); |
|
703 | 703 | |
704 | - $user->retrieve(1); |
|
704 | + $user->retrieve(1); |
|
705 | 705 | |
706 | - //test with default/true |
|
707 | - $result = $user->verify_data(); |
|
708 | - $this->assertEquals(true, $result); |
|
706 | + //test with default/true |
|
707 | + $result = $user->verify_data(); |
|
708 | + $this->assertEquals(true, $result); |
|
709 | 709 | |
710 | 710 | |
711 | - //test with false |
|
712 | - $result = $user->verify_data(false); |
|
713 | - $this->assertEquals(false, $result); |
|
711 | + //test with false |
|
712 | + $result = $user->verify_data(false); |
|
713 | + $this->assertEquals(false, $result); |
|
714 | 714 | |
715 | - } |
|
715 | + } |
|
716 | 716 | |
717 | - public function testget_list_view_data() |
|
718 | - { |
|
719 | - global $mod_strings; |
|
720 | - $mod_strings['LBL_CHECKMARK'] = ""; |
|
717 | + public function testget_list_view_data() |
|
718 | + { |
|
719 | + global $mod_strings; |
|
720 | + $mod_strings['LBL_CHECKMARK'] = ""; |
|
721 | 721 | |
722 | - $user = new User(); |
|
722 | + $user = new User(); |
|
723 | 723 | |
724 | - $user->retrieve(1); |
|
724 | + $user->retrieve(1); |
|
725 | 725 | |
726 | - $result = $user->get_list_view_data(); |
|
727 | - $this->assertTrue(is_array($result)); |
|
726 | + $result = $user->get_list_view_data(); |
|
727 | + $this->assertTrue(is_array($result)); |
|
728 | 728 | |
729 | - } |
|
729 | + } |
|
730 | 730 | |
731 | - public function testlist_view_parse_additional_sections() |
|
732 | - { |
|
731 | + public function testlist_view_parse_additional_sections() |
|
732 | + { |
|
733 | 733 | |
734 | - $user = new User(); |
|
734 | + $user = new User(); |
|
735 | 735 | |
736 | - $list_form = array(); |
|
737 | - $result = $user->list_view_parse_additional_sections($list_form); |
|
738 | - $this->assertSame($list_form, $result); |
|
736 | + $list_form = array(); |
|
737 | + $result = $user->list_view_parse_additional_sections($list_form); |
|
738 | + $this->assertSame($list_form, $result); |
|
739 | 739 | |
740 | - } |
|
740 | + } |
|
741 | 741 | |
742 | 742 | public function testGetAllUsersAndGetActiveUsers() |
743 | 743 | { |
744 | 744 | |
745 | - $all_users = User::getAllUsers(); |
|
746 | - $this->assertTrue(is_array($all_users)); |
|
745 | + $all_users = User::getAllUsers(); |
|
746 | + $this->assertTrue(is_array($all_users)); |
|
747 | 747 | |
748 | - $active_users = User::getActiveUsers(); |
|
749 | - $this->assertTrue(is_array($active_users)); |
|
748 | + $active_users = User::getActiveUsers(); |
|
749 | + $this->assertTrue(is_array($active_users)); |
|
750 | 750 | |
751 | - $this->assertGreaterThanOrEqual(count($active_users), count($all_users)); |
|
751 | + $this->assertGreaterThanOrEqual(count($active_users), count($all_users)); |
|
752 | 752 | } |
753 | 753 | |
754 | 754 | |
755 | - public function testcreate_export_query() { |
|
755 | + public function testcreate_export_query() { |
|
756 | 756 | |
757 | - $user = new User(); |
|
757 | + $user = new User(); |
|
758 | 758 | |
759 | - //test with empty string params |
|
760 | - $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.deleted = 0 AND users.is_admin=0 ORDER BY users.user_name"; |
|
761 | - $actual = $user->create_export_query('',''); |
|
762 | - $this->assertSame($expected,$actual); |
|
759 | + //test with empty string params |
|
760 | + $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.deleted = 0 AND users.is_admin=0 ORDER BY users.user_name"; |
|
761 | + $actual = $user->create_export_query('',''); |
|
762 | + $this->assertSame($expected,$actual); |
|
763 | 763 | |
764 | 764 | |
765 | - //test with valid string params |
|
766 | - $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE user_name=\"\" AND users.deleted = 0 AND users.is_admin=0 ORDER BY id"; |
|
767 | - $actual = $user->create_export_query('id','user_name=""'); |
|
768 | - $this->assertSame($expected,$actual); |
|
765 | + //test with valid string params |
|
766 | + $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE user_name=\"\" AND users.deleted = 0 AND users.is_admin=0 ORDER BY id"; |
|
767 | + $actual = $user->create_export_query('id','user_name=""'); |
|
768 | + $this->assertSame($expected,$actual); |
|
769 | 769 | |
770 | - } |
|
770 | + } |
|
771 | 771 | |
772 | 772 | |
773 | - public function testget_meetings() { |
|
773 | + public function testget_meetings() { |
|
774 | 774 | |
775 | - $user = new User(); |
|
775 | + $user = new User(); |
|
776 | 776 | |
777 | - $result = $user->get_meetings(); |
|
778 | - $this->assertTrue(is_array($result)); |
|
777 | + $result = $user->get_meetings(); |
|
778 | + $this->assertTrue(is_array($result)); |
|
779 | 779 | |
780 | - } |
|
780 | + } |
|
781 | 781 | |
782 | - public function testget_calls() { |
|
782 | + public function testget_calls() { |
|
783 | 783 | |
784 | - $user = new User(); |
|
784 | + $user = new User(); |
|
785 | 785 | |
786 | - //$result = $user->get_calls(); |
|
787 | - //$this->assertTrue(is_array($result)); |
|
786 | + //$result = $user->get_calls(); |
|
787 | + //$this->assertTrue(is_array($result)); |
|
788 | 788 | |
789 | - $this->markTestIncomplete('Error:Only variables should be passed by reference'); |
|
790 | - } |
|
789 | + $this->markTestIncomplete('Error:Only variables should be passed by reference'); |
|
790 | + } |
|
791 | 791 | |
792 | 792 | |
793 | - public function testdisplayEmailCounts() { |
|
793 | + public function testdisplayEmailCounts() { |
|
794 | 794 | |
795 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
796 | - global $db; |
|
797 | - unset ($db->database); |
|
798 | - $db->checkConnection(); |
|
795 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
796 | + global $db; |
|
797 | + unset ($db->database); |
|
798 | + $db->checkConnection(); |
|
799 | 799 | |
800 | 800 | |
801 | - $user = new User(); |
|
801 | + $user = new User(); |
|
802 | 802 | |
803 | - $expected = '<script type="text/javascript" language="Javascript">var welcome = document.getElementById("welcome");var welcomeContent = welcome.innerHTML;welcome.innerHTML = welcomeContent + " <a href=index.php?module=Emails&action=ListViewGroup>Group Inbox: (0 New)</a>";</script>'; |
|
803 | + $expected = '<script type="text/javascript" language="Javascript">var welcome = document.getElementById("welcome");var welcomeContent = welcome.innerHTML;welcome.innerHTML = welcomeContent + " <a href=index.php?module=Emails&action=ListViewGroup>Group Inbox: (0 New)</a>";</script>'; |
|
804 | 804 | |
805 | - //cpature the screen output and compare with exected values |
|
805 | + //cpature the screen output and compare with exected values |
|
806 | 806 | |
807 | - ob_start(); |
|
807 | + ob_start(); |
|
808 | 808 | |
809 | - $user->displayEmailCounts(); |
|
809 | + $user->displayEmailCounts(); |
|
810 | 810 | |
811 | - $renderedContent = ob_get_contents(); |
|
812 | - ob_end_clean(); |
|
811 | + $renderedContent = ob_get_contents(); |
|
812 | + ob_end_clean(); |
|
813 | 813 | |
814 | - $this->assertSame($expected,$renderedContent); |
|
814 | + $this->assertSame($expected,$renderedContent); |
|
815 | 815 | |
816 | - } |
|
816 | + } |
|
817 | 817 | |
818 | 818 | |
819 | - public function testgetSystemDefaultNameAndEmail() |
|
820 | - { |
|
819 | + public function testgetSystemDefaultNameAndEmail() |
|
820 | + { |
|
821 | 821 | |
822 | - $user = new User(); |
|
822 | + $user = new User(); |
|
823 | 823 | |
824 | - $expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM'); |
|
825 | - $actual = $user->getSystemDefaultNameAndEmail(); |
|
826 | - $this->assertSame($expected,$actual); |
|
824 | + $expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM'); |
|
825 | + $actual = $user->getSystemDefaultNameAndEmail(); |
|
826 | + $this->assertSame($expected,$actual); |
|
827 | 827 | |
828 | - } |
|
828 | + } |
|
829 | 829 | |
830 | 830 | |
831 | - public function testsetDefaultsInConfig() |
|
832 | - { |
|
833 | - $user = new User(); |
|
831 | + public function testsetDefaultsInConfig() |
|
832 | + { |
|
833 | + $user = new User(); |
|
834 | 834 | |
835 | - $result = $user->setDefaultsInConfig(); |
|
835 | + $result = $user->setDefaultsInConfig(); |
|
836 | 836 | |
837 | - $this->assertTrue(is_array($result)); |
|
838 | - $this->assertEquals('sugar', $result['email_default_client']); |
|
839 | - $this->assertEquals('html', $result['email_default_editor']); |
|
837 | + $this->assertTrue(is_array($result)); |
|
838 | + $this->assertEquals('sugar', $result['email_default_client']); |
|
839 | + $this->assertEquals('html', $result['email_default_editor']); |
|
840 | 840 | |
841 | - } |
|
841 | + } |
|
842 | 842 | |
843 | 843 | |
844 | - public function testgetEmailLink2() |
|
845 | - { |
|
846 | - $user = new User(); |
|
844 | + public function testgetEmailLink2() |
|
845 | + { |
|
846 | + $user = new User(); |
|
847 | 847 | |
848 | - $user->retrieve(1); |
|
848 | + $user->retrieve(1); |
|
849 | 849 | |
850 | 850 | |
851 | - //test with accounts module |
|
852 | - $account = new Account(); |
|
853 | - $account->name = "test"; |
|
851 | + //test with accounts module |
|
852 | + $account = new Account(); |
|
853 | + $account->name = "test"; |
|
854 | 854 | |
855 | - $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \[email protected]\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
856 | - $actual = $user->getEmailLink2("[email protected]", $account); |
|
857 | - $this->assertSame($expected,$actual); |
|
855 | + $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \[email protected]\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
856 | + $actual = $user->getEmailLink2("[email protected]", $account); |
|
857 | + $this->assertSame($expected,$actual); |
|
858 | 858 | |
859 | 859 | |
860 | - //test with contacts module |
|
861 | - $contact = new Contact(); |
|
862 | - $contact->name = "test"; |
|
860 | + //test with contacts module |
|
861 | + $contact = new Contact(); |
|
862 | + $contact->name = "test"; |
|
863 | 863 | |
864 | - $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\" \[email protected]\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
865 | - $actual = $user->getEmailLink2("[email protected]", $contact); |
|
866 | - $this->assertSame($expected,$actual); |
|
864 | + $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Babc%40email.com%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\" \[email protected]\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
865 | + $actual = $user->getEmailLink2("[email protected]", $contact); |
|
866 | + $this->assertSame($expected,$actual); |
|
867 | 867 | |
868 | - } |
|
868 | + } |
|
869 | 869 | |
870 | 870 | |
871 | - public function testgetEmailLink() |
|
872 | - { |
|
871 | + public function testgetEmailLink() |
|
872 | + { |
|
873 | 873 | |
874 | - $user = new User(); |
|
874 | + $user = new User(); |
|
875 | 875 | |
876 | - $user->retrieve(1); |
|
876 | + $user->retrieve(1); |
|
877 | 877 | |
878 | 878 | |
879 | - //test with accounts module |
|
880 | - $account = new Account(); |
|
881 | - $account->name = "test"; |
|
879 | + //test with accounts module |
|
880 | + $account = new Account(); |
|
881 | + $account->name = "test"; |
|
882 | 882 | |
883 | - $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \u003Ctest\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
884 | - $actual = $user->getEmailLink("name", $account); |
|
885 | - $this->assertSame($expected,$actual); |
|
883 | + $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Accounts\u0026parent_id=\u0026parent_name=test\u0026to_addrs_ids=\u0026to_addrs_names=\u0026to_addrs_emails=\u0026to_email_addrs=test%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Accounts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Accounts\",\"parent_id\":\"\",\"parent_name\":\"test\",\"to_addrs_ids\":\"\",\"to_addrs_names\":\"\",\"to_addrs_emails\":\"\",\"to_email_addrs\":\"test \u003Ctest\u003E\",\"return_module\":\"Accounts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
884 | + $actual = $user->getEmailLink("name", $account); |
|
885 | + $this->assertSame($expected,$actual); |
|
886 | 886 | |
887 | 887 | |
888 | - //test with contacts module |
|
889 | - $contact = new Contact(); |
|
890 | - $contact->name = "test"; |
|
888 | + //test with contacts module |
|
889 | + $contact = new Contact(); |
|
890 | + $contact->name = "test"; |
|
891 | 891 | |
892 | - $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\" \u003Ctest\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
893 | - $actual = $user->getEmailLink("name", $contact); |
|
894 | - $this->assertSame($expected,$actual); |
|
892 | + $expected = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({\"fullComposeUrl\":\"contact_id=\u0026parent_type=Contacts\u0026parent_id=\u0026parent_name=+\u0026to_addrs_ids=\u0026to_addrs_names=+\u0026to_addrs_emails=\u0026to_email_addrs=+%26nbsp%3B%26lt%3Btest%26gt%3B\u0026return_module=Contacts\u0026return_action=DetailView\u0026return_id=\",\"composePackage\":{\"contact_id\":\"\",\"parent_type\":\"Contacts\",\"parent_id\":\"\",\"parent_name\":\" \",\"to_addrs_ids\":\"\",\"to_addrs_names\":\" \",\"to_addrs_emails\":\"\",\"to_email_addrs\":\" \u003Ctest\u003E\",\"return_module\":\"Contacts\",\"return_action\":\"DetailView\",\"return_id\":\"\"}});' class=''>"; |
|
893 | + $actual = $user->getEmailLink("name", $contact); |
|
894 | + $this->assertSame($expected,$actual); |
|
895 | 895 | |
896 | - } |
|
896 | + } |
|
897 | 897 | |
898 | - public function testgetLocaleFormatDesc() |
|
899 | - { |
|
900 | - $user = new User(); |
|
898 | + public function testgetLocaleFormatDesc() |
|
899 | + { |
|
900 | + $user = new User(); |
|
901 | 901 | |
902 | - $result = $user->getLocaleFormatDesc(); |
|
903 | - $this->assertTrue(isset($result)); |
|
904 | - $this->assertGreaterThan(0,strlen($result)); |
|
902 | + $result = $user->getLocaleFormatDesc(); |
|
903 | + $this->assertTrue(isset($result)); |
|
904 | + $this->assertGreaterThan(0,strlen($result)); |
|
905 | 905 | |
906 | - } |
|
906 | + } |
|
907 | 907 | |
908 | 908 | public function testisAdmin() |
909 | 909 | { |
910 | - $user = new User(); |
|
910 | + $user = new User(); |
|
911 | 911 | |
912 | - //test without setting attribute |
|
913 | - $this->assertEquals(false, $user->isAdmin()); |
|
912 | + //test without setting attribute |
|
913 | + $this->assertEquals(false, $user->isAdmin()); |
|
914 | 914 | |
915 | - //test with attribute set |
|
916 | - $user->is_admin = 1; |
|
917 | - $this->assertEquals(true, $user->isAdmin()); |
|
915 | + //test with attribute set |
|
916 | + $user->is_admin = 1; |
|
917 | + $this->assertEquals(true, $user->isAdmin()); |
|
918 | 918 | |
919 | 919 | } |
920 | 920 | |
921 | 921 | public function testisDeveloperForAnyModule() |
922 | 922 | { |
923 | - $user = new User(); |
|
923 | + $user = new User(); |
|
924 | 924 | |
925 | - //test without setting is_admin |
|
926 | - $this->assertEquals(false, $user->isDeveloperForAnyModule()); |
|
925 | + //test without setting is_admin |
|
926 | + $this->assertEquals(false, $user->isDeveloperForAnyModule()); |
|
927 | 927 | |
928 | 928 | |
929 | - //test with id set |
|
930 | - $user->id = 1; |
|
931 | - $this->assertEquals(false, $user->isDeveloperForAnyModule()); |
|
929 | + //test with id set |
|
930 | + $user->id = 1; |
|
931 | + $this->assertEquals(false, $user->isDeveloperForAnyModule()); |
|
932 | 932 | |
933 | 933 | |
934 | - //test with id and is_admin set |
|
935 | - $user->is_admin = 1; |
|
936 | - $this->assertEquals(true, $user->isDeveloperForAnyModule()); |
|
934 | + //test with id and is_admin set |
|
935 | + $user->is_admin = 1; |
|
936 | + $this->assertEquals(true, $user->isDeveloperForAnyModule()); |
|
937 | 937 | |
938 | 938 | } |
939 | 939 | |
940 | 940 | public function testgetDeveloperModules() |
941 | 941 | { |
942 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
943 | - global $db; |
|
944 | - unset ($db->database); |
|
945 | - $db->checkConnection(); |
|
942 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
943 | + global $db; |
|
944 | + unset ($db->database); |
|
945 | + $db->checkConnection(); |
|
946 | 946 | |
947 | - $user = new User(); |
|
947 | + $user = new User(); |
|
948 | 948 | |
949 | - $user->retrieve(1); |
|
949 | + $user->retrieve(1); |
|
950 | 950 | |
951 | - $result = $user->getDeveloperModules(); |
|
952 | - $this->assertTrue(is_array($result)); |
|
951 | + $result = $user->getDeveloperModules(); |
|
952 | + $this->assertTrue(is_array($result)); |
|
953 | 953 | |
954 | 954 | } |
955 | 955 | |
956 | 956 | public function testisDeveloperForModule() |
957 | 957 | { |
958 | - global $db; |
|
959 | - unset ($db->database); |
|
960 | - $db->checkConnection(); |
|
958 | + global $db; |
|
959 | + unset ($db->database); |
|
960 | + $db->checkConnection(); |
|
961 | 961 | |
962 | - $user = new User(); |
|
962 | + $user = new User(); |
|
963 | 963 | |
964 | 964 | |
965 | - //test without setting is_admin |
|
966 | - $this->assertEquals(false, $user->isDeveloperForModule("Accounts")); |
|
965 | + //test without setting is_admin |
|
966 | + $this->assertEquals(false, $user->isDeveloperForModule("Accounts")); |
|
967 | 967 | |
968 | 968 | |
969 | - //test with id set |
|
970 | - $user->id = 1; |
|
971 | - $this->assertEquals(false, $user->isDeveloperForModule("Accounts")); |
|
969 | + //test with id set |
|
970 | + $user->id = 1; |
|
971 | + $this->assertEquals(false, $user->isDeveloperForModule("Accounts")); |
|
972 | 972 | |
973 | 973 | |
974 | - //test with id and is_admin set |
|
975 | - $user->is_admin = 1; |
|
976 | - $this->assertEquals(true, $user->isDeveloperForModule("Accounts")); |
|
974 | + //test with id and is_admin set |
|
975 | + $user->is_admin = 1; |
|
976 | + $this->assertEquals(true, $user->isDeveloperForModule("Accounts")); |
|
977 | 977 | |
978 | 978 | |
979 | 979 | } |
@@ -981,93 +981,93 @@ discard block |
||
981 | 981 | public function testgetAdminModules() |
982 | 982 | { |
983 | 983 | //unset and reconnect Db to resolve mysqli fetch exeception |
984 | - global $db; |
|
985 | - unset ($db->database); |
|
986 | - $db->checkConnection(); |
|
984 | + global $db; |
|
985 | + unset ($db->database); |
|
986 | + $db->checkConnection(); |
|
987 | 987 | |
988 | - $user = new User(); |
|
988 | + $user = new User(); |
|
989 | 989 | |
990 | - $user->retrieve(1); |
|
990 | + $user->retrieve(1); |
|
991 | 991 | |
992 | - $result = $user->getAdminModules(); |
|
993 | - $this->assertTrue(is_array($result)); |
|
992 | + $result = $user->getAdminModules(); |
|
993 | + $this->assertTrue(is_array($result)); |
|
994 | 994 | |
995 | 995 | } |
996 | 996 | |
997 | 997 | public function testisAdminForModule() |
998 | 998 | { |
999 | - global $db; |
|
1000 | - unset ($db->database); |
|
1001 | - $db->checkConnection(); |
|
999 | + global $db; |
|
1000 | + unset ($db->database); |
|
1001 | + $db->checkConnection(); |
|
1002 | 1002 | |
1003 | - $user = new User(); |
|
1003 | + $user = new User(); |
|
1004 | 1004 | |
1005 | 1005 | |
1006 | - //test without setting is_admin |
|
1007 | - $this->assertEquals(false, $user->isAdminForModule("Accounts")); |
|
1006 | + //test without setting is_admin |
|
1007 | + $this->assertEquals(false, $user->isAdminForModule("Accounts")); |
|
1008 | 1008 | |
1009 | 1009 | |
1010 | - //test with id set |
|
1011 | - $user->id = 1; |
|
1012 | - $this->assertEquals(false, $user->isAdminForModule("Accounts")); |
|
1010 | + //test with id set |
|
1011 | + $user->id = 1; |
|
1012 | + $this->assertEquals(false, $user->isAdminForModule("Accounts")); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | - //test with id and is_admin set |
|
1016 | - $user->is_admin = 1; |
|
1017 | - $this->assertEquals(true, $user->isAdminForModule("Accounts")); |
|
1015 | + //test with id and is_admin set |
|
1016 | + $user->is_admin = 1; |
|
1017 | + $this->assertEquals(true, $user->isAdminForModule("Accounts")); |
|
1018 | 1018 | |
1019 | 1019 | |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - public function testshowLastNameFirst() |
|
1023 | - { |
|
1024 | - $user = new User(); |
|
1022 | + public function testshowLastNameFirst() |
|
1023 | + { |
|
1024 | + $user = new User(); |
|
1025 | 1025 | |
1026 | - $result = $user->showLastNameFirst(); |
|
1027 | - $this->assertEquals(false, $result); |
|
1026 | + $result = $user->showLastNameFirst(); |
|
1027 | + $this->assertEquals(false, $result); |
|
1028 | 1028 | |
1029 | - } |
|
1029 | + } |
|
1030 | 1030 | |
1031 | - public function testcreate_new_list_query() |
|
1032 | - { |
|
1031 | + public function testcreate_new_list_query() |
|
1032 | + { |
|
1033 | 1033 | |
1034 | - $user = new User(); |
|
1034 | + $user = new User(); |
|
1035 | 1035 | |
1036 | - //test with empty string params |
|
1037 | - $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where users.deleted=0"; |
|
1038 | - $actual = $user->create_new_list_query('',''); |
|
1039 | - $this->assertSame($expected,$actual); |
|
1036 | + //test with empty string params |
|
1037 | + $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where users.deleted=0"; |
|
1038 | + $actual = $user->create_new_list_query('',''); |
|
1039 | + $this->assertSame($expected,$actual); |
|
1040 | 1040 | |
1041 | 1041 | |
1042 | - //test with valid string params |
|
1043 | - $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (user_name=\"\") AND users.deleted=0 ORDER BY users.id"; |
|
1044 | - $actual = $user->create_new_list_query('id','user_name=""'); |
|
1045 | - $this->assertSame($expected,$actual); |
|
1042 | + //test with valid string params |
|
1043 | + $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (user_name=\"\") AND users.deleted=0 ORDER BY users.id"; |
|
1044 | + $actual = $user->create_new_list_query('id','user_name=""'); |
|
1045 | + $this->assertSame($expected,$actual); |
|
1046 | 1046 | |
1047 | - } |
|
1047 | + } |
|
1048 | 1048 | |
1049 | 1049 | |
1050 | 1050 | public function testget_first_day_of_week() |
1051 | 1051 | { |
1052 | - $user = new User(); |
|
1052 | + $user = new User(); |
|
1053 | 1053 | |
1054 | - $result = $user->get_first_day_of_week(); |
|
1055 | - $this->assertTrue(is_numeric($result)); |
|
1054 | + $result = $user->get_first_day_of_week(); |
|
1055 | + $this->assertTrue(is_numeric($result)); |
|
1056 | 1056 | |
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | |
1060 | 1060 | public function testgeneratePassword() |
1061 | 1061 | { |
1062 | - //generate apsswords and verify they are not same |
|
1062 | + //generate apsswords and verify they are not same |
|
1063 | 1063 | |
1064 | - $password1 = User::generatePassword(); |
|
1065 | - $this->assertGreaterThan(0,strlen($password1)); |
|
1064 | + $password1 = User::generatePassword(); |
|
1065 | + $this->assertGreaterThan(0,strlen($password1)); |
|
1066 | 1066 | |
1067 | - $password2 = User::generatePassword(); |
|
1068 | - $this->assertGreaterThan(0,strlen($password2)); |
|
1067 | + $password2 = User::generatePassword(); |
|
1068 | + $this->assertGreaterThan(0,strlen($password2)); |
|
1069 | 1069 | |
1070 | - $this->assertNotEquals($password1, $password2); |
|
1070 | + $this->assertNotEquals($password1, $password2); |
|
1071 | 1071 | |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1075,50 +1075,50 @@ discard block |
||
1075 | 1075 | public function testsendEmailForPassword() |
1076 | 1076 | { |
1077 | 1077 | |
1078 | - $user = new User(); |
|
1078 | + $user = new User(); |
|
1079 | 1079 | |
1080 | - $result = $user->sendEmailForPassword("1"); |
|
1080 | + $result = $user->sendEmailForPassword("1"); |
|
1081 | 1081 | |
1082 | - //expected result is a array with template not found message. |
|
1083 | - $this->assertTrue(is_array($result)); |
|
1082 | + //expected result is a array with template not found message. |
|
1083 | + $this->assertTrue(is_array($result)); |
|
1084 | 1084 | |
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | |
1088 | 1088 | public function testafterImportSave() |
1089 | 1089 | { |
1090 | - error_reporting(E_ALL); |
|
1090 | + error_reporting(E_ALL); |
|
1091 | 1091 | |
1092 | - $user = new User(); |
|
1092 | + $user = new User(); |
|
1093 | 1093 | |
1094 | - //execute the method and test if it works and does not throws an exception. |
|
1095 | - try { |
|
1096 | - $result = $user->afterImportSave(); |
|
1097 | - $this->assertTrue(true); |
|
1098 | - } |
|
1099 | - catch (Exception $e) { |
|
1100 | - $this->assertStringStartsWith('Cannot modify header information', $e->getMessage()); |
|
1101 | - } |
|
1094 | + //execute the method and test if it works and does not throws an exception. |
|
1095 | + try { |
|
1096 | + $result = $user->afterImportSave(); |
|
1097 | + $this->assertTrue(true); |
|
1098 | + } |
|
1099 | + catch (Exception $e) { |
|
1100 | + $this->assertStringStartsWith('Cannot modify header information', $e->getMessage()); |
|
1101 | + } |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | |
1106 | 1106 | public function testisPrimaryEmail() |
1107 | 1107 | { |
1108 | - $user = new User(); |
|
1108 | + $user = new User(); |
|
1109 | 1109 | |
1110 | - //test without user email |
|
1111 | - $this->assertEquals(false, $user->isPrimaryEmail("[email protected]")); |
|
1110 | + //test without user email |
|
1111 | + $this->assertEquals(false, $user->isPrimaryEmail("[email protected]")); |
|
1112 | 1112 | |
1113 | 1113 | |
1114 | - //test with non matching user email |
|
1115 | - $user->email1 = "[email protected]"; |
|
1116 | - $this->assertEquals(false, $user->isPrimaryEmail("[email protected]")); |
|
1114 | + //test with non matching user email |
|
1115 | + $user->email1 = "[email protected]"; |
|
1116 | + $this->assertEquals(false, $user->isPrimaryEmail("[email protected]")); |
|
1117 | 1117 | |
1118 | 1118 | |
1119 | - //test with matching user email |
|
1120 | - $user->email1 = "[email protected]"; |
|
1121 | - $this->assertEquals(true, $user->isPrimaryEmail("[email protected]")); |
|
1119 | + //test with matching user email |
|
1120 | + $user->email1 = "[email protected]"; |
|
1121 | + $this->assertEquals(true, $user->isPrimaryEmail("[email protected]")); |
|
1122 | 1122 | |
1123 | 1123 | } |
1124 | 1124 |
@@ -4,106 +4,106 @@ |
||
4 | 4 | class VersionTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testVersion() { |
|
7 | + public function testVersion() { |
|
8 | 8 | |
9 | - error_reporting(E_ERROR | E_PARSE); |
|
9 | + error_reporting(E_ERROR | E_PARSE); |
|
10 | 10 | |
11 | - //execute the contructor and check for the Object type and attributes |
|
12 | - $version = new Version(); |
|
11 | + //execute the contructor and check for the Object type and attributes |
|
12 | + $version = new Version(); |
|
13 | 13 | |
14 | - $this->assertInstanceOf('Version',$version); |
|
15 | - $this->assertInstanceOf('SugarBean',$version); |
|
14 | + $this->assertInstanceOf('Version',$version); |
|
15 | + $this->assertInstanceOf('SugarBean',$version); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals('versions', 'table_name', $version); |
|
18 | - $this->assertAttributeEquals('Versions', 'module_dir', $version); |
|
19 | - $this->assertAttributeEquals('Version', 'object_name', $version); |
|
17 | + $this->assertAttributeEquals('versions', 'table_name', $version); |
|
18 | + $this->assertAttributeEquals('Versions', 'module_dir', $version); |
|
19 | + $this->assertAttributeEquals('Version', 'object_name', $version); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $version); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $version); |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testbuild_generic_where_clause() { |
|
25 | + public function testbuild_generic_where_clause() { |
|
26 | 26 | |
27 | - $version = new Version(); |
|
27 | + $version = new Version(); |
|
28 | 28 | |
29 | - //test with empty string params |
|
30 | - $expected = "name like '%'"; |
|
31 | - $actual = $version->build_generic_where_clause(''); |
|
32 | - $this->assertSame($expected,$actual); |
|
29 | + //test with empty string params |
|
30 | + $expected = "name like '%'"; |
|
31 | + $actual = $version->build_generic_where_clause(''); |
|
32 | + $this->assertSame($expected,$actual); |
|
33 | 33 | |
34 | 34 | |
35 | - //test with valid string params |
|
36 | - $expected = "name like 'test%'"; |
|
37 | - $actual = $version->build_generic_where_clause('test'); |
|
38 | - $this->assertSame($expected,$actual); |
|
35 | + //test with valid string params |
|
36 | + $expected = "name like 'test%'"; |
|
37 | + $actual = $version->build_generic_where_clause('test'); |
|
38 | + $this->assertSame($expected,$actual); |
|
39 | 39 | |
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public function testis_expected_version(){ |
|
43 | + public function testis_expected_version(){ |
|
44 | 44 | |
45 | - $version = new Version(); |
|
45 | + $version = new Version(); |
|
46 | 46 | |
47 | - //test without setting attributes |
|
48 | - $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
49 | - $this->assertEquals(false,$actual); |
|
47 | + //test without setting attributes |
|
48 | + $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
49 | + $this->assertEquals(false,$actual); |
|
50 | 50 | |
51 | 51 | |
52 | - //test with attributes set to on matching values |
|
53 | - $version->file_version = "2"; |
|
54 | - $version->db_version = "2"; |
|
55 | - $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
56 | - $this->assertEquals(false,$actual); |
|
52 | + //test with attributes set to on matching values |
|
53 | + $version->file_version = "2"; |
|
54 | + $version->db_version = "2"; |
|
55 | + $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
56 | + $this->assertEquals(false,$actual); |
|
57 | 57 | |
58 | 58 | |
59 | - //test with valid param |
|
60 | - $version->file_version = "1"; |
|
61 | - $version->db_version = "2"; |
|
62 | - $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
63 | - $this->assertEquals(true,$actual); |
|
59 | + //test with valid param |
|
60 | + $version->file_version = "1"; |
|
61 | + $version->db_version = "2"; |
|
62 | + $actual = $version->is_expected_version(array("file_version"=>"1","db_version"=>"2")); |
|
63 | + $this->assertEquals(true,$actual); |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - public function testmark_upgraded(){ |
|
67 | + public function testmark_upgraded(){ |
|
68 | 68 | |
69 | - $version = new Version(); |
|
69 | + $version = new Version(); |
|
70 | 70 | |
71 | - $version->mark_upgraded('test', 1, 1); |
|
71 | + $version->mark_upgraded('test', 1, 1); |
|
72 | 72 | |
73 | - $version = $version->retrieve_by_string_fields(array("name" => "test")); |
|
73 | + $version = $version->retrieve_by_string_fields(array("name" => "test")); |
|
74 | 74 | |
75 | - //test for record ID to verify that record is saved |
|
76 | - $this->assertTrue(isset($version->id)); |
|
77 | - $this->assertEquals(36, strlen($version->id)); |
|
75 | + //test for record ID to verify that record is saved |
|
76 | + $this->assertTrue(isset($version->id)); |
|
77 | + $this->assertEquals(36, strlen($version->id)); |
|
78 | 78 | |
79 | 79 | |
80 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
81 | - $version->mark_deleted($version->id); |
|
82 | - $result = $version->retrieve($version->id); |
|
83 | - $this->assertEquals(null,$result); |
|
80 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
81 | + $version->mark_deleted($version->id); |
|
82 | + $result = $version->retrieve($version->id); |
|
83 | + $this->assertEquals(null,$result); |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | - public function testget_profile(){ |
|
87 | + public function testget_profile(){ |
|
88 | 88 | |
89 | - $version = new Version(); |
|
89 | + $version = new Version(); |
|
90 | 90 | |
91 | - //test without setting attributes |
|
92 | - $expected = array('name'=> null, 'file_version'=> null, 'db_version'=>null); |
|
93 | - $actual = $version->get_profile(); |
|
94 | - $this->assertSame($expected,$actual); |
|
91 | + //test without setting attributes |
|
92 | + $expected = array('name'=> null, 'file_version'=> null, 'db_version'=>null); |
|
93 | + $actual = $version->get_profile(); |
|
94 | + $this->assertSame($expected,$actual); |
|
95 | 95 | |
96 | 96 | |
97 | - //test with attributes set |
|
98 | - $version->name = "test"; |
|
99 | - $version->file_version = 1; |
|
100 | - $version->db_version = 1; |
|
97 | + //test with attributes set |
|
98 | + $version->name = "test"; |
|
99 | + $version->file_version = 1; |
|
100 | + $version->db_version = 1; |
|
101 | 101 | |
102 | - $expected = array('name'=> 'test', 'file_version'=> 1, 'db_version'=>1); |
|
103 | - $actual = $version->get_profile(); |
|
104 | - $this->assertSame($expected,$actual); |
|
102 | + $expected = array('name'=> 'test', 'file_version'=> 1, 'db_version'=>1); |
|
103 | + $actual = $version->get_profile(); |
|
104 | + $this->assertSame($expected,$actual); |
|
105 | 105 | |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | 108 | } |
109 | 109 |
@@ -4,239 +4,239 @@ |
||
4 | 4 | class BugTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testBug() |
|
8 | - { |
|
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $bug = new Bug(); |
|
11 | - $this->assertInstanceOf('Bug',$bug); |
|
12 | - $this->assertInstanceOf('SugarBean',$bug); |
|
7 | + public function testBug() |
|
8 | + { |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $bug = new Bug(); |
|
11 | + $this->assertInstanceOf('Bug',$bug); |
|
12 | + $this->assertInstanceOf('SugarBean',$bug); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('Bugs', 'module_dir', $bug); |
|
15 | - $this->assertAttributeEquals('Bug', 'object_name', $bug); |
|
16 | - $this->assertAttributeEquals('bugs', 'table_name', $bug); |
|
17 | - $this->assertAttributeEquals('accounts_bugs', 'rel_account_table', $bug); |
|
18 | - $this->assertAttributeEquals('contacts_bugs', 'rel_contact_table', $bug); |
|
19 | - $this->assertAttributeEquals('cases_bugs', 'rel_case_table', $bug); |
|
20 | - $this->assertAttributeEquals(true, 'new_schema', $bug); |
|
14 | + $this->assertAttributeEquals('Bugs', 'module_dir', $bug); |
|
15 | + $this->assertAttributeEquals('Bug', 'object_name', $bug); |
|
16 | + $this->assertAttributeEquals('bugs', 'table_name', $bug); |
|
17 | + $this->assertAttributeEquals('accounts_bugs', 'rel_account_table', $bug); |
|
18 | + $this->assertAttributeEquals('contacts_bugs', 'rel_contact_table', $bug); |
|
19 | + $this->assertAttributeEquals('cases_bugs', 'rel_case_table', $bug); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $bug); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - public function testget_summary_text() |
|
26 | - { |
|
27 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + public function testget_summary_text() |
|
26 | + { |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $bug = new Bug(); |
|
29 | + $bug = new Bug(); |
|
30 | 30 | |
31 | - //test without setting name |
|
32 | - $this->assertEquals(Null,$bug->get_summary_text()); |
|
31 | + //test without setting name |
|
32 | + $this->assertEquals(Null,$bug->get_summary_text()); |
|
33 | 33 | |
34 | - //test with name set//test with name set |
|
35 | - $bug->name = "test"; |
|
36 | - $this->assertEquals('test',$bug->get_summary_text()); |
|
34 | + //test with name set//test with name set |
|
35 | + $bug->name = "test"; |
|
36 | + $this->assertEquals('test',$bug->get_summary_text()); |
|
37 | 37 | |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - public function testcreate_list_query() |
|
41 | - { |
|
42 | - $bug = new Bug(); |
|
40 | + public function testcreate_list_query() |
|
41 | + { |
|
42 | + $bug = new Bug(); |
|
43 | 43 | |
44 | - //test with empty string params |
|
45 | - $expected = "SELECT \n bugs.*\n\n ,users.user_name as assigned_user_name, releases.id release_id, releases.name release_name FROM bugs LEFT JOIN releases ON bugs.found_in_release=releases.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.deleted=0 ORDER BY bugs.name"; |
|
46 | - $actual = $bug->create_list_query('',''); |
|
47 | - $this->assertSame($expected,$actual); |
|
44 | + //test with empty string params |
|
45 | + $expected = "SELECT \n bugs.*\n\n ,users.user_name as assigned_user_name, releases.id release_id, releases.name release_name FROM bugs LEFT JOIN releases ON bugs.found_in_release=releases.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.deleted=0 ORDER BY bugs.name"; |
|
46 | + $actual = $bug->create_list_query('',''); |
|
47 | + $this->assertSame($expected,$actual); |
|
48 | 48 | |
49 | 49 | |
50 | - //test with valid string params |
|
51 | - $expected = "SELECT \n bugs.*\n\n ,users.user_name as assigned_user_name, releases.id release_id, releases.name release_name FROM bugs LEFT JOIN releases ON bugs.found_in_release=releases.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.name=\"\" AND bugs.deleted=0 ORDER BY releases.id"; |
|
52 | - $actual = $bug->create_list_query('releases.id','bugs.name=""'); |
|
53 | - $this->assertSame($expected,$actual); |
|
50 | + //test with valid string params |
|
51 | + $expected = "SELECT \n bugs.*\n\n ,users.user_name as assigned_user_name, releases.id release_id, releases.name release_name FROM bugs LEFT JOIN releases ON bugs.found_in_release=releases.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.name=\"\" AND bugs.deleted=0 ORDER BY releases.id"; |
|
52 | + $actual = $bug->create_list_query('releases.id','bugs.name=""'); |
|
53 | + $this->assertSame($expected,$actual); |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - public function testcreate_export_query() |
|
58 | - { |
|
59 | - $bug = new Bug(); |
|
57 | + public function testcreate_export_query() |
|
58 | + { |
|
59 | + $bug = new Bug(); |
|
60 | 60 | |
61 | - //test with empty string params |
|
62 | - $expected = "SELECT\n bugs.*,\n r1.name found_in_release_name,\n r2.name fixed_in_release_name,\n users.user_name assigned_user_name FROM bugs LEFT JOIN releases r1 ON bugs.found_in_release = r1.id\n LEFT JOIN releases r2 ON bugs.fixed_in_release = r2.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.deleted=0\n ORDER BY bugs.bug_number"; |
|
63 | - $actual = $bug->create_export_query('',''); |
|
64 | - $this->assertSame($expected,$actual); |
|
61 | + //test with empty string params |
|
62 | + $expected = "SELECT\n bugs.*,\n r1.name found_in_release_name,\n r2.name fixed_in_release_name,\n users.user_name assigned_user_name FROM bugs LEFT JOIN releases r1 ON bugs.found_in_release = r1.id\n LEFT JOIN releases r2 ON bugs.fixed_in_release = r2.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.deleted=0\n ORDER BY bugs.bug_number"; |
|
63 | + $actual = $bug->create_export_query('',''); |
|
64 | + $this->assertSame($expected,$actual); |
|
65 | 65 | |
66 | 66 | |
67 | - //test with valid string params |
|
68 | - $expected = "SELECT\n bugs.*,\n r1.name found_in_release_name,\n r2.name fixed_in_release_name,\n users.user_name assigned_user_name FROM bugs LEFT JOIN releases r1 ON bugs.found_in_release = r1.id\n LEFT JOIN releases r2 ON bugs.fixed_in_release = r2.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.name=\"\" AND bugs.deleted=0\n ORDER BY releases.id"; |
|
69 | - $actual = $bug->create_export_query('releases.id','bugs.name=""'); |
|
70 | - $this->assertSame($expected,$actual); |
|
67 | + //test with valid string params |
|
68 | + $expected = "SELECT\n bugs.*,\n r1.name found_in_release_name,\n r2.name fixed_in_release_name,\n users.user_name assigned_user_name FROM bugs LEFT JOIN releases r1 ON bugs.found_in_release = r1.id\n LEFT JOIN releases r2 ON bugs.fixed_in_release = r2.id\n LEFT JOIN users\n ON bugs.assigned_user_id=users.id where bugs.name=\"\" AND bugs.deleted=0\n ORDER BY releases.id"; |
|
69 | + $actual = $bug->create_export_query('releases.id','bugs.name=""'); |
|
70 | + $this->assertSame($expected,$actual); |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - public function testfill_in_additional_list_fields() |
|
77 | - { |
|
78 | - $bug = new Bug(); |
|
79 | - |
|
80 | - //execute the method and test if it works and does not throws an exception. |
|
81 | - try { |
|
82 | - $bug->fill_in_additional_list_fields(); |
|
83 | - $this->assertTrue(true); |
|
84 | - } |
|
85 | - catch (Exception $e) { |
|
86 | - $this->fail(); |
|
87 | - } |
|
76 | + public function testfill_in_additional_list_fields() |
|
77 | + { |
|
78 | + $bug = new Bug(); |
|
79 | + |
|
80 | + //execute the method and test if it works and does not throws an exception. |
|
81 | + try { |
|
82 | + $bug->fill_in_additional_list_fields(); |
|
83 | + $this->assertTrue(true); |
|
84 | + } |
|
85 | + catch (Exception $e) { |
|
86 | + $this->fail(); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | - public function testfill_in_additional_detail_fields() |
|
93 | - { |
|
92 | + public function testfill_in_additional_detail_fields() |
|
93 | + { |
|
94 | 94 | |
95 | - $bug = new Bug(); |
|
96 | - $bug->assigned_user_id = 1; |
|
97 | - $bug->created_by = 1; |
|
98 | - $bug->modified_user_id = 1; |
|
95 | + $bug = new Bug(); |
|
96 | + $bug->assigned_user_id = 1; |
|
97 | + $bug->created_by = 1; |
|
98 | + $bug->modified_user_id = 1; |
|
99 | 99 | |
100 | - //test with attributes preset and verify attributes are set accordingly |
|
101 | - $bug->fill_in_additional_detail_fields(); |
|
100 | + //test with attributes preset and verify attributes are set accordingly |
|
101 | + $bug->fill_in_additional_detail_fields(); |
|
102 | 102 | |
103 | - $this->assertEquals("Administrator", $bug->assigned_user_name); |
|
104 | - $this->assertEquals("Administrator", $bug->created_by_name); |
|
105 | - $this->assertEquals("Administrator", $bug->modified_by_name); |
|
103 | + $this->assertEquals("Administrator", $bug->assigned_user_name); |
|
104 | + $this->assertEquals("Administrator", $bug->created_by_name); |
|
105 | + $this->assertEquals("Administrator", $bug->modified_by_name); |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - public function testset_release() |
|
111 | - { |
|
110 | + public function testset_release() |
|
111 | + { |
|
112 | 112 | |
113 | - $bug = new Bug(); |
|
114 | - $bug->found_in_release = "1"; |
|
113 | + $bug = new Bug(); |
|
114 | + $bug->found_in_release = "1"; |
|
115 | 115 | |
116 | - $bug->set_release(); |
|
116 | + $bug->set_release(); |
|
117 | 117 | |
118 | - $this->assertEquals("",$bug->release_name); |
|
118 | + $this->assertEquals("",$bug->release_name); |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | - public function testset_fixed_in_release() |
|
124 | - { |
|
123 | + public function testset_fixed_in_release() |
|
124 | + { |
|
125 | 125 | |
126 | - $bug = new Bug(); |
|
127 | - $bug->found_in_release = "1"; |
|
126 | + $bug = new Bug(); |
|
127 | + $bug->found_in_release = "1"; |
|
128 | 128 | |
129 | - $bug->set_release(); |
|
129 | + $bug->set_release(); |
|
130 | 130 | |
131 | - $this->assertEquals("",$bug->fixed_in_release_name); |
|
132 | - } |
|
131 | + $this->assertEquals("",$bug->fixed_in_release_name); |
|
132 | + } |
|
133 | 133 | |
134 | 134 | |
135 | - public function testget_list_view_data() |
|
136 | - { |
|
137 | - $bug = new Bug(); |
|
138 | - |
|
139 | - //execute the method and verify that it retunrs expected results |
|
140 | - $expected = array( |
|
141 | - "DELETED"=>0, |
|
142 | - "NAME"=>"<em>blank</em>", |
|
143 | - "PRIORITY"=>"", |
|
144 | - "STATUS"=>"", |
|
145 | - "TYPE"=>"", |
|
146 | - "RELEASE"=> NULL, |
|
147 | - "BUG_NUMBER" => NULL, |
|
148 | - "ENCODED_NAME"=>NULL |
|
149 | - ); |
|
150 | - |
|
151 | - $actual = $bug->get_list_view_data(); |
|
152 | - $this->assertSame($expected,$actual); |
|
135 | + public function testget_list_view_data() |
|
136 | + { |
|
137 | + $bug = new Bug(); |
|
138 | + |
|
139 | + //execute the method and verify that it retunrs expected results |
|
140 | + $expected = array( |
|
141 | + "DELETED"=>0, |
|
142 | + "NAME"=>"<em>blank</em>", |
|
143 | + "PRIORITY"=>"", |
|
144 | + "STATUS"=>"", |
|
145 | + "TYPE"=>"", |
|
146 | + "RELEASE"=> NULL, |
|
147 | + "BUG_NUMBER" => NULL, |
|
148 | + "ENCODED_NAME"=>NULL |
|
149 | + ); |
|
150 | + |
|
151 | + $actual = $bug->get_list_view_data(); |
|
152 | + $this->assertSame($expected,$actual); |
|
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | 156 | |
157 | - public function testbuild_generic_where_clause () |
|
158 | - { |
|
159 | - $bug = new Bug(); |
|
157 | + public function testbuild_generic_where_clause () |
|
158 | + { |
|
159 | + $bug = new Bug(); |
|
160 | 160 | |
161 | - //execute with blank parameters |
|
162 | - $expected = "bugs.name like '%'"; |
|
163 | - $actual = $bug->build_generic_where_clause (""); |
|
164 | - $this->assertSame($expected,$actual); |
|
161 | + //execute with blank parameters |
|
162 | + $expected = "bugs.name like '%'"; |
|
163 | + $actual = $bug->build_generic_where_clause (""); |
|
164 | + $this->assertSame($expected,$actual); |
|
165 | 165 | |
166 | 166 | |
167 | - //execute with numeric parameter |
|
168 | - $expected = "bugs.name like '1%' or bugs.bug_number like '1%'"; |
|
169 | - $actual = $bug->build_generic_where_clause(1); |
|
170 | - $this->assertSame($expected,$actual); |
|
167 | + //execute with numeric parameter |
|
168 | + $expected = "bugs.name like '1%' or bugs.bug_number like '1%'"; |
|
169 | + $actual = $bug->build_generic_where_clause(1); |
|
170 | + $this->assertSame($expected,$actual); |
|
171 | 171 | |
172 | - } |
|
172 | + } |
|
173 | 173 | |
174 | 174 | |
175 | - public function testset_notification_body() |
|
176 | - { |
|
177 | - $bug = new Bug(); |
|
178 | - |
|
179 | - $bug->name = "test"; |
|
180 | - $bug->type = "Defect"; |
|
181 | - $bug->priority = "Urgent"; |
|
182 | - $bug->status = "New"; |
|
183 | - $bug->resolution = "Accepted"; |
|
184 | - $bug->bug_number ="1"; |
|
185 | - |
|
186 | - //test with attributes preset and verify template variables are set accordingly |
|
187 | - $result = $bug->set_notification_body(new Sugar_Smarty(), $bug); |
|
188 | - |
|
189 | - $this->assertEquals($bug->name ,$result->_tpl_vars['BUG_SUBJECT']); |
|
190 | - $this->assertEquals($bug->type ,$result->_tpl_vars['BUG_TYPE']); |
|
191 | - $this->assertEquals($bug->priority ,$result->_tpl_vars['BUG_PRIORITY']); |
|
192 | - $this->assertEquals($bug->status ,$result->_tpl_vars['BUG_STATUS']); |
|
193 | - $this->assertEquals($bug->resolution ,$result->_tpl_vars['BUG_RESOLUTION']); |
|
194 | - $this->assertEquals($bug->bug_number ,$result->_tpl_vars['BUG_BUG_NUMBER']); |
|
195 | - |
|
196 | - } |
|
175 | + public function testset_notification_body() |
|
176 | + { |
|
177 | + $bug = new Bug(); |
|
178 | + |
|
179 | + $bug->name = "test"; |
|
180 | + $bug->type = "Defect"; |
|
181 | + $bug->priority = "Urgent"; |
|
182 | + $bug->status = "New"; |
|
183 | + $bug->resolution = "Accepted"; |
|
184 | + $bug->bug_number ="1"; |
|
185 | + |
|
186 | + //test with attributes preset and verify template variables are set accordingly |
|
187 | + $result = $bug->set_notification_body(new Sugar_Smarty(), $bug); |
|
188 | + |
|
189 | + $this->assertEquals($bug->name ,$result->_tpl_vars['BUG_SUBJECT']); |
|
190 | + $this->assertEquals($bug->type ,$result->_tpl_vars['BUG_TYPE']); |
|
191 | + $this->assertEquals($bug->priority ,$result->_tpl_vars['BUG_PRIORITY']); |
|
192 | + $this->assertEquals($bug->status ,$result->_tpl_vars['BUG_STATUS']); |
|
193 | + $this->assertEquals($bug->resolution ,$result->_tpl_vars['BUG_RESOLUTION']); |
|
194 | + $this->assertEquals($bug->bug_number ,$result->_tpl_vars['BUG_BUG_NUMBER']); |
|
195 | + |
|
196 | + } |
|
197 | 197 | |
198 | - public function testbean_implements() |
|
199 | - { |
|
200 | - $bug = new Bug(); |
|
201 | - $this->assertEquals(false, $bug->bean_implements('')); //test with blank value |
|
202 | - $this->assertEquals(false, $bug->bean_implements('test')); //test with invalid value |
|
203 | - $this->assertEquals(true, $bug->bean_implements('ACL')); //test with valid value |
|
204 | - } |
|
198 | + public function testbean_implements() |
|
199 | + { |
|
200 | + $bug = new Bug(); |
|
201 | + $this->assertEquals(false, $bug->bean_implements('')); //test with blank value |
|
202 | + $this->assertEquals(false, $bug->bean_implements('test')); //test with invalid value |
|
203 | + $this->assertEquals(true, $bug->bean_implements('ACL')); //test with valid value |
|
204 | + } |
|
205 | 205 | |
206 | - public function testsave() |
|
207 | - { |
|
208 | - $bug = new Bug(); |
|
209 | - |
|
210 | - $bug->name = "test"; |
|
211 | - $bug->bug_number ="1"; |
|
212 | - $bug->type = "Defect"; |
|
213 | - $bug->priority = "Urgent"; |
|
214 | - $bug->status = "New"; |
|
215 | - $bug->resolution = "Accepted"; |
|
216 | - |
|
217 | - $bug->save(); |
|
206 | + public function testsave() |
|
207 | + { |
|
208 | + $bug = new Bug(); |
|
209 | + |
|
210 | + $bug->name = "test"; |
|
211 | + $bug->bug_number ="1"; |
|
212 | + $bug->type = "Defect"; |
|
213 | + $bug->priority = "Urgent"; |
|
214 | + $bug->status = "New"; |
|
215 | + $bug->resolution = "Accepted"; |
|
216 | + |
|
217 | + $bug->save(); |
|
218 | 218 | |
219 | 219 | |
220 | - //test for record ID to verify that record is saved |
|
221 | - $this->assertTrue(isset($bug->id)); |
|
222 | - $this->assertEquals(36, strlen($bug->id)); |
|
220 | + //test for record ID to verify that record is saved |
|
221 | + $this->assertTrue(isset($bug->id)); |
|
222 | + $this->assertEquals(36, strlen($bug->id)); |
|
223 | 223 | |
224 | 224 | |
225 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
226 | - $bug->mark_deleted($bug->id); |
|
227 | - $result = $bug->retrieve($bug->id); |
|
228 | - $this->assertEquals(null,$result); |
|
225 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
226 | + $bug->mark_deleted($bug->id); |
|
227 | + $result = $bug->retrieve($bug->id); |
|
228 | + $this->assertEquals(null,$result); |
|
229 | 229 | |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | |
233 | - public function testgetReleaseDropDown() |
|
234 | - { |
|
235 | - $result = getReleaseDropDown(); |
|
233 | + public function testgetReleaseDropDown() |
|
234 | + { |
|
235 | + $result = getReleaseDropDown(); |
|
236 | 236 | |
237 | - //execute the method and verify it returns an array |
|
238 | - $this->assertTrue(is_array($result)); |
|
239 | - } |
|
237 | + //execute the method and verify it returns an array |
|
238 | + $this->assertTrue(is_array($result)); |
|
239 | + } |
|
240 | 240 | |
241 | 241 | |
242 | 242 | } |