This is a (multiple allowed):
[ ] feature-discussion (RFC)
CakePHP Version: 3.8.8 and newer
Updated to 3.8.8
Some tests started to fail that check for correct URLs.
1) App\Test\TestCase\View\Helper\SearchFilterHelperTest::testRemoveQueryParam
Cake\Routing\Exception\MissingRouteException: A route matching "array (
'?' =>
array (
'section' => 'profiles',
'preserve' => 1,
),
'language' => 'en',
'action' => 'index',
'plugin' => NULL,
'controller' => NULL,
'_ext' => NULL,
)" could not be found.
I think this is related to the change mentioned in the notes here https://bakery.cakephp.org/2019/12/28/cakephp_388_released.html
When generating URLs, routes with controller and action placeholders no longer strip these these keys when they are undefined. Instead routes missing the controller and action keys will fail to match.
No BC breaking behavior because of a patch release! 馃槧 Cake is still using https://semver.org/ right?
Is there any workaround that can be applied globally to this problem or will I have to manually merge the URL array in all places that don't use the controller and action key? This basically means I'll have to do this in all the places that somehow build an URL.
$url = [
'plugin' => $request->getParam('plugin'),
'controller' => $request->getParam('controller'),
'action' => $request->getParam('action'),
'?' => array_merge($query, ['char' => $char])
];
This is only happening inside a test case, correct?
I had to fix up my tests here as well. If you just set some value for the controller the test case will work again fine.
So far it seems to happen only in the tests but how can I trust the framework and app if we have failing tests because of a change in the framework? This is also hard to sell to my boss for obvious reasons.
The previous behavior was not correct and was masked by incorrect tests. If you are unable to fix your tests you can pin to 3.8.7.
Most helpful comment
The previous behavior was not correct and was masked by incorrect tests. If you are unable to fix your tests you can pin to 3.8.7.