@@ -1113,54 +1113,6 @@ final protected function registerFailureType(string $classOrInterface): void
1113
1113
$ this ->failureTypes [$ classOrInterface ] = true ;
1114
1114
}
1115
1115
1116
- /**
1117
- * @throws AssertionFailedError
1118
- * @throws Exception
1119
- * @throws ExpectationFailedException
1120
- * @throws Throwable
1121
- *
1122
- * @internal This method is not covered by the backward compatibility promise for PHPUnit
1123
- */
1124
- final protected function runTest (): mixed
1125
- {
1126
- $ testArguments = array_merge ($ this ->data , array_values ($ this ->dependencyInput ));
1127
-
1128
- $ capture = tmpfile ();
1129
- $ errorLogPrevious = ini_set ('error_log ' , stream_get_meta_data ($ capture )['uri ' ]);
1130
-
1131
- try {
1132
- /** @phpstan-ignore method.dynamicName */
1133
- $ testResult = $ this ->{$ this ->methodName }(...$ testArguments );
1134
-
1135
- $ errorLogOutput = stream_get_contents ($ capture );
1136
-
1137
- if ($ this ->expectErrorLog ) {
1138
- $ this ->assertNotEmpty ($ errorLogOutput , 'Test did not call error_log(). ' );
1139
- } else {
1140
- // strip date from logged error, see https://github.com/php/php-src/blob/c696087e323263e941774ebbf902ac249774ec9f/main/main.c#L905
1141
- print preg_replace ('/\[.+\] / ' , '' , $ errorLogOutput );
1142
- }
1143
- } catch (Throwable $ exception ) {
1144
- if (!$ this ->shouldExceptionExpectationsBeVerified ($ exception )) {
1145
- throw $ exception ;
1146
- }
1147
-
1148
- $ this ->verifyExceptionExpectations ($ exception );
1149
-
1150
- return null ;
1151
- } finally {
1152
- if ($ capture !== false ) {
1153
- fclose ($ capture );
1154
- }
1155
-
1156
- ini_set ('error_log ' , $ errorLogPrevious );
1157
- }
1158
-
1159
- $ this ->expectedExceptionWasNotRaised ();
1160
-
1161
- return $ testResult ;
1162
- }
1163
-
1164
1116
/**
1165
1117
* Creates a mock object for the specified interface or class.
1166
1118
*
@@ -1290,6 +1242,62 @@ protected function onNotSuccessfulTest(Throwable $t): never
1290
1242
throw $ t ;
1291
1243
}
1292
1244
1245
+ /**
1246
+ * @throws AssertionFailedError
1247
+ * @throws Exception
1248
+ * @throws ExpectationFailedException
1249
+ * @throws Throwable
1250
+ */
1251
+ private function runTest (): mixed
1252
+ {
1253
+ $ testArguments = array_merge ($ this ->data , array_values ($ this ->dependencyInput ));
1254
+ $ positionalArguments = [];
1255
+ $ namedArguments = [];
1256
+
1257
+ foreach ($ testArguments as $ key => $ value ) {
1258
+ if (is_int ($ key )) {
1259
+ $ positionalArguments [] = $ value ;
1260
+ } else {
1261
+ $ namedArguments [$ key ] = $ value ;
1262
+ }
1263
+ }
1264
+
1265
+ $ capture = tmpfile ();
1266
+ $ errorLogPrevious = ini_set ('error_log ' , stream_get_meta_data ($ capture )['uri ' ]);
1267
+
1268
+ try {
1269
+ /** @phpstan-ignore method.dynamicName */
1270
+ $ testResult = $ this ->{$ this ->methodName }(...$ namedArguments , ...$ positionalArguments );
1271
+
1272
+ $ errorLogOutput = stream_get_contents ($ capture );
1273
+
1274
+ if ($ this ->expectErrorLog ) {
1275
+ $ this ->assertNotEmpty ($ errorLogOutput , 'Test did not call error_log(). ' );
1276
+ } else {
1277
+ // strip date from logged error, see https://github.com/php/php-src/blob/c696087e323263e941774ebbf902ac249774ec9f/main/main.c#L905
1278
+ print preg_replace ('/\[.+\] / ' , '' , $ errorLogOutput );
1279
+ }
1280
+ } catch (Throwable $ exception ) {
1281
+ if (!$ this ->shouldExceptionExpectationsBeVerified ($ exception )) {
1282
+ throw $ exception ;
1283
+ }
1284
+
1285
+ $ this ->verifyExceptionExpectations ($ exception );
1286
+
1287
+ return null ;
1288
+ } finally {
1289
+ if ($ capture !== false ) {
1290
+ fclose ($ capture );
1291
+ }
1292
+
1293
+ ini_set ('error_log ' , $ errorLogPrevious );
1294
+ }
1295
+
1296
+ $ this ->expectedExceptionWasNotRaised ();
1297
+
1298
+ return $ testResult ;
1299
+ }
1300
+
1293
1301
/**
1294
1302
* @throws ExpectationFailedException
1295
1303
*/
0 commit comments