24
24
class TestObjectHandlerTest extends TestCase
25
25
{
26
26
/**
27
- * Basic test to validate array => test object conversion
27
+ * Basic test to validate array => test object conversion.
28
+ *
29
+ * @throws \Exception
28
30
*/
29
31
public function testGetTestObject ()
30
32
{
31
33
// set up mock data
32
34
$ testDataArrayBuilder = new TestDataArrayBuilder ();
33
35
$ mockData = $ testDataArrayBuilder
34
36
->withAnnotations ()
37
+ ->withFailedHook ()
35
38
->withAfterHook ()
36
39
->withBeforeHook ()
37
40
->withTestActions ()
@@ -54,17 +57,26 @@ public function testGetTestObject()
54
57
$ testDataArrayBuilder ->testActionType ,
55
58
[]
56
59
);
60
+ $ expectedFailedActionObject = new ActionObject (
61
+ $ testDataArrayBuilder ->testActionAfterName ,
62
+ $ testDataArrayBuilder ->testActionType ,
63
+ []
64
+ );
65
+
57
66
$ expectedBeforeHookObject = new TestHookObject (
58
67
TestObjectExtractor::TEST_BEFORE_HOOK ,
59
68
$ testDataArrayBuilder ->testName ,
60
- [$ expectedBeforeActionObject ],
61
- []
69
+ [$ expectedBeforeActionObject ]
62
70
);
63
71
$ expectedAfterHookObject = new TestHookObject (
64
72
TestObjectExtractor::TEST_AFTER_HOOK ,
65
73
$ testDataArrayBuilder ->testName ,
66
- [$ expectedAfterActionObject ],
67
- []
74
+ [$ expectedAfterActionObject ]
75
+ );
76
+ $ expectedFailedHookObject = new TestHookObject (
77
+ TestObjectExtractor::TEST_FAILED_HOOK ,
78
+ $ testDataArrayBuilder ->testName ,
79
+ [$ expectedFailedActionObject ]
68
80
);
69
81
70
82
$ expectedTestActionObject = new ActionObject (
@@ -80,7 +92,8 @@ public function testGetTestObject()
80
92
],
81
93
[
82
94
TestObjectExtractor::TEST_BEFORE_HOOK => $ expectedBeforeHookObject ,
83
- TestObjectExtractor::TEST_AFTER_HOOK => $ expectedAfterHookObject
95
+ TestObjectExtractor::TEST_AFTER_HOOK => $ expectedAfterHookObject ,
96
+ TestObjectExtractor::TEST_FAILED_HOOK => $ expectedFailedHookObject
84
97
],
85
98
[]
86
99
);
@@ -89,7 +102,9 @@ public function testGetTestObject()
89
102
}
90
103
91
104
/**
92
- * Tests the function used to get a series of relevant tests by group
105
+ * Tests the function used to get a series of relevant tests by group.
106
+ *
107
+ * @throws \Exception
93
108
*/
94
109
public function testGetTestsByGroup ()
95
110
{
@@ -120,6 +135,7 @@ public function testGetTestsByGroup()
120
135
* Function used to set mock for parser return and force init method to run between tests.
121
136
*
122
137
* @param array $data
138
+ * @throws \Exception
123
139
*/
124
140
private function setMockParserOutput ($ data )
125
141
{
0 commit comments