PasswordResetRequestFormTest::testSendEmail()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 3
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: zjw
5
 * Date: 2017/8/17
6
 * Time: 下午5:23
7
 */
8
9
namespace zacksleo\yii2\backend\tests;
10
11
use Swift_TransportException;
12
use zacksleo\yii2\backend\models\forms\PasswordResetRequestForm;
13
14
class PasswordResetRequestFormTest extends TestCase
15
{
16
    public function testSendEmail()
17
    {
18
        $form = new PasswordResetRequestForm();
19
        $form->email = "[email protected]";
20
        $this->assertTrue($form->validate());
21
        try {
22
            $res = $form->sendEmail();
23
            $this->assertTrue($res);
24
        } catch (Swift_TransportException $e) {
25
            return;
26
        }
27
        $form->email = "[email protected]";
28
        $res = $form->sendEmail();
29
        $this->assertFalse($res);
30
    }
31
}
32