Passed
Push — master ( e31b0a...908be6 )
by Robbie
10:54 queued 10s
created

testFilterReportBySkippedRegistration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
namespace SilverStripe\MFA\Tests\Report;
4
5
use SilverStripe\Dev\FunctionalTest;
6
use SilverStripe\MFA\Report\EnabledMembers;
7
8
class EnabledMembersFunctionalTest extends FunctionalTest
9
{
10
    protected static $fixture_file = 'EnabledMembersTest.yml';
11
12
    protected function setUp()
13
    {
14
        parent::setUp();
15
16
        $this->logInWithPermission();
17
    }
18
19
    public function testReportHasMemberNames()
20
    {
21
        $result = (string) $this->get(EnabledMembers::create()->getLink())->getBody();
22
23
        $this->assertContains('Eleanor', $result);
24
        $this->assertContains('Ditor', $result);
25
        $this->assertContains('Michelle', $result);
26
        $this->assertContains('Fa', $result);
27
        $this->assertContains('Ursula', $result);
28
        $this->assertContains('Ser', $result);
29
    }
30
31
    public function testReportHasRegisteredMethods()
32
    {
33
        $result = (string) $this->get(EnabledMembers::create()->getLink())->getBody();
34
35
        $this->assertContains('Math problem, Null', $result);
36
    }
37
38
    public function testFilterReportByMemberName()
39
    {
40
        $this->get(EnabledMembers::create()->getLink());
41
        $response = $this->submitForm('Form_EditForm', 'action_updatereport', [
42
            'filters[Member]' => 'Michelle',
43
        ]);
44
        $result = (string) $response->getBody();
45
46
        $this->assertContains('[email protected]', $result);
47
        $this->assertNotContains('[email protected]', $result);
48
    }
49
50
    public function testFilterReportBySkippedRegistration()
51
    {
52
        $this->get(EnabledMembers::create()->getLink());
53
        $response = $this->submitForm('Form_EditForm', 'action_updatereport', [
54
            'filters[Skipped]' => 'yes',
55
        ]);
56
        $result = (string) $response->getBody();
57
58
        $this->assertContains('[email protected]', $result);
59
        $this->assertNotContains('[email protected]', $result);
60
    }
61
}
62