Closed synackSA closed 8 years ago
@synackSA Need to do tests
I can't really test this from the command line because you can't get the route
\Yii::$app->urlManager->parseRequest(\Yii::$app->request)
generates the following error when executed from the command line:
1) rmrevin\yii\minify\tests\unit\view\ViewTest::testRouteExclude
yii\base\UnknownMethodException: Calling unknown method: yii\console\Request::getQueryParam()
The piece of code if (php_sapi_name() !== 'cli')
makes sure that we don't check the routes when executed from the command line, so in turn, simply running the other tests and it not generating the above error, tests that line of code. I'm not sure how else to test the exclusion of routes on the command line (I have tested it via the web and it works).
You should create a mock object that will replace the request component. And configure the test application so that it used this mock object.
I'm gonna close this pull request for now, I've found more issues that need to be sorted out, I'll add them to the issues list.
Added a way to exclude certain routes so it could default to normal behaviour. Needed this due to the fact that wigget plugins with javacript wouldn't work like https://github.com/zxbodya/yii2-elfinder