Ignore host-map.php in phpcs, and ensure it is disabled in unit tests

This commit is contained in:
Robbie Averill 2018-01-18 17:48:09 +13:00
parent 6bbf988fda
commit 17427fd251
5 changed files with 14 additions and 8 deletions

View File

@ -46,7 +46,7 @@ before_script:
script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src tests *.php ; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src tests *.php --ignore=host-map.php; fi
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @subsites; fi
after_success:

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Subsites\Tests;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Subsites\Model\Subsite;
use SilverStripe\Subsites\State\SubsiteState;
@ -13,6 +14,7 @@ class BaseSubsiteTest extends SapphireTest
parent::setUp();
SubsiteState::singleton()->setUseSessions(true);
Config::modify()->set(Subsite::class, 'write_hostmap', false);
Subsite::$force_subsite = null;
}

View File

@ -13,6 +13,13 @@ class SubsiteAdminTest extends BaseSubsiteTest
{
protected static $fixture_file = 'SubsiteTest.yml';
protected function setUp()
{
parent::setUp();
Config::modify()->set(Subsite::class, 'write_hostmap', false);
}
protected function adminLoggedInSession()
{
return new Session([
@ -25,7 +32,6 @@ class SubsiteAdminTest extends BaseSubsiteTest
*/
public function testBasicView()
{
Config::modify()->set(Subsite::class, 'write_hostmap', false);
$subsite1ID = $this->objFromFixture(Subsite::class, 'domaintest1')->ID;
// Open the admin area logged in as admin

View File

@ -30,7 +30,8 @@ class SubsiteTest extends BaseSubsiteTest
Config::modify()
->set(Director::class, 'alternate_base_url', '/')
->set(Subsite::class, 'strict_subdomain_matching', false);
->set(Subsite::class, 'strict_subdomain_matching', false)
->set(Subsite::class, 'write_hostmap', false);
$this->origServer = $_SERVER;
}
@ -47,8 +48,6 @@ class SubsiteTest extends BaseSubsiteTest
*/
public function testSubsiteCreation()
{
Config::modify()->set(Subsite::class, 'write_hostmap', false);
// Create the instance
$template = $this->objFromFixture(Subsite::class, 'main');

View File

@ -29,6 +29,8 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
{
parent::setUp();
Config::modify()->set(Subsite::class, 'write_hostmap', false);
// Set backend root to /DataDifferencerTest
TestAssetStore::activate('SubsitesVirtualPageTest');
@ -54,8 +56,6 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
// Attempt to bring main:linky to subsite2:linky
public function testVirtualPageFromAnotherSubsite()
{
Config::modify()->set(Subsite::class, 'write_hostmap', false);
$subsite = $this->objFromFixture(Subsite::class, 'subsite2');
Subsite::changeSubsite($subsite->ID);
@ -261,7 +261,6 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
{
$this->markTestIncomplete('@todo fix this test');
Config::modify()->set(Subsite::class, 'write_hostmap', false);
$subsite1 = $this->objFromFixture(Subsite::class, 'subsite1');
$subsite2 = $this->objFromFixture(Subsite::class, 'subsite2');
Subsite::changeSubsite($subsite1->ID);