Skip to content

Commit

Permalink
Make "file containing" more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Aug 9, 2016
1 parent 3a19943 commit 607f456
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Context/TestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace FriendsOfBehat\TestContext\Context;

use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
Expand Down Expand Up @@ -69,19 +68,19 @@ public function afterScenario()
}

/**
* @Given /^a Behat configuration containing:$/
* @Given /^a Behat configuration containing(?: "([^"]+)"|:)$/
*/
public function thereIsConfiguration(PyStringNode $content)
public function thereIsConfiguration($content)
{
self::$filesystem->dumpFile(self::$workingDir . '/behat.yml', $content->getRaw());
self::$filesystem->dumpFile(self::$workingDir . '/behat.yml', (string) $content);
}

/**
* @Given /^a (?:config|context|feature) file "([^"]+)" containing:$/
* @Given /^a (?:.+ |)file "([^"]+)" containing(?: "([^"]+)"|:)$/
*/
public function thereIsFile($file, PyStringNode $content)
public function thereIsFile($file, $content)
{
self::$filesystem->dumpFile(self::$workingDir . '/' . $file, $content->getRaw());
self::$filesystem->dumpFile(self::$workingDir . '/' . $file, (string) $content);
}

/**
Expand Down

0 comments on commit 607f456

Please sign in to comment.