|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace UserManagement\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use SilverStripe\Dev\FunctionalTest; |
|
6
|
|
|
use UserManagement\Reports\UserReport; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class UserReportTest |
|
10
|
|
|
* |
|
11
|
|
|
* @package user-management |
|
12
|
|
|
*/ |
|
13
|
|
|
class UserReportTest extends FunctionalTest |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
private $userReport; |
|
17
|
|
|
|
|
18
|
|
|
protected function setUp() |
|
19
|
|
|
{ |
|
20
|
|
|
parent::setUp(); |
|
21
|
|
|
|
|
22
|
|
|
$this->userReport = new UserReport; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* User Report Title test |
|
27
|
|
|
*/ |
|
28
|
|
|
public function testtitle() |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
$gettitle = $this->userReport->title(); |
|
32
|
|
|
$this->assertEquals($gettitle, "Customer List", "Title validation"); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* User Report Source records test |
|
37
|
|
|
*/ |
|
38
|
|
|
public function testsourceRecords() |
|
39
|
|
|
{ |
|
40
|
|
|
$params = array(); |
|
41
|
|
|
|
|
42
|
|
|
$getsourcerecords = count($this->userReport->sourceRecords($params)); |
|
43
|
|
|
|
|
44
|
|
|
if ($getsourcerecords) { |
|
45
|
|
|
$this->assertLessThan($getsourcerecords, "0", "Source records validation"); |
|
46
|
|
|
} else { |
|
47
|
|
|
$this->assertEquals($getsourcerecords, "0", "Source records validation"); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* User Report fields test |
|
53
|
|
|
*/ |
|
54
|
|
|
public function testcolumns() |
|
55
|
|
|
{ |
|
56
|
|
|
|
|
57
|
|
|
$fields = count($this->userReport->columns()); |
|
58
|
|
|
|
|
59
|
|
|
if ($fields == 3) { |
|
60
|
|
|
$this->assertEquals($fields, "3", "Default fields"); |
|
61
|
|
|
} else { |
|
62
|
|
|
$this->assertLessThan($fields, "3", "Extra fields added"); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* User Report parameter fields test |
|
68
|
|
|
*/ |
|
69
|
|
|
public function testparameterFields() |
|
70
|
|
|
{ |
|
71
|
|
|
|
|
72
|
|
|
$fields = count($this->userReport->parameterFields()); |
|
73
|
|
|
|
|
74
|
|
|
if ($fields == 3) { |
|
75
|
|
|
$this->assertEquals($fields, "3", "Default fields"); |
|
76
|
|
|
} else { |
|
77
|
|
|
$this->assertLessThan($fields, "3", "Extra fields added"); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|