mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-08-09 17:06:30 +02:00
zip extra fields tests
This commit is contained in:
55
tests/Extra/Fields/JarMarkerExtraFieldTest.php
Normal file
55
tests/Extra/Fields/JarMarkerExtraFieldTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace PhpZip\Tests\Extra\Fields;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PhpZip\Exception\ZipException;
|
||||
use PhpZip\Model\Extra\Fields\JarMarkerExtraField;
|
||||
|
||||
/**
|
||||
* Class JarMarkerExtraFieldTest.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @small
|
||||
*/
|
||||
final class JarMarkerExtraFieldTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @throws ZipException
|
||||
*/
|
||||
public function testExtraField()
|
||||
{
|
||||
$jarField = new JarMarkerExtraField();
|
||||
self::assertSame('', $jarField->packLocalFileData());
|
||||
self::assertSame('', $jarField->packCentralDirData());
|
||||
self::assertEquals(JarMarkerExtraField::unpackLocalFileData(''), $jarField);
|
||||
self::assertEquals(JarMarkerExtraField::unpackCentralDirData(''), $jarField);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ZipException
|
||||
*/
|
||||
public function testInvalidUnpackLocalData()
|
||||
{
|
||||
$this->setExpectedException(
|
||||
ZipException::class,
|
||||
"JarMarker doesn't expect any data"
|
||||
);
|
||||
|
||||
JarMarkerExtraField::unpackLocalFileData("\x02\x00\00");
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ZipException
|
||||
*/
|
||||
public function testInvalidUnpackCdData()
|
||||
{
|
||||
$this->setExpectedException(
|
||||
ZipException::class,
|
||||
"JarMarker doesn't expect any data"
|
||||
);
|
||||
|
||||
JarMarkerExtraField::unpackCentralDirData("\x02\x00\00");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user