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
cakephp fashioned redirect if possible #7
cakephp fashioned redirect if possible #7
Conversation
Thanks for your contribute! Can you please add one or more tests for this? |
Oh right, I always forget to add tests, sorry, will do it in ~1h |
No problem, when you can. It's important to add test when you add a feature to demonstrate that your code works fine, It's not a very used plugin but tests guarantee that this plugin works fine if someone would like to use It. Thanks for your contribute |
Some unexpected stuff occured, so its delayed, and I have a question: for the test i basically need another class, so where should I put it? (Basically its just a class that implements redirect, to check afterwards if its redirect method gets called) |
You can a directory into test like "Resources" and put there a class for example |
Something is still wrong with the namespacing for the MockRedirect class, can you help me there? I've put the class into the file But it still won't load the class ending up in an class not found error. |
Can you show me the error? Try to launch the command:
|
well as Scrutinizer check says:
Do I have to run |
Try to change autoload into composer.json into this:
And after launch composer dump-autoload into the root of the project and into the root of the plugin please |
It's still showing the same error. |
If you can't include into Resources directory, try to put the class into the same directory of the test file please @cap5lut |
Any news on this PR? @cap5lut |
I am closing this PR because it passed a lot of time :) |
Sorry that I am bothering you again.
Due some debugging in my cakephp project I realized how the redirecting of this plugin works and that its levering out the cakephp's redirect. So I thought of adding that.
Basically it will just check if there is a
redirect
method in the controller and passes the redirect attribute to it, because in the cakephp's way to pass the redirection data (for example asarray("controller" => "tests", "action" => "index")
) I changed the initialization of$this->redirect
and the comparison in theredirectIfIsSet
method as well.If the
redirect
method does not exist it will still use the old way.