Passed
Push — master ( 5c444f...454f16 )
by Fabien
03:16
created

setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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, ['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
            '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
59
        $anchors = $this->curriculumVitae->getAnchors();
60
        if (is_array($anchors)) {
61
            $this->assertEquals([
62
                'identity' => [
63
                    'href'  => 'identity',
64
                    'title' => 'identity'],
65
                'followMe' => [
66
                    'href'  => 'followMe',
67
                    'title' => 'followMe'],
68
                'experiences' => [
69
                    'href'  => 'experiences',
70
                    'title' => 'experiences'],
71
                'skills' => [
72
                    'href'  => 'skills',
73
                    'title' => 'skills'],
74
                'educations' => [
75
                    'href'  => 'educations',
76
                    'title' => 'educations'],
77
                'languageSkills' => [
78
                    'href'  => 'languageSkills',
79
                    'title' => 'languageSkills'],
80
                'miscellaneous' => [
81
                    'href'  => 'miscellaneous',
82
                    'title' => 'miscellaneous']],
83
                $anchors
84
            );
85
        }
86
    }
87
}
88