private function createSection(array $sectionData) : Section { $sec = new Section(); $sec->setTitle($sectionData['title']); $sec->setContent($sectionData['content']); $sec->setImg($sectionData['img']); return $sec; }
public function testGetPresentation() { $filesystem = $this->prophesize('League\\Flysystem\\Filesystem'); $testYml = "presentation:\n title: 'Test'\n sections:\n - chapter1"; $filesystem->read(Argument::any())->willReturn($testYml)->shouldBeCalled(); $sectionRepo = $this->prophesize('Msg\\Repository\\SectionRepository'); $section = new Section(); $section->setTitle('test sec'); $sectionRepo->get(Argument::any())->willReturn($section)->shouldBeCalled(); $repo = new PresentationRepository($filesystem->reveal(), $sectionRepo->reveal()); $pres = $repo->get(); $this->assertInstanceOf('Msg\\Model\\Presentation', $pres); $this->assertEquals('Test', $pres->getTitle()); $this->assertInstanceOf('ArrayObject', $pres->getSections()); $this->assertEquals($section, $pres->getSections()->offsetGet(0)); }