Passed
Push — master ( 80cabb...a0e7de )
by Sathish
03:53
created

LostPasswordPageTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testLostPasswordForm() 0 11 1
A testfindlink() 0 6 1
A testCanCreate() 0 4 1
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(LostPasswordPage::find_link(false), "/forgotten-password/", "LostPasswordPage exists");
25
    }
26
27
28
    /**
29
     * Lost password form test
30
     */
31
    public function testLostPasswordForm()
32
    {
33
34
        $this->get("forgotten-password/");
35
36
        $this->submitForm("LostPasswordForm_lostPasswordForm", "action_forgotPassword", array("Email" => "[email protected]"));
37
        
38
        $this->assertEquals(
39
            false,
40
            http_response_code(),
41
            'testLostPasswordForm() sends email'
42
        );
43
    }
44
45
    public function testCanCreate()
46
    {
47
        LostPasswordPage::create()->canCreate();
48
        $this->markTestIncomplete('Can create');
49
    }
50
51
52
}
53