Skip to content

Commit

Permalink
Issue #62 Use a custom constant instead of YII_ENV_TEST during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Oct 8, 2016
1 parent ad0bd31 commit d0b40ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion UrlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ protected function redirectToLanguage($language)
}
Yii::trace("Redirecting to $url.", __METHOD__);
Yii::$app->getResponse()->redirect($url);
if (YII_ENV_TEST) {
if (YII2_LOCALEURLS_TEST) {
// Response::redirect($url) above will call `Url::to()` internally. So to really
// test for the same final redirect URL here, we need to call Url::to(), too.
throw new \yii\base\Exception(\yii\helpers\Url::to($url));
Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

define('YII_DEBUG', true);
define('YII_ENV_TEST', true);
define('YII2_LOCALEURLS_TEST', true);
// require composer autoloader if available
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
Expand Down

0 comments on commit d0b40ce

Please sign in to comment.