I made quite positive experiences with the laminas testing environment. It’s quite useful to be able to dispatch a path and check if the correct route/controller was triggered.
But when I added a top level Route with a Hostname I got a lot of trouble with testing. I can open the Pages with a Web browser, but don’t know how I should define it for the testing environment to use a Domain not just a path.
I tried already:
$this->dispatch('abc.local/some', 'GET');
$this->getRequest()->setBaseUrl("abc.local");
$this->dispatch('/some', 'GET');
Router Definition:
'router' => [
'routes' => [
'abc' => [
'type' => Hostname::class,
'options' => [
'route' => '[:subdomain.]:domain.:tld',
'defaults' => [
'tld' => 'local',
'domain' => 'abc',
],
'constraints' => [
'tld' => '(ch|local)',
'domain' => 'abc',
]
],
'child_routes' => [
'home' => [
'type' => Segment::class,
'options' => [
'route' => '/[:action]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
],
],
],
],
],
],
],
],