Release of v5.1.1-alpha1

Move all banners to GitHub. Adds library phpspreadsheet to JCB. Adds import item example to demo component. Updates the Superpower class with the GetRemote class in the plugin. Ensures the super power autoloader triggers the correct repositories.
This commit is contained in:
2025-03-04 21:50:18 +00:00
parent 442263e387
commit 06185f8c3a
1141 changed files with 193033 additions and 158 deletions

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace ZipStream\Test\Zip64;
use PHPUnit\Framework\TestCase;
use ZipStream\Zip64\DataDescriptor;
class DataDescriptorTest extends TestCase
{
public function testSerializesCorrectly(): void
{
$descriptor = DataDescriptor::generate(
crc32UncompressedData: 0x11111111,
compressedSize: (0x77777777 << 32) + 0x66666666,
uncompressedSize: (0x99999999 << 32) + 0x88888888,
);
$this->assertSame(
bin2hex($descriptor),
'504b0708' . // 4 bytes; Optional data descriptor signature = 0x08074b50
'11111111' . // 4 bytes; CRC-32 of uncompressed data
'6666666677777777' . // 8 bytes; Compressed size
'8888888899999999' // 8 bytes; Uncompressed size
);
}
}

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace ZipStream\Test\Zip64;
use PHPUnit\Framework\TestCase;
use ZipStream\Zip64\EndOfCentralDirectoryLocator;
class EndOfCentralDirectoryLocatorTest extends TestCase
{
public function testSerializesCorrectly(): void
{
$descriptor = EndOfCentralDirectoryLocator::generate(
numberOfTheDiskWithZip64CentralDirectoryStart: 0x11111111,
zip64centralDirectoryStartOffsetOnDisk: (0x22222222 << 32) + 0x33333333,
totalNumberOfDisks: 0x44444444,
);
$this->assertSame(
bin2hex($descriptor),
'504b0607' . // 4 bytes; zip64 end of central dir locator signature - 0x07064b50
'11111111' . // 4 bytes; number of the disk with the start of the zip64 end of central directory
'3333333322222222' . // 28 bytes; relative offset of the zip64 end of central directory record
'44444444' // 4 bytes;total number of disks
);
}
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace ZipStream\Test\Zip64;
use PHPUnit\Framework\TestCase;
use ZipStream\Zip64\EndOfCentralDirectory;
class EndOfCentralDirectoryTest extends TestCase
{
public function testSerializesCorrectly(): void
{
$descriptor = EndOfCentralDirectory::generate(
versionMadeBy: 0x3333,
versionNeededToExtract: 0x4444,
numberOfThisDisk: 0x55555555,
numberOfTheDiskWithCentralDirectoryStart: 0x66666666,
numberOfCentralDirectoryEntriesOnThisDisk: (0x77777777 << 32) + 0x88888888,
numberOfCentralDirectoryEntries: (0x99999999 << 32) + 0xAAAAAAAA,
sizeOfCentralDirectory: (0xBBBBBBBB << 32) + 0xCCCCCCCC,
centralDirectoryStartOffsetOnDisk: (0xDDDDDDDD << 32) + 0xEEEEEEEE,
extensibleDataSector: 'foo',
);
$this->assertSame(
bin2hex($descriptor),
'504b0606' . // 4 bytes;zip64 end of central dir signature - 0x06064b50
'2f00000000000000' . // 8 bytes; size of zip64 end of central directory record
'3333' . // 2 bytes; version made by
'4444' . // 2 bytes; version needed to extract
'55555555' . // 4 bytes; number of this disk
'66666666' . // 4 bytes; number of the disk with the start of the central directory
'8888888877777777' . // 8 bytes; total number of entries in the central directory on this disk
'aaaaaaaa99999999' . // 8 bytes; total number of entries in the central directory
'ccccccccbbbbbbbb' . // 8 bytes; size of the central directory
'eeeeeeeedddddddd' . // 8 bytes; offset of start of central directory with respect to the starting disk number
bin2hex('foo')
);
}
}

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace ZipStream\Test\Zip64;
use PHPUnit\Framework\TestCase;
use ZipStream\Zip64\ExtendedInformationExtraField;
class ExtendedInformationExtraFieldTest extends TestCase
{
public function testSerializesCorrectly(): void
{
$extraField = ExtendedInformationExtraField::generate(
originalSize: (0x77777777 << 32) + 0x66666666,
compressedSize: (0x99999999 << 32) + 0x88888888,
relativeHeaderOffset: (0x22222222 << 32) + 0x11111111,
diskStartNumber: 0x33333333,
);
$this->assertSame(
bin2hex($extraField),
'0100' . // 2 bytes; Tag for this "extra" block type
'1c00' . // 2 bytes; Size of this "extra" block
'6666666677777777' . // 8 bytes; Original uncompressed file size
'8888888899999999' . // 8 bytes; Size of compressed data
'1111111122222222' . // 8 bytes; Offset of local header record
'33333333' // 4 bytes; Number of the disk on which this file starts
);
}
public function testSerializesEmptyCorrectly(): void
{
$extraField = ExtendedInformationExtraField::generate();
$this->assertSame(
bin2hex($extraField),
'0100' . // 2 bytes; Tag for this "extra" block type
'0000' // 2 bytes; Size of this "extra" block
);
}
}