Skip to content

Commit 9c28af0

Browse files
committed
fix test failures
1 parent 3db3a13 commit 9c28af0

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/VerifierException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class VerifierException extends \RuntimeException {
99
public function __construct($message = '', array $failures = [], $code = 0, Throwable $previous = NULL)
1010
{
1111
parent::__construct($message, $code, $previous);
12-
$this->failures = $verificationFailures;
12+
$this->failures = $failures;
1313
}
1414

1515
public function getVerificationFailures()

tests/SignifyTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,14 @@ public function testChecksumFileCompromisedArchive()
134134
$public_key = file_get_contents(__DIR__ . '/fixtures/checksumlist.pub');
135135
$var = new Verifier($public_key);
136136
$this->expectException(VerifierException::class);
137-
$this->expectExceptionMessage('File "payload-compromised.zip" does not pass checksum verification.');
138-
$var->verifyChecksumFile(__DIR__ . '/fixtures/checksumlist-compromised.sig');
137+
$this->expectExceptionMessage('Checksum list could not be verified.');
138+
try {
139+
$var->verifyChecksumFile(__DIR__ . '/fixtures/checksumlist-compromised.sig');
140+
}
141+
catch (VerifierException $exception) {
142+
$this->assertEquals('File "payload-compromised.zip" does not pass checksum verification.', $exception->getVerificationFailures()[0]);
143+
throw $exception;
144+
}
139145
}
140146

141147
/**
@@ -168,8 +174,14 @@ public function testChecksumListUnreadableFile()
168174
$var = new Verifier($public_key);
169175
$signed_checksumlist = file_get_contents(__DIR__ . '/fixtures/checksumlist.sig');
170176
$this->expectException(VerifierException::class);
171-
$this->expectExceptionMessage('File "payload.zip" in the checksum list could not be read.');
172-
$var->verifyChecksumList($signed_checksumlist, __DIR__ . '/intentionally wrong path');
177+
$this->expectExceptionMessage('Checksum list could not be verified.');
178+
try {
179+
$var->verifyChecksumList($signed_checksumlist, __DIR__ . '/intentionally wrong path');
180+
}
181+
catch (VerifierException $exception) {
182+
$this->assertEquals('File "payload.zip" in the checksum list could not be read.', $exception->getVerificationFailures()[0]);
183+
throw $exception;
184+
}
173185
}
174186

175187
public function testDefaultGetNow()

0 commit comments

Comments
 (0)