I have a TableObject that sends an email in the afterSave-Event to notify the admin of a change. After the switch from cakephp-3 to cakephp-4 the test for this fails with this error message:
Cake\Routing\Exception\MissingRouteException: A route matching ... could not be found.
The exception occurs on a line in the email template where I build a link like this:
$this->Url->build([
'prefix' => 'Partner',
'controller' => 'orders',
'action' => 'view',
$order->id,
]);
I believe that the routes are not set up in the context of a test for a Tableobject and therefore the reverse routing is not working. (I only get the error when running the test, not when the email is sent in the app).
Is there a way I can load all routes in the test?