diff --git a/src/Context/RestContext.php b/src/Context/RestContext.php index 2a1524f8..0785b0c4 100644 --- a/src/Context/RestContext.php +++ b/src/Context/RestContext.php @@ -54,6 +54,16 @@ public function iSendARequestToWithParameters($method, $url, TableNode $datas) parse_str(implode('&', $parameters), $parameters); + if (stristr($method, 'GET')) { + $parametersArray = array(); + foreach ($parameters as $key => $value) { + $parametersArray[] = $key.'='.$value; + } + + $url .= (!strstr($url, '?') ? '?' : '&').implode('&', $parametersArray); + $parameters = array(); + } + $client->request($method, $this->locatePath($url), $parameters); $client->followRedirects(true); @@ -265,4 +275,15 @@ private function getHttpHeaders() CASE_LOWER ); } + + /** + * @Then /^the response should contain '([^']*)'$/ + */ + public function theResponseShouldContain($expected) + { + $expected = str_replace('\\"', '"', $expected); + $actual = $this->getSession()->getPage()->getContent(); + $message = sprintf('The string "%s" is not containd by the response of the current request', $expected); + $this->assertContains($expected, $actual, $message); + } }