LostPasswordPageTest::testCanCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace UserManagement\Tests;
4
5
use SilverStripe\Dev\FunctionalTest;
6
use UserManagement\Page\LostPasswordPage;
7
8
/**
9
 * Class LostPasswordPageTest
10
 *
11
 * @package user-management
12
 */
13
class LostPasswordPageTest extends FunctionalTest
14
{
15
    
16
    /**
17
     * Lost password page link test
18
     */
19
    public function testfindlink()
20
    {
21
       
22
        $page = $this->get("forgotten-password/"); // attempt to access the Lost Forgot Page
23
        $this->assertEquals(200, $page->getStatusCode(), "a page should load");
24
        $this->assertEquals(
25
            LostPasswordPage::find_link(false),
26
            "/forgotten-password/",
27
            "LostPasswordPage exists"
28
        );
29
    }
30
31
    /**
32
     * Lost password form test
33
     */
34
    public function testLostPasswordForm()
35
    {
36
37
        $this->get("forgotten-password/");
38
39
        $this->submitForm(
40
            "LostPasswordForm_lostPasswordForm",
41
            "action_forgotPassword",
42
            array("Email" => "[email protected]")
43
        );
44
        
45
        $this->assertEquals(
46
            false,
47
            http_response_code(),
48
            'testLostPasswordForm() sends email'
49
        );
50
    }
51
    
52
    /**
53
     * Can create
54
     */
55
    public function testCanCreate()
56
    {
57
        $canCreate = LostPasswordPage::create()->canCreate();
58
        $this->assertNotTrue($canCreate, "Can create");
59
    }
60
}
61