Passed
Push — LessIssues ( ec8676...8e619e )
by Fabien
03:21
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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
    private $interface;
0 ignored issues
show
Unused Code introduced by
The property $interface is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
21
    private $arrayToCompare;
0 ignored issues
show
Unused Code introduced by
The property $arrayToCompare is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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 testGetAnchorsWithNoLang() {
59
        $this->curriculumVitae = new CurriculumVitae(__DIR__.'/../Resources/data/backbone.xml');
60
61
        $anchors = $this->curriculumVitae->getAnchors();
62
        if (is_array($anchors)) {
63
            $this->assertEquals(array('identity' => array(
64
                        'href' => 'identity',
65
                        'title' => 'identity'),
66
                      'followMe' => array(
67
                        'href' => 'followMe',
68
                        'title' => 'followMe'),
69
                      'experiences' => array(
70
                        'href' => 'experiences',
71
                        'title' => 'experiences'),
72
                      'skills' => array(
73
                        'href' => 'skills',
74
                        'title' => 'skills'),
75
                      'educations' => array(
76
                        'href' => 'educations',
77
                        'title' => 'educations'),
78
                      'languageSkills' => array(
79
                        'href' => 'languageSkills',
80
                        'title' => 'languageSkills'),
81
                      'miscellaneous' => array(
82
                        'href' => 'miscellaneous',
83
                        'title' => 'miscellaneous')
84
                ),
85
                $anchors
86
            );
87
        }
88
    }
89
}
90