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