Skip to content

Instantly share code, notes, and snippets.

@Zayon
Last active June 6, 2019 15:09
Show Gist options
  • Save Zayon/f05dec4983c23a4ba8cb3baa358cebbc to your computer and use it in GitHub Desktop.
Save Zayon/f05dec4983c23a4ba8cb3baa358cebbc to your computer and use it in GitHub Desktop.
RestContext
<?php
declare(strict_types=1);
use Behat\Gherkin\Node\PyStringNode;
use Behatch\Context\RestContext as BehatchRestContext;
class RestContext extends BehatchRestContext
{
use SharedContextTrait;
/**
* @override Given I send a :method request to :url with body:
*/
public function iSendARequestToWithBody($method, $url, PyStringNode $body)
{
$rawBody = $body->getRaw();
$this->sharingContext->renderTwigTemplate($rawBody);
$newBody = new PyStringNode(explode("\n", $rawBody), $body->getLine());
return parent::iSendARequestToWithBody($method, $url, $newBody);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment