20
20
use RuntimeException ;
21
21
use SimpleXMLElement ;
22
22
23
- final class FeatureContext extends TestCase implements Context
23
+ final class FeatureContext implements Context
24
24
{
25
25
use AttachmentContextTrait;
26
26
use CustomFieldContextTrait;
@@ -90,8 +90,6 @@ public function __construct(string $redmineVersion, string $rootPath)
90
90
}
91
91
92
92
$ this ->redmine = static ::$ tracer ::getRedmineInstance ($ version , $ rootPath );
93
-
94
- parent ::__construct ('BehatRedmine ' . $ version ->asId ());
95
93
}
96
94
97
95
/**
@@ -126,7 +124,7 @@ private function registerClientResponse(mixed $lastReturn, Response $lastRespons
126
124
*/
127
125
public function theResponseHasTheStatusCode (int $ statusCode )
128
126
{
129
- $ this -> assertSame (
127
+ TestCase:: assertSame (
130
128
$ statusCode ,
131
129
$ this ->lastResponse ->getStatusCode (),
132
130
'Raw response content: ' . $ this ->lastResponse ->getContent (),
@@ -138,7 +136,7 @@ public function theResponseHasTheStatusCode(int $statusCode)
138
136
*/
139
137
public function theResponseHasTheContentType (string $ contentType )
140
138
{
141
- $ this -> assertStringStartsWith (
139
+ TestCase:: assertStringStartsWith (
142
140
$ contentType ,
143
141
$ this ->lastResponse ->getContentType (),
144
142
'Raw response content: ' . $ this ->lastResponse ->getContent (),
@@ -150,79 +148,79 @@ public function theResponseHasTheContentType(string $contentType)
150
148
*/
151
149
public function theResponseHasAnEmptyContentType ()
152
150
{
153
- $ this -> assertSame ('' , $ this ->lastResponse ->getContentType ());
151
+ TestCase:: assertSame ('' , $ this ->lastResponse ->getContentType ());
154
152
}
155
153
156
154
/**
157
155
* @Then the response has the content :content
158
156
*/
159
157
public function theResponseHasTheContent (string $ content )
160
158
{
161
- $ this -> assertSame ($ content , $ this ->lastResponse ->getContent ());
159
+ TestCase:: assertSame ($ content , $ this ->lastResponse ->getContent ());
162
160
}
163
161
164
162
/**
165
163
* @Then the response has the content
166
164
*/
167
165
public function theResponseHasTheContentWithMultipleLines (PyStringNode $ string )
168
166
{
169
- $ this -> assertSame ($ string ->getRaw (), $ this ->lastResponse ->getContent ());
167
+ TestCase:: assertSame ($ string ->getRaw (), $ this ->lastResponse ->getContent ());
170
168
}
171
169
172
170
/**
173
171
* @Then the returned data is true
174
172
*/
175
173
public function theReturnedDataIsTrue ()
176
174
{
177
- $ this -> assertTrue ($ this ->lastReturn );
175
+ TestCase:: assertTrue ($ this ->lastReturn );
178
176
}
179
177
180
178
/**
181
179
* @Then the returned data is false
182
180
*/
183
181
public function theReturnedDataIsFalse ()
184
182
{
185
- $ this -> assertFalse ($ this ->lastReturn );
183
+ TestCase:: assertFalse ($ this ->lastReturn );
186
184
}
187
185
188
186
/**
189
187
* @Then the returned data is exactly :content
190
188
*/
191
189
public function theReturnedDataIsExactly (string $ content )
192
190
{
193
- $ this -> assertSame ($ content , $ this ->lastReturn );
191
+ TestCase:: assertSame ($ content , $ this ->lastReturn );
194
192
}
195
193
196
194
/**
197
195
* @Then the returned data is exactly
198
196
*/
199
197
public function theReturnedDataIsExactlyWithMultipleLines (PyStringNode $ string )
200
198
{
201
- $ this -> assertSame ($ string ->getRaw (), $ this ->lastReturn );
199
+ TestCase:: assertSame ($ string ->getRaw (), $ this ->lastReturn );
202
200
}
203
201
204
202
/**
205
203
* @Then the returned data is an instance of :className
206
204
*/
207
205
public function theReturnedDataIsAnInstanceOf (string $ className )
208
206
{
209
- $ this -> assertInstanceOf ($ className , $ this ->lastReturn );
207
+ TestCase:: assertInstanceOf ($ className , $ this ->lastReturn );
210
208
}
211
209
212
210
/**
213
211
* @Then the returned data is an array
214
212
*/
215
213
public function theReturnedDataIsAnArray ()
216
214
{
217
- $ this -> assertIsArray ($ this ->lastReturn );
215
+ TestCase:: assertIsArray ($ this ->lastReturn );
218
216
}
219
217
220
218
/**
221
219
* @Then the returned data contains :count items
222
220
*/
223
221
public function theReturnedDataContainsItems (int $ count )
224
222
{
225
- $ this -> assertCount ($ count , $ this ->lastReturn );
223
+ TestCase:: assertCount ($ count , $ this ->lastReturn );
226
224
}
227
225
228
226
/**
@@ -264,7 +262,7 @@ public function theReturnedDataPropertyIsAnArray($property)
264
262
265
263
$ value = $ this ->getItemFromArray ($ returnData , $ property );
266
264
267
- $ this -> assertIsArray ($ value );
265
+ TestCase:: assertIsArray ($ value );
268
266
}
269
267
270
268
/**
@@ -276,8 +274,8 @@ public function theReturnedDataPropertyContainsItems($property, int $count)
276
274
277
275
$ value = $ this ->getItemFromArray ($ returnData , $ property );
278
276
279
- $ this -> assertIsArray ($ value );
280
- $ this -> assertCount ($ count , $ value );
277
+ TestCase:: assertIsArray ($ value );
278
+ TestCase:: assertCount ($ count , $ value );
281
279
}
282
280
283
281
/**
@@ -321,7 +319,7 @@ public function theReturnedDataPropertyHasOnlyTheFollowingProperties($property,
321
319
322
320
$ properties = array_keys ($ value );
323
321
324
- $ this -> assertSame ($ string ->getStrings (), $ properties );
322
+ TestCase:: assertSame ($ string ->getStrings (), $ properties );
325
323
}
326
324
327
325
/**
@@ -393,7 +391,7 @@ private function getItemFromArray(array $array, $key): mixed
393
391
private function assertTableNodeIsSameAsArray (TableNode $ table , array $ data )
394
392
{
395
393
foreach ($ table as $ row ) {
396
- $ this -> assertArrayHasKey ($ row ['property ' ], $ data , 'Possible keys are: ' . implode (', ' , array_keys ($ data )));
394
+ TestCase:: assertArrayHasKey ($ row ['property ' ], $ data , 'Possible keys are: ' . implode (', ' , array_keys ($ data )));
397
395
398
396
$ value = $ data [$ row ['property ' ]];
399
397
@@ -438,7 +436,7 @@ private function assertTableNodeIsSameAsArray(TableNode $table, array $data)
438
436
$ expected = str_replace ('%redmine_id% ' , strval ($ this ->redmine ->getVersionId ()), $ expected );
439
437
}
440
438
441
- $ this -> assertSame ($ expected , $ value , 'Error with property " ' . $ row ['property ' ] . '" ' );
439
+ TestCase:: assertSame ($ expected , $ value , 'Error with property " ' . $ row ['property ' ] . '" ' );
442
440
}
443
441
}
444
442
}
0 commit comments