summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorPatrick Brown <ptbrown@whoopdedo.org>2015-05-29 15:38:43 -0400
committerPatrick Brown <ptbrown@whoopdedo.org>2015-05-29 15:38:43 -0400
commitdc4a4eb00d67d7d28fae137437900220920577d4 (patch)
tree677ad6c67fe0a95b8022bf0f1765701ca77950d0 /_test
parente12c5ac781d560502d478775502df70cd80472de (diff)
downloadrpg-dc4a4eb00d67d7d28fae137437900220920577d4.tar.gz
rpg-dc4a4eb00d67d7d28fae137437900220920577d4.tar.bz2
Abort io_replaceInLine when the search parameter is empty
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/io_replaceinfile.test.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/_test/tests/inc/io_replaceinfile.test.php b/_test/tests/inc/io_replaceinfile.test.php
index 597138a20..452ed7401 100644
--- a/_test/tests/inc/io_replaceinfile.test.php
+++ b/_test/tests/inc/io_replaceinfile.test.php
@@ -94,4 +94,15 @@ class io_replaceinfile_test extends DokuWikiTest {
$this->assertTrue(io_replaceInFile($file, "Delete\012", "Replace\012", false, -1));
$this->assertEquals("The\012Replace\01201Delete\01202Delete\012Test\012", io_readFile($file), "Edge case: old line is a match for parts of other lines");
}
+
+ /**
+ * Test passing an invalid parameter.
+ *
+ * @expectedException PHPUnit_Framework_Error_Warning
+ */
+ function test_badparam()
+ {
+ /* The empty $oldline parameter should be caught before the file doesn't exist test. */
+ $this->assertFalse(io_replaceInFile(TMP_DIR.'/not_existing_file.txt', '', '', false, 0));
+ }
}