@@ -19,14 +19,14 @@ class CurlHelpers extends Helper
19
19
*
20
20
* @param string $url
21
21
* @param string $expectedString
22
- * @param string $formKey
22
+ * @param string $postBody
23
23
* @return void
24
24
*
25
25
*/
26
- public function assertCurlResponseContainsString ($ url , $ expectedString , $ formKey = null ): void
26
+ public function assertCurlResponseContainsString ($ url , $ expectedString , $ postBody = null ): void
27
27
{
28
28
$ cookie = $ this ->getCookie ('admin ' );
29
- $ curlResponse = $ this ->getCurlResponse ($ url , $ cookie , $ formKey );
29
+ $ curlResponse = $ this ->getCurlResponse ($ url , $ cookie , $ postBody );
30
30
$ this ->assertStringContainsString ($ expectedString , $ curlResponse );
31
31
}
32
32
@@ -35,20 +35,18 @@ public function assertCurlResponseContainsString($url, $expectedString, $formKey
35
35
*
36
36
* @param string $url
37
37
* @param string $cookie
38
- * @param string $formKey
38
+ * @param string $postBody
39
39
* @return string
40
40
*
41
41
*/
42
- public function getCurlResponse ($ url , $ cookie = null , $ formKey = null ): string
42
+ private function getCurlResponse ($ url , $ cookie = null , $ postBody = null ): string
43
43
{
44
44
// Start Session
45
45
$ session = curl_init ($ url );
46
46
47
47
// Set Options
48
- if ($ formKey ) {
49
- $ data = [
50
- 'form_key ' => $ formKey
51
- ];
48
+ if ($ postBody ) {
49
+ $ data = json_decode ($ postBody );
52
50
curl_setopt ($ session , CURLOPT_POST , true );
53
51
curl_setopt ($ session , CURLOPT_POSTFIELDS , $ data );
54
52
}
@@ -69,7 +67,7 @@ public function getCurlResponse($url, $cookie = null, $formKey = null): string
69
67
* @return string
70
68
*
71
69
*/
72
- public function getCookie ($ cookieName = 'admin ' ): string
70
+ private function getCookie ($ cookieName = 'admin ' ): string
73
71
{
74
72
try {
75
73
$ webDriver = $ this ->getModule ('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver ' );
0 commit comments