From e4850cba6fd67a6d4d9d8c969281e57447c17fd9 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 2 Sep 2018 18:58:32 -0400 Subject: add tests/ and composer test script --- tests/LargeFileTest.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/LargeFileTest.php (limited to 'tests/LargeFileTest.php') diff --git a/tests/LargeFileTest.php b/tests/LargeFileTest.php new file mode 100644 index 0000000..c271b47 --- /dev/null +++ b/tests/LargeFileTest.php @@ -0,0 +1,35 @@ +with_temp_zip(function(ZipStream &$zip) use ($chunk_size, $num_chunks) { + $zip->add('hello.txt', function($e) use ($chunk_size, $num_chunks) { + # build chunk + $data = str_repeat('x', $chunk_size); + + # repeatedly write chunk + foreach (range(0, $num_chunks - 1) as $i) { + $e->write($data); + } + }); + }, function($zip_path) use ($expected_size) { + $zip = $this->open_archive($zip_path); + $st = $zip->statName('hello.txt'); + + $this->assertEquals($expected_size, $st['size']); + }); + } +}; -- cgit v1.2.3