Use chaining syntax for setting up middleware

This commit is contained in:
Daniel Hensby 2018-06-08 14:00:59 +01:00
parent 48304fd6f0
commit 1d6d601050
No known key found for this signature in database
GPG Key ID: D8DEBC4C8E7BC8B9

View File

@ -30,14 +30,12 @@ class DirectorTest extends SapphireTest
parent::setUp(); parent::setUp();
Director::config()->set('alternate_base_url', 'http://www.mysite.com:9090/'); Director::config()->set('alternate_base_url', 'http://www.mysite.com:9090/');
// Ensure redirects enabled on all environments // Ensure redirects enabled on all environments and global state doesn't affect the tests
$middleware = CanonicalURLMiddleware::singleton()->setEnabledEnvs(true); CanonicalURLMiddleware::singleton()
$this->expectedRedirect = null;
// Ensure global state doesn't affect this test
$middleware
->setForceSSLDomain(null) ->setForceSSLDomain(null)
->setForceSSLPatterns([]); ->setForceSSLPatterns([])
->setEnabledEnvs(true);
$this->expectedRedirect = null;
} }
protected function getExtraRoutes() protected function getExtraRoutes()