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
|
|
|
|