From 656cba05e6e9997908b73c15661afa27c8007324 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 22 Apr 2022 12:32:35 +1200 Subject: [PATCH] MNT Fix unit tests for kitchen-sink --- tests/php/Control/DirectorTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/php/Control/DirectorTest.php b/tests/php/Control/DirectorTest.php index e6fdc26c872..efa93201076 100644 --- a/tests/php/Control/DirectorTest.php +++ b/tests/php/Control/DirectorTest.php @@ -38,8 +38,10 @@ protected function setUp(): void // Ensure redirects enabled on all environments and global state doesn't affect the tests CanonicalURLMiddleware::singleton() + ->setForceSSL(null) ->setForceSSLDomain(null) ->setForceSSLPatterns([]) + ->setForceWWW(null) ->setEnabledEnvs(true); $this->expectedRedirect = null; } @@ -858,7 +860,10 @@ public function testRequestFilterInDirectorTest() $processor = new RequestProcessor([$filter]); - Injector::inst()->registerService($processor, RequestProcessor::class); + $middlewares = Director::singleton()->getMiddlewares(); + $middlewares['RequestProcessorMiddleware'] = $processor; + Director::singleton()->setMiddlewares($middlewares); + $response = Director::test('some-dummy-url'); $this->assertEquals(404, $response->getStatusCode());