Skip to content

Commit

Permalink
Merge pull request consolidation#128 from pscheit/test-replace-multip…
Browse files Browse the repository at this point in the history
…le-in-file

Test Task ReplaceInFile for multiple strings in file
  • Loading branch information
burzum committed Mar 15, 2015
2 parents 2408d9a + 16b3a75 commit a01a370
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Task/File/Replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
* ->regex('~^service:~')
* ->to('services:')
* ->run();
*
* $this->taskReplaceInFile('box/robo.txt')
* ->from(array('##dbname##', 'robo'))
* ->to(array('##dbhost## ', 'localhost'))
* ->run();
* ?>
* ```
*
Expand Down
10 changes: 10 additions & 0 deletions tests/cli/WriteFileCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
}
}

0 comments on commit a01a370

Please sign in to comment.