From 607f456effcf5ac99395c8fddedb5f9b67d07717 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Wed, 10 Aug 2016 00:25:54 +0200 Subject: [PATCH] Make "file containing" more flexible --- src/Context/TestContext.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Context/TestContext.php b/src/Context/TestContext.php index ab83864..2fcfb44 100644 --- a/src/Context/TestContext.php +++ b/src/Context/TestContext.php @@ -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; @@ -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); } /**