1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the FabienCrassat\CurriculumVitaeBundle Symfony bundle. |
5
|
|
|
* |
6
|
|
|
* (c) Fabien Crassat <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace FabienCrassat\CurriculumVitaeBundle\Tests\Entity; |
13
|
|
|
|
14
|
|
|
use FabienCrassat\CurriculumVitaeBundle\Entity\CurriculumVitae; |
15
|
|
|
|
16
|
|
|
class CurriculumVitaeGetterFromExampleXMLFileTest extends \PHPUnit\Framework\TestCase |
17
|
|
|
{ |
18
|
|
|
private $curriculumVitae; |
19
|
|
|
private $lang; |
20
|
|
|
private $interface; |
21
|
|
|
private $arrayToCompare; |
22
|
|
|
|
23
|
|
|
public function setUp() { |
24
|
|
|
$this->lang = 'en'; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testGetDropDownLanguages() { |
28
|
|
|
$this->interface = 'getDropDownLanguages'; |
29
|
|
|
$this->arrayToCompare = array( |
30
|
|
|
'en' => 'English', |
31
|
|
|
'fr' => 'Français', |
32
|
|
|
'es' => 'español' |
33
|
|
|
); |
34
|
|
|
|
35
|
|
|
$this->assertCVInterface(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function testGetFollowMe() { |
39
|
|
|
$this->interface = 'getFollowMe'; |
40
|
|
|
$this->arrayToCompare = array( |
41
|
|
|
'linkedin' => array( |
42
|
|
|
'title' => 'Linked In', |
43
|
|
|
'url' => 'http://www.linkedin.com', |
44
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/linkedin.png' |
45
|
|
|
), |
46
|
|
|
'viadeo' => array( |
47
|
|
|
'title' => 'Viadeo', |
48
|
|
|
'url' => 'http://www.viadeo.com', |
49
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/viadeo.png' |
50
|
|
|
), |
51
|
|
|
'monster' => array( |
52
|
|
|
'title' => 'Monster', |
53
|
|
|
'url' => 'http://beknown.com', |
54
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/monster.png' |
55
|
|
|
), |
56
|
|
|
'twitter' => array( |
57
|
|
|
'title' => 'Twitter', |
58
|
|
|
'url' => 'https://twitter.com', |
59
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/twitter.png' |
60
|
|
|
), |
61
|
|
|
'googleplus' => array( |
62
|
|
|
'title' => 'Google+', |
63
|
|
|
'url' => 'https://plus.google.com', |
64
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/googleplus.png' |
65
|
|
|
), |
66
|
|
|
'facebook' => array( |
67
|
|
|
'title' => 'Facebook', |
68
|
|
|
'url' => 'https://www.facebook.com', |
69
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/facebook.png' |
70
|
|
|
), |
71
|
|
|
'scrum' => array( |
72
|
|
|
'title' => 'Scrum', |
73
|
|
|
'url' => 'http://www.scrumalliance.org', |
74
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/scrum-alliance.png' |
75
|
|
|
) |
76
|
|
|
); |
77
|
|
|
|
78
|
|
|
$this->assertCVInterface(); |
79
|
|
|
|
80
|
|
|
$this->lang = 'fr'; |
81
|
|
|
$this->assertCVInterface(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function testGetLookingFor() { |
85
|
|
|
$this->interface = 'getLookingFor'; |
86
|
|
|
|
87
|
|
|
$this->arrayToCompare = array( |
88
|
|
|
'experience' => 'Curriculum Vitae Title', |
89
|
|
|
'presentation' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' |
90
|
|
|
.' Aenean eu lectus facilisis, posuere leo laoreet, dignissim ligula. Praesent' |
91
|
|
|
.' ultricies dignissim diam vitae dictum. Donec sed nisi tortor. Proin tempus' |
92
|
|
|
.' scelerisque lectus, sit amet convallis mi semper a. Integer blandit a ligula' |
93
|
|
|
.' a volutpat. Ut dolor eros, interdum quis ante ac, tempus commodo odio. Suspendisse' |
94
|
|
|
.' ut nisi purus. Mauris vestibulum nibh sit amet turpis consequat pharetra. Duis at' |
95
|
|
|
.' adipiscing risus. Vivamus vitae orci ac felis porta euismod. Fusce sit amet metus' |
96
|
|
|
.' sem. Maecenas suscipit tincidunt ante, sed feugiat odio eleifend eu. Sed eu' |
97
|
|
|
.' ultricies ipsum. In cursus tincidunt elit a gravida. Nam eu aliquet leo. Maecenas' |
98
|
|
|
.' nibh leo, eleifend fermentum neque sit amet, viverra consequat lorem.', |
99
|
|
|
); |
100
|
|
|
$this->assertCVInterface(); |
101
|
|
|
|
102
|
|
|
$this->lang = 'fr'; |
103
|
|
|
$this->arrayToCompare = array( |
104
|
|
|
'experience' => 'Titre du curriculum vitae', |
105
|
|
|
'presentation' => 'Mauris rutrum justo ac bibendum ultrices. Mauris a dolor a diam' |
106
|
|
|
.' tempus ornare vel non urna. Donec a dui vel nunc ultrices porta non vitae felis.' |
107
|
|
|
.' Ut blandit ullamcorper orci. Quisque quis justo vitae nisl auctor laoreet non eget' |
108
|
|
|
.' mauris. Sed volutpat enim est, vitae vulputate nibh laoreet gravida. Duis nec' |
109
|
|
|
.' tincidunt ante. Nullam metus turpis, accumsan nec laoreet et, consectetur et' |
110
|
|
|
.' ligula. Curabitur convallis feugiat lorem, sit amet tincidunt arcu sollicitudin' |
111
|
|
|
.' vel. Aliquam erat volutpat. In odio elit, accumsan in facilisis at, ultricies' |
112
|
|
|
.' quis justo.', |
113
|
|
|
); |
114
|
|
|
$this->assertCVInterface(); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function testGetExperiences() { |
118
|
|
|
$this->interface = 'getExperiences'; |
119
|
|
|
|
120
|
|
|
$this->arrayToCompare = array( |
121
|
|
|
'FirstExperience' => array( |
122
|
|
|
'date' => 'Jan 2007 - Present', |
123
|
|
|
'job' => 'My current job', |
124
|
|
|
'society' => array( |
125
|
|
|
'name' => 'My Company', |
126
|
|
|
'address' => 'the address of the company', |
127
|
|
|
'siteurl' => 'http://www.MyCompany.com'), |
128
|
|
|
'missions' => array( |
129
|
|
|
'item' => array( |
130
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', |
131
|
|
|
1 => 'Suspendisse nec mauris eu orci dapibus mollis ac ac mi.'))), |
132
|
|
|
'SecondExperience' => array( |
133
|
|
|
'collapse' => 'false', |
134
|
|
|
'date' => 'Sept - Dec 2006', |
135
|
|
|
'job' => 'My previous job', |
136
|
|
|
'society' => array( |
137
|
|
|
'name' => 'My Other Company', |
138
|
|
|
'address' => 'the address of the company', |
139
|
|
|
'siteurl' => 'http://www.MyOtherCompany.com')), |
140
|
|
|
'ThirdExperience' => array( |
141
|
|
|
'date' => 'Summer 2006', |
142
|
|
|
'job' => 'A summer job', |
143
|
|
|
'society' => array( |
144
|
|
|
'name' => 'A company wihtout site', |
145
|
|
|
'address' => 'the address of the company'), |
146
|
|
|
'missions' => array( |
147
|
|
|
'item' => array( |
148
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))), |
149
|
|
|
'FourthExperience' => array( |
150
|
|
|
'collapse' => 'true', |
151
|
|
|
'date' => 'Before 2006', |
152
|
|
|
'job' => 'The job of my life', |
153
|
|
|
'society' => 'A society with a name per language', |
154
|
|
|
'missions' => array( |
155
|
|
|
'item' => array( |
156
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))) |
157
|
|
|
); |
158
|
|
|
$this->assertCVInterface(); |
159
|
|
|
|
160
|
|
|
$this->lang = 'fr'; |
161
|
|
|
$this->arrayToCompare = array( |
162
|
|
|
'FirstExperience' => array( |
163
|
|
|
'date' => 'Jan. 2007 - Aujourd\'hui', |
164
|
|
|
'job' => 'Mon poste actuel', |
165
|
|
|
'society' => array( |
166
|
|
|
'name' => 'My Company', |
167
|
|
|
'address' => 'the address of the company', |
168
|
|
|
'siteurl' => 'http://www.MyCompany.com'), |
169
|
|
|
'missions' => array( |
170
|
|
|
'item' => array( |
171
|
|
|
0 => 'Donec gravida enim viverra tempor dignissim.', |
172
|
|
|
1 => 'Sed a eros at mauris placerat adipiscing.'))), |
173
|
|
|
'SecondExperience' => array( |
174
|
|
|
'collapse' => 'false', |
175
|
|
|
'date' => 'Sept - Dec 2006', |
176
|
|
|
'job' => 'Mon poste précédent', |
177
|
|
|
'society' => array( |
178
|
|
|
'name' => 'Mon autre compagnie', |
179
|
|
|
'address' => 'l\'adresse de la compagnie', |
180
|
|
|
'siteurl' => 'http://www.MyOtherCompany.com')), |
181
|
|
|
'ThirdExperience' => array( |
182
|
|
|
'date' => 'Summer 2006', |
183
|
|
|
'job' => 'Un travail d\'été', |
184
|
|
|
'society' => array( |
185
|
|
|
'name' => 'Une compagnie sans site', |
186
|
|
|
'address' => 'l\'adresse de la compagnie'), |
187
|
|
|
'missions' => array( |
188
|
|
|
'item' => array( |
189
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))), |
190
|
|
|
'FourthExperience' => array( |
191
|
|
|
'collapse' => 'true', |
192
|
|
|
'date' => 'Before 2006', |
193
|
|
|
'job' => 'Le job de ma vie', |
194
|
|
|
'society' => 'Une société avec un nom par langue', |
195
|
|
|
'missions' => array( |
196
|
|
|
'item' => array( |
197
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))) |
198
|
|
|
); |
199
|
|
|
$this->assertCVInterface(); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
public function testGetSkills() { |
203
|
|
|
$this->interface = 'getSkills'; |
204
|
|
|
|
205
|
|
|
$this->arrayToCompare = array( |
206
|
|
|
'Functional' => array( |
207
|
|
|
'title' => 'Skills', |
208
|
|
|
'lines' => array( |
209
|
|
|
'success' => array( |
210
|
|
|
'percentage' => 90, |
211
|
|
|
'class' => 'success', |
212
|
|
|
'striped' => 'true', |
213
|
|
|
'label' => 'Increasing Skills', |
214
|
|
|
), |
215
|
|
|
'otherSucess' => array( |
216
|
|
|
'percentage' => 90, |
217
|
|
|
'class' => 'success', |
218
|
|
|
'label' => 'success', |
219
|
|
|
), |
220
|
|
|
'info' => array( |
221
|
|
|
'percentage' => 40, |
222
|
|
|
'class' => 'info', |
223
|
|
|
'striped' => 'false', |
224
|
|
|
'label' => 'info', |
225
|
|
|
), |
226
|
|
|
'warning' => array( |
227
|
|
|
'percentage' => 20, |
228
|
|
|
'class' => 'warning', |
229
|
|
|
'label' => 'warning', |
230
|
|
|
), |
231
|
|
|
'danger' => array( |
232
|
|
|
'percentage' => 10, |
233
|
|
|
'class' => 'danger', |
234
|
|
|
'label' => 'danger', |
235
|
|
|
), |
236
|
|
|
'noClass' => array( |
237
|
|
|
'percentage' => 5, |
238
|
|
|
'label' => 'noClass', |
239
|
|
|
), |
240
|
|
|
'nothing' => array( |
241
|
|
|
'label' => 'nothing', |
242
|
|
|
) |
243
|
|
|
) |
244
|
|
|
), |
245
|
|
|
'OtherSkill' => array( |
246
|
|
|
'title' => 'One other', |
247
|
|
|
'lines' => array( |
248
|
|
|
'success' => array( |
249
|
|
|
'percentage' => 90, |
250
|
|
|
'class' => 'success', |
251
|
|
|
'striped' => 'false', |
252
|
|
|
'label' => 'Skills List', |
253
|
|
|
), |
254
|
|
|
'info' => array( |
255
|
|
|
'percentage' => 40, |
256
|
|
|
'class' => 'info', |
257
|
|
|
'striped' => 'false', |
258
|
|
|
'label' => 'Label', |
259
|
|
|
), |
260
|
|
|
'warning' => array( |
261
|
|
|
'percentage' => 20, |
262
|
|
|
'class' => 'warning', |
263
|
|
|
'striped' => 'false', |
264
|
|
|
'label' => 'Label', |
265
|
|
|
), |
266
|
|
|
'danger' => array( |
267
|
|
|
'percentage' => 10, |
268
|
|
|
'class' => 'danger', |
269
|
|
|
'striped' => 'true', |
270
|
|
|
'label' => 'Label', |
271
|
|
|
) |
272
|
|
|
) |
273
|
|
|
) |
274
|
|
|
); |
275
|
|
|
$this->assertCVInterface(); |
276
|
|
|
|
277
|
|
|
$this->lang = 'fr'; |
278
|
|
|
// Only set the french labels |
279
|
|
|
$arrayToChange = $this->arrayToCompare; |
280
|
|
|
$arrayToChange['Functional']['title'] = 'Compétences'; |
281
|
|
|
$arrayToChange['Functional']['lines']['success']['label'] = 'Compétences grandissantes'; |
282
|
|
|
$arrayToChange['OtherSkill']['title'] = 'Une autre'; |
283
|
|
|
$arrayToChange['OtherSkill']['lines']['success']['label'] = 'Liste de Compétences'; |
284
|
|
|
|
285
|
|
|
$this->arrayToCompare = $arrayToChange; |
286
|
|
|
$this->assertCVInterface(); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public function testGetEducations() { |
290
|
|
|
$this->interface = 'getEducations'; |
291
|
|
|
|
292
|
|
|
$this->arrayToCompare = array( |
293
|
|
|
'University' => array( |
294
|
|
|
'date' => '2002 - 2005', |
295
|
|
|
'education' => 'My diploma in my university', |
296
|
|
|
'descriptions' => array('item' => array( |
297
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in' |
298
|
|
|
.' auctor ipsum. Nullam venenatis sem.' |
299
|
|
|
)) |
300
|
|
|
), |
301
|
|
|
'HighSchool' => array( |
302
|
|
|
'collapse' => 'false', |
303
|
|
|
'date' => 'June 2002', |
304
|
|
|
'education' => 'My diploma in my high school', |
305
|
|
|
'descriptions' => array('item' => array( |
306
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris elit' |
307
|
|
|
.' dui, faucibus non laoreet luctus, dignissim at lectus. Quisque dignissim' |
308
|
|
|
.' imperdiet consectetur. Praesent scelerisque neque.', |
309
|
|
|
1 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium' |
310
|
|
|
.' varius est sit amet consectetur. Suspendisse cursus dapibus egestas.' |
311
|
|
|
.' Ut id augue quis mi scelerisque.' |
312
|
|
|
)) |
313
|
|
|
), |
314
|
|
|
'FirstSchool' => array( |
315
|
|
|
'collapse' => 'true', |
316
|
|
|
'date' => 'June 2000', |
317
|
|
|
'education' => 'My diploma in my first school' |
318
|
|
|
) |
319
|
|
|
); |
320
|
|
|
$this->assertCVInterface(); |
321
|
|
|
|
322
|
|
|
$this->lang = 'fr'; |
323
|
|
|
$this->arrayToCompare = array( |
324
|
|
|
'University' => array( |
325
|
|
|
'date' => '2002 - 2005', |
326
|
|
|
'education' => 'Mon diplôme dans mon université', |
327
|
|
|
'descriptions' => array('item' => array( |
328
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris elit dui,' |
329
|
|
|
.' faucibus non laoreet luctus, dignissim at lectus. Quisque dignissim' |
330
|
|
|
.' imperdiet consectetur. Praesent scelerisque neque.', |
331
|
|
|
1 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium' |
332
|
|
|
.' varius est sit amet consectetur. Suspendisse cursus dapibus egestas.' |
333
|
|
|
.' Ut id augue quis mi scelerisque.' |
334
|
|
|
)) |
335
|
|
|
), |
336
|
|
|
'HighSchool' => array( |
337
|
|
|
'collapse' => 'false', |
338
|
|
|
'date' => 'Juin 2002', |
339
|
|
|
'education' => 'Mon diplôme dans mon lycée', |
340
|
|
|
'descriptions' => array('item' => array( |
341
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in auctor' |
342
|
|
|
.' ipsum. Nullam venenatis sem.' |
343
|
|
|
)) |
344
|
|
|
), |
345
|
|
|
'FirstSchool' => array( |
346
|
|
|
'collapse' => 'true', |
347
|
|
|
'date' => 'Juin 2000', |
348
|
|
|
'education' => 'Mon diplôme dans mon collège' |
349
|
|
|
) |
350
|
|
|
); |
351
|
|
|
$this->assertCVInterface(); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public function testGetLanguageSkills() { |
355
|
|
|
$this->interface = 'getLanguageSkills'; |
356
|
|
|
|
357
|
|
|
$frenchFlag = 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-France.png'; |
358
|
|
|
$englishFlag = 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-United-Kingdom.png'; |
359
|
|
|
|
360
|
|
|
$this->arrayToCompare = array( |
361
|
|
|
'French' => array( |
362
|
|
|
'title' => 'French', |
363
|
|
|
'description' => 'My French level of the skill.', |
364
|
|
|
'icon' => $frenchFlag |
365
|
|
|
), |
366
|
|
|
'English' => array( |
367
|
|
|
'title' => 'English', |
368
|
|
|
'description' => 'My English level of the skill.', |
369
|
|
|
'icon' => $englishFlag |
370
|
|
|
) |
371
|
|
|
); |
372
|
|
|
$this->assertCVInterface(); |
373
|
|
|
|
374
|
|
|
$this->lang = 'fr'; |
375
|
|
|
$this->arrayToCompare = array( |
376
|
|
|
'French' => array( |
377
|
|
|
'title' => 'Français', |
378
|
|
|
'description' => 'Mon niveau de Français.', |
379
|
|
|
'icon' => $frenchFlag |
380
|
|
|
), |
381
|
|
|
'English' => array( |
382
|
|
|
'title' => 'Anglais', |
383
|
|
|
'description' => 'Mon niveau d\'Anglais.', |
384
|
|
|
'icon' => $englishFlag |
385
|
|
|
) |
386
|
|
|
); |
387
|
|
|
$this->assertCVInterface(); |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
public function testGetMiscellaneous() { |
391
|
|
|
$this->interface = 'getMiscellaneous'; |
392
|
|
|
|
393
|
|
|
$this->arrayToCompare = array( |
394
|
|
|
'Practical' => array( |
395
|
|
|
'title' => 'Practices', |
396
|
|
|
'miscellaneous' => 'My practices' |
397
|
|
|
) |
398
|
|
|
); |
399
|
|
|
$this->assertCVInterface(); |
400
|
|
|
|
401
|
|
|
$this->lang = 'fr'; |
402
|
|
|
$this->arrayToCompare = array( |
403
|
|
|
'Practical' => array( |
404
|
|
|
'title' => 'Pratiques', |
405
|
|
|
'miscellaneous' => 'Mes pratiques', |
406
|
|
|
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' |
407
|
|
|
.' Curabitur nec auctor nisl, eu fringilla nisi. Morbi scelerisque,' |
408
|
|
|
.' est vitae mattis faucibus, felis sapien lobortis augue.' |
409
|
|
|
) |
410
|
|
|
); |
411
|
|
|
$this->assertCVInterface(); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
private function assertCVInterface($pathToFile = '/../../Resources/data/example.xml') { |
415
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.$pathToFile, $this->lang); |
416
|
|
|
$this->assertEquals($this->arrayToCompare, $this->curriculumVitae->{$this->interface}()); |
417
|
|
|
} |
418
|
|
|
} |
419
|
|
|
|