LoginFormTest::testLogin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: zjw
5
 * Date: 2017/8/17
6
 * Time: 下午5:17
7
 */
8
9
namespace zacksleo\yii2\backend\tests;
10
11
use zacksleo\yii2\backend\models\forms\LoginForm;
12
13
class LoginFormTest extends TestCase
14
{
15
    public function testLogin()
16
    {
17
        $form = new LoginForm();
18
        $form->username = "lianluo";
19
        $form->password = "lianluo";
20
        $form->validate();
21
        $form->login();
22
        $this->assertFalse(empty($form->getErrors()));
23
24
        $form->username = "lianluo";
25
        $form->password = "1!an1u0";
26
        $form->rememberMe = true;
27
        $form->validate();
28
        //$this->assertTrue($form->login());
29
        //$this->assertTrue(empty($form->getErrors()));
30
        $res = $form->attributeLabels();
31
        $this->assertTrue(count($res) == 2);
32
    }
33
}
34