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 CurriculumVitaeTest extends \PHPUnit_Framework_TestCase |
17
|
|
|
{ |
18
|
|
|
private $curriculumVitae; |
19
|
|
|
private $lang; |
20
|
|
|
private $interface; |
21
|
|
|
private $arrayToCompare; |
22
|
|
|
|
23
|
|
|
public function __construct() { |
24
|
|
|
$this->lang = 'en'; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testgetLookingForAndExperiencesAndHumanFileName() { |
28
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml', $this->lang); |
29
|
|
|
|
30
|
|
|
$result = array(); |
31
|
|
|
$result = array_merge($result, array('lookingFor' => $this->curriculumVitae->getLookingFor())); |
32
|
|
|
$result = array_merge($result, array('experiences' => $this->curriculumVitae->getExperiences())); |
33
|
|
|
$result = array_merge($result, array('pdfFile' => $this->curriculumVitae->getHumanFileName())); |
34
|
|
|
|
35
|
|
|
$expected = array( |
36
|
|
|
'lookingFor' => array( |
37
|
|
|
'experience' => array( |
38
|
|
|
'date' => 'Date', |
39
|
|
|
'job' => 'The job', |
40
|
|
|
'society' => array( |
41
|
|
|
'name' => 'My Company', |
42
|
|
|
'address' => 'The address of the company', |
43
|
|
|
'siteurl' => 'http://www.MyCompany.com')), |
44
|
|
|
'presentation' => 'A presentation'), |
45
|
|
|
'experiences' => array( |
46
|
|
|
'LastJob' => array( |
47
|
|
|
'date' => 'Date', |
48
|
|
|
'job' => 'The job', |
49
|
|
|
'society' => array( |
50
|
|
|
'name' => 'My Company', |
51
|
|
|
'address' => 'The address of the company', |
52
|
|
|
'siteurl' => 'http://www.MyCompany.com'))), |
53
|
|
|
'pdfFile' => 'First Name Last Name - The job' |
54
|
|
|
); |
55
|
|
|
$this->assertEquals($expected, $result); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function testNoLanguage() { |
59
|
|
|
$this->interface = 'getDropDownLanguages'; |
60
|
|
|
|
61
|
|
|
$this->arrayToCompare = array( |
62
|
|
|
$this->lang => $this->lang |
63
|
|
|
); |
64
|
|
|
|
65
|
|
|
$this->assertCVInterface('/../Resources/data/core.xml'); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function testSpecialCharacters() { |
69
|
|
|
$this->interface = 'getLookingFor'; |
70
|
|
|
|
71
|
|
|
$this->arrayToCompare = array( |
72
|
|
|
'experience' => 'Curriculum Vitae With Special Characters', |
73
|
|
|
'presentation' => 'AZERTY keyboard' |
74
|
|
|
.' Line 1 ²é"(-è_çà)=' |
75
|
|
|
.' Line 1 with shift 1234567890°+' |
76
|
|
|
.' Line 1 with Alt Gr ~#{[|`\^@]}' |
77
|
|
|
.' Line 2 azertyuiop^$' |
78
|
|
|
.' Line 2 with shift AZERTYUIOP¨£' |
79
|
|
|
.' Line 2 with Alt Gr €¤' |
80
|
|
|
.' Line 3 qsdfghjklmù*' |
81
|
|
|
.' Line 3 with shift QSDFGHJKLM%µ' |
82
|
|
|
.' Line 3 with Alt Gr ' |
83
|
|
|
.' Line 4 wxcvbn,;:!' |
84
|
|
|
.' Line 4 with shift WXCVBN?./§' |
85
|
|
|
.' Line 4 with Alt Gr ' |
86
|
|
|
.' Escape Characters < > &' |
87
|
|
|
.' End', |
88
|
|
|
); |
89
|
|
|
$this->assertCVInterface('/../Resources/data/specialCharacters.xml'); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function testSimpleHumanFileName() { |
93
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/core.xml'); |
94
|
|
|
$this->assertSame('core', $this->curriculumVitae->getHumanFileName()); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function testHumanFileNameWithExperience() { |
98
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../../Resources/data/example.xml'); |
99
|
|
|
$this->assertSame('First Name Last Name - Curriculum Vitae Title', |
100
|
|
|
$this->curriculumVitae->getHumanFileName() |
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml'); |
104
|
|
|
$this->assertSame('First Name Last Name - The job', |
105
|
|
|
$this->curriculumVitae->getHumanFileName() |
106
|
|
|
); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function testHumanFileNameWithJob() { |
110
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml'); |
111
|
|
|
$this->assertSame('First Name Last Name - The job', $this->curriculumVitae->getHumanFileName()); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function testHumanFileNameWithOnLyName(){ |
115
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/justIdentityMySelf.xml'); |
116
|
|
|
$this->assertSame('First Name Last Name', $this->curriculumVitae->getHumanFileName()); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function testNullReturnWithNoDeclarationInCurriculumVitaeTag() { |
120
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/core.xml'); |
121
|
|
|
$this->assertNull($this->curriculumVitae->getIdentity()); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function testGetAnchorsWithNoLang() { |
125
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml'); |
126
|
|
|
|
127
|
|
|
$anchors = $this->curriculumVitae->getAnchors(); |
128
|
|
|
if (is_array($anchors)) { |
129
|
|
|
$this->assertEquals(array('identity' => array( |
130
|
|
|
'href' => 'identity', |
131
|
|
|
'title' => 'identity'), |
132
|
|
|
'followMe' => array( |
133
|
|
|
'href' => 'followMe', |
134
|
|
|
'title' => 'followMe'), |
135
|
|
|
'experiences' => array( |
136
|
|
|
'href' => 'experiences', |
137
|
|
|
'title' => 'experiences'), |
138
|
|
|
'skills' => array( |
139
|
|
|
'href' => 'skills', |
140
|
|
|
'title' => 'skills'), |
141
|
|
|
'educations' => array( |
142
|
|
|
'href' => 'educations', |
143
|
|
|
'title' => 'educations'), |
144
|
|
|
'languageSkills' => array( |
145
|
|
|
'href' => 'languageSkills', |
146
|
|
|
'title' => 'languageSkills'), |
147
|
|
|
'miscellaneous' => array( |
148
|
|
|
'href' => 'miscellaneous', |
149
|
|
|
'title' => 'miscellaneous') |
150
|
|
|
), |
151
|
|
|
$anchors |
152
|
|
|
); |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function testGetIdentityWithEnglishLanguage() { |
157
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../../Resources/data/example.xml'); |
158
|
|
|
|
159
|
|
|
$identity = $this->curriculumVitae->getIdentity(); |
160
|
|
|
// We remove the values because of travisci and scrutinizer (depending of date) |
161
|
|
|
unset($identity['myself']['birthday']); |
162
|
|
|
unset($identity['myself']['age']); |
163
|
|
|
$this->assertEquals(array( |
164
|
|
|
'myself' => array( |
165
|
|
|
'name' => 'First Name Last Name', |
166
|
|
|
'nationality' => 'French Citizenship', |
167
|
|
|
'picture' => 'bundles/fabiencrassatcurriculumvitae/img/example.png' |
168
|
|
|
), |
169
|
|
|
'address' => array( |
170
|
|
|
'street' => 'Street', |
171
|
|
|
'postalcode' => 'PostalCode', |
172
|
|
|
'city' => 'City', |
173
|
|
|
'country' => 'Country', |
174
|
|
|
'googlemap' => 'http://maps.google.com' |
175
|
|
|
), |
176
|
|
|
'contact' => array( |
177
|
|
|
'mobile' => 'Telephone', |
178
|
|
|
'email' => 'email_arobase_site_dot_com' |
179
|
|
|
), |
180
|
|
|
'social' => array( |
181
|
|
|
'drivelicences' => 'French driving licence' |
182
|
|
|
) |
183
|
|
|
), $identity); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function testGetIdentityWithFrenchLanguage() { |
187
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../../Resources/data/example.xml', 'fr'); |
188
|
|
|
|
189
|
|
|
$identity = $this->curriculumVitae->getIdentity(); |
190
|
|
|
// We remove the format birthday because of travisci and scrutinizer |
191
|
|
|
unset($identity['myself']['birthday']); |
192
|
|
|
$this->assertEquals(array( |
193
|
|
|
'myself' => array( |
194
|
|
|
'name' => 'First Name Last Name', |
195
|
|
|
'birthplace' => 'Paris', |
196
|
|
|
'picture' => 'bundles/fabiencrassatcurriculumvitae/img/example.png' |
197
|
|
|
), |
198
|
|
|
'address' => array( |
199
|
|
|
'street' => 'Street', |
200
|
|
|
'postalcode' => 'PostalCode', |
201
|
|
|
'city' => 'City', |
202
|
|
|
'country' => 'Country', |
203
|
|
|
'googlemap' => 'http://maps.google.com' |
204
|
|
|
), |
205
|
|
|
'contact' => array( |
206
|
|
|
'mobile' => 'Telephone', |
207
|
|
|
'email' => 'email_arobase_site_dot_com' |
208
|
|
|
), |
209
|
|
|
'social' => array( |
210
|
|
|
'marital' => 'Célibataire', |
211
|
|
|
'military' => 'Dégagé des obligations militaires', |
212
|
|
|
'drivelicences' => 'Titulaire du permis B' |
213
|
|
|
) |
214
|
|
|
), $identity); |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
public function testGetDropDownLanguages() { |
218
|
|
|
$this->interface = 'getDropDownLanguages'; |
219
|
|
|
$this->arrayToCompare = array( |
220
|
|
|
'en' => 'English', |
221
|
|
|
'fr' => 'Français', |
222
|
|
|
'es' => 'español' |
223
|
|
|
); |
224
|
|
|
|
225
|
|
|
$this->assertCVInterface(); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
public function testGetFollowMe() { |
229
|
|
|
$this->interface = 'getFollowMe'; |
230
|
|
|
$this->arrayToCompare = array( |
231
|
|
|
'linkedin' => array( |
232
|
|
|
'title' => 'Linked In', |
233
|
|
|
'url' => 'http://www.linkedin.com', |
234
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/linkedin.png' |
235
|
|
|
), |
236
|
|
|
'viadeo' => array( |
237
|
|
|
'title' => 'Viadeo', |
238
|
|
|
'url' => 'http://www.viadeo.com', |
239
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/viadeo.png' |
240
|
|
|
), |
241
|
|
|
'monster' => array( |
242
|
|
|
'title' => 'Monster', |
243
|
|
|
'url' => 'http://beknown.com', |
244
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/monster.png' |
245
|
|
|
), |
246
|
|
|
'twitter' => array( |
247
|
|
|
'title' => 'Twitter', |
248
|
|
|
'url' => 'https://twitter.com', |
249
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/twitter.png' |
250
|
|
|
), |
251
|
|
|
'googleplus' => array( |
252
|
|
|
'title' => 'Google+', |
253
|
|
|
'url' => 'https://plus.google.com', |
254
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/googleplus.png' |
255
|
|
|
), |
256
|
|
|
'facebook' => array( |
257
|
|
|
'title' => 'Facebook', |
258
|
|
|
'url' => 'https://www.facebook.com', |
259
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/facebook.png' |
260
|
|
|
), |
261
|
|
|
'scrum' => array( |
262
|
|
|
'title' => 'Scrum', |
263
|
|
|
'url' => 'http://www.scrumalliance.org', |
264
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/scrum-alliance.png' |
265
|
|
|
) |
266
|
|
|
); |
267
|
|
|
|
268
|
|
|
$this->assertCVInterface(); |
269
|
|
|
|
270
|
|
|
$this->lang = 'fr'; |
271
|
|
|
$this->assertCVInterface(); |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public function testGetLookingFor() { |
275
|
|
|
$this->interface = 'getLookingFor'; |
276
|
|
|
|
277
|
|
|
$this->arrayToCompare = array( |
278
|
|
|
'experience' => 'Curriculum Vitae Title', |
279
|
|
|
'presentation' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' |
280
|
|
|
.' Aenean eu lectus facilisis, posuere leo laoreet, dignissim ligula. Praesent' |
281
|
|
|
.' ultricies dignissim diam vitae dictum. Donec sed nisi tortor. Proin tempus' |
282
|
|
|
.' scelerisque lectus, sit amet convallis mi semper a. Integer blandit a ligula' |
283
|
|
|
.' a volutpat. Ut dolor eros, interdum quis ante ac, tempus commodo odio. Suspendisse' |
284
|
|
|
.' ut nisi purus. Mauris vestibulum nibh sit amet turpis consequat pharetra. Duis at' |
285
|
|
|
.' adipiscing risus. Vivamus vitae orci ac felis porta euismod. Fusce sit amet metus' |
286
|
|
|
.' sem. Maecenas suscipit tincidunt ante, sed feugiat odio eleifend eu. Sed eu' |
287
|
|
|
.' ultricies ipsum. In cursus tincidunt elit a gravida. Nam eu aliquet leo. Maecenas' |
288
|
|
|
.' nibh leo, eleifend fermentum neque sit amet, viverra consequat lorem.', |
289
|
|
|
); |
290
|
|
|
$this->assertCVInterface(); |
291
|
|
|
|
292
|
|
|
$this->lang = 'fr'; |
293
|
|
|
$this->arrayToCompare = array( |
294
|
|
|
'experience' => 'Titre du curriculum vitae', |
295
|
|
|
'presentation' => 'Mauris rutrum justo ac bibendum ultrices. Mauris a dolor a diam' |
296
|
|
|
.' tempus ornare vel non urna. Donec a dui vel nunc ultrices porta non vitae felis.' |
297
|
|
|
.' Ut blandit ullamcorper orci. Quisque quis justo vitae nisl auctor laoreet non eget' |
298
|
|
|
.' mauris. Sed volutpat enim est, vitae vulputate nibh laoreet gravida. Duis nec' |
299
|
|
|
.' tincidunt ante. Nullam metus turpis, accumsan nec laoreet et, consectetur et' |
300
|
|
|
.' ligula. Curabitur convallis feugiat lorem, sit amet tincidunt arcu sollicitudin' |
301
|
|
|
.' vel. Aliquam erat volutpat. In odio elit, accumsan in facilisis at, ultricies' |
302
|
|
|
.' quis justo.', |
303
|
|
|
); |
304
|
|
|
$this->assertCVInterface(); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
public function testGetExperiences() { |
308
|
|
|
$this->interface = 'getExperiences'; |
309
|
|
|
|
310
|
|
|
$this->arrayToCompare = array( |
311
|
|
|
'FirstExperience' => array( |
312
|
|
|
'date' => 'Jan 2007 - Present', |
313
|
|
|
'job' => 'My current job', |
314
|
|
|
'society' => array( |
315
|
|
|
'name' => 'My Company', |
316
|
|
|
'address' => 'the address of the company', |
317
|
|
|
'siteurl' => 'http://www.MyCompany.com'), |
318
|
|
|
'missions' => array( |
319
|
|
|
'item' => array( |
320
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', |
321
|
|
|
1 => 'Suspendisse nec mauris eu orci dapibus mollis ac ac mi.'))), |
322
|
|
|
'SecondExperience' => array( |
323
|
|
|
'collapse' => 'false', |
324
|
|
|
'date' => 'Sept - Dec 2006', |
325
|
|
|
'job' => 'My previous job', |
326
|
|
|
'society' => array( |
327
|
|
|
'name' => 'My Other Company', |
328
|
|
|
'address' => 'the address of the company', |
329
|
|
|
'siteurl' => 'http://www.MyOtherCompany.com')), |
330
|
|
|
'ThirdExperience' => array( |
331
|
|
|
'date' => 'Summer 2006', |
332
|
|
|
'job' => 'A summer job', |
333
|
|
|
'society' => array( |
334
|
|
|
'name' => 'A company wihtout site', |
335
|
|
|
'address' => 'the address of the company'), |
336
|
|
|
'missions' => array( |
337
|
|
|
'item' => array( |
338
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))), |
339
|
|
|
'FourthExperience' => array( |
340
|
|
|
'collapse' => 'true', |
341
|
|
|
'date' => 'Before 2006', |
342
|
|
|
'job' => 'The job of my life', |
343
|
|
|
'society' => 'A society with a name per language', |
344
|
|
|
'missions' => array( |
345
|
|
|
'item' => array( |
346
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))) |
347
|
|
|
); |
348
|
|
|
$this->assertCVInterface(); |
349
|
|
|
|
350
|
|
|
$this->lang = 'fr'; |
351
|
|
|
$this->arrayToCompare = array( |
352
|
|
|
'FirstExperience' => array( |
353
|
|
|
'date' => 'Jan. 2007 - Aujourd\'hui', |
354
|
|
|
'job' => 'Mon poste actuel', |
355
|
|
|
'society' => array( |
356
|
|
|
'name' => 'My Company', |
357
|
|
|
'address' => 'the address of the company', |
358
|
|
|
'siteurl' => 'http://www.MyCompany.com'), |
359
|
|
|
'missions' => array( |
360
|
|
|
'item' => array( |
361
|
|
|
0 => 'Donec gravida enim viverra tempor dignissim.', |
362
|
|
|
1 => 'Sed a eros at mauris placerat adipiscing.'))), |
363
|
|
|
'SecondExperience' => array( |
364
|
|
|
'collapse' => 'false', |
365
|
|
|
'date' => 'Sept - Dec 2006', |
366
|
|
|
'job' => 'Mon poste précédent', |
367
|
|
|
'society' => array( |
368
|
|
|
'name' => 'Mon autre compagnie', |
369
|
|
|
'address' => 'l\'adresse de la compagnie', |
370
|
|
|
'siteurl' => 'http://www.MyOtherCompany.com')), |
371
|
|
|
'ThirdExperience' => array( |
372
|
|
|
'date' => 'Summer 2006', |
373
|
|
|
'job' => 'Un travail d\'été', |
374
|
|
|
'society' => array( |
375
|
|
|
'name' => 'Une compagnie sans site', |
376
|
|
|
'address' => 'l\'adresse de la compagnie'), |
377
|
|
|
'missions' => array( |
378
|
|
|
'item' => array( |
379
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))), |
380
|
|
|
'FourthExperience' => array( |
381
|
|
|
'collapse' => 'true', |
382
|
|
|
'date' => 'Before 2006', |
383
|
|
|
'job' => 'Le job de ma vie', |
384
|
|
|
'society' => 'Une société avec un nom par langue', |
385
|
|
|
'missions' => array( |
386
|
|
|
'item' => array( |
387
|
|
|
0 => 'Suspendisse et arcu eget est feugiat elementum.'))) |
388
|
|
|
); |
389
|
|
|
$this->assertCVInterface(); |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
public function testGetSkills() { |
393
|
|
|
$this->interface = 'getSkills'; |
394
|
|
|
|
395
|
|
|
$this->arrayToCompare = array( |
396
|
|
|
'Functional' => array( |
397
|
|
|
'title' => 'Skills', |
398
|
|
|
'lines' => array( |
399
|
|
|
'success' => array( |
400
|
|
|
'percentage' => 90, |
401
|
|
|
'class' => 'success', |
402
|
|
|
'striped' => 'true', |
403
|
|
|
'label' => 'Increasing Skills', |
404
|
|
|
), |
405
|
|
|
'otherSucess' => array( |
406
|
|
|
'percentage' => 90, |
407
|
|
|
'class' => 'success', |
408
|
|
|
'label' => 'success', |
409
|
|
|
), |
410
|
|
|
'info' => array( |
411
|
|
|
'percentage' => 40, |
412
|
|
|
'class' => 'info', |
413
|
|
|
'striped' => 'false', |
414
|
|
|
'label' => 'info', |
415
|
|
|
), |
416
|
|
|
'warning' => array( |
417
|
|
|
'percentage' => 20, |
418
|
|
|
'class' => 'warning', |
419
|
|
|
'label' => 'warning', |
420
|
|
|
), |
421
|
|
|
'danger' => array( |
422
|
|
|
'percentage' => 10, |
423
|
|
|
'class' => 'danger', |
424
|
|
|
'label' => 'danger', |
425
|
|
|
), |
426
|
|
|
'noClass' => array( |
427
|
|
|
'percentage' => 5, |
428
|
|
|
'label' => 'noClass', |
429
|
|
|
), |
430
|
|
|
'nothing' => array( |
431
|
|
|
'label' => 'nothing', |
432
|
|
|
) |
433
|
|
|
) |
434
|
|
|
), |
435
|
|
|
'OtherSkill' => array( |
436
|
|
|
'title' => 'One other', |
437
|
|
|
'lines' => array( |
438
|
|
|
'success' => array( |
439
|
|
|
'percentage' => 90, |
440
|
|
|
'class' => 'success', |
441
|
|
|
'striped' => 'false', |
442
|
|
|
'label' => 'Skills List', |
443
|
|
|
), |
444
|
|
|
'info' => array( |
445
|
|
|
'percentage' => 40, |
446
|
|
|
'class' => 'info', |
447
|
|
|
'striped' => 'false', |
448
|
|
|
'label' => 'Label', |
449
|
|
|
), |
450
|
|
|
'warning' => array( |
451
|
|
|
'percentage' => 20, |
452
|
|
|
'class' => 'warning', |
453
|
|
|
'striped' => 'false', |
454
|
|
|
'label' => 'Label', |
455
|
|
|
), |
456
|
|
|
'danger' => array( |
457
|
|
|
'percentage' => 10, |
458
|
|
|
'class' => 'danger', |
459
|
|
|
'striped' => 'true', |
460
|
|
|
'label' => 'Label', |
461
|
|
|
) |
462
|
|
|
) |
463
|
|
|
) |
464
|
|
|
); |
465
|
|
|
$this->assertCVInterface(); |
466
|
|
|
|
467
|
|
|
$this->lang = 'fr'; |
468
|
|
|
// Only set the french labels |
469
|
|
|
$arrayToChange = $this->arrayToCompare; |
470
|
|
|
$arrayToChange['Functional']['title'] = 'Compétences'; |
471
|
|
|
$arrayToChange['Functional']['lines']['success']['label'] = 'Compétences grandissantes'; |
472
|
|
|
$arrayToChange['OtherSkill']['title'] = 'Une autre'; |
473
|
|
|
$arrayToChange['OtherSkill']['lines']['success']['label'] = 'Liste de Compétences'; |
474
|
|
|
|
475
|
|
|
$this->arrayToCompare = $arrayToChange; |
476
|
|
|
$this->assertCVInterface(); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
public function testGetEducations() { |
480
|
|
|
$this->interface = 'getEducations'; |
481
|
|
|
|
482
|
|
|
$this->arrayToCompare = array( |
483
|
|
|
'University' => array( |
484
|
|
|
'date' => '2002 - 2005', |
485
|
|
|
'education' => 'My diploma in my university', |
486
|
|
|
'descriptions' => array('item' => array( |
487
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in' |
488
|
|
|
.' auctor ipsum. Nullam venenatis sem.' |
489
|
|
|
)) |
490
|
|
|
), |
491
|
|
|
'HighSchool' => array( |
492
|
|
|
'collapse' => 'false', |
493
|
|
|
'date' => 'June 2002', |
494
|
|
|
'education' => 'My diploma in my high school', |
495
|
|
|
'descriptions' => array('item' => array( |
496
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris elit' |
497
|
|
|
.' dui, faucibus non laoreet luctus, dignissim at lectus. Quisque dignissim' |
498
|
|
|
.' imperdiet consectetur. Praesent scelerisque neque.', |
499
|
|
|
1 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium' |
500
|
|
|
.' varius est sit amet consectetur. Suspendisse cursus dapibus egestas.' |
501
|
|
|
.' Ut id augue quis mi scelerisque.' |
502
|
|
|
)) |
503
|
|
|
), |
504
|
|
|
'FirstSchool' => array( |
505
|
|
|
'collapse' => 'true', |
506
|
|
|
'date' => 'June 2000', |
507
|
|
|
'education' => 'My diploma in my first school' |
508
|
|
|
) |
509
|
|
|
); |
510
|
|
|
$this->assertCVInterface(); |
511
|
|
|
|
512
|
|
|
$this->lang = 'fr'; |
513
|
|
|
$this->arrayToCompare = array( |
514
|
|
|
'University' => array( |
515
|
|
|
'date' => '2002 - 2005', |
516
|
|
|
'education' => 'Mon diplôme dans mon université', |
517
|
|
|
'descriptions' => array('item' => array( |
518
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris elit dui,' |
519
|
|
|
.' faucibus non laoreet luctus, dignissim at lectus. Quisque dignissim' |
520
|
|
|
.' imperdiet consectetur. Praesent scelerisque neque.', |
521
|
|
|
1 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pretium' |
522
|
|
|
.' varius est sit amet consectetur. Suspendisse cursus dapibus egestas.' |
523
|
|
|
.' Ut id augue quis mi scelerisque.' |
524
|
|
|
)) |
525
|
|
|
), |
526
|
|
|
'HighSchool' => array( |
527
|
|
|
'collapse' => 'false', |
528
|
|
|
'date' => 'Juin 2002', |
529
|
|
|
'education' => 'Mon diplôme dans mon lycée', |
530
|
|
|
'descriptions' => array('item' => array( |
531
|
|
|
0 => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc in auctor' |
532
|
|
|
.' ipsum. Nullam venenatis sem.' |
533
|
|
|
)) |
534
|
|
|
), |
535
|
|
|
'FirstSchool' => array( |
536
|
|
|
'collapse' => 'true', |
537
|
|
|
'date' => 'Juin 2000', |
538
|
|
|
'education' => 'Mon diplôme dans mon collège' |
539
|
|
|
) |
540
|
|
|
); |
541
|
|
|
$this->assertCVInterface(); |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
public function testGetLanguageSkills() { |
545
|
|
|
$this->interface = 'getLanguageSkills'; |
546
|
|
|
|
547
|
|
|
$this->arrayToCompare = array( |
548
|
|
|
'French' => array( |
549
|
|
|
'title' => 'French', |
550
|
|
|
'description' => 'Level of the skill.', |
551
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-France.png' |
552
|
|
|
), |
553
|
|
|
'English' => array( |
554
|
|
|
'title' => 'English', |
555
|
|
|
'description' => 'Level of the skill.', |
556
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-United-Kingdom.png' |
557
|
|
|
) |
558
|
|
|
); |
559
|
|
|
$this->assertCVInterface(); |
560
|
|
|
|
561
|
|
|
$this->lang = 'fr'; |
562
|
|
|
$this->arrayToCompare = array( |
563
|
|
|
'French' => array( |
564
|
|
|
'title' => 'Français', |
565
|
|
|
'description' => 'Niveau', |
566
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-France.png' |
567
|
|
|
), |
568
|
|
|
'English' => array( |
569
|
|
|
'title' => 'Anglais', |
570
|
|
|
'description' => 'Niveau', |
571
|
|
|
'icon' => 'bundles/fabiencrassatcurriculumvitae/img/Flag-of-United-Kingdom.png' |
572
|
|
|
) |
573
|
|
|
); |
574
|
|
|
$this->assertCVInterface(); |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
public function testGetMiscellaneous() { |
578
|
|
|
$this->interface = 'getMiscellaneous'; |
579
|
|
|
|
580
|
|
|
$this->arrayToCompare = array( |
581
|
|
|
'Practical' => array( |
582
|
|
|
'title' => 'Practices', |
583
|
|
|
'miscellaneous' => 'My practices' |
584
|
|
|
) |
585
|
|
|
); |
586
|
|
|
$this->assertCVInterface(); |
587
|
|
|
|
588
|
|
|
$this->lang = 'fr'; |
589
|
|
|
$this->arrayToCompare = array( |
590
|
|
|
'Practical' => array( |
591
|
|
|
'title' => 'Pratiques', |
592
|
|
|
'miscellaneous' => 'Mes pratiques', |
593
|
|
|
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' |
594
|
|
|
.' Curabitur nec auctor nisl, eu fringilla nisi. Morbi scelerisque,' |
595
|
|
|
.' est vitae mattis faucibus, felis sapien lobortis augue.' |
596
|
|
|
) |
597
|
|
|
); |
598
|
|
|
$this->assertCVInterface(); |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
private function assertCVInterface($pathToFile = '/../../Resources/data/example.xml') { |
602
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.$pathToFile, $this->lang); |
603
|
|
|
$this->assertEquals($this->arrayToCompare, $this->curriculumVitae->{$this->interface}()); |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
/** |
607
|
|
|
* @expectedException InvalidArgumentException |
608
|
|
|
*/ |
609
|
|
|
public function testInvalidArgumentExceptionWithBadCurriculumVitaeFile() { |
610
|
|
|
$this->curriculumVitae = new CurriculumVitae('abd file'); |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* @expectedException InvalidArgumentException |
615
|
|
|
*/ |
616
|
|
|
public function testInvalidArgumentExceptionWithNoValidXMLFile() { |
617
|
|
|
$this->curriculumVitae = new CurriculumVitae( __DIR__.'/../Resources/data/empty.xml'); |
618
|
|
|
$this->curriculumVitae->getDropDownLanguages(); |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* @expectedException InvalidArgumentException |
623
|
|
|
*/ |
624
|
|
|
public function testInvalidArgumentExceptionWithFatalErrorXMLFile() { |
625
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/fatalerror.xml'); |
626
|
|
|
$this->curriculumVitae->getDropDownLanguages(); |
627
|
|
|
} |
628
|
|
|
} |
629
|
|
|
|