Completed
Push — master ( bdf206...96b1f4 )
by Tim
01:37
created

TestCaseFactory::getTestResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Module\monitor;
4
5
abstract class TestCaseFactory extends TestFactory
6
{
7
    /**
8
     * @var TestSuiteFactory|null
9
     */
10
    private $testSuite = null;
11
12
    /**
13
     * @var string|null
14
     */
15
    private $category = null;
16
17
    /**
18
     * @var string|null
19
     */
20
    private $subject = null;
21
22
    /**
23
     * @param TestSuiteFactory|null $testSuite
24
     * @param TestData $testData
25
     */
26
    public function __construct($testSuite = null, $testData)
27
    {
28
        assert($testSuite instanceof TestSuiteFactory);
29
        assert($testData instanceof TestData);
30
31
        $this->setTestSuite($testSuite);
32
        $this->initialize($testData);
33
        $this->invokeTest();
34
    }
35
36
    /**
37
     * @param Testdata $testData
38
     *
39
     * @return void
40
     */
41
    protected function initialize($testData)
42
    {
43
        $this->setTestData($testData);
44
    }
45
46
    /**
47
     * @param TestSuiteFactory $testSuite
48
     *
49
     * @return void
50
     */
51
    private function setTestSuite($testSuite)
52
    {
53
        assert($testSuite instanceof TestSuiteFactory);
54
        $this->testSuite = $testSuite;
55
    }
56
57
58
    /**
59
     * @return TestSuiteFactory
60
     */
61
    public function getTestSuite()
62
    {
63
        assert($this->testSuite instanceof TestSuiteFactory);
64
        return $this->testSuite;
65
    }
66
67
68
    /**
69
     * @param string $subject
70
     *
71
     * @return void
72
     */
73
    protected function setSubject($subject)
74
    {
75
        assert(is_string($subject));
76
        $this->subject = $subject;
77
    }
78
79
80
    /**
81
     * @return string
82
     */
83
    public function getSubject()
84
    {
85
        assert(is_string($this->subject));
86
        return $this->subject;
87
    }
88
89
90
    /**
91
     * @param string $category
92
     *
93
     * @return void
94
     */
95
    protected function setCategory($category)
96
    {
97
        assert(is_string($category));
98
        $this->category = $category;
99
    }
100
101
102
    /**
103
     * @return string
104
     */
105
    public function getCategory()
106
    {
107
        assert(is_string($this->category));
108
        return $this->category;
109
    }
110
111
    
112
    /**
113
     * @return void
114
     */
115
    abstract protected function invokeTest();
116
}
117