PHPUnit-Base/src/DomainRedirectTest.php
2019-09-18 09:58:46 +01:00

73 lines
2.1 KiB
PHP

<?php
namespace JHodges\PHPUnitBase;
abstract class DomainRedirectTest extends UrlRedirectTest{
/**
* @return string the source domain
**/
abstract protected function getSourceDomain();
/**
* @return string the destination URL
**/
abstract protected function getDestinationURL();
/**
* Test source domain with HTTP:// redirects correctly to the destination URL
**/
public function testHttp(){
$this->assertUrlRedirect('http://'.$this->getSourceDomain().'',$this->getDestinationURL());
}
/**
* Test source domain with HTTPS:// redirects correctly to the destination URL
**/
public function testHttps(){
$this->assertUrlRedirect('https://'.$this->getSourceDomain().'',$this->getDestinationURL());
}
/**
* Test source domain with HTTP://WWW. redirects correctly to the destination URL
**/
public function testHttpWww(){
$this->assertUrlRedirect('http://www.'.$this->getSourceDomain().'',$this->getDestinationURL());
}
/**
* Test source domain with HTTPS://www. redirects correctly to the destination URL
**/
public function testHttpsWww(){
$this->assertUrlRedirect('https://www.'.$this->getSourceDomain().'',$this->getDestinationURL());
}
/**
* Test source domain with HTTP:// and a trailing slash redirects correctly to the destination URL
**/
public function testHttpSlash(){
$this->assertUrlRedirect('http://'.$this->getSourceDomain().'/',$this->getDestinationURL());
}
/**
* Test source domain with HTTPS:// and a trailing slash redirects correctly to the destination URL
**/
public function testHttpsSlash(){
$this->assertUrlRedirect('https://'.$this->getSourceDomain().'/',$this->getDestinationURL());
}
/**
* Test source domain with HTTP://www. and a trailing slash redirects correctly to the destination URL
**/
public function testHttpWwwSlash(){
$this->assertUrlRedirect('http://www.'.$this->getSourceDomain().'/',$this->getDestinationURL());
}
/**
* Test source domain with HTTPS://www. and a trailing slash redirects correctly to the destination URL
**/
public function testHttpsWwwSlash(){
$this->assertUrlRedirect('https://www.'.$this->getSourceDomain().'/',$this->getDestinationURL());
}
}