public function tagOfName($name) { if (!$name instanceof Tag) { $name = new Name($name); } return $this->tagRepo->tagOfName($name); }
public function createWebsites() { $websites = [['n' => 'Rekenmeeseter', 'u' => 'www.rekenmeester.be', 'o' => ['WIS G1', 'WIS G1.a'], 't' => ['optellen', 'aftrekken']], ['n' => 'Google', 'u' => 'www.google.be', 'o' => ['WIS G7', 'WIS G9', 'WIS G9.e'], 't' => ['optellen', 'Sinterklaas']]]; foreach ($websites as $awebsite) { $website = Website::register(new Name($awebsite['n']), new URL($awebsite['u'])); foreach ($awebsite['t'] as $atag) { $tag = $this->tagRepo->tagOfName(new TagName($atag)); $website->addTag($tag); } foreach ($awebsite['o'] as $aobjective) { $objective = $this->currRepo->objectiveOfCode($aobjective); $website->addObjective($objective); } $this->manager->persist($website); $this->websiteRepo->add($website); } }
/** * @test * @group tagrepo */ public function should_return_null_when_tag_of_name_not_found() { $n_tag = new TagName('foo'); $tag = $this->tagRepo->tagOfName($n_tag); $this->assertNull($tag); }