[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 class io_getSizeFile_test extends DokuWikiTest { 4 5 /* 6 * dependency for tests needing zlib extension to pass 7 */ 8 public function test_ext_zlib() { 9 if (!DOKU_HAS_GZIP) { 10 $this->markTestSkipped('skipping all zlib tests. Need zlib extension'); 11 } 12 $this->assertTrue(true); // avoid being marked as risky for having no assertion 13 } 14 15 /* 16 * dependency for tests needing zlib extension to pass 17 */ 18 public function test_ext_bz2() { 19 if (!DOKU_HAS_BZIP) { 20 $this->markTestSkipped('skipping all bzip2 tests. Need bz2 extension'); 21 } 22 $this->assertTrue(true); // avoid being marked as risky for having no assertion 23 } 24 25 function test_plain(){ 26 // since git converts line endings, we can't check in this test file but have to create it ourselves 27 $plain = TMP_DIR.'/test.txt'; 28 file_put_contents($plain, "The\015\012Test\015\012"); 29 30 $this->assertEquals(11, io_getSizeFile($plain)); 31 $this->assertEquals(0, io_getSizeFile(__DIR__.'/io_readfile/nope.txt')); 32 $plain_mb = TMP_DIR.'/test.txt'; 33 io_saveFile($plain_mb, "string with utf-8 chars åèö - doo-bee doo-bee dooh\012"); 34 $this->assertEquals(54, io_getSizeFile($plain_mb)); 35 } 36 37 /** 38 * @depends test_ext_zlib 39 */ 40 function test_gzfiles(){ 41 $this->assertEquals(11, io_getSizeFile(__DIR__.'/io_readfile/test.txt.gz')); 42 $this->assertEquals(0, io_getSizeFile(__DIR__.'/io_readfile/nope.txt.gz')); 43 $this->assertEquals(11, io_getSizeFile(__DIR__.'/io_readfile/corrupt.txt.gz')); 44 $gz_mb = TMP_DIR.'/test.txt.gz'; 45 io_saveFile($gz_mb, "string with utf-8 chars åèö - doo-bee doo-bee dooh\012"); 46 $this->assertEquals(54, io_getSizeFile($gz_mb)); 47 } 48 49 /** 50 * @depends test_ext_bz2 51 */ 52 function test_bzfiles(){ 53 54 $this->assertEquals(11, io_getSizeFile(__DIR__.'/io_readfile/test.txt.bz2')); 55 $this->assertEquals(0, io_getSizeFile(__DIR__.'/io_readfile/nope.txt.bz2')); 56 $this->assertEquals(0, io_getSizeFile(__DIR__.'/io_readfile/corrupt.txt.bz2')); 57 $this->assertEquals(9720, io_getSizeFile(__DIR__.'/io_readfile/large.txt.bz2')); 58 $this->assertEquals(17780, io_getSizeFile(__DIR__.'/io_readfile/long.txt.bz2')); 59 $bz_mb = TMP_DIR.'/test.txt.bz2'; 60 io_saveFile($bz_mb, "string with utf-8 chars åèö - doo-bee doo-bee dooh\012"); 61 $this->assertEquals(54, io_getSizeFile($bz_mb)); 62 } 63 64 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body