|
@@ -31,7 +31,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFileCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'does not exist');
|
|
|
+ $this->expectException(ZipException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->openFile(uniqid('', false));
|
|
@@ -50,7 +50,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $this->setExpectedException(ZipException::class, 'can\'t open');
|
|
|
+ $this->expectException(ZipException::class, 'can\'t open');
|
|
|
|
|
|
static::assertNotFalse(file_put_contents($this->outputFilename, 'content'));
|
|
|
static::assertTrue(chmod($this->outputFilename, 0222));
|
|
@@ -64,7 +64,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFileEmptyFile()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'Corrupt zip file');
|
|
|
+ $this->expectException(ZipException::class, 'Corrupt zip file');
|
|
|
|
|
|
static::assertNotFalse(touch($this->outputFilename));
|
|
|
$zipFile = new ZipFile();
|
|
@@ -77,7 +77,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFileInvalidZip()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipException::class,
|
|
|
'Invalid zip file. The end of the central directory could not be found.'
|
|
|
);
|
|
@@ -92,7 +92,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStringNullString()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Empty string passed');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Empty string passed');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->openFromString(null);
|
|
@@ -103,7 +103,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStringEmptyString()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Empty string passed');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Empty string passed');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->openFromString('');
|
|
@@ -115,7 +115,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStringInvalidZip()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipException::class,
|
|
|
'Invalid zip file. The end of the central directory could not be found.'
|
|
|
);
|
|
@@ -149,7 +149,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamNullStream()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Stream must be a resource');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Stream must be a resource');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->openFromStream(null);
|
|
@@ -160,7 +160,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamInvalidResourceType()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Stream must be a resource');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Stream must be a resource');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
/** @noinspection PhpParamsInspection */
|
|
@@ -172,7 +172,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamInvalidResourceType2()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Invalid resource type');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Invalid resource type');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
|
|
@@ -190,7 +190,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamInvalidResourceType3()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Directory stream not supported');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Directory stream not supported');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->openFromStream(opendir(__DIR__));
|
|
@@ -203,7 +203,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamNoSeekable()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The stream wrapper type "http" is not supported');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The stream wrapper type "http" is not supported');
|
|
|
|
|
|
if (!$fp = @fopen('http://localhost', 'rb')) {
|
|
|
if (!$fp = @fopen('http://example.org', 'rb')) {
|
|
@@ -222,7 +222,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamEmptyContents()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'Corrupt zip file');
|
|
|
+ $this->expectException(ZipException::class, 'Corrupt zip file');
|
|
|
|
|
|
$fp = fopen($this->outputFilename, 'w+b');
|
|
|
$zipFile = new ZipFile();
|
|
@@ -235,7 +235,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testOpenFromStreamInvalidZip()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipException::class,
|
|
|
'Invalid zip file. The end of the central directory could not be found.'
|
|
|
);
|
|
@@ -508,7 +508,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRenameEntryNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'name is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'name is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->rename(null, 'new-file');
|
|
@@ -519,7 +519,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRenameEntryNull2()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'name is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'name is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->rename('old-file', null);
|
|
@@ -530,7 +530,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRenameEntryToExistsNewEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'is exists');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'is exists');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['file'] = 'content';
|
|
@@ -548,7 +548,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRenameEntryNotFound()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipEntryNotFoundException::class);
|
|
|
+ $this->expectException(ZipEntryNotFoundException::class);
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['file'] = 'content';
|
|
@@ -615,7 +615,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testDeleteFromNameNotFoundEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipEntryNotFoundException::class);
|
|
|
+ $this->expectException(ZipEntryNotFoundException::class);
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->deleteFromName('entry');
|
|
@@ -674,7 +674,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
|
|
|
public function testDeleteFromGlobFailNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->deleteFromGlob(null);
|
|
@@ -682,7 +682,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
|
|
|
public function testDeleteFromGlobFailEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->deleteFromGlob('');
|
|
@@ -722,7 +722,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
|
|
|
public function testDeleteFromRegexFailNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->deleteFromRegex(null);
|
|
@@ -730,7 +730,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
|
|
|
public function testDeleteFromRegexFailEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->deleteFromRegex('');
|
|
@@ -806,7 +806,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testVeryLongArchiveComment()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class);
|
|
|
+ $this->expectException(InvalidArgumentException::class);
|
|
|
|
|
|
$comment = 'Very long comment' . \PHP_EOL .
|
|
|
'Очень длинный комментарий' . \PHP_EOL;
|
|
@@ -898,7 +898,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testVeryLongEntryComment()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Comment too long');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Comment too long');
|
|
|
|
|
|
$comment = 'Very long comment' . \PHP_EOL .
|
|
|
'Очень длинный комментарий' . \PHP_EOL;
|
|
@@ -914,7 +914,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testSetEntryCommentNotFoundEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipEntryNotFoundException::class);
|
|
|
+ $this->expectException(ZipEntryNotFoundException::class);
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->setEntryComment('test', 'comment');
|
|
@@ -979,7 +979,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testSetInvalidCompressionLevel($compressionLevel)
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
InvalidArgumentException::class,
|
|
|
'Invalid compression level. Minimum level 1. Maximum level 9'
|
|
|
);
|
|
@@ -1131,7 +1131,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testExtractFail()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'not found');
|
|
|
+ $this->expectException(ZipException::class, 'not found');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['file'] = 'content';
|
|
@@ -1147,7 +1147,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testExtractFail2()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'Destination is not directory');
|
|
|
+ $this->expectException(ZipException::class, 'Destination is not directory');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['file'] = 'content';
|
|
@@ -1163,7 +1163,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testExtractFail3()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'Destination is not writable directory');
|
|
|
+ $this->expectException(ZipException::class, 'Destination is not writable directory');
|
|
|
|
|
|
if (static::skipTestForRootUser()) {
|
|
|
return;
|
|
@@ -1186,7 +1186,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromArrayAccessNullName()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
InvalidArgumentException::class,
|
|
|
'Key must not be null, but must contain the name of the zip entry.'
|
|
|
);
|
|
@@ -1200,7 +1200,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromArrayAccessEmptyName()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
InvalidArgumentException::class,
|
|
|
'Key is empty, but must contain the name of the zip entry.'
|
|
|
);
|
|
@@ -1214,7 +1214,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStringNullContents()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Contents is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Contents is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFromString('file', null);
|
|
@@ -1225,7 +1225,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStringNullEntryName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Entry name is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Entry name is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFromString(null, 'contents');
|
|
@@ -1236,7 +1236,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStringUnsupportedMethod()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipUnsupportMethodException::class,
|
|
|
'Compression method 99 (AES Encryption) is not supported.'
|
|
|
);
|
|
@@ -1251,7 +1251,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStringEmptyEntryName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFromString('', 'contents');
|
|
@@ -1292,7 +1292,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStreamInvalidResource()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Stream is not resource');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Stream is not resource');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
/** @noinspection PhpParamsInspection */
|
|
@@ -1304,7 +1304,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStreamEmptyEntryName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
|
|
|
$handle = fopen(__FILE__, 'rb');
|
|
|
|
|
@@ -1317,7 +1317,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFromStreamUnsupportedMethod()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipUnsupportMethodException::class,
|
|
|
'Compression method 99 (AES Encryption) is not supported.'
|
|
|
);
|
|
@@ -1367,7 +1367,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFileNullFileName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Filename is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Filename is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFile(null);
|
|
@@ -1378,7 +1378,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFileCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'File path/to/file is not readable');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'File path/to/file is not readable');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFile('path/to/file');
|
|
@@ -1389,7 +1389,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFileUnsupportedMethod()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipUnsupportMethodException::class,
|
|
|
'Compression method 99 (AES Encryption) is not supported.'
|
|
|
);
|
|
@@ -1412,7 +1412,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'is not readable');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'is not readable');
|
|
|
|
|
|
static::assertNotFalse(file_put_contents($this->outputFilename, ''));
|
|
|
static::assertTrue(chmod($this->outputFilename, 0244));
|
|
@@ -1426,7 +1426,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirNullDirname()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDir(null);
|
|
@@ -1437,7 +1437,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirEmptyDirname()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDir('');
|
|
@@ -1448,7 +1448,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDir(uniqid('', false));
|
|
@@ -1459,7 +1459,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirRecursiveNullDirname()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDirRecursive(null);
|
|
@@ -1470,7 +1470,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirRecursiveEmptyDirname()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDirRecursive('');
|
|
@@ -1481,7 +1481,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddDirRecursiveCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addDirRecursive(uniqid('', false));
|
|
@@ -1492,7 +1492,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlob(null, '*.png');
|
|
@@ -1503,7 +1503,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlob('', '*.png');
|
|
@@ -1514,7 +1514,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlob('path/to/path', '*.png');
|
|
@@ -1525,7 +1525,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobNullPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlob(__DIR__, null);
|
|
@@ -1536,7 +1536,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobEmptyPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlob(__DIR__, '');
|
|
@@ -1547,7 +1547,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobRecursiveNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Input dir is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive(null, '*.png');
|
|
@@ -1558,7 +1558,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobRecursiveEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive('', '*.png');
|
|
@@ -1569,7 +1569,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobRecursiveCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive('path/to/path', '*.png');
|
|
@@ -1580,7 +1580,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobRecursiveNullPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive(__DIR__, null);
|
|
@@ -1591,7 +1591,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromGlobRecursiveEmptyPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The glob pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive(__DIR__, '');
|
|
@@ -1602,7 +1602,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexDirectoryNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegex(null, '~\.png$~i');
|
|
@@ -1613,7 +1613,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexDirectoryEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegex('', '~\.png$~i');
|
|
@@ -1624,7 +1624,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegex('path/to/path', '~\.png$~i');
|
|
@@ -1635,7 +1635,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexNullPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegex(__DIR__, null);
|
|
@@ -1646,7 +1646,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexEmptyPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegex(__DIR__, '');
|
|
@@ -1657,7 +1657,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexRecursiveDirectoryNull()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegexRecursive(null, '~\.png$~i');
|
|
@@ -1668,7 +1668,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexRecursiveEmpty()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The input directory is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegexRecursive('', '~\.png$~i');
|
|
@@ -1679,7 +1679,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexRecursiveCantExists()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'does not exist');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'does not exist');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromGlobRecursive('path/to/path', '~\.png$~i');
|
|
@@ -1690,7 +1690,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexRecursiveNullPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegexRecursive(__DIR__, null);
|
|
@@ -1701,7 +1701,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddFilesFromRegexRecursiveEmptyPattern()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'The regex pattern is not specified');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFilesFromRegexRecursive(__DIR__, '');
|
|
@@ -1712,7 +1712,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testSaveAsStreamBadStream()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'handle is not resource');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'handle is not resource');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
/** @noinspection PhpParamsInspection */
|
|
@@ -1894,7 +1894,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddEmptyDirNullName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Entry name is null');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Entry name is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addEmptyDir(null);
|
|
@@ -1905,7 +1905,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testAddEmptyDirEmptyName()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Empty entry name');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addEmptyDir('');
|
|
@@ -1913,7 +1913,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
|
|
|
public function testNotFoundEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipEntryNotFoundException::class, '"bad entry name"');
|
|
|
+ $this->expectException(ZipEntryNotFoundException::class, '"bad entry name"');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['bad entry name'];
|
|
@@ -1960,7 +1960,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRewriteString()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'Overwrite is only supported for open local files');
|
|
|
+ $this->expectException(ZipException::class, 'Overwrite is only supported for open local files');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile['file'] = 'content';
|
|
@@ -1986,7 +1986,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testRewriteNullStream()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'input stream is null');
|
|
|
+ $this->expectException(ZipException::class, 'input stream is null');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->rewrite();
|
|
@@ -2177,7 +2177,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testInvalidCompressionLevel()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Invalid compression level');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Invalid compression level');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFromString('file', 'content');
|
|
@@ -2189,7 +2189,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testInvalidCompressionLevelEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(InvalidArgumentException::class, 'Invalid compression level');
|
|
|
+ $this->expectException(InvalidArgumentException::class, 'Invalid compression level');
|
|
|
|
|
|
$zipFile = new ZipFile();
|
|
|
$zipFile->addFromString('file', 'content');
|
|
@@ -2249,7 +2249,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testInvalidCompressionMethodEntry()
|
|
|
{
|
|
|
- $this->setExpectedException(
|
|
|
+ $this->expectException(
|
|
|
ZipUnsupportMethodException::class,
|
|
|
'Compression method 99 (AES Encryption) is not supported.'
|
|
|
);
|
|
@@ -2428,7 +2428,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
{
|
|
|
for ($i = 0; $i < 2; $i++) {
|
|
|
$fp = $zipFile->getEntryStream($entryName);
|
|
|
- static::assertInternalType('resource', $fp);
|
|
|
+ static::assertIsResource($fp);
|
|
|
static::assertSame(stream_get_contents($fp), $contents);
|
|
|
fclose($fp);
|
|
|
}
|
|
@@ -2566,7 +2566,7 @@ class ZipFileTest extends ZipTestCase
|
|
|
*/
|
|
|
public function testNoData()
|
|
|
{
|
|
|
- $this->setExpectedException(ZipException::class, 'No data for zip entry file');
|
|
|
+ $this->expectException(ZipException::class, 'No data for zip entry file');
|
|
|
|
|
|
$entryName = 'file';
|
|
|
|