From 2686a54aa3e47ab6499028401a9f9dadae9b82b0 Mon Sep 17 00:00:00 2001 From: resurtm Date: Wed, 21 Dec 2016 13:21:40 +0600 Subject: [PATCH] wip --- .travis.yml | 1 + lib/User/Bootstrap.php | 1 + lib/User/Controller/AdminController.php | 8 ++++---- tests/_app/config/console.php | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca53c5f..78c5fb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,7 @@ before_script: # initialize database - mysql -e 'CREATE DATABASE `yii2-usuario-test`;'; - php tests/_app/yii.php migrate/up --interactive=0 + - php tests/_app/yii.php migrate/up --interactive=0 --migrationPath=@yii/rbac/migrations # enable code coverage on PHP 7.1, only one PHP version needs to generate coverage data - | diff --git a/lib/User/Bootstrap.php b/lib/User/Bootstrap.php index 27c5509..1037821 100644 --- a/lib/User/Bootstrap.php +++ b/lib/User/Bootstrap.php @@ -50,6 +50,7 @@ class Bootstrap implements BootstrapInterface } else { /* @var $app ConsoleApplication */ $this->initConsoleCommands($app); + $this->initAuthManager($app); } } } diff --git a/lib/User/Controller/AdminController.php b/lib/User/Controller/AdminController.php index 077c182..d945406 100644 --- a/lib/User/Controller/AdminController.php +++ b/lib/User/Controller/AdminController.php @@ -61,7 +61,7 @@ class AdminController extends Controller */ public function beforeAction($action) { - if (in_array($action->id, ['index', 'update', 'update-profile', 'info', 'assignments'])) { + if (in_array($action->id, ['index', 'update', 'update-profile', 'info', 'assignments'], true)) { Url::remember('', 'actions-redirect'); } @@ -75,7 +75,7 @@ class AdminController extends Controller { return [ 'verbs' => [ - 'class' => VerbFilter::className(), + 'class' => VerbFilter::class, 'actions' => [ 'delete' => ['post'], 'confirm' => ['post'], @@ -83,9 +83,9 @@ class AdminController extends Controller ], ], 'access' => [ - 'class' => AccessControl::className(), + 'class' => AccessControl::class, 'ruleConfig' => [ - 'class' => AccessRuleFilter::className(), + 'class' => AccessRuleFilter::class, ], 'rules' => [ [ diff --git a/tests/_app/config/console.php b/tests/_app/config/console.php index f495daa..b60e290 100644 --- a/tests/_app/config/console.php +++ b/tests/_app/config/console.php @@ -11,10 +11,13 @@ return [ 'log' => null, 'cache' => null, 'db' => require __DIR__.'/db.php', + 'authManager' => [ + 'class' => Da\User\Component\AuthDbManagerComponent::class, + ], ], 'controllerMap' => [ 'migrate' => [ - 'class' => \yii\console\controllers\MigrateController::class, + 'class' => yii\console\controllers\MigrateController::class, 'migrationPath' => null, 'migrationNamespaces' => [ 'Da\User\Migration',