public function createSite($domainName, $country, $language, $theme) { $em = $this->entityManager; $domain = new Domain(); $domain->setDomainName($domainName); $em->persist($domain); /** @var \Rcm\Repository\Country $countryRepo */ $countryRepo = $em->getRepository('\\Rcm\\Entity\\Country'); $countryEntity = $countryRepo->getCountryByString($country); /** @var \Rcm\Repository\Language $languageRepo */ $languageRepo = $em->getRepository('\\Rcm\\Entity\\Language'); $languageEntity = $languageRepo->getLanguageByString($language); $site = new Site(); $site->setDomain($domain); $site->setCountry($countryEntity); $site->setLanguage($languageEntity); $site->setTheme($theme); $site->setSiteLayout('default'); $site->setStatus('A'); $this->createSiteContainers($site, $theme); $this->createPages($site, $theme); $em->persist($site); $em->flush(); return $site; }
/** * Test Get and Set the Country Object * * @return void * * @covers \Rcm\Entity\Site */ public function testGetAndSetCountry() { $country = new Country(); $country->setIso3('USA'); $this->site->setCountry($country); $actual = $this->site->getCountry(); $this->assertTrue($actual instanceof Country); $this->assertEquals($country, $actual); }
public function setup() { $country = new Country(); $country->setIso2('US'); $lang = new Language(); $lang->setIso6391('en'); $site = new Site(); $site->setCountry($country); $site->setLanguage($lang); $mockSiteRepo = $this->getMockBuilder('\\Rcm\\Repository\\Site')->disableOriginalConstructor()->getMock(); $mockSiteRepo->expects($this->any())->method('getSites')->will($this->returnValue([$site])); $this->unit = new Locales($mockSiteRepo); }
/** * Get Test Page Data for Page Repo Mocks * * @param integer $pageId PageID * @param integer $pageName PageName * @param integer $revisionId RevisionId * @param string $pageType PageType * @param boolean $useStaged Use staged revision instead of published * @param string $siteLayoutOverride Layout Override * * @return array */ protected function getPageData($pageId, $pageName, $revisionId, $pageType = 'n', $useStaged = false, $siteLayoutOverride = null) { $country = new Country(); $country->setCountryName('United States'); $country->setIso2('US'); $country->setIso3('USA'); $language = new Language(); $language->setLanguageId(1); $language->setIso6391('en'); $language->setIso6392b('eng'); $language->setIso6392t('eng'); $domain = new Domain(); $domain->setDomainId(1); $domain->setDomainName('reliv.com'); $site = new Site(); $site->setSiteId(1); $site->setCountry($country); $site->setLanguage($language); $site->setLoginPage('login'); $site->setNotFoundPage('not-found'); $site->setDomain($domain); $revision = new Revision(); $revision->setRevisionId($revisionId); $revision->setAuthor('Westin Shafer'); $revision->setCreatedDate(new \DateTime()); $revision->setPublishedDate(new \DateTime()); $page = new Page(); $page->setSite($site); $page->setName($pageName); $page->setPageId($pageId); $page->setPageType($pageType); $page->addRevision($revision); $page->setPublishedRevision($revision); if ($useStaged) { $page->setStagedRevision($revision); } $page->setPageId(22); $page->setSiteLayoutOverride($siteLayoutOverride); return $page; }