public function testToArray() { $expected = ['key' => 'foo', 'name' => 'portal_key', 'localizations' => [['fr']], 'security' => ['system' => 'sec_sys'], 'segments' => [['asd']], 'portals' => [['one']], 'theme' => ['dsa'], 'navigation' => ['contexts' => []]]; $this->security->getSystem()->willReturn($expected['security']['system']); $this->localization->toArray()->willReturn($expected['localizations'][0]); $this->segment->toArray()->willReturn($expected['segments'][0]); $this->theme->toArray()->willReturn($expected['theme']); $this->portal->toArray()->willReturn($expected['portals'][0]); $this->webspace->setKey($expected['key']); $this->webspace->setName($expected['name']); $this->webspace->setLocalizations([$this->localization->reveal()]); $this->webspace->setSecurity($this->security->reveal()); $this->webspace->setSegments([$this->segment->reveal()]); $this->webspace->setPortals([$this->portal->reveal()]); $this->webspace->setTheme($this->theme->reveal()); $res = $this->webspace->toArray(); $this->assertEquals($expected, $res); }
public function testAddDefaultTemplate() { $expected = ['key' => 'foo', 'errorTemplates' => [], 'defaultTemplates' => ['page' => 'default', 'homepage' => 'overview']]; $theme = new Theme(); $theme->setKey($expected['key']); $theme->addDefaultTemplate('page', 'default'); $theme->addDefaultTemplate('homepage', 'overview'); $this->assertEquals($expected['defaultTemplates'], $theme->getDefaultTemplates()); $this->assertEquals($expected['defaultTemplates']['page'], $theme->getDefaultTemplate('page')); $this->assertEquals($expected['defaultTemplates']['homepage'], $theme->getDefaultTemplate('homepage')); $this->assertNull($theme->getDefaultTemplate('other-type')); $this->assertEquals($expected, $theme->toArray()); }