All Data Structures Functions Variables Pages
ModelAttributesImportMappingAdapterTest.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
38  {
39  public static function setUpBeforeClass()
40  {
41  parent::setUpBeforeClass();
42  SecurityTestHelper::createSuperAdmin();
43  }
44 
45  public function testGetAttributes()
46  {
47  $modelAttributesAdapter = new ModelAttributesImportMappingAdapter(new ImportModelTestItem(false));
48  $attributesCollection = $modelAttributesAdapter->getAttributes();
49  $compareData = array(
50  'id' =>
51  array (
52  'attributeLabel' => 'Id',
53  'attributeName' => 'id',
54  'relationAttributeName' => null,
55  'attributeImportRulesType' => 'Id',
56  'isRequired' => false,
57  ),
58  'createdDateTime' =>
59  array (
60  'attributeLabel' => 'Created Date Time',
61  'attributeName' => 'createdDateTime',
62  'relationAttributeName' => null,
63  'attributeImportRulesType' => 'CreatedDateTime',
64  'isRequired' => true,
65  ),
66  'modifiedDateTime' =>
67  array (
68  'attributeLabel' => 'Modified Date Time',
69  'attributeName' => 'modifiedDateTime',
70  'relationAttributeName' => null,
71  'attributeImportRulesType' => 'ModifiedDateTime',
72  'isRequired' => true,
73  ),
74  'createdByUser' =>
75  array (
76  'attributeLabel' => 'Created By User',
77  'attributeName' => 'createdByUser',
78  'relationAttributeName' => null,
79  'attributeImportRulesType' => 'CreatedByUser',
80  'isRequired' => false,
81  ),
82  'firstName' =>
83  array (
84  'attributeLabel' => 'First Name',
85  'attributeName' => 'firstName',
86  'relationAttributeName' => null,
87  'attributeImportRulesType' => 'Text',
88  'isRequired' => false,
89  ),
90  'lastName' =>
91  array (
92  'attributeLabel' => 'Last Name',
93  'attributeName' => 'lastName',
94  'relationAttributeName' => null,
95  'attributeImportRulesType' => 'Text',
96  'isRequired' => true,
97  ),
98  'modifiedByUser' =>
99  array (
100  'attributeLabel' => 'Modified By User',
101  'attributeName' => 'modifiedByUser',
102  'relationAttributeName' => null,
103  'attributeImportRulesType' => 'ModifiedByUser',
104  'isRequired' => false,
105  ),
106  'owner' =>
107  array (
108  'attributeLabel' => 'Owner',
109  'attributeName' => 'owner',
110  'relationAttributeName' => null,
111  'attributeImportRulesType' => 'User',
112  'isRequired' => true,
113  ),
114  'boolean' =>
115  array (
116  'attributeLabel' => 'Boolean',
117  'attributeName' => 'boolean',
118  'relationAttributeName' => null,
119  'attributeImportRulesType' => 'CheckBox',
120  'isRequired' => false,
121  ),
122  'date' =>
123  array (
124  'attributeLabel' => 'Date',
125  'attributeName' => 'date',
126  'relationAttributeName' => null,
127  'attributeImportRulesType' => 'Date',
128  'isRequired' => false,
129  ),
130  'dateTime' =>
131  array (
132  'attributeLabel' => 'Date Time',
133  'attributeName' => 'dateTime',
134  'relationAttributeName' => null,
135  'attributeImportRulesType' => 'DateTime',
136  'isRequired' => false,
137  ),
138  'decimal' =>
139  array (
140  'attributeLabel' => 'Decimal',
141  'attributeName' => 'decimal',
142  'relationAttributeName' => null,
143  'attributeImportRulesType' => 'Decimal',
144  'isRequired' => false,
145  ),
146  'float' =>
147  array (
148  'attributeLabel' => 'Float',
149  'attributeName' => 'float',
150  'relationAttributeName' => null,
151  'attributeImportRulesType' => 'Decimal',
152  'isRequired' => false,
153  ),
154  'integer' =>
155  array (
156  'attributeLabel' => 'Integer',
157  'attributeName' => 'integer',
158  'relationAttributeName' => null,
159  'attributeImportRulesType' => 'Integer',
160  'isRequired' => false,
161  ),
162  'numerical' =>
163  array (
164  'attributeLabel' => 'Numerical',
165  'attributeName' => 'numerical',
166  'relationAttributeName' => null,
167  'attributeImportRulesType' => 'Integer',
168  'isRequired' => false,
169  ),
170  'phone' =>
171  array (
172  'attributeLabel' => 'Phone',
173  'attributeName' => 'phone',
174  'relationAttributeName' => null,
175  'attributeImportRulesType' => 'Phone',
176  'isRequired' => false,
177  ),
178  'string' =>
179  array (
180  'attributeLabel' => 'String',
181  'attributeName' => 'string',
182  'relationAttributeName' => null,
183  'attributeImportRulesType' => 'Text',
184  'isRequired' => true,
185  ),
186  'tagCloud' =>
187  array (
188  'attributeLabel' => 'Tag Cloud',
189  'attributeName' => 'tagCloud',
190  'relationAttributeName' => null,
191  'attributeImportRulesType' => 'TagCloud',
192  'isRequired' => false,
193  ),
194  'textArea' =>
195  array (
196  'attributeLabel' => 'Text Area',
197  'attributeName' => 'textArea',
198  'relationAttributeName' => null,
199  'attributeImportRulesType' => 'TextArea',
200  'isRequired' => false,
201  ),
202  'url' =>
203  array (
204  'attributeLabel' => 'Url',
205  'attributeName' => 'url',
206  'relationAttributeName' => null,
207  'attributeImportRulesType' => 'Url',
208  'isRequired' => false,
209  ),
210  'currencyValue' =>
211  array (
212  'attributeLabel' => 'Currency Value',
213  'attributeName' => 'currencyValue',
214  'relationAttributeName' => null,
215  'attributeImportRulesType' => 'CurrencyValue',
216  'isRequired' => false,
217  ),
218  'dropDown' =>
219  array (
220  'attributeLabel' => 'Drop Down',
221  'attributeName' => 'dropDown',
222  'relationAttributeName' => null,
223  'attributeImportRulesType' => 'DropDown',
224  'isRequired' => false,
225  ),
226  'multiDropDown' =>
227  array (
228  'attributeLabel' => 'Multi Drop Down',
229  'attributeName' => 'multiDropDown',
230  'relationAttributeName' => null,
231  'attributeImportRulesType' => 'MultiSelectDropDown',
232  'isRequired' => false,
233  ),
234  'radioDropDown' =>
235  array (
236  'attributeLabel' => 'Radio Drop Down',
237  'attributeName' => 'radioDropDown',
238  'relationAttributeName' => null,
239  'attributeImportRulesType' => 'RadioDropDown',
240  'isRequired' => false,
241  ),
242  'hasOne' =>
243  array (
244  'attributeLabel' => 'Has One',
245  'attributeName' => 'hasOne',
246  'relationAttributeName' => null,
247  'attributeImportRulesType' => 'ImportModelTestItem2',
248  'isRequired' => false,
249  ),
250  'hasOneAlso' =>
251  array (
252  'attributeLabel' => 'Has One Also',
253  'attributeName' => 'hasOneAlso',
254  'relationAttributeName' => null,
255  'attributeImportRulesType' => 'ImportModelTestItem4',
256  'isRequired' => false,
257  ),
258  'primaryEmail__emailAddress' =>
259  array (
260  'attributeLabel' => 'Primary Email - Email Address',
261  'attributeName' => 'primaryEmail',
262  'relationAttributeName' => 'emailAddress',
263  'attributeImportRulesType' => 'Email',
264  'isRequired' => false,
265  ),
266  'primaryEmail__optOut' =>
267  array (
268  'attributeLabel' => 'Primary Email - Opt Out',
269  'attributeName' => 'primaryEmail',
270  'relationAttributeName' => 'optOut',
271  'attributeImportRulesType' => 'CheckBox',
272  'isRequired' => false,
273  ),
274  'primaryEmail__isInvalid' =>
275  array (
276  'attributeLabel' => 'Primary Email - Is Invalid',
277  'attributeName' => 'primaryEmail',
278  'relationAttributeName' => 'isInvalid',
279  'attributeImportRulesType' => 'CheckBox',
280  'isRequired' => false,
281  ),
282  'primaryAddress__street1' =>
283  array (
284  'attributeLabel' => 'Primary Address - Street 1',
285  'attributeName' => 'primaryAddress',
286  'relationAttributeName' => 'street1',
287  'attributeImportRulesType' => 'Text',
288  'isRequired' => false,
289  ),
290  'primaryAddress__street2' =>
291  array (
292  'attributeLabel' => 'Primary Address - Street 2',
293  'attributeName' => 'primaryAddress',
294  'relationAttributeName' => 'street2',
295  'attributeImportRulesType' => 'Text',
296  'isRequired' => false,
297  ),
298  'primaryAddress__city' =>
299  array (
300  'attributeLabel' => 'Primary Address - City',
301  'attributeName' => 'primaryAddress',
302  'relationAttributeName' => 'city',
303  'attributeImportRulesType' => 'Text',
304  'isRequired' => false,
305  ),
306  'primaryAddress__state' =>
307  array (
308  'attributeLabel' => 'Primary Address - State',
309  'attributeName' => 'primaryAddress',
310  'relationAttributeName' => 'state',
311  'attributeImportRulesType' => 'Text',
312  'isRequired' => false,
313  ),
314  'primaryAddress__postalCode' =>
315  array (
316  'attributeLabel' => 'Primary Address - Postal Code',
317  'attributeName' => 'primaryAddress',
318  'relationAttributeName' => 'postalCode',
319  'attributeImportRulesType' => 'Text',
320  'isRequired' => false,
321  ),
322  'primaryAddress__country' =>
323  array (
324  'attributeLabel' => 'Primary Address - Country',
325  'attributeName' => 'primaryAddress',
326  'relationAttributeName' => 'country',
327  'attributeImportRulesType' => 'Text',
328  'isRequired' => false,
329  ),
330  'primaryAddress__invalid' =>
331  array (
332  'attributeLabel' => 'Primary Address - Invalid',
333  'attributeName' => 'primaryAddress',
334  'relationAttributeName' => 'invalid',
335  'attributeImportRulesType' => 'CheckBox',
336  'isRequired' => false,
337  ),
338  'primaryAddress__latitude' =>
339  array (
340  'attributeLabel' => 'Primary Address - Latitude',
341  'attributeName' => 'primaryAddress',
342  'relationAttributeName' => 'latitude',
343  'attributeImportRulesType' => 'Decimal',
344  'isRequired' => false,
345  ),
346  'primaryAddress__longitude' =>
347  array (
348  'attributeLabel' => 'Primary Address - Longitude',
349  'attributeName' => 'primaryAddress',
350  'relationAttributeName' => 'longitude',
351  'attributeImportRulesType' => 'Decimal',
352  'isRequired' => false,
353  ),
354  'secondaryEmail__emailAddress' =>
355  array (
356  'attributeLabel' => 'Secondary Email - Email Address',
357  'attributeName' => 'secondaryEmail',
358  'relationAttributeName' => 'emailAddress',
359  'attributeImportRulesType' => 'Email',
360  'isRequired' => false,
361  ),
362  'secondaryEmail__optOut' =>
363  array (
364  'attributeLabel' => 'Secondary Email - Opt Out',
365  'attributeName' => 'secondaryEmail',
366  'relationAttributeName' => 'optOut',
367  'attributeImportRulesType' => 'CheckBox',
368  'isRequired' => false,
369  ),
370  'secondaryEmail__isInvalid' =>
371  array (
372  'attributeLabel' => 'Secondary Email - Is Invalid',
373  'attributeName' => 'secondaryEmail',
374  'relationAttributeName' => 'isInvalid',
375  'attributeImportRulesType' => 'CheckBox',
376  'isRequired' => false,
377  ),
378  );
379  $this->assertEquals($compareData, $attributesCollection);
380  }
381  }
382 ?>
Generated on Sun May 31 2020 07:10:32