1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-08-04 06:27:23 +02:00

fix syntax error for php 5

This commit is contained in:
Ne-Lexa
2019-12-30 18:55:35 +03:00
parent f377b889b5
commit 28bddadac3

View File

@@ -1,5 +1,7 @@
<?php <?php
/** @noinspection PhpUsageOfSilenceOperatorInspection */
namespace PhpZip\Tests; namespace PhpZip\Tests;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@@ -49,34 +51,24 @@ class ZipStreamOpenTest extends TestCase
} }
/** /**
* @return array|\Generator * @return array
*/ */
public function provideStreams() public function provideStreams()
{ {
return [ return [
'file' => yield [fopen(__DIR__ . '/resources/apk.zip', 'rb'), null, null], [@fopen(__DIR__ . '/resources/apk.zip', 'rb'), null, null],
'directory' => yield [ [
fopen(__DIR__, 'rb'), @fopen(__DIR__, 'rb'),
InvalidArgumentException::class, InvalidArgumentException::class,
'Directory stream not supported', 'Directory stream not supported',
], ],
'temp' => yield [$this->getTempResource('php://temp'), null, null], [$this->getTempResource('php://temp'), null, null],
'memory' => yield [$this->getTempResource('php://memory'), null, null], [$this->getTempResource('php://memory'), null, null],
'bz' => yield [ [
$this->getBzResource(), @fopen('https://github.com/Ne-Lexa/php-zip/archive/master.zip', 'rb'),
InvalidArgumentException::class,
'The stream wrapper type "Unknown" is not supported.',
],
'url' => yield [
fopen('https://github.com/Ne-Lexa/php-zip/archive/master.zip', 'rb'),
InvalidArgumentException::class, InvalidArgumentException::class,
'The stream wrapper type "http" is not supported.', 'The stream wrapper type "http" is not supported.',
], ],
'ftp' => yield [
fopen('ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest.md5', 'rb'),
InvalidArgumentException::class,
'The stream wrapper type "ftp" is not supported.',
],
]; ];
} }
@@ -95,18 +87,4 @@ class ZipStreamOpenTest extends TestCase
return $stream; return $stream;
} }
/**
* @return resource|null
*/
private function getBzResource()
{
if (!\extension_loaded('bz2')) {
return null;
}
$stream = bzopen('php://temp', 'w');
bzwrite($stream, 'some input here');
return $stream;
}
} }