Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix router reload regression in integration testing. #12695

Merged
merged 3 commits into from Nov 4, 2018

Conversation

dereuromark
Copy link
Member

Alternative to #12628
It provides a now "BC way" to shim it back for the use cases where we need it.
Not sure that is the best solution, but it would provide a way for integration tests to fix the regression manually where needed via

class FeedExamplesControllerTest extends IntegrationTestCase {

	/**
	 * Allow router reloading to be disabled.
	 *
	 * @var bool
	 */
	protected $_disableRouterReload = true;
...

per class.

@dereuromark dereuromark added this to the 3.6.13 milestone Oct 31, 2018
@lorenzo
Copy link
Member

lorenzo commented Nov 1, 2018

looks good to me, just needs a test

@dereuromark
Copy link
Member Author

I tried adding a test, but I cant reproduce the issue apps or plugins are facing.
The test works even without this flag enabled, but this is not true for the actual plugin or app cases.

I need help here to finalize this PR for the upcoming patch release.

@dereuromark
Copy link
Member Author

As proof, I have dereuromark/cakephp-sandbox#14 which shows this fixes the currently broken master tests ("Tests: 65, Assertions: 286, Errors: 4").

@@ -43,7 +44,8 @@ public function setUp()
static::setAppNamespace();

Router::reload();
Router::scope('/', function ($routes) {
Router::extensions(['json']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because routes are added in the setup method I don't think the router would be reloaded as routes would not be automatically loaded.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to change anything on that test case?
Feel free to add a commit on top with desired changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be ok. I think this code won't be needed in 4.x, or at least I hope it isn't.

@markstory markstory merged commit aff3831 into master Nov 4, 2018
@markstory markstory deleted the master-regression-fix-2 branch November 4, 2018 19:56
markstory added a commit that referenced this pull request Nov 13, 2018
I wasn't entirely happy with the solution in #12695 and wanted to try an
alternate approach. This set of changes adds state to fewer places and
doesn't require plugins to opt-in to backwards compatible behavior.
Instead it introduces new internal methods to reset router state that
can cause conflicts/duplicate work. Global extensions and default route
classes are not reset.

Refs #12695
Refs #12577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants