<?php


namespace CubiStore\Tests\Web\Utils;


use CubiStore\Web\Utils\ApkSignUtils;
use PHPUnit\Framework\TestCase;

class ApkSignUtilsTest extends TestCase
{
    function testCorruptedZip64() {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage("Corrupted ZIP, ZIP64 offset and normal offset don't match up.");
        $utils = new ApkSignUtils();
        $utils->findSignature(__DIR__ . '/../../var/testdata/signedapks/zip64corrupted.jar');
    }

    function testSha1Signature()
    {
        $utils = new ApkSignUtils();
        $apkSignature = $utils->findSignature(__DIR__ . '/../../var/testdata/signedapks/sha1.apk');
        $this->assertNotNull($apkSignature, "Couldn't find APK signature");
    }
}