I have config in Application.php this:
$middlewareQueue
->add(new HttpsEnforcerMiddleware([
'hsts' => ['maxAge' => 31536000, 'includeSubDomains' => true],
]))
In the test
public function testMissingTemplate()
{
Configure::write('debug', false);
$this->get('/pages/not_existing');
$this->assertResponseError();
$this->assertResponseContains('Error');
}
I get error: Failed asserting that 301 is between 400 and 429.
If I don’t initialize the HttpsEnforcerMiddleware, the test works. Please help, thank you!