Completed
Pull Request — master (#16)
by Fabien
06:12 queued 03:13
created

CurriculumVitaeGetterFromBackboneXMLFileTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 72
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
B testGetLookingForAndExperiencesAndHumanFileName() 0 30 1
B testGetAnchorsWithNoLang() 0 31 2
A setUp() 0 3 1
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
    function setUp() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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 = array();
29
        $result = array_merge($result, array('lookingFor' => $this->curriculumVitae->getLookingFor()));
30
        $result = array_merge($result, array('experiences' => $this->curriculumVitae->getExperiences()));
31
        $result = array_merge($result, array('pdfFile' => $this->curriculumVitae->getHumanFileName()));
32
33
        $expected = array(
34
            'lookingFor' => array(
35
                'experience'   => array(
36
                    'date' => 'Date',
37
                    'job' => 'The job',
38
                    'society' => array(
39
                        'name' => 'My Company',
40
                        'address' => 'The address of the company',
41
                        'siteurl' => 'http://www.MyCompany.com')),
42
                'presentation' => 'A presentation'),
43
            'experiences' => array(
44
                'LastJob' => array(
45
                    'date' => 'Date',
46
                    'job' => 'The job',
47
                    'society' => array(
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(array('identity' => array(
62
                        'href' => 'identity',
63
                        'title' => 'identity'),
64
                      'followMe' => array(
65
                        'href' => 'followMe',
66
                        'title' => 'followMe'),
67
                      'experiences' => array(
68
                        'href' => 'experiences',
69
                        'title' => 'experiences'),
70
                      'skills' => array(
71
                        'href' => 'skills',
72
                        'title' => 'skills'),
73
                      'educations' => array(
74
                        'href' => 'educations',
75
                        'title' => 'educations'),
76
                      'languageSkills' => array(
77
                        'href' => 'languageSkills',
78
                        'title' => 'languageSkills'),
79
                      'miscellaneous' => array(
80
                        'href' => 'miscellaneous',
81
                        'title' => 'miscellaneous')
82
                ),
83
                $anchors
84
            );
85
        }
86
    }
87
}
88