mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-01-16 23:08:14 +01:00
fix test
This commit is contained in:
parent
ac3533dece
commit
c9130665cd
@ -15,7 +15,7 @@ use PhpZip\ZipFile;
|
||||
*
|
||||
* @small
|
||||
*/
|
||||
class PhpZipExtResourceTest extends ZipTestCase
|
||||
final class PhpZipExtResourceTest extends ZipTestCase
|
||||
{
|
||||
/**
|
||||
* Bug #7214 (zip_entry_read() binary safe).
|
||||
@ -33,11 +33,11 @@ class PhpZipExtResourceTest extends ZipTestCase
|
||||
|
||||
foreach ($zipFile as $name => $contents) {
|
||||
$info = $zipFile->getEntryInfo($name);
|
||||
static::assertSame(\strlen($contents), $info->getSize());
|
||||
self::assertSame(\strlen($contents), $info->getSize());
|
||||
}
|
||||
$zipFile->close();
|
||||
|
||||
static::assertCorrectZipArchive($filename);
|
||||
self::assertCorrectZipArchive($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,13 +57,13 @@ class PhpZipExtResourceTest extends ZipTestCase
|
||||
$zipFile->saveAsFile($this->outputFilename);
|
||||
$zipFile->close();
|
||||
|
||||
static::assertCorrectZipArchive($this->outputFilename);
|
||||
self::assertCorrectZipArchive($this->outputFilename);
|
||||
|
||||
$zipFile->openFile($this->outputFilename);
|
||||
static::assertCount(2, $zipFile);
|
||||
static::assertTrue(isset($zipFile['1.txt']));
|
||||
static::assertTrue(isset($zipFile['2.txt']));
|
||||
static::assertSame($zipFile['2.txt'], $zipFile['1.txt']);
|
||||
self::assertCount(2, $zipFile);
|
||||
self::assertTrue(isset($zipFile['1.txt']));
|
||||
self::assertTrue(isset($zipFile['2.txt']));
|
||||
self::assertSame($zipFile['2.txt'], $zipFile['1.txt']);
|
||||
$zipFile->close();
|
||||
}
|
||||
|
||||
@ -80,14 +80,14 @@ class PhpZipExtResourceTest extends ZipTestCase
|
||||
*/
|
||||
public function testBug40228($filename)
|
||||
{
|
||||
static::assertTrue(mkdir($this->outputDirname, 0755, true));
|
||||
self::assertTrue(mkdir($this->outputDirname, 0755, true));
|
||||
|
||||
$zipFile = new ZipFile();
|
||||
$zipFile->openFile($filename);
|
||||
$zipFile->extractTo($this->outputDirname);
|
||||
$zipFile->close();
|
||||
|
||||
static::assertDirectoryExists($this->outputDirname . '/test/empty');
|
||||
self::assertDirectoryExists($this->outputDirname . '/test/empty');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,24 +129,16 @@ class PhpZipExtResourceTest extends ZipTestCase
|
||||
public function testBug70752()
|
||||
{
|
||||
if (\PHP_INT_SIZE === 4) { // php 32 bit
|
||||
$this->expectException(
|
||||
RuntimeException::class
|
||||
);
|
||||
$this->expectExceptionMessage(
|
||||
'Traditional PKWARE Encryption is not supported in 32-bit PHP.'
|
||||
);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Traditional PKWARE Encryption is not supported in 32-bit PHP.');
|
||||
} else { // php 64 bit
|
||||
$this->expectException(
|
||||
ZipAuthenticationException::class
|
||||
);
|
||||
$this->expectExceptionMessage(
|
||||
'Invalid password'
|
||||
);
|
||||
$this->expectException(ZipAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Invalid password');
|
||||
}
|
||||
|
||||
$filename = __DIR__ . '/resources/pecl/bug70752.zip';
|
||||
|
||||
static::assertTrue(mkdir($this->outputDirname, 0755, true));
|
||||
self::assertTrue(mkdir($this->outputDirname, 0755, true));
|
||||
|
||||
$zipFile = new ZipFile();
|
||||
$zipFile->openFile($filename);
|
||||
@ -154,9 +146,9 @@ class PhpZipExtResourceTest extends ZipTestCase
|
||||
|
||||
try {
|
||||
$zipFile->extractTo($this->outputDirname);
|
||||
static::markTestIncomplete('failed test');
|
||||
self::markTestIncomplete('failed test');
|
||||
} catch (ZipException $exception) {
|
||||
static::assertFileDoesNotExist($this->outputDirname . '/bug70752.txt');
|
||||
self::assertFileDoesNotExist($this->outputDirname . '/bug70752.txt');
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ trait PhpUnit9CompatTrait
|
||||
public static function assertFileDoesNotExist(string $filename, string $message = ''): void
|
||||
{
|
||||
if (version_compare(Version::id(), '9.1.0', '<')) {
|
||||
static::assertFileNotExists($filename, $message);
|
||||
self::assertFileNotExists($filename, $message);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -46,7 +46,7 @@ trait PhpUnit9CompatTrait
|
||||
public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void
|
||||
{
|
||||
if (version_compare(Version::id(), '9.1.0', '<')) {
|
||||
static::assertDirectoryNotExists($directory, $message);
|
||||
self::assertDirectoryNotExists($directory, $message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -450,8 +450,6 @@ class ZipFileTest extends ZipTestCase
|
||||
{
|
||||
if (!\function_exists('mime_content_type')) {
|
||||
static::markTestSkipped('Function mime_content_type not exists');
|
||||
|
||||
return;
|
||||
}
|
||||
$outputFilename = $this->outputFilename;
|
||||
$this->outputFilename .= '.gif';
|
||||
|
Loading…
x
Reference in New Issue
Block a user