Explorar o código

remove codeception

wushuiyong %!s(int64=9) %!d(string=hai) anos
pai
achega
4dbcf56f63

+ 0 - 9
.travis.yml

@@ -16,20 +16,11 @@ install:
   - wget http://codeception.com/codecept.phar -O vendor/bin/codecept && chmod +x vendor/bin/codecept
 
 before_script:
-  - sudo apt-get install nginx
-#  - sudo add-apt-repository ppa:ondrej/php5 && sudo apt-get update
-#  - sudo apt-get autoremove && sudo apt-get install php5-fpm
-#  - sudo /etc/init.d/php5-fpm restart
-  - ps aux|grep php
-  - sudo cp tests/nginx.conf /etc/nginx/nginx.conf
-  - sudo /etc/init.d/nginx restart
   - mysql -e 'CREATE DATABASE IF NOT EXISTS walle DEFAULT CHARSET utf8 COLLATE utf8_general_ci;'
   - ./yii migrate/up  --interactive=0
   - cd tests && ../vendor/bin/codecept build
 
 script:
-  - curl http://localhost/
-  - curl http://127.0.0.1/
   - ../vendor/bin/codecept run
 matrix:
   fast_finish: true

+ 3 - 0
composer.json

@@ -13,6 +13,9 @@
         "yiisoft/yii2-swiftmailer": "*"
     },
     "require-dev": {
+        "codeception/codeception": "2.1.2",
+        "codeception/specify": "0.4.1",
+        "codeception/verify": "0.2.7",
         "yiisoft/yii2-codeception": "*",
         "yiisoft/yii2-debug": "*",
         "yiisoft/yii2-gii": "*",

+ 0 - 36
tests/codeception/acceptance/LoginCept.php

@@ -1,36 +0,0 @@
-<?php
-
-use tests\codeception\_pages\LoginPage;
-/* @var $scenario Codeception\Scenario */
-
-$I = new AcceptanceTester($scenario);
-$I->wantTo('perform actions and see');
-$I->amOnPage('/');
-$I->see('Walle');
-$I->see('登录');
-
-//$loginPage = LoginPage::openBy($I);
-//$I->amGoingTo('try to login with empty credentials');
-//$loginPage->login('', '');
-//if (method_exists($I, 'wait')) {
-//    $I->wait(3); // only for selenium
-//}
-//$I->expectTo('see validations errors');
-//$I->see('Username不能为空');
-//$I->see('Password不能为空');
-//
-//$I->amGoingTo('try to login with wrong credentials');
-//$loginPage->login('admin', 'wrong');
-//if (method_exists($I, 'wait')) {
-//    $I->wait(3); // only for selenium
-//}
-//$I->expectTo('see validations errors');
-//$I->see('Incorrect username or password.');
-//
-//$I->amGoingTo('try to login with correct credentials');
-//$loginPage->login('admin', 'admin');
-//if (method_exists($I, 'wait')) {
-//    $I->wait(3); // only for selenium
-//}
-//$I->expectTo('see user info');
-//$I->see('Logout (admin)');

+ 28 - 27
tests/codeception/unit/models/LoginFormTest.php

@@ -16,20 +16,21 @@ class LoginFormTest extends TestCase
         Yii::$app->user->logout();
         parent::tearDown();
     }
-//
-//    public function testLoginNoUser()
-//    {
-//        $model = new LoginForm([
-//            'username' => 'not_existing_username',
-//            'password' => 'not_existing_password',
-//        ]);
-//
-//        $this->specify('user should not be able to login, when there is no identity', function () use ($model) {
-//            expect('model should not login user', $model->login())->false();
-//            expect('user should not be logged in', Yii::$app->user->isGuest)->true();
-//        });
-//    }
-//
+
+    public function testLoginNoUser()
+    {
+        $model = new LoginForm([
+            'username' => 'not_existing_username',
+            'password' => 'not_existing_password',
+        ]);
+
+
+        $this->specify('user should not be able to login, when there is no identity', function () use ($model) {
+            expect('model should not login user', $model->login())->false();
+            expect('user should not be logged in', Yii::$app->user->isGuest)->true();
+        });
+    }
+
 //    public function testLoginWrongPassword()
 //    {
 //        $model = new LoginForm([
@@ -44,18 +45,18 @@ class LoginFormTest extends TestCase
 //        });
 //    }
 
-//    public function testLoginCorrect()
-//    {
-//        $model = new LoginForm([
-//            'username' => 'demo',
-//            'password' => 'demo',
-//        ]);
-//
-//        $this->specify('user should be able to login with correct credentials', function () use ($model) {
-//            expect('model should login user', $model->login())->true();
-//            expect('error message should not be set', $model->errors)->hasntKey('password');
-//            expect('user should be logged in', Yii::$app->user->isGuest)->false();
-//        });
-//    }
+    public function testLoginCorrect()
+    {
+        $model = new LoginForm([
+            'username' => 'demo',
+            'password' => 'demo',
+        ]);
+
+        $this->specify('user should be able to login with correct credentials', function () use ($model) {
+            expect('model should login user', $model->login())->true();
+            expect('error message should not be set', $model->errors)->hasntKey('password');
+            expect('user should be logged in', Yii::$app->user->isGuest)->false();
+        });
+    }
 
 }