mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8102 from creative-commoners/pulls/4.1/response-assertion
Add test assertion for response instance
This commit is contained in:
commit
48304fd6f0
@ -31,8 +31,13 @@ class DirectorTest extends SapphireTest
|
|||||||
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
|
||||||
CanonicalURLMiddleware::singleton()->setEnabledEnvs(true);
|
$middleware = CanonicalURLMiddleware::singleton()->setEnabledEnvs(true);
|
||||||
$this->expectedRedirect = null;
|
$this->expectedRedirect = null;
|
||||||
|
|
||||||
|
// Ensure global state doesn't affect this test
|
||||||
|
$middleware
|
||||||
|
->setForceSSLDomain(null)
|
||||||
|
->setForceSSLPatterns([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExtraRoutes()
|
protected function getExtraRoutes()
|
||||||
@ -593,6 +598,7 @@ class DirectorTest extends SapphireTest
|
|||||||
}, 'http://www.mysite.com:9090/some-url');
|
}, 'http://www.mysite.com:9090/some-url');
|
||||||
|
|
||||||
// Middleware returns non-exception redirect
|
// Middleware returns non-exception redirect
|
||||||
|
$this->assertInstanceOf(HTTPResponse::class, $response);
|
||||||
$this->assertEquals('https://www.mysite.com:9090/some-url', $response->getHeader('Location'));
|
$this->assertEquals('https://www.mysite.com:9090/some-url', $response->getHeader('Location'));
|
||||||
$this->assertEquals(301, $response->getStatusCode());
|
$this->assertEquals(301, $response->getStatusCode());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user