From 39b3e182c4adc92e5baf873ba8db10d7633272dd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 22 Feb 2021 19:03:49 +0100 Subject: [PATCH 1/3] run tests on windows too --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74ee02d..669b0c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,13 +4,14 @@ on: [push, pull_request] jobs: run: - name: PHP ${{ matrix.php-versions }} - runs-on: ubuntu-latest + name: PHP ${{ matrix.php-versions }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: matrix: php-versions: ['7.2', '7.3', '7.4', '8.0'] + os: ['ubuntu-latest', 'windows-latest'] fail-fast: false steps: @@ -21,6 +22,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} + extensions: bz2, zip - name: Setup problem matchers run: | From 2880b674751956e141bee5ee32a9b019f966a2f6 Mon Sep 17 00:00:00 2001 From: Erwin Derksen Date: Mon, 22 Feb 2021 21:03:29 +0100 Subject: [PATCH 2/3] dirname(__FILE__) => __DIR__ (valid as of php 5.3) --- tests/TarTestCase.php | 42 +++++++++++++++++++++--------------------- tests/ZipTestCase.php | 26 +++++++++++++------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/TarTestCase.php b/tests/TarTestCase.php index 687f70a..6752128 100644 --- a/tests/TarTestCase.php +++ b/tests/TarTestCase.php @@ -79,7 +79,7 @@ public function testCreateDynamic() { $tar = new Tar(); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tdir = ltrim($dir, '/'); $tar->create(); @@ -117,7 +117,7 @@ public function testCreateFile() { $tar = new Tar(); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tdir = ltrim($dir, '/'); $tmp = vfsStream::url('home_root_path/test.tar'); @@ -153,7 +153,7 @@ public function testCreateFile() */ public function testTarcontent() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; foreach ($this->extensions as $ext) { $tar = new Tar(); @@ -178,7 +178,7 @@ public function testTarcontent() public function testDogfood() { foreach ($this->extensions as $ext) { - $input = glob(dirname(__FILE__) . '/../src/*'); + $input = glob(__DIR__ . '/../src/*'); $archive = sys_get_temp_dir() . '/dwtartest' . md5(time()) . '.' . $ext; $extract = sys_get_temp_dir() . '/dwtartest' . md5(time() + 1); @@ -250,7 +250,7 @@ protected function nativeCheck($archive, $ext) */ public function testTarExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -277,7 +277,7 @@ public function testTarExtract() */ public function testCompStripExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -304,7 +304,7 @@ public function testCompStripExtract() */ public function testPrefixStripExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -331,7 +331,7 @@ public function testPrefixStripExtract() */ public function testIncludeExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -357,7 +357,7 @@ public function testIncludeExtract() */ public function testExcludeExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -394,7 +394,7 @@ public function testFileType() $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.BZ2')); $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.bz2')); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $this->assertEquals(Tar::COMPRESS_NONE, $tar->filetype("$dir/test.tar")); $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype("$dir/test.tgz")); $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype("$dir/test.tbz")); @@ -408,7 +408,7 @@ public function testFileType() */ public function testLongPathExtract() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); foreach (array('ustar', 'gnu') as $format) { @@ -504,7 +504,7 @@ public function testCreateLongPathGnu() */ public function testTarBomb() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); $tar = new Tar(); @@ -524,7 +524,7 @@ public function testTarBomb() */ public function testZeroFile() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->setCompression(0); $tar->create(); @@ -582,7 +582,7 @@ public function testZeroByteFile() { */ public function testBlockFile() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->setCompression(0); $tar->create(); @@ -609,7 +609,7 @@ public function testBlockData() public function testGzipIsValid() { foreach (['tgz', 'tar.gz'] as $ext) { - $input = glob(dirname(__FILE__) . '/../src/*'); + $input = glob(__DIR__ . '/../src/*'); $archive = sys_get_temp_dir() . '/dwtartest' . md5(time()) . '.' . $ext; $extract = sys_get_temp_dir() . '/dwtartest' . md5(time() + 1); @@ -649,7 +649,7 @@ public function testContentsWithInvalidArchiveStream() public function testExtractWithInvalidOutDir() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = '/root/invalid_out_dir'; $tar = new Tar(); @@ -661,7 +661,7 @@ public function testExtractWithInvalidOutDir() public function testExtractWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $out = '/root/invalid_out_dir'; $tar = new Tar(); @@ -674,7 +674,7 @@ public function testExtractWithArchiveStreamIsClosed() public function testCreateWithInvalidFile() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->open("$dir/tarbomb.tgz"); @@ -730,7 +730,7 @@ public function testCloseHasBeenClosed() */ public function testGetArchiveWithBzipCompress() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->setCompression(9, Tar::COMPRESS_BZIP); $tar->create(); @@ -742,7 +742,7 @@ public function testGetArchiveWithBzipCompress() public function testSaveWithCompressionAuto() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->setCompression(-1); $tar->create(); @@ -755,7 +755,7 @@ public function testSaveWithCompressionAuto() public function testSaveWithInvalidDestinationFile() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $tar = new Tar(); $tar->setCompression(); $tar->create(); diff --git a/tests/ZipTestCase.php b/tests/ZipTestCase.php index 40dff81..7104a4a 100644 --- a/tests/ZipTestCase.php +++ b/tests/ZipTestCase.php @@ -51,7 +51,7 @@ public function testCreateDynamic() { $zip = new Zip(); - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $tdir = ltrim($dir, '/'); $zip->create(); @@ -91,7 +91,7 @@ public function testCreateFile() { $zip = new Zip(); - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $tdir = ltrim($dir, '/'); $tmp = vfsStream::url('home_root_path/test.zip'); @@ -135,7 +135,7 @@ public function testAddFileWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); $zip = new Zip(); - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $zip->setCompression(0); $zip->close(); $zip->addFile("$dir/testdata1.txt", "$dir/testdata1.txt"); @@ -158,7 +158,7 @@ public function testAddFileWithInvalidFile() */ public function testZipContent() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $zip = new Zip(); $file = "$dir/test.zip"; @@ -177,7 +177,7 @@ public function testZipContent() public function testZipContentWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $zip = new Zip(); $file = "$dir/test.zip"; $zip->open($file); @@ -191,7 +191,7 @@ public function testZipContentWithArchiveStreamIsClosed() */ public function testDogFood() { - $input = glob(dirname(__FILE__) . '/../src/*'); + $input = glob(__DIR__ . '/../src/*'); $archive = sys_get_temp_dir() . '/dwziptest' . md5(time()) . '.zip'; $extract = sys_get_temp_dir() . '/dwziptest' . md5(time() + 1); @@ -312,7 +312,7 @@ public function testCloseWithArchiveStreamIsClosed() public function testSaveArchiveFile() { - $dir = dirname(__FILE__) . '/tar'; + $dir = __DIR__ . '/tar'; $zip = new zip(); $zip->setCompression(-1); $zip->create(); @@ -382,7 +382,7 @@ protected function native7ZipCheck($archive) */ public function testZipExtract() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -409,7 +409,7 @@ public function testZipExtract() public function testZipExtractWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -426,7 +426,7 @@ public function testZipExtractWithArchiveStreamIsClosed() */ public function testCompStripExtract() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -452,7 +452,7 @@ public function testCompStripExtract() */ public function testPrefixStripExtract() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -478,7 +478,7 @@ public function testPrefixStripExtract() */ public function testIncludeExtract() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -503,7 +503,7 @@ public function testIncludeExtract() */ public function testExcludeExtract() { - $dir = dirname(__FILE__) . '/zip'; + $dir = __DIR__ . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); From a54081a9bcd0fe0dbf38e50e0e4515b2e129aff7 Mon Sep 17 00:00:00 2001 From: Erwin Derksen Date: Mon, 22 Feb 2021 21:33:17 +0100 Subject: [PATCH 3/3] Make tests run on Windows. --- tests/TarTestCase.php | 61 ++++++++++++++++++++++++++----------------- tests/ZipTestCase.php | 45 +++++++++++++++++++------------ 2 files changed, 65 insertions(+), 41 deletions(-) diff --git a/tests/TarTestCase.php b/tests/TarTestCase.php index 6752128..32cdeed 100644 --- a/tests/TarTestCase.php +++ b/tests/TarTestCase.php @@ -37,6 +37,18 @@ protected function tearDown() : void $this->extensions[] = null; } + /** + * Returns the current dir with Linux style separator (/) + * + * This makes it easier to run the tests on Windows as well. + * + * @return string + */ + protected function getDir() + { + return str_replace('\\', '/', __DIR__); + } + /** * Callback check function * @param FileInfo $fileinfo @@ -79,7 +91,7 @@ public function testCreateDynamic() { $tar = new Tar(); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tdir = ltrim($dir, '/'); $tar->create(); @@ -117,7 +129,7 @@ public function testCreateFile() { $tar = new Tar(); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tdir = ltrim($dir, '/'); $tmp = vfsStream::url('home_root_path/test.tar'); @@ -153,7 +165,7 @@ public function testCreateFile() */ public function testTarcontent() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; foreach ($this->extensions as $ext) { $tar = new Tar(); @@ -178,7 +190,7 @@ public function testTarcontent() public function testDogfood() { foreach ($this->extensions as $ext) { - $input = glob(__DIR__ . '/../src/*'); + $input = glob($this->getDir() . '/../src/*'); $archive = sys_get_temp_dir() . '/dwtartest' . md5(time()) . '.' . $ext; $extract = sys_get_temp_dir() . '/dwtartest' . md5(time() + 1); @@ -250,7 +262,7 @@ protected function nativeCheck($archive, $ext) */ public function testTarExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -277,7 +289,7 @@ public function testTarExtract() */ public function testCompStripExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -304,7 +316,7 @@ public function testCompStripExtract() */ public function testPrefixStripExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -331,7 +343,7 @@ public function testPrefixStripExtract() */ public function testIncludeExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -357,7 +369,7 @@ public function testIncludeExtract() */ public function testExcludeExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); foreach ($this->extensions as $ext) { @@ -394,7 +406,7 @@ public function testFileType() $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.BZ2')); $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.bz2')); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $this->assertEquals(Tar::COMPRESS_NONE, $tar->filetype("$dir/test.tar")); $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype("$dir/test.tgz")); $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype("$dir/test.tbz")); @@ -408,7 +420,7 @@ public function testFileType() */ public function testLongPathExtract() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); foreach (array('ustar', 'gnu') as $format) { @@ -504,7 +516,7 @@ public function testCreateLongPathGnu() */ public function testTarBomb() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); $tar = new Tar(); @@ -524,7 +536,7 @@ public function testTarBomb() */ public function testZeroFile() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->setCompression(0); $tar->create(); @@ -554,7 +566,7 @@ public function testZeroByteFile() { $tar = new Tar(); $tar->create($archive); - $tar->addFile(__DIR__ . '/zip/zero.txt', 'foo/zero.txt'); + $tar->addFile($this->getDir() . '/zip/zero.txt', 'foo/zero.txt'); $tar->close(); $this->assertFileExists($archive); @@ -582,7 +594,7 @@ public function testZeroByteFile() { */ public function testBlockFile() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->setCompression(0); $tar->create(); @@ -609,7 +621,7 @@ public function testBlockData() public function testGzipIsValid() { foreach (['tgz', 'tar.gz'] as $ext) { - $input = glob(__DIR__ . '/../src/*'); + $input = glob($this->getDir() . '/../src/*'); $archive = sys_get_temp_dir() . '/dwtartest' . md5(time()) . '.' . $ext; $extract = sys_get_temp_dir() . '/dwtartest' . md5(time() + 1); @@ -649,8 +661,9 @@ public function testContentsWithInvalidArchiveStream() public function testExtractWithInvalidOutDir() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/tar'; - $out = '/root/invalid_out_dir'; + $dir = $this->getDir() . '/tar'; + // Fails on Linux and Windows. + $out = '/root/invalid_out_dir:'; $tar = new Tar(); @@ -661,7 +674,7 @@ public function testExtractWithInvalidOutDir() public function testExtractWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $out = '/root/invalid_out_dir'; $tar = new Tar(); @@ -674,11 +687,11 @@ public function testExtractWithArchiveStreamIsClosed() public function testCreateWithInvalidFile() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->open("$dir/tarbomb.tgz"); - $tar->create('/root/invalid_file'); + $tar->create('/root/invalid_file:'); } public function testAddFileWithArchiveStreamIsClosed() @@ -730,7 +743,7 @@ public function testCloseHasBeenClosed() */ public function testGetArchiveWithBzipCompress() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->setCompression(9, Tar::COMPRESS_BZIP); $tar->create(); @@ -742,7 +755,7 @@ public function testGetArchiveWithBzipCompress() public function testSaveWithCompressionAuto() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->setCompression(-1); $tar->create(); @@ -755,7 +768,7 @@ public function testSaveWithCompressionAuto() public function testSaveWithInvalidDestinationFile() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $tar = new Tar(); $tar->setCompression(); $tar->create(); diff --git a/tests/ZipTestCase.php b/tests/ZipTestCase.php index 7104a4a..3f169d5 100644 --- a/tests/ZipTestCase.php +++ b/tests/ZipTestCase.php @@ -16,6 +16,18 @@ protected function setUp() : void vfsStream::setup('home_root_path'); } + /** + * Returns the current dir with Linux style separator (/) + * + * This makes it easier to run the tests on Windows as well. + * + * @return string + */ + protected function getDir() + { + return str_replace('\\', '/', __DIR__); + } + /** * Callback check function * @param FileInfo $fileinfo @@ -51,7 +63,7 @@ public function testCreateDynamic() { $zip = new Zip(); - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $tdir = ltrim($dir, '/'); $zip->create(); @@ -91,7 +103,7 @@ public function testCreateFile() { $zip = new Zip(); - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $tdir = ltrim($dir, '/'); $tmp = vfsStream::url('home_root_path/test.zip'); @@ -135,7 +147,7 @@ public function testAddFileWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); $zip = new Zip(); - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $zip->setCompression(0); $zip->close(); $zip->addFile("$dir/testdata1.txt", "$dir/testdata1.txt"); @@ -158,7 +170,7 @@ public function testAddFileWithInvalidFile() */ public function testZipContent() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $zip = new Zip(); $file = "$dir/test.zip"; @@ -177,7 +189,7 @@ public function testZipContent() public function testZipContentWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $zip = new Zip(); $file = "$dir/test.zip"; $zip->open($file); @@ -191,7 +203,7 @@ public function testZipContentWithArchiveStreamIsClosed() */ public function testDogFood() { - $input = glob(__DIR__ . '/../src/*'); + $input = glob($this->getDir() . '/../src/*'); $archive = sys_get_temp_dir() . '/dwziptest' . md5(time()) . '.zip'; $extract = sys_get_temp_dir() . '/dwziptest' . md5(time() + 1); @@ -235,7 +247,7 @@ public function testZeroByteFile() { $zip = new Zip(); $zip->create($archive); - $zip->addFile(__DIR__ . '/zip/zero.txt', 'foo/zero.txt'); + $zip->addFile($this->getDir() . '/zip/zero.txt', 'foo/zero.txt'); $zip->close(); $this->assertFileExists($archive); @@ -312,7 +324,7 @@ public function testCloseWithArchiveStreamIsClosed() public function testSaveArchiveFile() { - $dir = __DIR__ . '/tar'; + $dir = $this->getDir() . '/tar'; $zip = new zip(); $zip->setCompression(-1); $zip->create(); @@ -382,7 +394,7 @@ protected function native7ZipCheck($archive) */ public function testZipExtract() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -409,7 +421,7 @@ public function testZipExtract() public function testZipExtractWithArchiveStreamIsClosed() { $this->expectException(ArchiveIOException::class); - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -426,7 +438,7 @@ public function testZipExtractWithArchiveStreamIsClosed() */ public function testCompStripExtract() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -452,7 +464,7 @@ public function testCompStripExtract() */ public function testPrefixStripExtract() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -478,7 +490,7 @@ public function testPrefixStripExtract() */ public function testIncludeExtract() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -503,7 +515,7 @@ public function testIncludeExtract() */ public function testExcludeExtract() { - $dir = __DIR__ . '/zip'; + $dir = $this->getDir() . '/zip'; $out = sys_get_temp_dir() . '/dwziptest' . md5(time()); $zip = new Zip(); @@ -530,7 +542,7 @@ public function testUmlautWinrar() $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); $zip = new Zip(); - $zip->open(__DIR__ . '/zip/issue14-winrar.zip'); + $zip->open($this->getDir() . '/zip/issue14-winrar.zip'); $zip->extract($out); $this->assertFileExists("$out/tüst.txt"); } @@ -543,7 +555,7 @@ public function testUmlautWindows() $out = vfsStream::url('home_root_path/dwtartest' . md5(time())); $zip = new Zip(); - $zip->open(__DIR__ . '/zip/issue14-windows.zip'); + $zip->open($this->getDir() . '/zip/issue14-windows.zip'); $zip->extract($out); $this->assertFileExists("$out/täst.txt"); } @@ -570,5 +582,4 @@ public static function RDelete($target) rmdir($target); } } - }