コード例 #1
0
ファイル: DomainTest.php プロジェクト: reliv/rcm
 /**
  * Test is Get and Set Primary Domain Name
  *
  * @return void
  *
  * @covers \Rcm\Entity\Domain
  */
 public function testGetAndSetPrimaryDomainName()
 {
     $primaryDomain = new Domain();
     $primaryDomain->setDomainId(654);
     $this->domain->setPrimary($primaryDomain);
     $actual = $this->domain->getPrimary();
     $this->assertEquals($primaryDomain, $actual);
 }
コード例 #2
0
ファイル: RouteListenerTest.php プロジェクト: reliv/Rcm
 /**
  * Test Check Domain Redirects To Primary
  *
  * @return void
  *
  * @covers \Rcm\EventListener\RouteListener
  */
 public function testCheckDomainRedirectsToPrimary()
 {
     $serverParams = new Parameters(['HTTP_HOST' => 'www.reliv.com']);
     $primary = $this->currentSite->getDomain();
     $domain = new Domain();
     $domain->setDomainId(1);
     $domain->setDomainName('www.reliv.com');
     $domain->setPrimary($primary);
     $this->currentSite->setDomain($domain);
     $this->domainRedirectServiceMock->expects($this->any())->method('getPrimaryRedirectUrl')->will($this->returnValue($primary->getDomainName()));
     $request = new Request();
     $request->setServer($serverParams);
     $event = new MvcEvent();
     $event->setRequest($request);
     $actual = $this->routeListener->checkDomain($event);
     $this->assertTrue($actual instanceof Response);
     $this->assertEquals(302, $actual->getStatusCode());
     $this->assertEquals('//' . $this->currentSite->getDomain()->getPrimary()->getDomainName(), $actual->getHeaders()->get('Location')->getFieldValue());
 }