diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-07-18 13:25:17 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-07-18 13:25:17 +0200 |
commit | 51d83b85e139e124f20b972d632b8ba2cb3d3458 (patch) | |
tree | 13c38cdb4f2c30c68bea506e9ceb8f96a508fe75 /_test/tests/inc/io_savefile.test.php | |
parent | b86bc28af9b961266a2caeeb86c8f6f125adc412 (diff) | |
parent | d93ba631117932f06b44535a9d6256cc8e9c4b90 (diff) | |
download | rpg-51d83b85e139e124f20b972d632b8ba2cb3d3458.tar.gz rpg-51d83b85e139e124f20b972d632b8ba2cb3d3458.tar.bz2 |
Merge pull request #1176 from splitbrain/ioreplaceinfile
Add IO function to replace lines in a file (new)
Diffstat (limited to '_test/tests/inc/io_savefile.test.php')
-rw-r--r-- | _test/tests/inc/io_savefile.test.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/_test/tests/inc/io_savefile.test.php b/_test/tests/inc/io_savefile.test.php new file mode 100644 index 000000000..4a4d4671d --- /dev/null +++ b/_test/tests/inc/io_savefile.test.php @@ -0,0 +1,49 @@ +<?php + +class io_savefile_test extends DokuWikiTest { + + /* + * dependency for tests needing zlib extension to pass + */ + public function test_ext_zlib() { + if (!extension_loaded('zlib')) { + $this->markTestSkipped('skipping all zlib tests. Need zlib extension'); + } + } + + /* + * dependency for tests needing zlib extension to pass + */ + public function test_ext_bz2() { + if (!extension_loaded('bz2')) { + $this->markTestSkipped('skipping all bzip2 tests. Need bz2 extension'); + } + } + + function _write($file){ + $contents = "The\012Write\012Test\012"; + $this->assertTrue(io_saveFile($file, $contents)); + $this->assertEquals($contents, io_readFile($file)); + $this->assertTrue(io_saveFile($file, $contents, true)); + $this->assertEquals($contents.$contents, io_readFile($file)); + } + + function test_write(){ + $this->_write(TMP_DIR.'/test.txt'); + } + + /** + * @depends test_ext_zlib + */ + function test_gzwrite(){ + $this->_write(TMP_DIR.'/test.txt.gz'); + } + + /** + * @depends test_ext_bz2 + */ + function test_bzwrite(){ + $this->_write(TMP_DIR.'/test.txt.bz2'); + } + +} |