@@ -39,20 +39,26 @@ class DeployTest extends TestCase
3939
4040 private static $ name = 'helloHttp ' ;
4141
42- public function testFunction (): void
43- {
44- foreach (self ::cases () as $ test ) {
45- $ body = json_encode ($ test ['body ' ]);
46- $ resp = $ this ->client ->post ('' , [
47- 'body ' => $ body ,
48- 'query ' => $ test ['query ' ],
49- // Uncomment and CURLOPT_VERBOSE debug content will be sent to stdout.
50- // 'debug' => true,
51- ]);
52- $ actual = trim ((string ) $ resp ->getBody ());
53- $ this ->assertEquals ($ test ['code ' ], $ resp ->getStatusCode (), $ test ['label ' ] . ': ' );
54- // Failures often lead to a large HTML page in the response body.
55- $ this ->assertContains ($ test ['expected ' ], $ actual , $ test ['label ' ] . ': ' );
56- }
42+ /**
43+ * @dataProvider cases
44+ */
45+ public function testFunction (
46+ $ label ,
47+ $ query ,
48+ $ body ,
49+ $ expected ,
50+ $ statusCode
51+ ): void {
52+ $ body = json_encode ($ body );
53+ $ resp = $ this ->client ->post ('' , [
54+ 'body ' => $ body , 'query ' => $ query ]);
55+ $ actual = trim ((string ) $ resp ->getBody ());
56+ $ this ->assertEquals (
57+ $ statusCode ,
58+ $ resp ->getStatusCode (),
59+ $ label . ': '
60+ );
61+ // Failures often lead to a large HTML page in the response body.
62+ $ this ->assertContains ($ expected , $ actual , $ label . ': ' );
5763 }
5864}
0 commit comments