1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor; |
4
|
|
|
|
5
|
|
|
abstract class TestFactory |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var string|null |
9
|
|
|
*/ |
10
|
|
|
private $category = null; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @var TestData |
14
|
|
|
*/ |
15
|
|
|
private $testData; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var TestConfiguration|null |
19
|
|
|
*/ |
20
|
|
|
private $configuration = null; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var TestResult |
24
|
|
|
*/ |
25
|
|
|
private $testResult; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $category |
29
|
|
|
* |
30
|
|
|
* @return void |
31
|
|
|
*/ |
32
|
|
|
protected function setCategory($category) |
33
|
|
|
{ |
34
|
|
|
assert(is_string($category)); |
35
|
|
|
$this->category = $category; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return string |
40
|
|
|
*/ |
41
|
|
|
public function getCategory() |
42
|
|
|
{ |
43
|
|
|
assert(is_string($this->category)); |
44
|
|
|
return $this->category; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param TestConfiguration|null $configuration |
49
|
|
|
* |
50
|
|
|
* @return void |
51
|
|
|
*/ |
52
|
|
|
protected function setConfiguration($configuration = null) |
53
|
|
|
{ |
54
|
|
|
assert($configuration instanceof TestConfiguration); |
55
|
|
|
if (!is_null($configuration)) { |
56
|
|
|
$this->configuration = $configuration; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return TestConfiguration |
62
|
|
|
*/ |
63
|
|
|
public function getConfiguration() |
64
|
|
|
{ |
65
|
|
|
assert($this->configuration instanceof TestConfiguration); |
66
|
|
|
return $this->configuration; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return TestData|null |
71
|
|
|
*/ |
72
|
|
|
public function getTestData() |
73
|
|
|
{ |
74
|
|
|
assert($this->testData instanceof TestData || is_null($this->testData)); |
75
|
|
|
return $this->testData; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param TestData|null $testData |
80
|
|
|
* |
81
|
|
|
* @return void |
82
|
|
|
*/ |
83
|
|
|
protected function setTestData($testData = null) |
84
|
|
|
{ |
85
|
|
|
assert($testData instanceof TestData || is_null($testData)); |
86
|
|
|
if (!is_null($testData)) { |
87
|
|
|
$this->testData = $testData; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param TestResult $testResult |
93
|
|
|
* |
94
|
|
|
* @return void |
95
|
|
|
*/ |
96
|
|
|
protected function setTestResult($testResult) |
97
|
|
|
{ |
98
|
|
|
assert($testResult instanceof TestResult); |
99
|
|
|
$this->testResult = $testResult; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return TestResult |
104
|
|
|
*/ |
105
|
|
|
public function getTestResult() |
106
|
|
|
{ |
107
|
|
|
assert($this->testResult instanceof TestResult); |
108
|
|
|
return $this->testResult; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|