|
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 CurriculumVitaeGetterFromBackboneXMLFileTest extends \PHPUnit\Framework\TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
private $curriculumVitae; |
|
19
|
|
|
private $lang; |
|
20
|
|
|
|
|
21
|
|
|
public function setUp() { |
|
22
|
|
|
$this->lang = 'en'; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function testGetLookingForAndExperiencesAndHumanFileName() { |
|
26
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml', $this->lang); |
|
27
|
|
|
|
|
28
|
|
|
$result = []; |
|
29
|
|
|
$result = array_merge($result, ['lookingFor' => $this->curriculumVitae->getLookingFor()]); |
|
30
|
|
|
$result = array_merge($result, [CurriculumVitae::EXPERIENCES => $this->curriculumVitae->getExperiences()]); |
|
31
|
|
|
$result = array_merge($result, ['pdfFile' => $this->curriculumVitae->getHumanFileName()]); |
|
32
|
|
|
|
|
33
|
|
|
$expected = [ |
|
34
|
|
|
'lookingFor' => [ |
|
35
|
|
|
'experience' => [ |
|
36
|
|
|
'date' => 'Date', |
|
37
|
|
|
'job' => 'The job', |
|
38
|
|
|
'society' => [ |
|
39
|
|
|
'name' => 'My Company', |
|
40
|
|
|
'address' => 'The address of the company', |
|
41
|
|
|
'siteurl' => 'http://www.MyCompany.com']], |
|
42
|
|
|
'presentation' => 'A presentation'], |
|
43
|
|
|
CurriculumVitae::EXPERIENCES => [ |
|
44
|
|
|
'LastJob' => [ |
|
45
|
|
|
'date' => 'Date', |
|
46
|
|
|
'job' => 'The job', |
|
47
|
|
|
'society' => [ |
|
48
|
|
|
'name' => 'My Company', |
|
49
|
|
|
'address' => 'The address of the company', |
|
50
|
|
|
'siteurl' => 'http://www.MyCompany.com']]], |
|
51
|
|
|
'pdfFile' => 'First Name Last Name - The job' |
|
52
|
|
|
]; |
|
53
|
|
|
$this->assertEquals($expected, $result); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function testGetAnchorsWithNoLang() { |
|
57
|
|
|
$this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml'); |
|
58
|
|
|
$href = 'href'; |
|
59
|
|
|
$title = 'title'; |
|
60
|
|
|
$identity = 'identity'; |
|
61
|
|
|
$followMe = 'followMe'; |
|
62
|
|
|
$experiences = CurriculumVitae::EXPERIENCES; |
|
63
|
|
|
$skills = 'skills'; |
|
64
|
|
|
$educations = 'educations'; |
|
65
|
|
|
$languageSkills = 'languageSkills'; |
|
66
|
|
|
$miscellaneous = 'miscellaneous'; |
|
67
|
|
|
|
|
68
|
|
|
$anchors = $this->curriculumVitae->getAnchors(); |
|
69
|
|
|
$this->assertEquals([ |
|
70
|
|
|
$identity => [ |
|
71
|
|
|
$href => $identity, |
|
72
|
|
|
$title => $identity], |
|
73
|
|
|
$followMe => [ |
|
74
|
|
|
$href => $followMe, |
|
75
|
|
|
$title => $followMe], |
|
76
|
|
|
$experiences => [ |
|
77
|
|
|
$href => $experiences, |
|
78
|
|
|
$title => $experiences], |
|
79
|
|
|
$skills => [ |
|
80
|
|
|
$href => $skills, |
|
81
|
|
|
$title => $skills], |
|
82
|
|
|
$educations => [ |
|
83
|
|
|
$href => $educations, |
|
84
|
|
|
$title => $educations], |
|
85
|
|
|
$languageSkills => [ |
|
86
|
|
|
$href => $languageSkills, |
|
87
|
|
|
$title => $languageSkills], |
|
88
|
|
|
$miscellaneous => [ |
|
89
|
|
|
$href => $miscellaneous, |
|
90
|
|
|
$title => $miscellaneous]], |
|
91
|
|
|
$anchors |
|
92
|
|
|
); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|