Closed aschempp closed 5 years ago
I think this should be reviewed and merged pretty soon, because we will likely need multiple iterations on the concept. But that won't be possible without first getting something done (remember Security and Fragments) …
I cannot merge this with all checks failing though.
😂 feel free to review/test first 😝
In order to merge this, we should first try to write a test for the existing routing logic. Then we can be sure that the new logic does not break anything.
@aschempp Can we port the FrontendTest
class to test the routing in Contao 4.6?
Can we port the FrontendTest class to test the routing in Contao 4.6?
That was my idea. We should at some point port all the tests, but in CMF-Router they will span multiple classes. I'm not sure if we should rather find a way to write functional tests, maybe by using the new Symfony Panther?
As a first step, I have created a test class that tests all variations of Frontend::getPageIdFromUrl()
(see contao/contao@0bd65319f3e1528931d2ed114fa131a4b4020dc0). What else needs to be tested?
Frontend::getRootPageFromUrl()
?FrontendIndex::run()
?Honestly I'm not sure this test will actually handle all cases. I tried to implement the same but I failed because you never realize which statement returns null
or false
. That's why I copied the whole method and changed the return statements to exceptions in https://github.com/contao/core-bundle/pull/1653/files#diff-c52fbc6c0eb3348578874e564aeaa1aeR73
Maybe we should start by writing down a list of supported and non-supported cases that should be tested? But we should probably brainstorm that on a phone call …
This is a work in progress how to implement the CMF Dynamic Router to the Contao code base. It currently does nothing more than routing, there are no new features like real controllers for pages etc.
Feel free to review and test it, but there's a lot still to be changed 😊
PS: this also incorporates/replaces https://github.com/contao/core-bundle/pull/1637