1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-07-30 20:20:11 +02:00

Changed the algorithm for adding paddings to zipalign.

Now we will use the special field ExtraField c ID 0xD935,
which was implemented by Google in the apksigner library.
Now this field corresponds to the ZIP standard for storing
ExtraField records, and not just filling with zero bytes,
as in the zipalign console utility.
This commit is contained in:
Ne-Lexa
2017-11-17 10:54:22 +03:00
parent d67fc4db7d
commit a3083b821c
13 changed files with 384 additions and 108 deletions

View File

@@ -9,28 +9,15 @@ use PhpZip\Util\CryptoUtil;
*/
class ZipAlignTest extends ZipTestCase
{
public function testApkAlignedAndReSave()
{
$filename = __DIR__ . '/resources/test.apk';
self::assertCorrectZipArchive($filename);
self::doZipAlignVerify($this->outputFilename);
$zipFile = new ZipFile();
$zipFile->openFile($filename);
$zipFile->saveAsFile($this->outputFilename);
$zipFile->close();
self::assertCorrectZipArchive($this->outputFilename);
self::doZipAlignVerify($this->outputFilename);
}
public function testApkAlignedAndSetZipAlignAndReSave()
{
$filename = __DIR__ . '/resources/test.apk';
self::assertCorrectZipArchive($filename);
self::doZipAlignVerify($this->outputFilename);
$result = self::doZipAlignVerify($filename);
if (null !== $result) {
self::assertTrue($result);
}
$zipFile = new ZipFile();
$zipFile->openFile($filename);
@@ -39,7 +26,10 @@ class ZipAlignTest extends ZipTestCase
$zipFile->close();
self::assertCorrectZipArchive($this->outputFilename);
self::doZipAlignVerify($this->outputFilename);
$result = self::doZipAlignVerify($this->outputFilename, true);
if (null !== $result) {
self::assertTrue($result);
}
}
/**