wushuiyong 9 rokov pred
rodič
commit
d95fc41dd6

+ 11 - 0
.gitignore

@@ -1,2 +1,13 @@
 /vendor
 submit.sh
+
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*
+tests/_output/*

+ 4 - 4
controllers/WalleController.php

@@ -55,7 +55,7 @@ class WalleController extends Controller {
     public function actionStartDeploy() {
         $taskId = \Yii::$app->request->post('taskId');
         if (!$taskId) {
-            static::renderJson([], -1, '任务号不能为空:)');
+            $this->renderJson([], -1, '任务号不能为空:)');
         }
         $this->task = Task::findOne($taskId);
         if (!$this->task) {
@@ -138,9 +138,9 @@ class WalleController extends Controller {
         $code = 0;
 
         // 本地git ssh-key是否加入deploy-keys列表
-        $revision = Repo::getRevision($project->repo_type);
+        $revision = Repo::getRevision($project);
         try {
-            $ret = $revision->setConfig($project)->updateRepo();
+            $ret = $revision->updateRepo();
             if (!$ret) {
                 $code  = -1;
                 $error = $project->repo_type == Project::REPO_GIT
@@ -282,7 +282,7 @@ class WalleController extends Controller {
         $record['memo'] = stripslashes($record['memo']);
         $record['command'] = stripslashes($record['command']);
 
-        static::renderJson($record);
+        $this->renderJson($record);
     }
 
     /**

+ 15 - 15
tests/codeception/unit/models/LoginFormTest.php

@@ -31,25 +31,25 @@ class LoginFormTest extends TestCase
         });
     }
 
-//    public function testLoginWrongPassword()
-//    {
-//        $model = new LoginForm([
-//            'username' => 'demo',
-//            'password' => 'wrong_password',
-//        ]);
-//
-//        $this->specify('user should not be able to login with wrong password', function () use ($model) {
-//            expect('model should not login user', $model->login())->false();
-//            expect('error message should be set', $model->errors)->hasKey('password');
-//            expect('user should not be logged in', Yii::$app->user->isGuest)->true();
-//        });
-//    }
+    public function testLoginWrongPassword()
+    {
+        $model = new LoginForm([
+            'username' => 'demo',
+            'password' => 'wrong_password',
+        ]);
+
+        $this->specify('user should not be able to login with wrong password', function () use ($model) {
+            expect('model should not login user', $model->login())->false();
+            expect('error message should be set', $model->errors)->hasKey('password');
+            expect('user should not be logged in', Yii::$app->user->isGuest)->true();
+        });
+    }
 
     public function testLoginCorrect()
     {
         $model = new LoginForm([
-            'username' => 'demo',
-            'password' => 'demo',
+            'username' => 'admin',
+            'password' => 'admin',
         ]);
 
         $this->specify('user should be able to login with correct credentials', function () use ($model) {