@@ -5,58 +5,58 @@ discard block |
||
5 | 5 | |
6 | 6 | |
7 | 7 | public function test__construct() |
8 | - { |
|
8 | + { |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $oauthToken = new OAuthToken(); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $oauthToken = new OAuthToken(); |
|
12 | 12 | |
13 | - $this->assertInstanceOf('OAuthToken',$oauthToken); |
|
14 | - $this->assertInstanceOf('SugarBean',$oauthToken); |
|
13 | + $this->assertInstanceOf('OAuthToken',$oauthToken); |
|
14 | + $this->assertInstanceOf('SugarBean',$oauthToken); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('OAuthTokens', 'module_dir', $oauthToken); |
|
17 | - $this->assertAttributeEquals('OAuthToken', 'object_name', $oauthToken); |
|
18 | - $this->assertAttributeEquals('oauth_tokens', 'table_name', $oauthToken); |
|
16 | + $this->assertAttributeEquals('OAuthTokens', 'module_dir', $oauthToken); |
|
17 | + $this->assertAttributeEquals('OAuthToken', 'object_name', $oauthToken); |
|
18 | + $this->assertAttributeEquals('oauth_tokens', 'table_name', $oauthToken); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $oauthToken); |
|
20 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $oauthToken); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - public function testsetState() |
|
26 | - { |
|
27 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + public function testsetState() |
|
26 | + { |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $oauthToken = new OAuthToken(); |
|
30 | - $oauthToken->setState(); |
|
29 | + $oauthToken = new OAuthToken(); |
|
30 | + $oauthToken->setState(); |
|
31 | 31 | |
32 | - $this->assertEquals( $oauthToken->REQUEST ,$oauthToken->tstate); |
|
32 | + $this->assertEquals( $oauthToken->REQUEST ,$oauthToken->tstate); |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - public function testsetConsumer() |
|
38 | - { |
|
39 | - $oauthToken = new OAuthToken(); |
|
37 | + public function testsetConsumer() |
|
38 | + { |
|
39 | + $oauthToken = new OAuthToken(); |
|
40 | 40 | |
41 | - $oauthKey = new OAuthKey(); |
|
42 | - $oauthKey->id = "1"; |
|
41 | + $oauthKey = new OAuthKey(); |
|
42 | + $oauthKey->id = "1"; |
|
43 | 43 | |
44 | - $oauthToken->setConsumer($oauthKey); |
|
44 | + $oauthToken->setConsumer($oauthKey); |
|
45 | 45 | |
46 | - $this->assertEquals( $oauthKey->id ,$oauthToken->consumer); |
|
47 | - $this->assertEquals( $oauthKey ,$oauthToken->consumer_obj); |
|
46 | + $this->assertEquals( $oauthKey->id ,$oauthToken->consumer); |
|
47 | + $this->assertEquals( $oauthKey ,$oauthToken->consumer_obj); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | 52 | public function testsetCallbackURL() |
53 | 53 | { |
54 | - $oauthToken = new OAuthToken(); |
|
54 | + $oauthToken = new OAuthToken(); |
|
55 | 55 | |
56 | - $url = "test url"; |
|
57 | - $oauthToken->setCallbackURL($url); |
|
56 | + $url = "test url"; |
|
57 | + $oauthToken->setCallbackURL($url); |
|
58 | 58 | |
59 | - $this->assertEquals( $url ,$oauthToken->callback_url ); |
|
59 | + $this->assertEquals( $url ,$oauthToken->callback_url ); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -64,210 +64,210 @@ discard block |
||
64 | 64 | public function testgenerate() |
65 | 65 | { |
66 | 66 | |
67 | - $result = OAuthToken::generate(); |
|
67 | + $result = OAuthToken::generate(); |
|
68 | 68 | |
69 | - $this->assertInstanceOf('OAuthToken',$result); |
|
70 | - $this->assertGreaterThan(0,strlen($result->token)); |
|
71 | - $this->assertGreaterThan(0,strlen($result->secret)); |
|
69 | + $this->assertInstanceOf('OAuthToken',$result); |
|
70 | + $this->assertGreaterThan(0,strlen($result->token)); |
|
71 | + $this->assertGreaterThan(0,strlen($result->secret)); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function testSaveAndOthers() |
77 | 77 | { |
78 | - $oauthToken = OAuthToken::generate(); |
|
78 | + $oauthToken = OAuthToken::generate(); |
|
79 | 79 | |
80 | - $oauthToken->save(); |
|
80 | + $oauthToken->save(); |
|
81 | 81 | |
82 | - //test for record ID to verify that record is saved |
|
83 | - $this->assertTrue(isset($oauthToken->id)); |
|
84 | - $this->assertEquals(12, strlen($oauthToken->id)); |
|
82 | + //test for record ID to verify that record is saved |
|
83 | + $this->assertTrue(isset($oauthToken->id)); |
|
84 | + $this->assertEquals(12, strlen($oauthToken->id)); |
|
85 | 85 | |
86 | 86 | |
87 | - //test load method |
|
88 | - $this->load($oauthToken->id); |
|
87 | + //test load method |
|
88 | + $this->load($oauthToken->id); |
|
89 | 89 | |
90 | 90 | |
91 | - //test invalidate method |
|
92 | - $token = OAuthToken::load($oauthToken->id); |
|
93 | - $this->invalidate($token); |
|
91 | + //test invalidate method |
|
92 | + $token = OAuthToken::load($oauthToken->id); |
|
93 | + $this->invalidate($token); |
|
94 | 94 | |
95 | 95 | |
96 | - //test authorize method |
|
97 | - $this->authorize($token); |
|
96 | + //test authorize method |
|
97 | + $this->authorize($token); |
|
98 | 98 | |
99 | 99 | |
100 | - //test mark_deleted method |
|
101 | - $this->mark_deleted($oauthToken->id); |
|
100 | + //test mark_deleted method |
|
101 | + $this->mark_deleted($oauthToken->id); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
105 | 105 | public function load($id) |
106 | 106 | { |
107 | - $token = OAuthToken::load($id); |
|
107 | + $token = OAuthToken::load($id); |
|
108 | 108 | |
109 | - $this->assertInstanceOf('OAuthToken',$token); |
|
110 | - $this->assertTrue(isset($token->id)); |
|
109 | + $this->assertInstanceOf('OAuthToken',$token); |
|
110 | + $this->assertTrue(isset($token->id)); |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | - public function invalidate($token) |
|
115 | - { |
|
114 | + public function invalidate($token) |
|
115 | + { |
|
116 | 116 | |
117 | - $token->invalidate(); |
|
117 | + $token->invalidate(); |
|
118 | 118 | |
119 | - $this->assertEquals( $token::INVALID ,$token->tstate); |
|
120 | - $this->assertEquals( false ,$token->verify); |
|
119 | + $this->assertEquals( $token::INVALID ,$token->tstate); |
|
120 | + $this->assertEquals( false ,$token->verify); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | - public function authorize($token) |
|
126 | - { |
|
125 | + public function authorize($token) |
|
126 | + { |
|
127 | 127 | |
128 | - $result = $token->authorize("test"); |
|
129 | - $this->assertEquals(false, $result); |
|
128 | + $result = $token->authorize("test"); |
|
129 | + $this->assertEquals(false, $result); |
|
130 | 130 | |
131 | - $token->tstate = $token::REQUEST ; |
|
132 | - $result = $token->authorize("test"); |
|
131 | + $token->tstate = $token::REQUEST ; |
|
132 | + $result = $token->authorize("test"); |
|
133 | 133 | |
134 | - $this->assertEquals("test", $token->authdata); |
|
135 | - $this->assertGreaterThan(0, strlen($result)); |
|
136 | - $this->assertEquals($result, $token->verify); |
|
134 | + $this->assertEquals("test", $token->authdata); |
|
135 | + $this->assertGreaterThan(0, strlen($result)); |
|
136 | + $this->assertEquals($result, $token->verify); |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | - public function mark_deleted($id) |
|
142 | - { |
|
141 | + public function mark_deleted($id) |
|
142 | + { |
|
143 | 143 | |
144 | - $oauthToken = new OAuthToken(); |
|
144 | + $oauthToken = new OAuthToken(); |
|
145 | 145 | |
146 | - //execute the method |
|
147 | - $oauthToken->mark_deleted($id); |
|
146 | + //execute the method |
|
147 | + $oauthToken->mark_deleted($id); |
|
148 | 148 | |
149 | - //verify that record can not be loaded anymore |
|
150 | - $token = OAuthToken::load($id); |
|
151 | - $this->assertEquals(null, $token->id); |
|
149 | + //verify that record can not be loaded anymore |
|
150 | + $token = OAuthToken::load($id); |
|
151 | + $this->assertEquals(null, $token->id); |
|
152 | 152 | |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | 155 | |
156 | - public function testcreateAuthorized() |
|
157 | - { |
|
156 | + public function testcreateAuthorized() |
|
157 | + { |
|
158 | 158 | |
159 | - $oauthKey = new OAuthKey(); |
|
160 | - $oauthKey->id = "1"; |
|
159 | + $oauthKey = new OAuthKey(); |
|
160 | + $oauthKey->id = "1"; |
|
161 | 161 | |
162 | - $user = new User(); |
|
163 | - $user->retrieve("1"); |
|
162 | + $user = new User(); |
|
163 | + $user->retrieve("1"); |
|
164 | 164 | |
165 | - $oauthToken = OAuthToken::createAuthorized($oauthKey, $user); |
|
165 | + $oauthToken = OAuthToken::createAuthorized($oauthKey, $user); |
|
166 | 166 | |
167 | - $this->assertEquals( $oauthKey->id ,$oauthToken->consumer); |
|
168 | - $this->assertEquals( $oauthKey ,$oauthToken->consumer_obj); |
|
169 | - $this->assertEquals( $oauthToken::ACCESS ,$oauthToken->tstate); |
|
170 | - $this->assertEquals( $user->id ,$oauthToken->assigned_user_id); |
|
167 | + $this->assertEquals( $oauthKey->id ,$oauthToken->consumer); |
|
168 | + $this->assertEquals( $oauthKey ,$oauthToken->consumer_obj); |
|
169 | + $this->assertEquals( $oauthToken::ACCESS ,$oauthToken->tstate); |
|
170 | + $this->assertEquals( $user->id ,$oauthToken->assigned_user_id); |
|
171 | 171 | |
172 | 172 | |
173 | - //execute copyAuthData method |
|
174 | - $oauthToken->authdata = "test"; |
|
175 | - $this->copyAuthData($oauthToken); |
|
173 | + //execute copyAuthData method |
|
174 | + $oauthToken->authdata = "test"; |
|
175 | + $this->copyAuthData($oauthToken); |
|
176 | 176 | |
177 | - //finally mark deleted for cleanup |
|
178 | - $oauthToken->mark_deleted($oauthToken->id); |
|
177 | + //finally mark deleted for cleanup |
|
178 | + $oauthToken->mark_deleted($oauthToken->id); |
|
179 | 179 | |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | 182 | |
183 | - public function copyAuthData($token) |
|
184 | - { |
|
185 | - $oauthToken = new OAuthToken(); |
|
183 | + public function copyAuthData($token) |
|
184 | + { |
|
185 | + $oauthToken = new OAuthToken(); |
|
186 | 186 | |
187 | - $oauthToken->copyAuthData($token); |
|
188 | - $this->assertEquals( $token->authdata , $oauthToken->authdata); |
|
189 | - $this->assertEquals( $token->assigned_user_id , $oauthToken->assigned_user_id); |
|
187 | + $oauthToken->copyAuthData($token); |
|
188 | + $this->assertEquals( $token->authdata , $oauthToken->authdata); |
|
189 | + $this->assertEquals( $token->assigned_user_id , $oauthToken->assigned_user_id); |
|
190 | 190 | |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - public function testqueryString() |
|
195 | - { |
|
196 | - $oauthToken = new OAuthToken(); |
|
194 | + public function testqueryString() |
|
195 | + { |
|
196 | + $oauthToken = new OAuthToken(); |
|
197 | 197 | |
198 | - $result = $oauthToken->queryString(); |
|
199 | - $this->assertEquals("oauth_token=&oauth_token_secret=", $result ); |
|
198 | + $result = $oauthToken->queryString(); |
|
199 | + $this->assertEquals("oauth_token=&oauth_token_secret=", $result ); |
|
200 | 200 | |
201 | 201 | |
202 | - //test with attributes set |
|
203 | - $oauthToken->token = "toekn"; |
|
204 | - $oauthToken->secret = "secret"; |
|
205 | - $result = $oauthToken->queryString(); |
|
206 | - $this->assertEquals("oauth_token=toekn&oauth_token_secret=secret", $result ); |
|
202 | + //test with attributes set |
|
203 | + $oauthToken->token = "toekn"; |
|
204 | + $oauthToken->secret = "secret"; |
|
205 | + $result = $oauthToken->queryString(); |
|
206 | + $this->assertEquals("oauth_token=toekn&oauth_token_secret=secret", $result ); |
|
207 | 207 | |
208 | - } |
|
208 | + } |
|
209 | 209 | |
210 | - public function testcleanup() |
|
211 | - { |
|
210 | + public function testcleanup() |
|
211 | + { |
|
212 | 212 | |
213 | - //execute the method and test if it works and does not throws an exception. |
|
214 | - try { |
|
215 | - OAuthToken::cleanup(); |
|
216 | - $this->assertTrue(true); |
|
217 | - } |
|
218 | - catch (Exception $e) { |
|
219 | - $this->fail(); |
|
220 | - } |
|
221 | - |
|
222 | - } |
|
213 | + //execute the method and test if it works and does not throws an exception. |
|
214 | + try { |
|
215 | + OAuthToken::cleanup(); |
|
216 | + $this->assertTrue(true); |
|
217 | + } |
|
218 | + catch (Exception $e) { |
|
219 | + $this->fail(); |
|
220 | + } |
|
221 | + |
|
222 | + } |
|
223 | 223 | |
224 | - public function testcheckNonce() |
|
225 | - { |
|
226 | - $result = OAuthToken::checkNonce("test", "test", 123); |
|
227 | - $this->assertEquals(0, $result ); |
|
228 | - } |
|
224 | + public function testcheckNonce() |
|
225 | + { |
|
226 | + $result = OAuthToken::checkNonce("test", "test", 123); |
|
227 | + $this->assertEquals(0, $result ); |
|
228 | + } |
|
229 | 229 | |
230 | 230 | |
231 | - public function testdeleteByConsumer() |
|
232 | - { |
|
233 | - //execute the method and test if it works and does not throws an exception. |
|
234 | - try { |
|
235 | - OAuthToken::deleteByConsumer("1"); |
|
236 | - $this->assertTrue(true); |
|
237 | - } |
|
238 | - catch (Exception $e) { |
|
239 | - $this->fail(); |
|
240 | - } |
|
241 | - |
|
242 | - } |
|
231 | + public function testdeleteByConsumer() |
|
232 | + { |
|
233 | + //execute the method and test if it works and does not throws an exception. |
|
234 | + try { |
|
235 | + OAuthToken::deleteByConsumer("1"); |
|
236 | + $this->assertTrue(true); |
|
237 | + } |
|
238 | + catch (Exception $e) { |
|
239 | + $this->fail(); |
|
240 | + } |
|
241 | + |
|
242 | + } |
|
243 | 243 | |
244 | 244 | |
245 | - public function testdeleteByUser() |
|
246 | - { |
|
247 | - //execute the method and test if it works and does not throws an exception. |
|
248 | - try { |
|
249 | - OAuthToken::deleteByUser("1"); |
|
250 | - $this->assertTrue(true); |
|
251 | - } |
|
252 | - catch (Exception $e) { |
|
253 | - $this->fail(); |
|
254 | - } |
|
255 | - |
|
256 | - |
|
257 | - } |
|
245 | + public function testdeleteByUser() |
|
246 | + { |
|
247 | + //execute the method and test if it works and does not throws an exception. |
|
248 | + try { |
|
249 | + OAuthToken::deleteByUser("1"); |
|
250 | + $this->assertTrue(true); |
|
251 | + } |
|
252 | + catch (Exception $e) { |
|
253 | + $this->fail(); |
|
254 | + } |
|
255 | + |
|
256 | + |
|
257 | + } |
|
258 | 258 | |
259 | - public function testdisplayDateFromTs() |
|
260 | - { |
|
261 | - //test with empty array |
|
262 | - $result = displayDateFromTs(array(''=>''), 'timestamp'); |
|
263 | - $this->assertEquals('', $result); |
|
259 | + public function testdisplayDateFromTs() |
|
260 | + { |
|
261 | + //test with empty array |
|
262 | + $result = displayDateFromTs(array(''=>''), 'timestamp'); |
|
263 | + $this->assertEquals('', $result); |
|
264 | 264 | |
265 | 265 | |
266 | - //test with a valid array |
|
267 | - $result = displayDateFromTs(array('TIMESTAMP'=>'1272508903'), 'timestamp'); |
|
268 | - $this->assertEquals('04/29/2010 02:41', $result); |
|
266 | + //test with a valid array |
|
267 | + $result = displayDateFromTs(array('TIMESTAMP'=>'1272508903'), 'timestamp'); |
|
268 | + $this->assertEquals('04/29/2010 02:41', $result); |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | 272 | |
273 | 273 | } |
@@ -2,23 +2,23 @@ |
||
2 | 2 | |
3 | 3 | class Calls_RescheduleTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testCalls_Reschedule(){ |
|
5 | + public function testCalls_Reschedule(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $callsReschedule = new Calls_Reschedule(); |
|
9 | - $this->assertInstanceOf('Calls_Reschedule',$callsReschedule); |
|
10 | - $this->assertInstanceOf('Basic',$callsReschedule); |
|
11 | - $this->assertInstanceOf('SugarBean',$callsReschedule); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $callsReschedule = new Calls_Reschedule(); |
|
9 | + $this->assertInstanceOf('Calls_Reschedule',$callsReschedule); |
|
10 | + $this->assertInstanceOf('Basic',$callsReschedule); |
|
11 | + $this->assertInstanceOf('SugarBean',$callsReschedule); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('Calls_Reschedule', 'module_dir', $callsReschedule); |
|
14 | - $this->assertAttributeEquals('Calls_Reschedule', 'object_name', $callsReschedule); |
|
15 | - $this->assertAttributeEquals('calls_reschedule', 'table_name', $callsReschedule); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $callsReschedule); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $callsReschedule); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $callsReschedule); |
|
19 | - $this->assertAttributeEquals(false, 'tracker_visibility', $callsReschedule); |
|
13 | + $this->assertAttributeEquals('Calls_Reschedule', 'module_dir', $callsReschedule); |
|
14 | + $this->assertAttributeEquals('Calls_Reschedule', 'object_name', $callsReschedule); |
|
15 | + $this->assertAttributeEquals('calls_reschedule', 'table_name', $callsReschedule); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $callsReschedule); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $callsReschedule); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $callsReschedule); |
|
19 | + $this->assertAttributeEquals(false, 'tracker_visibility', $callsReschedule); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -3,200 +3,200 @@ |
||
3 | 3 | class DocumentRevisionTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testDocumentRevision() |
|
7 | - { |
|
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $documentRevision = new DocumentRevision(); |
|
10 | - $this->assertInstanceOf('DocumentRevision',$documentRevision); |
|
11 | - $this->assertInstanceOf('SugarBean',$documentRevision); |
|
6 | + public function testDocumentRevision() |
|
7 | + { |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $documentRevision = new DocumentRevision(); |
|
10 | + $this->assertInstanceOf('DocumentRevision',$documentRevision); |
|
11 | + $this->assertInstanceOf('SugarBean',$documentRevision); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('DocumentRevisions', 'module_dir', $documentRevision); |
|
14 | - $this->assertAttributeEquals('DocumentRevision', 'object_name', $documentRevision); |
|
15 | - $this->assertAttributeEquals('document_revisions', 'table_name', $documentRevision); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $documentRevision); |
|
13 | + $this->assertAttributeEquals('DocumentRevisions', 'module_dir', $documentRevision); |
|
14 | + $this->assertAttributeEquals('DocumentRevision', 'object_name', $documentRevision); |
|
15 | + $this->assertAttributeEquals('document_revisions', 'table_name', $documentRevision); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $documentRevision); |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function testSaveAndRetrieve() |
|
21 | - { |
|
22 | - error_reporting(E_ERROR | E_PARSE); |
|
20 | + public function testSaveAndRetrieve() |
|
21 | + { |
|
22 | + error_reporting(E_ERROR | E_PARSE); |
|
23 | 23 | |
24 | - $documentRevision = new DocumentRevision(); |
|
24 | + $documentRevision = new DocumentRevision(); |
|
25 | 25 | |
26 | - $documentRevision->document_id = "1"; |
|
27 | - $documentRevision->doc_id = "1"; |
|
28 | - $documentRevision->doc_type = "text"; |
|
29 | - $documentRevision->filename = "test"; |
|
30 | - $documentRevision->file_ext = "ext"; |
|
26 | + $documentRevision->document_id = "1"; |
|
27 | + $documentRevision->doc_id = "1"; |
|
28 | + $documentRevision->doc_type = "text"; |
|
29 | + $documentRevision->filename = "test"; |
|
30 | + $documentRevision->file_ext = "ext"; |
|
31 | 31 | |
32 | - $documentRevision->save(); |
|
32 | + $documentRevision->save(); |
|
33 | 33 | |
34 | - //test for record ID to verify that record is saved |
|
35 | - $this->assertTrue(isset($documentRevision->id)); |
|
36 | - $this->assertEquals(36, strlen($documentRevision->id)); |
|
34 | + //test for record ID to verify that record is saved |
|
35 | + $this->assertTrue(isset($documentRevision->id)); |
|
36 | + $this->assertEquals(36, strlen($documentRevision->id)); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | - //test document retrieve method |
|
41 | - $docRev = $documentRevision->retrieve($documentRevision->id); |
|
42 | - $this->assertEquals("1", $docRev->document_id); |
|
43 | - $this->assertEquals("1", $docRev->doc_id); |
|
44 | - $this->assertEquals("text", $docRev->doc_type ); |
|
45 | - $this->assertEquals("test", $docRev->filename); |
|
46 | - $this->assertEquals("ext", $docRev->file_ext); |
|
40 | + //test document retrieve method |
|
41 | + $docRev = $documentRevision->retrieve($documentRevision->id); |
|
42 | + $this->assertEquals("1", $docRev->document_id); |
|
43 | + $this->assertEquals("1", $docRev->doc_id); |
|
44 | + $this->assertEquals("text", $docRev->doc_type ); |
|
45 | + $this->assertEquals("test", $docRev->filename); |
|
46 | + $this->assertEquals("ext", $docRev->file_ext); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
51 | - $docRev->mark_deleted($docRev->id); |
|
52 | - $result = $docRev->retrieve($docRev->id); |
|
53 | - $this->assertEquals(null,$result); |
|
50 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
51 | + $docRev->mark_deleted($docRev->id); |
|
52 | + $result = $docRev->retrieve($docRev->id); |
|
53 | + $this->assertEquals(null,$result); |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - public function testget_summary_text() |
|
59 | - { |
|
58 | + public function testget_summary_text() |
|
59 | + { |
|
60 | 60 | |
61 | - $documentRevision = new DocumentRevision(); |
|
61 | + $documentRevision = new DocumentRevision(); |
|
62 | 62 | |
63 | - //test without setting name |
|
64 | - $this->assertEquals(Null,$documentRevision->get_summary_text()); |
|
63 | + //test without setting name |
|
64 | + $this->assertEquals(Null,$documentRevision->get_summary_text()); |
|
65 | 65 | |
66 | - //test with name set |
|
67 | - $documentRevision->filename = "test"; |
|
68 | - $this->assertEquals('test',$documentRevision->get_summary_text()); |
|
66 | + //test with name set |
|
67 | + $documentRevision->filename = "test"; |
|
68 | + $this->assertEquals('test',$documentRevision->get_summary_text()); |
|
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - public function testis_authenticated() |
|
75 | - { |
|
74 | + public function testis_authenticated() |
|
75 | + { |
|
76 | 76 | |
77 | - $documentRevision = new DocumentRevision(); |
|
77 | + $documentRevision = new DocumentRevision(); |
|
78 | 78 | |
79 | - //test wihout setting attributes |
|
80 | - $this->assertEquals(null,$documentRevision->is_authenticated()); |
|
79 | + //test wihout setting attributes |
|
80 | + $this->assertEquals(null,$documentRevision->is_authenticated()); |
|
81 | 81 | |
82 | 82 | |
83 | - //test with attributes preset |
|
84 | - $documentRevision->authenticated= true; |
|
85 | - $this->assertEquals(true,$documentRevision->is_authenticated()); |
|
86 | - } |
|
83 | + //test with attributes preset |
|
84 | + $documentRevision->authenticated= true; |
|
85 | + $this->assertEquals(true,$documentRevision->is_authenticated()); |
|
86 | + } |
|
87 | 87 | |
88 | - public function testfill_in_additional_list_fields() |
|
89 | - { |
|
88 | + public function testfill_in_additional_list_fields() |
|
89 | + { |
|
90 | 90 | |
91 | - $documentRevision = new DocumentRevision(); |
|
91 | + $documentRevision = new DocumentRevision(); |
|
92 | 92 | |
93 | - //execute the method and test if it works and does not throws an exception. |
|
94 | - try { |
|
95 | - $documentRevision->fill_in_additional_list_fields(); |
|
96 | - $this->assertTrue(true); |
|
97 | - } |
|
98 | - catch (Exception $e) { |
|
99 | - $this->fail(); |
|
100 | - } |
|
93 | + //execute the method and test if it works and does not throws an exception. |
|
94 | + try { |
|
95 | + $documentRevision->fill_in_additional_list_fields(); |
|
96 | + $this->assertTrue(true); |
|
97 | + } |
|
98 | + catch (Exception $e) { |
|
99 | + $this->fail(); |
|
100 | + } |
|
101 | 101 | |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | - public function testfill_in_additional_detail_fields() |
|
105 | - { |
|
106 | - $documentRevision = new DocumentRevision(); |
|
104 | + public function testfill_in_additional_detail_fields() |
|
105 | + { |
|
106 | + $documentRevision = new DocumentRevision(); |
|
107 | 107 | |
108 | - //execute the method and test if it works and does not throws an exception. |
|
109 | - try { |
|
110 | - $documentRevision->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 | + $documentRevision->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 | 119 | |
120 | - public function testgetDocumentRevisionNameForDisplay() |
|
121 | - { |
|
122 | - $documentRevision = new DocumentRevision(); |
|
120 | + public function testgetDocumentRevisionNameForDisplay() |
|
121 | + { |
|
122 | + $documentRevision = new DocumentRevision(); |
|
123 | 123 | |
124 | - //test wihout setting attributes |
|
125 | - $result = $documentRevision->getDocumentRevisionNameForDisplay(); |
|
126 | - $this->assertEquals(".",$result); |
|
124 | + //test wihout setting attributes |
|
125 | + $result = $documentRevision->getDocumentRevisionNameForDisplay(); |
|
126 | + $this->assertEquals(".",$result); |
|
127 | 127 | |
128 | 128 | |
129 | - //test with attributes preset |
|
130 | - $documentRevision->filename = "test.ext"; |
|
131 | - $documentRevision->revision = 1; |
|
132 | - $result = $documentRevision->getDocumentRevisionNameForDisplay(); |
|
133 | - $this->assertEquals("-Revision_1.ext",$result); |
|
129 | + //test with attributes preset |
|
130 | + $documentRevision->filename = "test.ext"; |
|
131 | + $documentRevision->revision = 1; |
|
132 | + $result = $documentRevision->getDocumentRevisionNameForDisplay(); |
|
133 | + $this->assertEquals("-Revision_1.ext",$result); |
|
134 | 134 | |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - public function testfill_document_name_revision() |
|
138 | - { |
|
137 | + public function testfill_document_name_revision() |
|
138 | + { |
|
139 | 139 | |
140 | - $documentRevision = new DocumentRevision(); |
|
140 | + $documentRevision = new DocumentRevision(); |
|
141 | 141 | |
142 | - //execute the method and test if it works and does not throws an exception. |
|
143 | - try { |
|
144 | - $documentRevision->fill_document_name_revision(); |
|
145 | - $this->assertTrue(true); |
|
146 | - } |
|
147 | - catch (Exception $e) { |
|
148 | - $this->fail(); |
|
149 | - } |
|
142 | + //execute the method and test if it works and does not throws an exception. |
|
143 | + try { |
|
144 | + $documentRevision->fill_document_name_revision(); |
|
145 | + $this->assertTrue(true); |
|
146 | + } |
|
147 | + catch (Exception $e) { |
|
148 | + $this->fail(); |
|
149 | + } |
|
150 | 150 | |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - public function testlist_view_parse_additional_sections(){ |
|
153 | + public function testlist_view_parse_additional_sections(){ |
|
154 | 154 | |
155 | - $documentRevision = new DocumentRevision(); |
|
155 | + $documentRevision = new DocumentRevision(); |
|
156 | 156 | |
157 | - //execute the method and test if it works and does not throws an exception. |
|
158 | - try { |
|
159 | - $documentRevision->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
160 | - $this->assertTrue(true); |
|
161 | - } |
|
162 | - catch (Exception $e) { |
|
163 | - $this->fail(); |
|
164 | - } |
|
157 | + //execute the method and test if it works and does not throws an exception. |
|
158 | + try { |
|
159 | + $documentRevision->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
160 | + $this->assertTrue(true); |
|
161 | + } |
|
162 | + catch (Exception $e) { |
|
163 | + $this->fail(); |
|
164 | + } |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - public function testget_list_view_data() |
|
169 | - { |
|
170 | - $documentRevision = new DocumentRevision(); |
|
171 | - $result = $documentRevision->get_list_view_data(); |
|
172 | - $this->assertEquals( array("DELETED"=>0), $result); |
|
168 | + public function testget_list_view_data() |
|
169 | + { |
|
170 | + $documentRevision = new DocumentRevision(); |
|
171 | + $result = $documentRevision->get_list_view_data(); |
|
172 | + $this->assertEquals( array("DELETED"=>0), $result); |
|
173 | 173 | |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | 176 | |
177 | - public function testget_document_revision_name() |
|
178 | - { |
|
179 | - $documentRevision = new DocumentRevision(); |
|
180 | - $result = $documentRevision->get_document_revision_name(1); |
|
181 | - $this->assertEquals(null,$result); |
|
177 | + public function testget_document_revision_name() |
|
178 | + { |
|
179 | + $documentRevision = new DocumentRevision(); |
|
180 | + $result = $documentRevision->get_document_revision_name(1); |
|
181 | + $this->assertEquals(null,$result); |
|
182 | 182 | |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | 185 | |
186 | - public function testget_document_revisions() |
|
187 | - { |
|
188 | - $documentRevision = new DocumentRevision(); |
|
189 | - $results = $documentRevision->get_document_revisions(1); |
|
190 | - $this->assertTrue(is_array($results)); |
|
186 | + public function testget_document_revisions() |
|
187 | + { |
|
188 | + $documentRevision = new DocumentRevision(); |
|
189 | + $results = $documentRevision->get_document_revisions(1); |
|
190 | + $this->assertTrue(is_array($results)); |
|
191 | 191 | |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | 194 | public function testbean_implements() { |
195 | 195 | |
196 | - $documentRevision = new DocumentRevision(); |
|
197 | - $this->assertEquals(false, $documentRevision->bean_implements('')); //test with blank value |
|
198 | - $this->assertEquals(false, $documentRevision->bean_implements('test')); //test with invalid value |
|
199 | - $this->assertEquals(true, $documentRevision->bean_implements('FILE')); //test with valid value |
|
196 | + $documentRevision = new DocumentRevision(); |
|
197 | + $this->assertEquals(false, $documentRevision->bean_implements('')); //test with blank value |
|
198 | + $this->assertEquals(false, $documentRevision->bean_implements('test')); //test with invalid value |
|
199 | + $this->assertEquals(true, $documentRevision->bean_implements('FILE')); //test with valid value |
|
200 | 200 | |
201 | 201 | } |
202 | 202 |
@@ -3,316 +3,316 @@ |
||
3 | 3 | class ProjectTaskTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testProjectTask() |
|
7 | - { |
|
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $projectTask = new ProjectTask(); |
|
6 | + public function testProjectTask() |
|
7 | + { |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $projectTask = new ProjectTask(); |
|
10 | 10 | |
11 | - $this->assertInstanceOf('ProjectTask',$projectTask); |
|
12 | - $this->assertInstanceOf('SugarBean',$projectTask); |
|
11 | + $this->assertInstanceOf('ProjectTask',$projectTask); |
|
12 | + $this->assertInstanceOf('SugarBean',$projectTask); |
|
13 | 13 | |
14 | 14 | |
15 | - $this->assertAttributeEquals('project_task', 'table_name', $projectTask); |
|
16 | - $this->assertAttributeEquals('ProjectTask', 'module_dir', $projectTask); |
|
17 | - $this->assertAttributeEquals('ProjectTask', 'object_name', $projectTask); |
|
15 | + $this->assertAttributeEquals('project_task', 'table_name', $projectTask); |
|
16 | + $this->assertAttributeEquals('ProjectTask', 'module_dir', $projectTask); |
|
17 | + $this->assertAttributeEquals('ProjectTask', 'object_name', $projectTask); |
|
18 | 18 | |
19 | - $this->assertAttributeEquals(true, 'new_schema', $projectTask); |
|
20 | - $this->assertAttributeEquals(false, '_skipParentUpdate', $projectTask); |
|
19 | + $this->assertAttributeEquals(true, 'new_schema', $projectTask); |
|
20 | + $this->assertAttributeEquals(false, '_skipParentUpdate', $projectTask); |
|
21 | 21 | |
22 | - $this->assertAttributeEquals(100, 'utilization', $projectTask); |
|
22 | + $this->assertAttributeEquals(100, 'utilization', $projectTask); |
|
23 | 23 | |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public function testskipParentUpdate() |
27 | 27 | { |
28 | - error_reporting(E_ERROR | E_PARSE); |
|
28 | + error_reporting(E_ERROR | E_PARSE); |
|
29 | 29 | |
30 | - $projectTask = new ProjectTask(); |
|
30 | + $projectTask = new ProjectTask(); |
|
31 | 31 | |
32 | - //test with default parameter value |
|
33 | - $projectTask->skipParentUpdate(); |
|
34 | - $this->assertAttributeEquals(true, '_skipParentUpdate', $projectTask); |
|
32 | + //test with default parameter value |
|
33 | + $projectTask->skipParentUpdate(); |
|
34 | + $this->assertAttributeEquals(true, '_skipParentUpdate', $projectTask); |
|
35 | 35 | |
36 | - //test with parameter value = true |
|
37 | - $projectTask->skipParentUpdate(false); |
|
38 | - $this->assertAttributeEquals(false, '_skipParentUpdate', $projectTask); |
|
36 | + //test with parameter value = true |
|
37 | + $projectTask->skipParentUpdate(false); |
|
38 | + $this->assertAttributeEquals(false, '_skipParentUpdate', $projectTask); |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
42 | - public function testsave() |
|
43 | - { |
|
44 | - $projectTask = new ProjectTask(); |
|
42 | + public function testsave() |
|
43 | + { |
|
44 | + $projectTask = new ProjectTask(); |
|
45 | 45 | |
46 | - $projectTask->name = "test"; |
|
47 | - //$projectTask->project_id = "1"; |
|
48 | - $projectTask->assigned_user_id = "1"; |
|
49 | - $projectTask->description = "test description"; |
|
50 | - $projectTask->parent_task_id =1; |
|
46 | + $projectTask->name = "test"; |
|
47 | + //$projectTask->project_id = "1"; |
|
48 | + $projectTask->assigned_user_id = "1"; |
|
49 | + $projectTask->description = "test description"; |
|
50 | + $projectTask->parent_task_id =1; |
|
51 | 51 | |
52 | - $projectTask->save(); |
|
52 | + $projectTask->save(); |
|
53 | 53 | |
54 | - //test for record ID to verify that record is saved |
|
55 | - $this->assertTrue(isset($projectTask->id)); |
|
56 | - $this->assertEquals(36, strlen($projectTask->id)); |
|
54 | + //test for record ID to verify that record is saved |
|
55 | + $this->assertTrue(isset($projectTask->id)); |
|
56 | + $this->assertEquals(36, strlen($projectTask->id)); |
|
57 | 57 | |
58 | 58 | |
59 | - //test _get_depends_on_name method |
|
60 | - $this->_get_depends_on_name($projectTask->id); |
|
59 | + //test _get_depends_on_name method |
|
60 | + $this->_get_depends_on_name($projectTask->id); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
65 | - $projectTask->mark_deleted($projectTask->id); |
|
66 | - $result = $projectTask->retrieve($projectTask->id); |
|
67 | - $this->assertEquals(null,$result); |
|
64 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
65 | + $projectTask->mark_deleted($projectTask->id); |
|
66 | + $result = $projectTask->retrieve($projectTask->id); |
|
67 | + $this->assertEquals(null,$result); |
|
68 | 68 | |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - public function _get_depends_on_name($id) |
|
73 | - { |
|
74 | - $projectTask = new ProjectTask(); |
|
72 | + public function _get_depends_on_name($id) |
|
73 | + { |
|
74 | + $projectTask = new ProjectTask(); |
|
75 | 75 | |
76 | - $result = $projectTask->_get_depends_on_name($id); |
|
76 | + $result = $projectTask->_get_depends_on_name($id); |
|
77 | 77 | |
78 | - $this->assertEquals("1", $projectTask->depends_on_name_owner) ; |
|
79 | - $this->assertEquals("ProjectTask", $projectTask->depends_on_name_mod); |
|
80 | - $this->assertEquals("test", $result); |
|
78 | + $this->assertEquals("1", $projectTask->depends_on_name_owner) ; |
|
79 | + $this->assertEquals("ProjectTask", $projectTask->depends_on_name_mod); |
|
80 | + $this->assertEquals("test", $result); |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - public function testupdateParentProjectTaskPercentage() |
|
86 | - { |
|
85 | + public function testupdateParentProjectTaskPercentage() |
|
86 | + { |
|
87 | 87 | |
88 | - $projectTask = new ProjectTask(); |
|
88 | + $projectTask = new ProjectTask(); |
|
89 | 89 | |
90 | - //execute the method and test if it works and does not throws an exception. |
|
91 | - try { |
|
92 | - $projectTask->updateParentProjectTaskPercentage(); |
|
93 | - $this->assertTrue(true); |
|
94 | - } |
|
95 | - catch (Exception $e) { |
|
96 | - $this->fail(); |
|
97 | - } |
|
90 | + //execute the method and test if it works and does not throws an exception. |
|
91 | + try { |
|
92 | + $projectTask->updateParentProjectTaskPercentage(); |
|
93 | + $this->assertTrue(true); |
|
94 | + } |
|
95 | + catch (Exception $e) { |
|
96 | + $this->fail(); |
|
97 | + } |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | 101 | |
102 | - public function testgetProjectTaskParent() |
|
103 | - { |
|
102 | + public function testgetProjectTaskParent() |
|
103 | + { |
|
104 | 104 | |
105 | - $projectTask = new ProjectTask(); |
|
105 | + $projectTask = new ProjectTask(); |
|
106 | 106 | |
107 | - $projectTask->parent_task_id =1; |
|
108 | - $result = $projectTask->getProjectTaskParent(); |
|
109 | - $this->assertEquals(false, $result); |
|
107 | + $projectTask->parent_task_id =1; |
|
108 | + $result = $projectTask->getProjectTaskParent(); |
|
109 | + $this->assertEquals(false, $result); |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - public function testgetAllSubProjectTasks() |
|
115 | - { |
|
114 | + public function testgetAllSubProjectTasks() |
|
115 | + { |
|
116 | 116 | |
117 | - $projectTask = new ProjectTask(); |
|
117 | + $projectTask = new ProjectTask(); |
|
118 | 118 | |
119 | - $result = $projectTask->getAllSubProjectTasks(); |
|
120 | - $this->assertTrue(is_array($result)); |
|
119 | + $result = $projectTask->getAllSubProjectTasks(); |
|
120 | + $this->assertTrue(is_array($result)); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | - public function testupdateStatistic() |
|
126 | - { |
|
125 | + public function testupdateStatistic() |
|
126 | + { |
|
127 | 127 | |
128 | - $projectTask = new ProjectTask(); |
|
128 | + $projectTask = new ProjectTask(); |
|
129 | 129 | |
130 | - //execute the method and test if it works and does not throws an exception. |
|
131 | - try { |
|
132 | - $projectTask->updateStatistic(); |
|
133 | - $this->assertTrue(true); |
|
134 | - } |
|
135 | - catch (Exception $e) { |
|
136 | - $this->fail(); |
|
137 | - } |
|
130 | + //execute the method and test if it works and does not throws an exception. |
|
131 | + try { |
|
132 | + $projectTask->updateStatistic(); |
|
133 | + $this->assertTrue(true); |
|
134 | + } |
|
135 | + catch (Exception $e) { |
|
136 | + $this->fail(); |
|
137 | + } |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | |
142 | - public function testfill_in_additional_detail_fields() |
|
143 | - { |
|
142 | + public function testfill_in_additional_detail_fields() |
|
143 | + { |
|
144 | 144 | |
145 | - $projectTask = new ProjectTask(); |
|
145 | + $projectTask = new ProjectTask(); |
|
146 | 146 | |
147 | - //test without setting assigned_user_id |
|
148 | - $projectTask->fill_in_additional_detail_fields(); |
|
149 | - $this->assertEquals("", $projectTask->assigned_user_name); |
|
147 | + //test without setting assigned_user_id |
|
148 | + $projectTask->fill_in_additional_detail_fields(); |
|
149 | + $this->assertEquals("", $projectTask->assigned_user_name); |
|
150 | 150 | |
151 | 151 | |
152 | - //test with assigned_user_id set |
|
153 | - $projectTask->assigned_user_id = 1; |
|
154 | - $projectTask->fill_in_additional_detail_fields(); |
|
155 | - $this->assertEquals("Administrator", $projectTask->assigned_user_name); |
|
152 | + //test with assigned_user_id set |
|
153 | + $projectTask->assigned_user_id = 1; |
|
154 | + $projectTask->fill_in_additional_detail_fields(); |
|
155 | + $this->assertEquals("Administrator", $projectTask->assigned_user_name); |
|
156 | 156 | |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | 159 | |
160 | - public function testfill_in_additional_list_fields() |
|
161 | - { |
|
160 | + public function testfill_in_additional_list_fields() |
|
161 | + { |
|
162 | 162 | |
163 | - $projectTask = new ProjectTask(); |
|
163 | + $projectTask = new ProjectTask(); |
|
164 | 164 | |
165 | - //test without setting assigned_user_id |
|
166 | - $projectTask->fill_in_additional_list_fields(); |
|
167 | - $this->assertEquals("", $projectTask->assigned_user_name); |
|
165 | + //test without setting assigned_user_id |
|
166 | + $projectTask->fill_in_additional_list_fields(); |
|
167 | + $this->assertEquals("", $projectTask->assigned_user_name); |
|
168 | 168 | |
169 | 169 | |
170 | - //test with assigned_user_id set |
|
171 | - $projectTask->assigned_user_id = 1; |
|
172 | - $projectTask->fill_in_additional_list_fields(); |
|
173 | - $this->assertEquals("Administrator", $projectTask->assigned_user_name); |
|
170 | + //test with assigned_user_id set |
|
171 | + $projectTask->assigned_user_id = 1; |
|
172 | + $projectTask->fill_in_additional_list_fields(); |
|
173 | + $this->assertEquals("Administrator", $projectTask->assigned_user_name); |
|
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | 177 | |
178 | - public function testget_summary_text() |
|
179 | - { |
|
180 | - $projectTask = new ProjectTask(); |
|
178 | + public function testget_summary_text() |
|
179 | + { |
|
180 | + $projectTask = new ProjectTask(); |
|
181 | 181 | |
182 | - //test without setting name |
|
183 | - $this->assertEquals(Null,$projectTask->get_summary_text()); |
|
182 | + //test without setting name |
|
183 | + $this->assertEquals(Null,$projectTask->get_summary_text()); |
|
184 | 184 | |
185 | - //test with name set |
|
186 | - $projectTask->name = "test"; |
|
187 | - $this->assertEquals('test',$projectTask->get_summary_text()); |
|
185 | + //test with name set |
|
186 | + $projectTask->name = "test"; |
|
187 | + $this->assertEquals('test',$projectTask->get_summary_text()); |
|
188 | 188 | |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - public function test_get_project_name() |
|
193 | - { |
|
194 | - $projectTask = new ProjectTask(); |
|
192 | + public function test_get_project_name() |
|
193 | + { |
|
194 | + $projectTask = new ProjectTask(); |
|
195 | 195 | |
196 | - //test with a empty string |
|
197 | - $result = $projectTask->_get_project_name(''); |
|
198 | - $this->assertEquals("", $result); |
|
196 | + //test with a empty string |
|
197 | + $result = $projectTask->_get_project_name(''); |
|
198 | + $this->assertEquals("", $result); |
|
199 | 199 | |
200 | 200 | |
201 | - //test with a non empty invalid id |
|
202 | - $result = $projectTask->_get_project_name('1'); |
|
203 | - $this->assertEquals("", $result); |
|
201 | + //test with a non empty invalid id |
|
202 | + $result = $projectTask->_get_project_name('1'); |
|
203 | + $this->assertEquals("", $result); |
|
204 | 204 | |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - public function test_get_parent_name() |
|
209 | - { |
|
210 | - $projectTask = new ProjectTask(); |
|
208 | + public function test_get_parent_name() |
|
209 | + { |
|
210 | + $projectTask = new ProjectTask(); |
|
211 | 211 | |
212 | - //test with a empty string |
|
213 | - $result = $projectTask->_get_parent_name(''); |
|
214 | - $this->assertEquals("", $result); |
|
212 | + //test with a empty string |
|
213 | + $result = $projectTask->_get_parent_name(''); |
|
214 | + $this->assertEquals("", $result); |
|
215 | 215 | |
216 | 216 | |
217 | - //test with a non empty invalid id |
|
218 | - $result = $projectTask->_get_parent_name('1'); |
|
219 | - $this->assertEquals("", $result); |
|
217 | + //test with a non empty invalid id |
|
218 | + $result = $projectTask->_get_parent_name('1'); |
|
219 | + $this->assertEquals("", $result); |
|
220 | 220 | |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | 223 | |
224 | - public function testbuild_generic_where_clause() |
|
225 | - { |
|
226 | - $projectTask = new ProjectTask(); |
|
224 | + public function testbuild_generic_where_clause() |
|
225 | + { |
|
226 | + $projectTask = new ProjectTask(); |
|
227 | 227 | |
228 | - //test with empty string params |
|
229 | - $expected = "project_task.name like '%'"; |
|
230 | - $actual = $projectTask->build_generic_where_clause(''); |
|
231 | - $this->assertSame($expected,$actual); |
|
228 | + //test with empty string params |
|
229 | + $expected = "project_task.name like '%'"; |
|
230 | + $actual = $projectTask->build_generic_where_clause(''); |
|
231 | + $this->assertSame($expected,$actual); |
|
232 | 232 | |
233 | 233 | |
234 | - //test with valid string params |
|
235 | - $expected = "project_task.name like '%'"; |
|
236 | - $actual = $projectTask->build_generic_where_clause('test'); |
|
237 | - $this->assertSame($expected,$actual); |
|
234 | + //test with valid string params |
|
235 | + $expected = "project_task.name like '%'"; |
|
236 | + $actual = $projectTask->build_generic_where_clause('test'); |
|
237 | + $this->assertSame($expected,$actual); |
|
238 | 238 | |
239 | - } |
|
239 | + } |
|
240 | 240 | |
241 | - public function testget_list_view_data(){ |
|
241 | + public function testget_list_view_data(){ |
|
242 | 242 | |
243 | - $projectTask = new ProjectTask(); |
|
243 | + $projectTask = new ProjectTask(); |
|
244 | 244 | |
245 | - $projectTask->name = "tes user"; |
|
246 | - $projectTask->description = "test assigned user"; |
|
247 | - $projectTask->parent_type = "Project"; |
|
245 | + $projectTask->name = "tes user"; |
|
246 | + $projectTask->description = "test assigned user"; |
|
247 | + $projectTask->parent_type = "Project"; |
|
248 | 248 | |
249 | - $expected = array ( |
|
250 | - 'NAME' => 'tes user', |
|
251 | - 'DESCRIPTION' => 'test assigned user', |
|
252 | - 'ORDER_NUMBER' => '1', |
|
253 | - 'DELETED' => 0, |
|
254 | - 'UTILIZATION' => 100, |
|
255 | - 'PARENT_MODULE' => 'Project', |
|
256 | - 'FIRST_NAME' => '', |
|
257 | - 'LAST_NAME' => '', |
|
258 | - 'CONTACT_NAME' => ' ', |
|
259 | - 'TITLE' => ': ' |
|
260 | - ); |
|
249 | + $expected = array ( |
|
250 | + 'NAME' => 'tes user', |
|
251 | + 'DESCRIPTION' => 'test assigned user', |
|
252 | + 'ORDER_NUMBER' => '1', |
|
253 | + 'DELETED' => 0, |
|
254 | + 'UTILIZATION' => 100, |
|
255 | + 'PARENT_MODULE' => 'Project', |
|
256 | + 'FIRST_NAME' => '', |
|
257 | + 'LAST_NAME' => '', |
|
258 | + 'CONTACT_NAME' => ' ', |
|
259 | + 'TITLE' => ': ' |
|
260 | + ); |
|
261 | 261 | |
262 | - $actual = $projectTask->get_list_view_data(); |
|
262 | + $actual = $projectTask->get_list_view_data(); |
|
263 | 263 | |
264 | - $this->assertSame($expected, $actual); |
|
264 | + $this->assertSame($expected, $actual); |
|
265 | 265 | |
266 | 266 | |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | - public function testbean_implements(){ |
|
269 | + public function testbean_implements(){ |
|
270 | 270 | |
271 | - $projectTask = new ProjectTask(); |
|
271 | + $projectTask = new ProjectTask(); |
|
272 | 272 | |
273 | - $this->assertEquals(false, $projectTask->bean_implements('')); //test with blank value |
|
274 | - $this->assertEquals(false, $projectTask->bean_implements('test')); //test with invalid value |
|
275 | - $this->assertEquals(true, $projectTask->bean_implements('ACL')); //test with valid value |
|
276 | - } |
|
273 | + $this->assertEquals(false, $projectTask->bean_implements('')); //test with blank value |
|
274 | + $this->assertEquals(false, $projectTask->bean_implements('test')); //test with invalid value |
|
275 | + $this->assertEquals(true, $projectTask->bean_implements('ACL')); //test with valid value |
|
276 | + } |
|
277 | 277 | |
278 | - public function testlistviewACLHelper(){ |
|
278 | + public function testlistviewACLHelper(){ |
|
279 | 279 | |
280 | - $projectTask = new ProjectTask(); |
|
280 | + $projectTask = new ProjectTask(); |
|
281 | 281 | |
282 | - $expected = array( 'MAIN' => 'a', 'PARENT' => 'a', 'PARENT_TASK' => 'a' ); |
|
283 | - $actual = $projectTask->listviewACLHelper(); |
|
284 | - $this->assertSame($expected,$actual); |
|
282 | + $expected = array( 'MAIN' => 'a', 'PARENT' => 'a', 'PARENT_TASK' => 'a' ); |
|
283 | + $actual = $projectTask->listviewACLHelper(); |
|
284 | + $this->assertSame($expected,$actual); |
|
285 | 285 | |
286 | - } |
|
286 | + } |
|
287 | 287 | |
288 | - public function testcreate_export_query() |
|
289 | - { |
|
288 | + public function testcreate_export_query() |
|
289 | + { |
|
290 | 290 | |
291 | - $projectTask = new ProjectTask(); |
|
291 | + $projectTask = new ProjectTask(); |
|
292 | 292 | |
293 | - //test with empty string params |
|
294 | - $expected = "SELECT\n project_task.*,\n users.user_name as assigned_user_name FROM project_task LEFT JOIN project ON project_task.project_id=project.id AND project.deleted=0 LEFT JOIN users\n ON project_task.assigned_user_id=users.id where project_task.deleted=0 "; |
|
295 | - $actual = $projectTask->create_export_query('',''); |
|
296 | - $this->assertSame($expected,$actual); |
|
293 | + //test with empty string params |
|
294 | + $expected = "SELECT\n project_task.*,\n users.user_name as assigned_user_name FROM project_task LEFT JOIN project ON project_task.project_id=project.id AND project.deleted=0 LEFT JOIN users\n ON project_task.assigned_user_id=users.id where project_task.deleted=0 "; |
|
295 | + $actual = $projectTask->create_export_query('',''); |
|
296 | + $this->assertSame($expected,$actual); |
|
297 | 297 | |
298 | 298 | |
299 | - //test with valid string params |
|
300 | - $expected = "SELECT\n project_task.*,\n users.user_name as assigned_user_name FROM project_task LEFT JOIN project ON project_task.project_id=project.id AND project.deleted=0 LEFT JOIN users\n ON project_task.assigned_user_id=users.id where (users.user_name= \"\") AND project_task.deleted=0 ORDER BY project_task.id"; |
|
301 | - $actual = $projectTask->create_export_query('project_task.id','users.user_name= ""'); |
|
302 | - $this->assertSame($expected,$actual); |
|
299 | + //test with valid string params |
|
300 | + $expected = "SELECT\n project_task.*,\n users.user_name as assigned_user_name FROM project_task LEFT JOIN project ON project_task.project_id=project.id AND project.deleted=0 LEFT JOIN users\n ON project_task.assigned_user_id=users.id where (users.user_name= \"\") AND project_task.deleted=0 ORDER BY project_task.id"; |
|
301 | + $actual = $projectTask->create_export_query('project_task.id','users.user_name= ""'); |
|
302 | + $this->assertSame($expected,$actual); |
|
303 | 303 | |
304 | - } |
|
304 | + } |
|
305 | 305 | |
306 | 306 | |
307 | - public function testgetUtilizationDropdown() |
|
308 | - { |
|
309 | - $projectTask = new ProjectTask(); |
|
307 | + public function testgetUtilizationDropdown() |
|
308 | + { |
|
309 | + $projectTask = new ProjectTask(); |
|
310 | 310 | |
311 | - $expected = "<select name=\"utilization\">\n<OPTION value='0'>none</OPTION>\n<OPTION value='25'>25</OPTION>\n<OPTION value='50'>50</OPTION>\n<OPTION value='75'>75</OPTION>\n<OPTION value='100'>100</OPTION></select>"; |
|
312 | - $actual = getUtilizationDropdown($projectTask, 'utilization', '0', 'EditView'); |
|
313 | - $this->assertSame($expected,$actual); |
|
311 | + $expected = "<select name=\"utilization\">\n<OPTION value='0'>none</OPTION>\n<OPTION value='25'>25</OPTION>\n<OPTION value='50'>50</OPTION>\n<OPTION value='75'>75</OPTION>\n<OPTION value='100'>100</OPTION></select>"; |
|
312 | + $actual = getUtilizationDropdown($projectTask, 'utilization', '0', 'EditView'); |
|
313 | + $this->assertSame($expected,$actual); |
|
314 | 314 | |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | 317 | } |
318 | 318 |
@@ -5,192 +5,192 @@ discard block |
||
5 | 5 | class DocumentTest extends PHPUnit_Framework_TestCase { |
6 | 6 | |
7 | 7 | |
8 | - public function testDocument() { |
|
8 | + public function testDocument() { |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $document = new Document(); |
|
12 | - $this->assertInstanceOf('Document',$document); |
|
13 | - $this->assertInstanceOf('File',$document); |
|
14 | - $this->assertInstanceOf('SugarBean',$document); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $document = new Document(); |
|
12 | + $this->assertInstanceOf('Document',$document); |
|
13 | + $this->assertInstanceOf('File',$document); |
|
14 | + $this->assertInstanceOf('SugarBean',$document); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('Documents', 'module_dir', $document); |
|
17 | - $this->assertAttributeEquals('Document', 'object_name', $document); |
|
18 | - $this->assertAttributeEquals('documents', 'table_name', $document); |
|
19 | - $this->assertAttributeEquals(true, 'new_schema', $document); |
|
20 | - $this->assertAttributeEquals(false, 'disable_row_level_security', $document); |
|
16 | + $this->assertAttributeEquals('Documents', 'module_dir', $document); |
|
17 | + $this->assertAttributeEquals('Document', 'object_name', $document); |
|
18 | + $this->assertAttributeEquals('documents', 'table_name', $document); |
|
19 | + $this->assertAttributeEquals(true, 'new_schema', $document); |
|
20 | + $this->assertAttributeEquals(false, 'disable_row_level_security', $document); |
|
21 | 21 | |
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testSaveAndGet_document_name() { |
|
25 | + public function testSaveAndGet_document_name() { |
|
26 | 26 | |
27 | - error_reporting(E_ERROR | E_PARSE); |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $document = new Document(); |
|
29 | + $document = new Document(); |
|
30 | 30 | |
31 | - $document->filename = "test"; |
|
32 | - $document->file_url ="test_url"; |
|
33 | - $document->file_url_noimage= "test_image_url"; |
|
34 | - $document->last_rev_created_name= "test"; |
|
35 | - $document->category_id = "1"; |
|
36 | - $document->subcategory_id = "1" ; |
|
37 | - $document->document_name = "test"; |
|
31 | + $document->filename = "test"; |
|
32 | + $document->file_url ="test_url"; |
|
33 | + $document->file_url_noimage= "test_image_url"; |
|
34 | + $document->last_rev_created_name= "test"; |
|
35 | + $document->category_id = "1"; |
|
36 | + $document->subcategory_id = "1" ; |
|
37 | + $document->document_name = "test"; |
|
38 | 38 | |
39 | - $document->save(); |
|
39 | + $document->save(); |
|
40 | 40 | |
41 | - //test for record ID to verify that record is saved |
|
42 | - $this->assertTrue(isset($document->id)); |
|
43 | - $this->assertEquals(36, strlen($document->id)); |
|
41 | + //test for record ID to verify that record is saved |
|
42 | + $this->assertTrue(isset($document->id)); |
|
43 | + $this->assertEquals(36, strlen($document->id)); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - //execute Get_document_name() method and verify it gets the name correctly |
|
48 | - $this->assertEquals(null, $document->get_document_name(1)); |
|
49 | - $this->assertEquals('test', $document->get_document_name($document->id)); |
|
47 | + //execute Get_document_name() method and verify it gets the name correctly |
|
48 | + $this->assertEquals(null, $document->get_document_name(1)); |
|
49 | + $this->assertEquals('test', $document->get_document_name($document->id)); |
|
50 | 50 | |
51 | 51 | |
52 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
53 | - $document->mark_deleted($document->id); |
|
54 | - $result = $document->retrieve($document->id); |
|
55 | - $this->assertEquals(null,$result); |
|
52 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
53 | + $document->mark_deleted($document->id); |
|
54 | + $result = $document->retrieve($document->id); |
|
55 | + $this->assertEquals(null,$result); |
|
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - public function testget_summary_text() { |
|
59 | + public function testget_summary_text() { |
|
60 | 60 | |
61 | 61 | |
62 | - $document = new Document(); |
|
62 | + $document = new Document(); |
|
63 | 63 | |
64 | - //test without setting name |
|
65 | - $this->assertEquals(Null,$document->get_summary_text()); |
|
64 | + //test without setting name |
|
65 | + $this->assertEquals(Null,$document->get_summary_text()); |
|
66 | 66 | |
67 | - //test with name set |
|
68 | - $document->document_name = "test"; |
|
69 | - $this->assertEquals('test',$document->get_summary_text()); |
|
67 | + //test with name set |
|
68 | + $document->document_name = "test"; |
|
69 | + $this->assertEquals('test',$document->get_summary_text()); |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function testis_authenticated() |
|
74 | - { |
|
73 | + public function testis_authenticated() |
|
74 | + { |
|
75 | 75 | |
76 | - $document = new Document(); |
|
76 | + $document = new Document(); |
|
77 | 77 | |
78 | - //test without presetting attributes |
|
79 | - $this->assertEquals(null,$document->is_authenticated()); |
|
78 | + //test without presetting attributes |
|
79 | + $this->assertEquals(null,$document->is_authenticated()); |
|
80 | 80 | |
81 | 81 | |
82 | - //test with attributes preset |
|
83 | - $document->authenticated= true; |
|
84 | - $this->assertEquals(true,$document->is_authenticated()); |
|
82 | + //test with attributes preset |
|
83 | + $document->authenticated= true; |
|
84 | + $this->assertEquals(true,$document->is_authenticated()); |
|
85 | 85 | |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - public function testfill_in_additional_list_fields() { |
|
88 | + public function testfill_in_additional_list_fields() { |
|
89 | 89 | |
90 | - $document = new Document(); |
|
90 | + $document = new Document(); |
|
91 | 91 | |
92 | - //execute the method and test if it works and does not throws an exception. |
|
93 | - try { |
|
94 | - $document->fill_in_additional_list_fields(); |
|
95 | - $this->assertTrue(true); |
|
96 | - } |
|
97 | - catch (Exception $e) { |
|
98 | - $this->fail(); |
|
99 | - } |
|
92 | + //execute the method and test if it works and does not throws an exception. |
|
93 | + try { |
|
94 | + $document->fill_in_additional_list_fields(); |
|
95 | + $this->assertTrue(true); |
|
96 | + } |
|
97 | + catch (Exception $e) { |
|
98 | + $this->fail(); |
|
99 | + } |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - public function testfill_in_additional_detail_fields() |
|
104 | - { |
|
103 | + public function testfill_in_additional_detail_fields() |
|
104 | + { |
|
105 | 105 | |
106 | - $document = new Document(); |
|
106 | + $document = new Document(); |
|
107 | 107 | |
108 | - $document->id = "abcde-12345"; |
|
108 | + $document->id = "abcde-12345"; |
|
109 | 109 | |
110 | - //execute the method with attributes preset and verify attributes are set accordingly |
|
111 | - $document->fill_in_additional_detail_fields(); |
|
110 | + //execute the method with attributes preset and verify attributes are set accordingly |
|
111 | + $document->fill_in_additional_detail_fields(); |
|
112 | 112 | |
113 | - $this->assertRegExp( |
|
113 | + $this->assertRegExp( |
|
114 | 114 | '~' |
115 | 115 | . preg_quote("<a href='index.php?entryPoint=download&id=&type=Documents' target='_blank'><img src=\"themes/SuiteR/images/def_image_inline.gif?v=") |
116 | 116 | . '[\w-]+' |
117 | 117 | .preg_quote("\" border=\"0\" alt=\"View\" /></a>") |
118 | 118 | . '~', |
119 | 119 | $document->file_url); |
120 | - $this->assertEquals("index.php?entryPoint=download&type=Documents&id=", $document->file_url_noimage); |
|
120 | + $this->assertEquals("index.php?entryPoint=download&type=Documents&id=", $document->file_url_noimage); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - public function testlist_view_parse_additional_sections() { |
|
124 | + public function testlist_view_parse_additional_sections() { |
|
125 | 125 | |
126 | - $document = new Document(); |
|
126 | + $document = new Document(); |
|
127 | 127 | |
128 | - //execute the method and test if it works and does not throws an exception. |
|
129 | - try { |
|
130 | - $document->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
131 | - $this->assertTrue(true); |
|
132 | - } |
|
133 | - catch (Exception $e) { |
|
134 | - $this->fail(); |
|
135 | - } |
|
128 | + //execute the method and test if it works and does not throws an exception. |
|
129 | + try { |
|
130 | + $document->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
131 | + $this->assertTrue(true); |
|
132 | + } |
|
133 | + catch (Exception $e) { |
|
134 | + $this->fail(); |
|
135 | + } |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | 139 | public function testcreate_export_query() |
140 | 140 | { |
141 | - $document = new Document(); |
|
141 | + $document = new Document(); |
|
142 | 142 | |
143 | - //test with empty string parameters |
|
144 | - $expected = "SELECT\n documents.* FROM documents WHERE documents.deleted = 0 ORDER BY documents.document_name"; |
|
145 | - $actual = $document->create_export_query('', ''); |
|
146 | - $this->assertSame($expected,$actual); |
|
143 | + //test with empty string parameters |
|
144 | + $expected = "SELECT\n documents.* FROM documents WHERE documents.deleted = 0 ORDER BY documents.document_name"; |
|
145 | + $actual = $document->create_export_query('', ''); |
|
146 | + $this->assertSame($expected,$actual); |
|
147 | 147 | |
148 | 148 | |
149 | - //test with valid string parameters |
|
150 | - $expected = "SELECT\n documents.* FROM documents WHERE documents.document_name = \"\" AND documents.deleted = 0 ORDER BY documents.id"; |
|
151 | - $actual = $document->create_export_query('documents.id', 'documents.document_name = ""'); |
|
152 | - $this->assertSame($expected,$actual); |
|
149 | + //test with valid string parameters |
|
150 | + $expected = "SELECT\n documents.* FROM documents WHERE documents.document_name = \"\" AND documents.deleted = 0 ORDER BY documents.id"; |
|
151 | + $actual = $document->create_export_query('documents.id', 'documents.document_name = ""'); |
|
152 | + $this->assertSame($expected,$actual); |
|
153 | 153 | |
154 | - } |
|
155 | - |
|
156 | - public function testget_list_view_data() |
|
157 | - { |
|
158 | - $document = new Document(); |
|
159 | - |
|
160 | - //execute the method and verify that it retunrs expected results |
|
161 | - |
|
162 | - $document->filename = "test"; |
|
163 | - $document->file_url ="test_url"; |
|
164 | - $document->file_url_noimage= "test_image_url"; |
|
165 | - $document->last_rev_created_name= "test"; |
|
166 | - $document->category_id = "1"; |
|
167 | - $document->subcategory_id = "1" ; |
|
168 | - $document->document_name = "test"; |
|
169 | - |
|
170 | - |
|
171 | - $expected = array ( |
|
172 | - 'DELETED' => 0, |
|
173 | - 'DOCUMENT_NAME' => 'test', |
|
174 | - 'DOC_TYPE' => 'Sugar', |
|
175 | - 'FILENAME' => 'test', |
|
176 | - 'ACTIVE_DATE' => $document->active_date, |
|
177 | - 'CATEGORY_ID' => NULL, |
|
178 | - 'SUBCATEGORY_ID' => NULL, |
|
179 | - 'REVISION' => '1', |
|
180 | - 'LAST_REV_CREATED_NAME' => 'test', |
|
181 | - 'IS_TEMPLATE' => '0', |
|
182 | - 'FILE_URL' => '~' |
|
154 | + } |
|
155 | + |
|
156 | + public function testget_list_view_data() |
|
157 | + { |
|
158 | + $document = new Document(); |
|
159 | + |
|
160 | + //execute the method and verify that it retunrs expected results |
|
161 | + |
|
162 | + $document->filename = "test"; |
|
163 | + $document->file_url ="test_url"; |
|
164 | + $document->file_url_noimage= "test_image_url"; |
|
165 | + $document->last_rev_created_name= "test"; |
|
166 | + $document->category_id = "1"; |
|
167 | + $document->subcategory_id = "1" ; |
|
168 | + $document->document_name = "test"; |
|
169 | + |
|
170 | + |
|
171 | + $expected = array ( |
|
172 | + 'DELETED' => 0, |
|
173 | + 'DOCUMENT_NAME' => 'test', |
|
174 | + 'DOC_TYPE' => 'Sugar', |
|
175 | + 'FILENAME' => 'test', |
|
176 | + 'ACTIVE_DATE' => $document->active_date, |
|
177 | + 'CATEGORY_ID' => NULL, |
|
178 | + 'SUBCATEGORY_ID' => NULL, |
|
179 | + 'REVISION' => '1', |
|
180 | + 'LAST_REV_CREATED_NAME' => 'test', |
|
181 | + 'IS_TEMPLATE' => '0', |
|
182 | + 'FILE_URL' => '~' |
|
183 | 183 | . preg_quote('<a href=\'index.php?entryPoint=download&id=&type=Documents\' target=\'_blank\'><img src="themes/SuiteR/images/def_image_inline.gif?v=') |
184 | 184 | . '[\w-]+' |
185 | 185 | . preg_quote('" border="0" alt="View" /></a>') |
186 | 186 | . '~', |
187 | - 'FILE_URL_NOIMAGE' => 'index.php?entryPoint=download&type=Documents&id=', |
|
188 | - 'LAST_REV_CREATED_BY' => 'test', |
|
189 | - 'NAME' => 'test', |
|
190 | - 'DOCUMENT_NAME_JAVASCRIPT' => NULL, |
|
191 | - ); |
|
187 | + 'FILE_URL_NOIMAGE' => 'index.php?entryPoint=download&type=Documents&id=', |
|
188 | + 'LAST_REV_CREATED_BY' => 'test', |
|
189 | + 'NAME' => 'test', |
|
190 | + 'DOCUMENT_NAME_JAVASCRIPT' => NULL, |
|
191 | + ); |
|
192 | 192 | |
193 | - $actual = $document->get_list_view_data(); |
|
193 | + $actual = $document->get_list_view_data(); |
|
194 | 194 | foreach($expected as $expectedKey => $expectedVal){ |
195 | 195 | if($expectedKey == 'FILE_URL'){ |
196 | 196 | $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
@@ -198,32 +198,32 @@ discard block |
||
198 | 198 | $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); |
199 | 199 | } |
200 | 200 | } |
201 | - } |
|
201 | + } |
|
202 | 202 | |
203 | - public function testmark_relationships_deleted() |
|
203 | + public function testmark_relationships_deleted() |
|
204 | 204 | { |
205 | - $document = new Document(); |
|
205 | + $document = new Document(); |
|
206 | 206 | |
207 | - //execute the method and test if it works and does not throws an exception. |
|
208 | - try { |
|
209 | - $document->mark_relationships_deleted(1); |
|
210 | - $this->assertTrue(true); |
|
211 | - } |
|
212 | - catch (Exception $e) { |
|
213 | - $this->fail(); |
|
214 | - } |
|
207 | + //execute the method and test if it works and does not throws an exception. |
|
208 | + try { |
|
209 | + $document->mark_relationships_deleted(1); |
|
210 | + $this->assertTrue(true); |
|
211 | + } |
|
212 | + catch (Exception $e) { |
|
213 | + $this->fail(); |
|
214 | + } |
|
215 | 215 | |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | 218 | |
219 | - public function testbean_implements() { |
|
219 | + public function testbean_implements() { |
|
220 | 220 | |
221 | - $document = new Document(); |
|
222 | - $this->assertEquals(false, $document->bean_implements('')); //test with blank value |
|
223 | - $this->assertEquals(false, $document->bean_implements('test')); //test with invalid value |
|
224 | - $this->assertEquals(true, $document->bean_implements('ACL')); //test with valid value |
|
221 | + $document = new Document(); |
|
222 | + $this->assertEquals(false, $document->bean_implements('')); //test with blank value |
|
223 | + $this->assertEquals(false, $document->bean_implements('test')); //test with invalid value |
|
224 | + $this->assertEquals(true, $document->bean_implements('ACL')); //test with valid value |
|
225 | 225 | |
226 | - } |
|
226 | + } |
|
227 | 227 | |
228 | 228 | |
229 | 229 | } |
@@ -3,48 +3,48 @@ |
||
3 | 3 | class AOR_ConditionTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAOR_Condition(){ |
|
6 | + public function testAOR_Condition(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aor_Condition = new AOR_Condition(); |
|
10 | - $this->assertInstanceOf('AOR_Condition',$aor_Condition); |
|
11 | - $this->assertInstanceOf('Basic',$aor_Condition); |
|
12 | - $this->assertInstanceOf('SugarBean',$aor_Condition); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aor_Condition = new AOR_Condition(); |
|
10 | + $this->assertInstanceOf('AOR_Condition',$aor_Condition); |
|
11 | + $this->assertInstanceOf('Basic',$aor_Condition); |
|
12 | + $this->assertInstanceOf('SugarBean',$aor_Condition); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOR_Conditions', 'module_dir', $aor_Condition); |
|
15 | - $this->assertAttributeEquals('AOR_Condition', 'object_name', $aor_Condition); |
|
16 | - $this->assertAttributeEquals('aor_conditions', 'table_name', $aor_Condition); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aor_Condition); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Condition); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $aor_Condition); |
|
20 | - $this->assertAttributeEquals(false, 'tracker_visibility', $aor_Condition); |
|
14 | + $this->assertAttributeEquals('AOR_Conditions', 'module_dir', $aor_Condition); |
|
15 | + $this->assertAttributeEquals('AOR_Condition', 'object_name', $aor_Condition); |
|
16 | + $this->assertAttributeEquals('aor_conditions', 'table_name', $aor_Condition); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aor_Condition); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Condition); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $aor_Condition); |
|
20 | + $this->assertAttributeEquals(false, 'tracker_visibility', $aor_Condition); |
|
21 | 21 | |
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | 25 | public function testsave_lines(){ |
26 | 26 | |
27 | - error_reporting(E_ERROR | E_PARSE); |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $aor_Condition = new AOR_Condition(); |
|
29 | + $aor_Condition = new AOR_Condition(); |
|
30 | 30 | |
31 | - //preset the required data |
|
32 | - $post_data = Array(); |
|
33 | - $post_data['field'][] = 'test field'; |
|
34 | - $post_data['name'][] = 'test'; |
|
35 | - $post_data['parameter'][] = '1'; |
|
36 | - $post_data['module_path'][] = 'test path'; |
|
37 | - $post_data['operator'][] = 'test'; |
|
38 | - $post_data['value_type'][] = 'test type'; |
|
31 | + //preset the required data |
|
32 | + $post_data = Array(); |
|
33 | + $post_data['field'][] = 'test field'; |
|
34 | + $post_data['name'][] = 'test'; |
|
35 | + $post_data['parameter'][] = '1'; |
|
36 | + $post_data['module_path'][] = 'test path'; |
|
37 | + $post_data['operator'][] = 'test'; |
|
38 | + $post_data['value_type'][] = 'test type'; |
|
39 | 39 | |
40 | - //execute the method and test if it works and does not throws an exception. |
|
41 | - try { |
|
42 | - $aor_Condition->save_lines($post_data, new AOR_Report()); |
|
43 | - $this->assertTrue(true); |
|
44 | - } |
|
45 | - catch (Exception $e) { |
|
46 | - $this->fail(); |
|
47 | - } |
|
40 | + //execute the method and test if it works and does not throws an exception. |
|
41 | + try { |
|
42 | + $aor_Condition->save_lines($post_data, new AOR_Report()); |
|
43 | + $this->assertTrue(true); |
|
44 | + } |
|
45 | + catch (Exception $e) { |
|
46 | + $this->fail(); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | } |
@@ -2,23 +2,23 @@ |
||
2 | 2 | |
3 | 3 | class AOD_IndexEventTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOD_IndexEvent(){ |
|
5 | + public function testAOD_IndexEvent(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and type attribute |
|
8 | - $aod_indexEvent = new AOD_IndexEvent(); |
|
9 | - $this->assertInstanceOf('AOD_IndexEvent',$aod_indexEvent); |
|
10 | - $this->assertInstanceOf('Basic',$aod_indexEvent); |
|
11 | - $this->assertInstanceOf('SugarBean',$aod_indexEvent); |
|
7 | + //execute the contructor and check for the Object type and type attribute |
|
8 | + $aod_indexEvent = new AOD_IndexEvent(); |
|
9 | + $this->assertInstanceOf('AOD_IndexEvent',$aod_indexEvent); |
|
10 | + $this->assertInstanceOf('Basic',$aod_indexEvent); |
|
11 | + $this->assertInstanceOf('SugarBean',$aod_indexEvent); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOD_IndexEvent', 'module_dir', $aod_indexEvent); |
|
14 | - $this->assertAttributeEquals('AOD_IndexEvent', 'object_name', $aod_indexEvent); |
|
15 | - $this->assertAttributeEquals('aod_indexevent', 'table_name', $aod_indexEvent); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aod_indexEvent); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aod_indexEvent); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $aod_indexEvent); |
|
19 | - $this->assertAttributeEquals(false, 'tracker_visibility', $aod_indexEvent); |
|
13 | + $this->assertAttributeEquals('AOD_IndexEvent', 'module_dir', $aod_indexEvent); |
|
14 | + $this->assertAttributeEquals('AOD_IndexEvent', 'object_name', $aod_indexEvent); |
|
15 | + $this->assertAttributeEquals('aod_indexevent', 'table_name', $aod_indexEvent); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aod_indexEvent); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aod_indexEvent); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $aod_indexEvent); |
|
19 | + $this->assertAttributeEquals(false, 'tracker_visibility', $aod_indexEvent); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -3,77 +3,77 @@ |
||
3 | 3 | class TrackerTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | 5 | |
6 | - public function testTracker() |
|
6 | + public function testTracker() |
|
7 | 7 | { |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $tracker = new Tracker(); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $tracker = new Tracker(); |
|
10 | 10 | |
11 | - $this->assertInstanceOf('Tracker',$tracker); |
|
12 | - $this->assertInstanceOf('SugarBean',$tracker); |
|
11 | + $this->assertInstanceOf('Tracker',$tracker); |
|
12 | + $this->assertInstanceOf('SugarBean',$tracker); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('tracker', 'table_name', $tracker); |
|
15 | - $this->assertAttributeEquals('Trackers', 'module_dir', $tracker); |
|
16 | - $this->assertAttributeEquals('Tracker', 'object_name', $tracker); |
|
14 | + $this->assertAttributeEquals('tracker', 'table_name', $tracker); |
|
15 | + $this->assertAttributeEquals('Trackers', 'module_dir', $tracker); |
|
16 | + $this->assertAttributeEquals('Tracker', 'object_name', $tracker); |
|
17 | 17 | |
18 | - $this->assertAttributeEquals(true, 'disable_var_defs', $tracker); |
|
18 | + $this->assertAttributeEquals(true, 'disable_var_defs', $tracker); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals('Tracker', 'acltype', $tracker); |
|
21 | - $this->assertAttributeEquals('Trackers', 'acl_category', $tracker); |
|
22 | - $this->assertAttributeEquals(true, 'disable_custom_fields', $tracker); |
|
20 | + $this->assertAttributeEquals('Tracker', 'acltype', $tracker); |
|
21 | + $this->assertAttributeEquals('Trackers', 'acl_category', $tracker); |
|
22 | + $this->assertAttributeEquals(true, 'disable_custom_fields', $tracker); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function testget_recently_viewed() |
26 | 26 | { |
27 | - $tracker = new Tracker(); |
|
27 | + $tracker = new Tracker(); |
|
28 | 28 | |
29 | - $result = $tracker->get_recently_viewed(1); |
|
29 | + $result = $tracker->get_recently_viewed(1); |
|
30 | 30 | |
31 | - $this->assertInstanceOf('BreadCrumbStack',$_SESSION['breadCrumbs']); |
|
32 | - $this->assertTrue(is_array($result)); |
|
31 | + $this->assertInstanceOf('BreadCrumbStack',$_SESSION['breadCrumbs']); |
|
32 | + $this->assertTrue(is_array($result)); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function testmakeInvisibleForAll() |
37 | 37 | { |
38 | 38 | |
39 | - $tracker = new Tracker(); |
|
39 | + $tracker = new Tracker(); |
|
40 | 40 | |
41 | - //execute the method and test if it works and does not throws an exception. |
|
42 | - try { |
|
43 | - $tracker->makeInvisibleForAll(1); |
|
44 | - $this->assertTrue(true); |
|
45 | - } |
|
46 | - catch (Exception $e) { |
|
47 | - $this->fail(); |
|
48 | - } |
|
41 | + //execute the method and test if it works and does not throws an exception. |
|
42 | + try { |
|
43 | + $tracker->makeInvisibleForAll(1); |
|
44 | + $this->assertTrue(true); |
|
45 | + } |
|
46 | + catch (Exception $e) { |
|
47 | + $this->fail(); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testbean_implements() |
54 | - { |
|
55 | - $tracker = new Tracker(); |
|
54 | + { |
|
55 | + $tracker = new Tracker(); |
|
56 | 56 | |
57 | - $this->assertEquals(false, $tracker->bean_implements('')); //test with blank value |
|
58 | - $this->assertEquals(false, $tracker->bean_implements('test')); //test with invalid value |
|
59 | - $this->assertEquals(false, $tracker->bean_implements('ACL')); //test with valid value |
|
57 | + $this->assertEquals(false, $tracker->bean_implements('')); //test with blank value |
|
58 | + $this->assertEquals(false, $tracker->bean_implements('test')); //test with invalid value |
|
59 | + $this->assertEquals(false, $tracker->bean_implements('ACL')); //test with valid value |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testlogPage() |
65 | 65 | { |
66 | - error_reporting(E_ERROR | E_PARSE); |
|
66 | + error_reporting(E_ERROR | E_PARSE); |
|
67 | 67 | |
68 | - //test without setting headerDisplayed |
|
69 | - Tracker::logPage(); |
|
70 | - $this->assertEquals(null, $_SESSION['lpage']); |
|
68 | + //test without setting headerDisplayed |
|
69 | + Tracker::logPage(); |
|
70 | + $this->assertEquals(null, $_SESSION['lpage']); |
|
71 | 71 | |
72 | 72 | |
73 | - //test with headerDisplayed set |
|
74 | - $GLOBALS['app']->headerDisplayed = 1; |
|
75 | - Tracker::logPage(); |
|
76 | - $this->assertEquals(time(), $_SESSION['lpage']); |
|
73 | + //test with headerDisplayed set |
|
74 | + $GLOBALS['app']->headerDisplayed = 1; |
|
75 | + Tracker::logPage(); |
|
76 | + $this->assertEquals(time(), $_SESSION['lpage']); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | } |
@@ -3,405 +3,405 @@ discard block |
||
3 | 3 | class MeetingTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testMeeting() { |
|
6 | + public function testMeeting() { |
|
7 | 7 | |
8 | - error_reporting(E_ERROR | E_PARSE); |
|
8 | + error_reporting(E_ERROR | E_PARSE); |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $meeting = new Meeting(); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $meeting = new Meeting(); |
|
12 | 12 | |
13 | - $this->assertInstanceOf('Meeting',$meeting); |
|
14 | - $this->assertInstanceOf('SugarBean',$meeting); |
|
13 | + $this->assertInstanceOf('Meeting',$meeting); |
|
14 | + $this->assertInstanceOf('SugarBean',$meeting); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('Meetings', 'module_dir', $meeting); |
|
17 | - $this->assertAttributeEquals('Meeting', 'object_name', $meeting); |
|
18 | - $this->assertAttributeEquals('meetings', 'table_name', $meeting); |
|
16 | + $this->assertAttributeEquals('Meetings', 'module_dir', $meeting); |
|
17 | + $this->assertAttributeEquals('Meeting', 'object_name', $meeting); |
|
18 | + $this->assertAttributeEquals('meetings', 'table_name', $meeting); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $meeting); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $meeting); |
|
22 | - $this->assertAttributeEquals(false, 'syncing', $meeting); |
|
23 | - $this->assertAttributeEquals(true, 'update_vcal', $meeting); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $meeting); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $meeting); |
|
22 | + $this->assertAttributeEquals(false, 'syncing', $meeting); |
|
23 | + $this->assertAttributeEquals(true, 'update_vcal', $meeting); |
|
24 | 24 | |
25 | - $this->assertAttributeEquals('meetings_users', 'rel_users_table', $meeting); |
|
26 | - $this->assertAttributeEquals('meetings_contacts', 'rel_contacts_table', $meeting); |
|
27 | - $this->assertAttributeEquals('meetings_leads', 'rel_leads_table', $meeting); |
|
25 | + $this->assertAttributeEquals('meetings_users', 'rel_users_table', $meeting); |
|
26 | + $this->assertAttributeEquals('meetings_contacts', 'rel_contacts_table', $meeting); |
|
27 | + $this->assertAttributeEquals('meetings_leads', 'rel_leads_table', $meeting); |
|
28 | 28 | |
29 | - $this->assertAttributeEquals(null, 'cached_get_users', $meeting); |
|
30 | - $this->assertAttributeEquals(false, 'date_changed', $meeting); |
|
29 | + $this->assertAttributeEquals(null, 'cached_get_users', $meeting); |
|
30 | + $this->assertAttributeEquals(false, 'date_changed', $meeting); |
|
31 | 31 | |
32 | - } |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - public function testACLAccess(){ |
|
35 | + public function testACLAccess(){ |
|
36 | 36 | |
37 | - $meeting = new Meeting(); |
|
37 | + $meeting = new Meeting(); |
|
38 | 38 | |
39 | - //test without recurring_source |
|
40 | - $this->assertEquals(true,$meeting->ACLAccess('edit')); |
|
41 | - $this->assertEquals(true,$meeting->ACLAccess('save')); |
|
42 | - $this->assertEquals(true,$meeting->ACLAccess('editview')); |
|
43 | - $this->assertEquals(true,$meeting->ACLAccess('delete')); |
|
39 | + //test without recurring_source |
|
40 | + $this->assertEquals(true,$meeting->ACLAccess('edit')); |
|
41 | + $this->assertEquals(true,$meeting->ACLAccess('save')); |
|
42 | + $this->assertEquals(true,$meeting->ACLAccess('editview')); |
|
43 | + $this->assertEquals(true,$meeting->ACLAccess('delete')); |
|
44 | 44 | |
45 | 45 | |
46 | - //test with recurring_source |
|
47 | - $meeting->recurring_source = "test"; |
|
48 | - $this->assertEquals(false,$meeting->ACLAccess('edit')); |
|
49 | - $this->assertEquals(false,$meeting->ACLAccess('save')); |
|
50 | - $this->assertEquals(false,$meeting->ACLAccess('editview')); |
|
51 | - $this->assertEquals(false,$meeting->ACLAccess('delete')); |
|
46 | + //test with recurring_source |
|
47 | + $meeting->recurring_source = "test"; |
|
48 | + $this->assertEquals(false,$meeting->ACLAccess('edit')); |
|
49 | + $this->assertEquals(false,$meeting->ACLAccess('save')); |
|
50 | + $this->assertEquals(false,$meeting->ACLAccess('editview')); |
|
51 | + $this->assertEquals(false,$meeting->ACLAccess('delete')); |
|
52 | 52 | |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - public function testhasIntegratedMeeting() { |
|
56 | + public function testhasIntegratedMeeting() { |
|
57 | 57 | |
58 | - $meeting = new Meeting(); |
|
59 | - $result = $meeting->hasIntegratedMeeting(); |
|
60 | - $this->assertEquals(false, $result); |
|
58 | + $meeting = new Meeting(); |
|
59 | + $result = $meeting->hasIntegratedMeeting(); |
|
60 | + $this->assertEquals(false, $result); |
|
61 | 61 | |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - public function testSaveAndMarkdeletedAndSetAcceptStatus() { |
|
65 | + public function testSaveAndMarkdeletedAndSetAcceptStatus() { |
|
66 | 66 | |
67 | 67 | |
68 | - $meeting = new Meeting(); |
|
68 | + $meeting = new Meeting(); |
|
69 | 69 | |
70 | - $meeting->name = "test"; |
|
71 | - $meeting->status = "Not Held"; |
|
72 | - $meeting->type = "Sugar"; |
|
73 | - $meeting->description = "test description"; |
|
74 | - $meeting->duration_hours = 1 ; |
|
75 | - $meeting->duration_minutes = 1; |
|
76 | - $meeting->date_start = "2016-02-11 17:30:00"; |
|
77 | - $meeting->date_end = "2016-02-11 17:30:00"; |
|
70 | + $meeting->name = "test"; |
|
71 | + $meeting->status = "Not Held"; |
|
72 | + $meeting->type = "Sugar"; |
|
73 | + $meeting->description = "test description"; |
|
74 | + $meeting->duration_hours = 1 ; |
|
75 | + $meeting->duration_minutes = 1; |
|
76 | + $meeting->date_start = "2016-02-11 17:30:00"; |
|
77 | + $meeting->date_end = "2016-02-11 17:30:00"; |
|
78 | 78 | |
79 | - $meeting->save(); |
|
79 | + $meeting->save(); |
|
80 | 80 | |
81 | - //test for record ID to verify that record is saved |
|
82 | - $this->assertTrue(isset($meeting->id)); |
|
83 | - $this->assertEquals(36, strlen($meeting->id)); |
|
81 | + //test for record ID to verify that record is saved |
|
82 | + $this->assertTrue(isset($meeting->id)); |
|
83 | + $this->assertEquals(36, strlen($meeting->id)); |
|
84 | 84 | |
85 | 85 | |
86 | - /* Test set_accept_status method */ |
|
86 | + /* Test set_accept_status method */ |
|
87 | 87 | |
88 | - //test set_accept_status with User object |
|
89 | - $user = new User(); |
|
90 | - $meeting->set_accept_status($user,"accept"); |
|
88 | + //test set_accept_status with User object |
|
89 | + $user = new User(); |
|
90 | + $meeting->set_accept_status($user,"accept"); |
|
91 | 91 | |
92 | 92 | |
93 | - //test set_accept_status with contact object |
|
94 | - $contact = new Contact(); |
|
95 | - $meeting->set_accept_status($contact,"accept"); |
|
93 | + //test set_accept_status with contact object |
|
94 | + $contact = new Contact(); |
|
95 | + $meeting->set_accept_status($contact,"accept"); |
|
96 | 96 | |
97 | 97 | |
98 | - //test set_accept_status with Lead object |
|
99 | - $lead = new Lead(); |
|
100 | - $meeting->set_accept_status($lead,"accept"); |
|
98 | + //test set_accept_status with Lead object |
|
99 | + $lead = new Lead(); |
|
100 | + $meeting->set_accept_status($lead,"accept"); |
|
101 | 101 | |
102 | 102 | |
103 | - //mark all created relationships as deleted |
|
104 | - $meeting->mark_relationships_deleted($meeting->id); |
|
103 | + //mark all created relationships as deleted |
|
104 | + $meeting->mark_relationships_deleted($meeting->id); |
|
105 | 105 | |
106 | 106 | |
107 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
108 | - $meeting->mark_deleted($meeting->id); |
|
109 | - $result = $meeting->retrieve($meeting->id); |
|
110 | - $this->assertEquals(null,$result); |
|
107 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
108 | + $meeting->mark_deleted($meeting->id); |
|
109 | + $result = $meeting->retrieve($meeting->id); |
|
110 | + $this->assertEquals(null,$result); |
|
111 | 111 | |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | 114 | |
115 | - public function testget_summary_text() { |
|
115 | + public function testget_summary_text() { |
|
116 | 116 | |
117 | - $meeting = new Meeting(); |
|
117 | + $meeting = new Meeting(); |
|
118 | 118 | |
119 | - //test without setting name |
|
120 | - $this->assertEquals(Null,$meeting->get_summary_text()); |
|
119 | + //test without setting name |
|
120 | + $this->assertEquals(Null,$meeting->get_summary_text()); |
|
121 | 121 | |
122 | - //test with name set |
|
123 | - $meeting->name = "test"; |
|
124 | - $this->assertEquals('test',$meeting->get_summary_text()); |
|
122 | + //test with name set |
|
123 | + $meeting->name = "test"; |
|
124 | + $this->assertEquals('test',$meeting->get_summary_text()); |
|
125 | 125 | |
126 | 126 | |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | public function testcreate_export_query(){ |
130 | 130 | |
131 | - $meeting = new Meeting(); |
|
131 | + $meeting = new Meeting(); |
|
132 | 132 | |
133 | - //test with empty string params |
|
134 | - $expected = "SELECT meetings.*, users.user_name as assigned_user_name FROM meetings LEFT JOIN users ON meetings.assigned_user_id=users.id where meetings.deleted=0"; |
|
135 | - $actual = $meeting->create_export_query('',''); |
|
136 | - $this->assertSame($expected,$actual); |
|
133 | + //test with empty string params |
|
134 | + $expected = "SELECT meetings.*, users.user_name as assigned_user_name FROM meetings LEFT JOIN users ON meetings.assigned_user_id=users.id where meetings.deleted=0"; |
|
135 | + $actual = $meeting->create_export_query('',''); |
|
136 | + $this->assertSame($expected,$actual); |
|
137 | 137 | |
138 | 138 | |
139 | - //test with valid string params |
|
140 | - $expected = "SELECT meetings.*, users.user_name as assigned_user_name FROM meetings LEFT JOIN users ON meetings.assigned_user_id=users.id where users.user_name=\"\" AND meetings.deleted=0"; |
|
141 | - $actual = $meeting->create_export_query('meetings.id','users.user_name=""'); |
|
142 | - $this->assertSame($expected,$actual); |
|
139 | + //test with valid string params |
|
140 | + $expected = "SELECT meetings.*, users.user_name as assigned_user_name FROM meetings LEFT JOIN users ON meetings.assigned_user_id=users.id where users.user_name=\"\" AND meetings.deleted=0"; |
|
141 | + $actual = $meeting->create_export_query('meetings.id','users.user_name=""'); |
|
142 | + $this->assertSame($expected,$actual); |
|
143 | 143 | |
144 | - } |
|
145 | - |
|
146 | - public function testfill_in_additional_detail_fields() { |
|
147 | - |
|
148 | - $meeting = new Meeting(); |
|
149 | - |
|
150 | - //preset required attributes |
|
151 | - $meeting->assigned_user_id =1; |
|
152 | - $meeting->modified_user_id =1; |
|
153 | - $meeting->created_by =1; |
|
154 | - $meeting->contact_id =1; |
|
155 | - |
|
156 | - $meeting->fill_in_additional_detail_fields(); |
|
157 | - |
|
158 | - //verify effected atributes |
|
159 | - $this->assertEquals("Administrator", $meeting->assigned_user_name); |
|
160 | - $this->assertEquals("Administrator", $meeting->created_by_name); |
|
161 | - $this->assertEquals("Administrator", $meeting->modified_by_name); |
|
162 | - $this->assertTrue(isset($meeting->time_start_hour)); |
|
163 | - $this->assertTrue(isset($meeting->date_start)); |
|
164 | - $this->assertTrue(isset($meeting->time_start)); |
|
165 | - $this->assertTrue(isset($meeting->duration_hours)); |
|
166 | - $this->assertTrue(isset($meeting->duration_minutes)); |
|
167 | - $this->assertEquals(-1, $meeting->reminder_time ); |
|
168 | - $this->assertTrue(isset($meeting->reminder_time)); |
|
169 | - $this->assertEquals(false, $meeting->reminder_checked ); |
|
170 | - $this->assertEquals(-1, $meeting->email_reminder_time ); |
|
171 | - $this->assertEquals(false, $meeting->email_reminder_checked ); |
|
172 | - $this->assertEquals("Accounts", $meeting->parent_type); |
|
173 | - |
|
174 | - } |
|
175 | - |
|
176 | - public function testget_list_view_data() { |
|
177 | - |
|
178 | - $meeting = new Meeting(); |
|
179 | - |
|
180 | - //preset required attribute values |
|
181 | - $meeting->status == "Planned"; |
|
182 | - $meeting->parent_type = "Accounts"; |
|
183 | - $meeting->contact_id = 1; |
|
184 | - $meeting->contact_name = "test"; |
|
185 | - $meeting->parent_name = "Account"; |
|
186 | - |
|
187 | - $expected = array ( |
|
188 | - 'DELETED' => 0, |
|
189 | - 'PARENT_TYPE' => 'Accounts', |
|
190 | - 'STATUS' => 'Planned', |
|
191 | - 'TYPE' => 'Sugar', |
|
192 | - 'REMINDER_TIME' => '-1', |
|
193 | - 'EMAIL_REMINDER_TIME' => '-1', |
|
194 | - 'EMAIL_REMINDER_SENT' => '0', |
|
195 | - 'SEQUENCE' => '0', |
|
196 | - 'CONTACT_NAME' => 'test', |
|
197 | - 'PARENT_NAME' => '', |
|
198 | - 'CONTACT_ID' => 1, |
|
199 | - 'REPEAT_INTERVAL' => '1', |
|
200 | - 'PARENT_MODULE' => 'Accounts', |
|
201 | - 'SET_COMPLETE' => '<a id=\'\' onclick=\'SUGAR.util.closeActivityPanel.show("Meetings","","Held","listview","1");\'><img src="themes/SuiteR/images/close_inline.png?v=fqXdFZ_r6FC1K7P_Fy3mVw" border=\'0\' alt="Close" /></a>', |
|
202 | - 'DATE_START' => '<font class=\'overdueTask\'></font>', |
|
203 | - 'REMINDER_CHECKED' => false, |
|
204 | - 'EMAIL_REMINDER_CHECKED' => false, |
|
205 | - ); |
|
206 | - |
|
207 | - $actual = $meeting->get_list_view_data(); |
|
208 | - |
|
209 | - //$this->assertSame($expected, $actual); |
|
210 | - $this->assertEquals($expected['PARENT_TYPE'], $actual['PARENT_TYPE']); |
|
211 | - $this->assertEquals($expected['STATUS'], $actual['STATUS']); |
|
212 | - $this->assertEquals($expected['TYPE'], $actual['TYPE']); |
|
213 | - $this->assertEquals($expected['REMINDER_TIME'], $actual['REMINDER_TIME']); |
|
214 | - $this->assertEquals($expected['EMAIL_REMINDER_TIME'], $actual['EMAIL_REMINDER_TIME']); |
|
215 | - $this->assertEquals($expected['EMAIL_REMINDER_SENT'], $actual['EMAIL_REMINDER_SENT']); |
|
216 | - $this->assertEquals($expected['CONTACT_NAME'], $actual['CONTACT_NAME']); |
|
217 | - $this->assertEquals($expected['CONTACT_ID'], $actual['CONTACT_ID']); |
|
218 | - $this->assertEquals($expected['REPEAT_INTERVAL'], $actual['REPEAT_INTERVAL']); |
|
219 | - $this->assertEquals($expected['PARENT_MODULE'], $actual['PARENT_MODULE']); |
|
220 | - |
|
221 | - |
|
222 | - } |
|
223 | - |
|
224 | - public function testset_notification_body() { |
|
225 | - |
|
226 | - global $current_user; |
|
227 | - $current_user = new User(1); |
|
228 | - |
|
229 | - $meeting = new Meeting(); |
|
230 | - |
|
231 | - //test with attributes preset and verify template variables are set accordingly |
|
232 | - $meeting->name = "test"; |
|
233 | - $meeting->status = "Not Held"; |
|
234 | - $meeting->type = "Sugar"; |
|
235 | - $meeting->description = "test description"; |
|
236 | - $meeting->duration_hours = 1 ; |
|
237 | - $meeting->duration_minutes = 1; |
|
238 | - $meeting->date_start = "2016-02-11 17:30:00"; |
|
239 | - $meeting->date_end = "2016-02-11 17:30:00"; |
|
240 | - |
|
241 | - $result = $meeting->set_notification_body(new Sugar_Smarty(), $meeting); |
|
242 | - |
|
243 | - $this->assertEquals($meeting->name ,$result->_tpl_vars['MEETING_SUBJECT']); |
|
244 | - $this->assertEquals($meeting->status ,$result->_tpl_vars['MEETING_STATUS']); |
|
245 | - $this->assertEquals("SuiteCRM" ,$result->_tpl_vars['MEETING_TYPE']); |
|
246 | - $this->assertEquals($meeting->duration_hours ,$result->_tpl_vars['MEETING_HOURS']); |
|
247 | - $this->assertEquals($meeting->duration_minutes ,$result->_tpl_vars['MEETING_MINUTES']); |
|
248 | - $this->assertEquals($meeting->description ,$result->_tpl_vars['MEETING_DESCRIPTION']); |
|
144 | + } |
|
145 | + |
|
146 | + public function testfill_in_additional_detail_fields() { |
|
147 | + |
|
148 | + $meeting = new Meeting(); |
|
149 | + |
|
150 | + //preset required attributes |
|
151 | + $meeting->assigned_user_id =1; |
|
152 | + $meeting->modified_user_id =1; |
|
153 | + $meeting->created_by =1; |
|
154 | + $meeting->contact_id =1; |
|
155 | + |
|
156 | + $meeting->fill_in_additional_detail_fields(); |
|
157 | + |
|
158 | + //verify effected atributes |
|
159 | + $this->assertEquals("Administrator", $meeting->assigned_user_name); |
|
160 | + $this->assertEquals("Administrator", $meeting->created_by_name); |
|
161 | + $this->assertEquals("Administrator", $meeting->modified_by_name); |
|
162 | + $this->assertTrue(isset($meeting->time_start_hour)); |
|
163 | + $this->assertTrue(isset($meeting->date_start)); |
|
164 | + $this->assertTrue(isset($meeting->time_start)); |
|
165 | + $this->assertTrue(isset($meeting->duration_hours)); |
|
166 | + $this->assertTrue(isset($meeting->duration_minutes)); |
|
167 | + $this->assertEquals(-1, $meeting->reminder_time ); |
|
168 | + $this->assertTrue(isset($meeting->reminder_time)); |
|
169 | + $this->assertEquals(false, $meeting->reminder_checked ); |
|
170 | + $this->assertEquals(-1, $meeting->email_reminder_time ); |
|
171 | + $this->assertEquals(false, $meeting->email_reminder_checked ); |
|
172 | + $this->assertEquals("Accounts", $meeting->parent_type); |
|
173 | + |
|
174 | + } |
|
175 | + |
|
176 | + public function testget_list_view_data() { |
|
177 | + |
|
178 | + $meeting = new Meeting(); |
|
179 | + |
|
180 | + //preset required attribute values |
|
181 | + $meeting->status == "Planned"; |
|
182 | + $meeting->parent_type = "Accounts"; |
|
183 | + $meeting->contact_id = 1; |
|
184 | + $meeting->contact_name = "test"; |
|
185 | + $meeting->parent_name = "Account"; |
|
186 | + |
|
187 | + $expected = array ( |
|
188 | + 'DELETED' => 0, |
|
189 | + 'PARENT_TYPE' => 'Accounts', |
|
190 | + 'STATUS' => 'Planned', |
|
191 | + 'TYPE' => 'Sugar', |
|
192 | + 'REMINDER_TIME' => '-1', |
|
193 | + 'EMAIL_REMINDER_TIME' => '-1', |
|
194 | + 'EMAIL_REMINDER_SENT' => '0', |
|
195 | + 'SEQUENCE' => '0', |
|
196 | + 'CONTACT_NAME' => 'test', |
|
197 | + 'PARENT_NAME' => '', |
|
198 | + 'CONTACT_ID' => 1, |
|
199 | + 'REPEAT_INTERVAL' => '1', |
|
200 | + 'PARENT_MODULE' => 'Accounts', |
|
201 | + 'SET_COMPLETE' => '<a id=\'\' onclick=\'SUGAR.util.closeActivityPanel.show("Meetings","","Held","listview","1");\'><img src="themes/SuiteR/images/close_inline.png?v=fqXdFZ_r6FC1K7P_Fy3mVw" border=\'0\' alt="Close" /></a>', |
|
202 | + 'DATE_START' => '<font class=\'overdueTask\'></font>', |
|
203 | + 'REMINDER_CHECKED' => false, |
|
204 | + 'EMAIL_REMINDER_CHECKED' => false, |
|
205 | + ); |
|
206 | + |
|
207 | + $actual = $meeting->get_list_view_data(); |
|
208 | + |
|
209 | + //$this->assertSame($expected, $actual); |
|
210 | + $this->assertEquals($expected['PARENT_TYPE'], $actual['PARENT_TYPE']); |
|
211 | + $this->assertEquals($expected['STATUS'], $actual['STATUS']); |
|
212 | + $this->assertEquals($expected['TYPE'], $actual['TYPE']); |
|
213 | + $this->assertEquals($expected['REMINDER_TIME'], $actual['REMINDER_TIME']); |
|
214 | + $this->assertEquals($expected['EMAIL_REMINDER_TIME'], $actual['EMAIL_REMINDER_TIME']); |
|
215 | + $this->assertEquals($expected['EMAIL_REMINDER_SENT'], $actual['EMAIL_REMINDER_SENT']); |
|
216 | + $this->assertEquals($expected['CONTACT_NAME'], $actual['CONTACT_NAME']); |
|
217 | + $this->assertEquals($expected['CONTACT_ID'], $actual['CONTACT_ID']); |
|
218 | + $this->assertEquals($expected['REPEAT_INTERVAL'], $actual['REPEAT_INTERVAL']); |
|
219 | + $this->assertEquals($expected['PARENT_MODULE'], $actual['PARENT_MODULE']); |
|
220 | + |
|
221 | + |
|
222 | + } |
|
223 | + |
|
224 | + public function testset_notification_body() { |
|
225 | + |
|
226 | + global $current_user; |
|
227 | + $current_user = new User(1); |
|
228 | + |
|
229 | + $meeting = new Meeting(); |
|
230 | + |
|
231 | + //test with attributes preset and verify template variables are set accordingly |
|
232 | + $meeting->name = "test"; |
|
233 | + $meeting->status = "Not Held"; |
|
234 | + $meeting->type = "Sugar"; |
|
235 | + $meeting->description = "test description"; |
|
236 | + $meeting->duration_hours = 1 ; |
|
237 | + $meeting->duration_minutes = 1; |
|
238 | + $meeting->date_start = "2016-02-11 17:30:00"; |
|
239 | + $meeting->date_end = "2016-02-11 17:30:00"; |
|
240 | + |
|
241 | + $result = $meeting->set_notification_body(new Sugar_Smarty(), $meeting); |
|
242 | + |
|
243 | + $this->assertEquals($meeting->name ,$result->_tpl_vars['MEETING_SUBJECT']); |
|
244 | + $this->assertEquals($meeting->status ,$result->_tpl_vars['MEETING_STATUS']); |
|
245 | + $this->assertEquals("SuiteCRM" ,$result->_tpl_vars['MEETING_TYPE']); |
|
246 | + $this->assertEquals($meeting->duration_hours ,$result->_tpl_vars['MEETING_HOURS']); |
|
247 | + $this->assertEquals($meeting->duration_minutes ,$result->_tpl_vars['MEETING_MINUTES']); |
|
248 | + $this->assertEquals($meeting->description ,$result->_tpl_vars['MEETING_DESCRIPTION']); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | 252 | |
253 | - public function testcreate_notification_email(){ |
|
253 | + public function testcreate_notification_email(){ |
|
254 | 254 | |
255 | - $meeting = new Meeting(); |
|
255 | + $meeting = new Meeting(); |
|
256 | 256 | |
257 | - $meeting->date_start = "2016-02-11 17:30:00"; |
|
258 | - $meeting->date_end = "2016-02-11 17:30:00"; |
|
257 | + $meeting->date_start = "2016-02-11 17:30:00"; |
|
258 | + $meeting->date_end = "2016-02-11 17:30:00"; |
|
259 | 259 | |
260 | - //test without setting user |
|
261 | - $result = $meeting->create_notification_email(new User()); |
|
262 | - $this->assertInstanceOf('SugarPHPMailer', $result); |
|
260 | + //test without setting user |
|
261 | + $result = $meeting->create_notification_email(new User()); |
|
262 | + $this->assertInstanceOf('SugarPHPMailer', $result); |
|
263 | 263 | |
264 | - //test with valid user |
|
265 | - $result = $meeting->create_notification_email(new User(1)); |
|
266 | - $this->assertInstanceOf('SugarPHPMailer', $result); |
|
264 | + //test with valid user |
|
265 | + $result = $meeting->create_notification_email(new User(1)); |
|
266 | + $this->assertInstanceOf('SugarPHPMailer', $result); |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | - public function testsend_assignment_notifications(){ |
|
271 | + public function testsend_assignment_notifications(){ |
|
272 | 272 | |
273 | - $meeting = new Meeting(); |
|
273 | + $meeting = new Meeting(); |
|
274 | 274 | |
275 | - $meeting->date_start = "2016-02-11 17:30:00"; |
|
276 | - $meeting->date_end = "2016-02-11 17:30:00"; |
|
275 | + $meeting->date_start = "2016-02-11 17:30:00"; |
|
276 | + $meeting->date_end = "2016-02-11 17:30:00"; |
|
277 | 277 | |
278 | - $admin = new Administration(); |
|
279 | - $admin->retrieveSettings(); |
|
280 | - $sendNotifications = false; |
|
278 | + $admin = new Administration(); |
|
279 | + $admin->retrieveSettings(); |
|
280 | + $sendNotifications = false; |
|
281 | 281 | |
282 | - $notify_user = new User(1); |
|
282 | + $notify_user = new User(1); |
|
283 | 283 | |
284 | 284 | |
285 | - //execute the method and test if it works and does not throws an exception. |
|
286 | - try { |
|
287 | - $meeting->send_assignment_notifications($notify_user, $admin); |
|
288 | - $this->assertTrue(true); |
|
289 | - } |
|
290 | - catch (Exception $e) { |
|
291 | - $this->fail(); |
|
292 | - } |
|
285 | + //execute the method and test if it works and does not throws an exception. |
|
286 | + try { |
|
287 | + $meeting->send_assignment_notifications($notify_user, $admin); |
|
288 | + $this->assertTrue(true); |
|
289 | + } |
|
290 | + catch (Exception $e) { |
|
291 | + $this->fail(); |
|
292 | + } |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - public function testget_meeting_users() { |
|
296 | + public function testget_meeting_users() { |
|
297 | 297 | |
298 | - $meeting = new Meeting(); |
|
298 | + $meeting = new Meeting(); |
|
299 | 299 | |
300 | - $result = $meeting->get_meeting_users(); |
|
301 | - $this->assertTrue(is_array($result)); |
|
300 | + $result = $meeting->get_meeting_users(); |
|
301 | + $this->assertTrue(is_array($result)); |
|
302 | 302 | |
303 | - } |
|
303 | + } |
|
304 | 304 | |
305 | - public function testget_invite_meetings() { |
|
305 | + public function testget_invite_meetings() { |
|
306 | 306 | |
307 | - $meeting = new Meeting(); |
|
307 | + $meeting = new Meeting(); |
|
308 | 308 | |
309 | - $result = $meeting->get_invite_meetings(new User()); |
|
310 | - $this->assertTrue(is_array($result)); |
|
309 | + $result = $meeting->get_invite_meetings(new User()); |
|
310 | + $this->assertTrue(is_array($result)); |
|
311 | 311 | |
312 | - } |
|
312 | + } |
|
313 | 313 | |
314 | 314 | |
315 | - public function testget_notification_recipients() { |
|
315 | + public function testget_notification_recipients() { |
|
316 | 316 | |
317 | - $meeting = new Meeting(); |
|
317 | + $meeting = new Meeting(); |
|
318 | 318 | |
319 | - //test without special_notification |
|
320 | - $result = $meeting->get_notification_recipients(); |
|
321 | - $this->assertTrue(is_array($result)); |
|
319 | + //test without special_notification |
|
320 | + $result = $meeting->get_notification_recipients(); |
|
321 | + $this->assertTrue(is_array($result)); |
|
322 | 322 | |
323 | 323 | |
324 | - //test with special_notification |
|
325 | - $meeting->special_notification = 1; |
|
326 | - $result = $meeting->get_notification_recipients(); |
|
327 | - $this->assertTrue(is_array($result)); |
|
324 | + //test with special_notification |
|
325 | + $meeting->special_notification = 1; |
|
326 | + $result = $meeting->get_notification_recipients(); |
|
327 | + $this->assertTrue(is_array($result)); |
|
328 | 328 | |
329 | - } |
|
329 | + } |
|
330 | 330 | |
331 | 331 | |
332 | - public function testbean_implements() { |
|
332 | + public function testbean_implements() { |
|
333 | 333 | |
334 | - $meeting = new Meeting(); |
|
334 | + $meeting = new Meeting(); |
|
335 | 335 | |
336 | - $this->assertEquals(false, $meeting->bean_implements('')); //test with blank value |
|
337 | - $this->assertEquals(false, $meeting->bean_implements('test')); //test with invalid value |
|
338 | - $this->assertEquals(true, $meeting->bean_implements('ACL')); //test with valid value |
|
336 | + $this->assertEquals(false, $meeting->bean_implements('')); //test with blank value |
|
337 | + $this->assertEquals(false, $meeting->bean_implements('test')); //test with invalid value |
|
338 | + $this->assertEquals(true, $meeting->bean_implements('ACL')); //test with valid value |
|
339 | 339 | |
340 | - } |
|
340 | + } |
|
341 | 341 | |
342 | - public function testlistviewACLHelper() { |
|
342 | + public function testlistviewACLHelper() { |
|
343 | 343 | |
344 | - $meeting = new Meeting(); |
|
344 | + $meeting = new Meeting(); |
|
345 | 345 | |
346 | - $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
347 | - $actual = $meeting->listviewACLHelper(); |
|
348 | - $this->assertSame($expected,$actual); |
|
346 | + $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
347 | + $actual = $meeting->listviewACLHelper(); |
|
348 | + $this->assertSame($expected,$actual); |
|
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | |
352 | 352 | |
353 | - public function testsave_relationship_changes() { |
|
353 | + public function testsave_relationship_changes() { |
|
354 | 354 | |
355 | - $meeting = new Meeting(); |
|
355 | + $meeting = new Meeting(); |
|
356 | 356 | |
357 | - //execute the method and test if it works and does not throws an exception. |
|
358 | - try { |
|
359 | - $meeting->save_relationship_changes(); |
|
360 | - $this->assertTrue(true); |
|
361 | - } |
|
362 | - catch (Exception $e) { |
|
363 | - $this->fail(); |
|
364 | - } |
|
357 | + //execute the method and test if it works and does not throws an exception. |
|
358 | + try { |
|
359 | + $meeting->save_relationship_changes(); |
|
360 | + $this->assertTrue(true); |
|
361 | + } |
|
362 | + catch (Exception $e) { |
|
363 | + $this->fail(); |
|
364 | + } |
|
365 | 365 | |
366 | 366 | |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | 369 | |
370 | - public function testafterImportSave(){ |
|
370 | + public function testafterImportSave(){ |
|
371 | 371 | |
372 | - require_once("data/Link.php"); |
|
372 | + require_once("data/Link.php"); |
|
373 | 373 | |
374 | - $meeting = new Meeting(); |
|
374 | + $meeting = new Meeting(); |
|
375 | 375 | |
376 | - //execute the method and test if it works and does not throws an exception. |
|
377 | - try { |
|
376 | + //execute the method and test if it works and does not throws an exception. |
|
377 | + try { |
|
378 | 378 | |
379 | - //test without parent_type |
|
380 | - $meeting->afterImportSave(); |
|
379 | + //test without parent_type |
|
380 | + $meeting->afterImportSave(); |
|
381 | 381 | |
382 | - //test with parent_type Contacts |
|
383 | - $meeting->parent_type = 'Contacts'; |
|
384 | - $meeting->afterImportSave(); |
|
382 | + //test with parent_type Contacts |
|
383 | + $meeting->parent_type = 'Contacts'; |
|
384 | + $meeting->afterImportSave(); |
|
385 | 385 | |
386 | - //test with parent_type Leads |
|
387 | - $meeting->parent_type = 'Leads'; |
|
388 | - $meeting->afterImportSave(); |
|
386 | + //test with parent_type Leads |
|
387 | + $meeting->parent_type = 'Leads'; |
|
388 | + $meeting->afterImportSave(); |
|
389 | 389 | |
390 | - $this->assertTrue(true); |
|
390 | + $this->assertTrue(true); |
|
391 | 391 | |
392 | - } |
|
393 | - catch (Exception $e) { |
|
394 | - $this->fail(); |
|
395 | - } |
|
392 | + } |
|
393 | + catch (Exception $e) { |
|
394 | + $this->fail(); |
|
395 | + } |
|
396 | 396 | |
397 | 397 | |
398 | - } |
|
398 | + } |
|
399 | 399 | |
400 | 400 | public function testgetDefaultStatus(){ |
401 | 401 | |
402 | - $meeting = new Meeting(); |
|
403 | - $result = $meeting->getDefaultStatus(); |
|
404 | - $this->assertEquals("Planned", $result); |
|
402 | + $meeting = new Meeting(); |
|
403 | + $result = $meeting->getDefaultStatus(); |
|
404 | + $this->assertEquals("Planned", $result); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | |
@@ -409,19 +409,19 @@ discard block |
||
409 | 409 | |
410 | 410 | public function testgetMeetingsExternalApiDropDown(){ |
411 | 411 | |
412 | - $actual = getMeetingsExternalApiDropDown(); |
|
413 | - $expected= array( "Sugar"=>"SuiteCRM"); |
|
414 | - $this->assertSame($expected, $actual); |
|
412 | + $actual = getMeetingsExternalApiDropDown(); |
|
413 | + $expected= array( "Sugar"=>"SuiteCRM"); |
|
414 | + $this->assertSame($expected, $actual); |
|
415 | 415 | |
416 | 416 | } |
417 | 417 | |
418 | 418 | |
419 | 419 | public function testgetMeetingTypeOptions(){ |
420 | 420 | |
421 | - global $dictionary, $app_list_strings; |
|
421 | + global $dictionary, $app_list_strings; |
|
422 | 422 | |
423 | - $result = getMeetingTypeOptions($dictionary, $app_list_strings); |
|
424 | - $this->assertTrue(is_array($result)); |
|
423 | + $result = getMeetingTypeOptions($dictionary, $app_list_strings); |
|
424 | + $this->assertTrue(is_array($result)); |
|
425 | 425 | |
426 | 426 | } |
427 | 427 |