How can i configure a base URL for all CakePHP 5 unit tests?
Currently, a test like this makes a request to “http://localhost/pages/home”, but I would like to change it to “http://abc.localhost/pages/home”.
public function testDisplay()
{
Configure::write('debug', true);
$this->get('/pages/home');
$this->assertResponseOk();
$this->assertResponseContains('Impressum');
$this->assertResponseContains('<html>');
}
Not in a redundant way, but in a central place.
I found the following lines in the file /tests/bootstrap.php
, but it didn’t work.
if (empty($_SERVER['HTTP_HOST']) && !Configure::read('App.fullBaseUrl')) {
Configure::write('App.fullBaseUrl', 'http://abc.localhost');
}