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

Not well testable php class method URL::redirectToUrl($url) #5262

Closed
tassoman opened this issue May 28, 2014 · 1 comment
Closed

Not well testable php class method URL::redirectToUrl($url) #5262

tassoman opened this issue May 28, 2014 · 1 comment
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@tassoman
Copy link
Contributor

I was writing tests for a Login override plugin. My logout controller method relies on the class method URL::redirectToUrl($url) to redirect users outside Piwik on logout.

The problem is the method dies while being in CLI mode (Common::isPhpCliMode()) so this halts tests.

In my controller I've overridden this behavior checking for PhpCli too then returning $url outside the method but I've expected URL class already used to.

This also would involve following URL class mehtods: redirectToReferrer and redirectToHttps.

Keywords: tests, testing, URL, class, method,

@mattab
Copy link
Member

mattab commented May 30, 2014

In 1a7648d: Fixes #5262 Throw exception instead of dying so that the function is testable.
Thanks for suggestion!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants