Beispiel #1
0
 /**
  * @When I send a :method request to URL :url with body:
  */
 public function iSendARequestToUrlWithBody($method, $url, PyStringNode $body)
 {
     $bodyReplace = $body->getRaw();
     $bodyReplace = $this->replaceParameters($bodyReplace);
     $body = new PyStringNode([$bodyReplace], $body->getLine());
     $this->restContext->iSendARequestToWithBody($method, $this->replaceParameters($url), $body);
 }
Beispiel #2
0
 public function iSendARequestWithBody($method, $url, PyStringNode $string)
 {
     $name = md5($string);
     $this->loader->setTemplate($name, (string) $string);
     $token = $this->getParameterBag()->get('token');
     $this->addHeader('Authorization', 'Bearer ' . $token);
     $body = $this->twig->render($name, $this->getParameterBag()->getAll());
     $string = new PyStringNode(explode("\n", $body), $string->getLine());
     $url = $this->parameterize($url);
     parent::iSendARequestWithBody($method, $url, $string);
     $this->getParameterBag()->set('response', $this->response);
 }
 /**
  * @param PyStringNode $stringNode
  * @return PyStringNode
  */
 protected function transformPyString(PyStringNode $stringNode)
 {
     $newValue = $this->transformValue($stringNode->getRaw());
     $strings = explode("\n", $newValue);
     return new PyStringNode($strings, $stringNode->getLine());
 }