Skip to content

Commit

Permalink
Factorise using getCurriculumViateArray()
Browse files Browse the repository at this point in the history
Signed-off-by: Fabien Crassat <fabien@crassat.com>
  • Loading branch information
fabiencrassat committed Oct 7, 2017
1 parent e288e1e commit 3efdf7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
16 changes: 1 addition & 15 deletions Controller/DefaultController.php
Expand Up @@ -174,7 +174,7 @@ private function setViewParameters()
if ($this->requestFormat != 'json' && $this->requestFormat != 'xml') {
$this->setToolParameters();
}
$this->setCoreParameters();
$this->setParameters($this->curriculumVitae->getCurriculumViateArray());
}

private function hasExportPDF()
Expand All @@ -199,20 +199,6 @@ private function setToolParameters()
));
}

private function setCoreParameters()
{
$this->setParameters(array(
'identity' => $this->curriculumVitae->getIdentity(),
'followMe' => $this->curriculumVitae->getFollowMe(),
'lookingFor' => $this->curriculumVitae->getLookingFor(),
'experiences' => $this->curriculumVitae->getExperiences(),
'skills' => $this->curriculumVitae->getSkills(),
'educations' => $this->curriculumVitae->getEducations(),
'languageSkills' => $this->curriculumVitae->getLanguageSkills(),
'miscellaneous' => $this->curriculumVitae->getMiscellaneous(),
));
}

/**
* @param array $parametersToAdd
*/
Expand Down
15 changes: 8 additions & 7 deletions Tests/Controller/DefaultControllerTest.php
Expand Up @@ -62,7 +62,9 @@ public function testOutputJSONXmlComparaison()
$pathToFile = __DIR__.'/../../Resources/data/example.xml';
$this->curriculumVitae = new CurriculumVitae($pathToFile, $value);

$this->assertSame($this->getCvXML(), $data);
$this->assertSame(
$this->curriculumVitae->getCurriculumViateArray(),
$data);
}
}

Expand All @@ -86,15 +88,14 @@ public function testOutputXmlXmlComparaison()
$normalizers = array(new GetSetMethodNormalizer());
$serializer = new Serializer($normalizers, $encoders);

$this->assertSame($serializer->serialize($this->getCvXML(), 'xml'), $data);
$this->assertSame(
$serializer->serialize(
$this->curriculumVitae->getCurriculumViateArray(),
'xml'),
$data);
}
}

private function getCvXML()
{
return $this->curriculumVitae->getCurriculumViateArray();
}

public function testOutputFollowMeLink()
{
$result = array();
Expand Down

0 comments on commit 3efdf7b

Please sign in to comment.