From b918d9b729472e06833f683383c3fea97fd83127 Mon Sep 17 00:00:00 2001
From: Philipp Scheit
Date: Tue, 3 Mar 2015 11:34:22 +0100
Subject: [PATCH 1/2] add a test for replacing multiple values in a file at
once
---
tests/cli/WriteFileCest.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/cli/WriteFileCest.php b/tests/cli/WriteFileCest.php
index 69ee45601..913da8b69 100644
--- a/tests/cli/WriteFileCest.php
+++ b/tests/cli/WriteFileCest.php
@@ -64,5 +64,15 @@ public function replaceInFile(CliGuy $I)
$I->seeFileContentsEqual('B');
}
+
+ public function replaceMultipleInFile(CliGuy $I)
+ {
+ $I->taskReplaceInFile('box/robo.txt')
+ ->from(array('HELLO', 'ROBO'))
+ ->to(array('Hello ', 'robo.li!'))
+ ->run();
+ $I->seeFileFound('box/robo.txt');
+ $I->seeFileContentsEqual('Hello robo.li!');
+ }
}
From 16b3a759375ccd3e7c8a5b7f950e90dc32aae780 Mon Sep 17 00:00:00 2001
From: Philipp Scheit
Date: Tue, 3 Mar 2015 11:34:26 +0100
Subject: [PATCH 2/2] add documentation for replacing multiple values in a file
at once
---
src/Task/File/Replace.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/Task/File/Replace.php b/src/Task/File/Replace.php
index b88567fd3..031e201ee 100644
--- a/src/Task/File/Replace.php
+++ b/src/Task/File/Replace.php
@@ -23,6 +23,11 @@
* ->regex('~^service:~')
* ->to('services:')
* ->run();
+ *
+ * $this->taskReplaceInFile('box/robo.txt')
+ * ->from(array('##dbname##', 'robo'))
+ * ->to(array('##dbhost## ', 'localhost'))
+ * ->run();
* ?>
* ```
*