expectNotToPerformAssertions(); $expectation->verify(); } public function testVerifyFailsWithFileThatDoesNotExist(): void { $expectation = new BinaryFile( '/path/to/a/file/that/does/not/exist', self::TEST_FILE_HASH, ); $this->expectException(FileNotFound::class); $expectation->verify(); } public function testVerifyFailsWithWrongHash(): void { $expectation = new BinaryFile( self::TEST_FILE, 'another hash that is wrong', ); $this->expectException(BinaryFileFailedVerification::class); $this->expectExceptionMessageMatches('/File "[^"]+" failed checksum verification\. Expected [^\.]+\.\.\., was [^\.]+\.\.\./'); $expectation->verify(); } public function testVerifyFailsWithDifferentFile(): void { $expectation = new BinaryFile( self::TEST_FILE, self::TEST_FILE_HASH, ); $this->expectException(BinaryFileFailedVerification::class); $this->expectExceptionMessageMatches('/Expected file "[^"]+" but actual file was "[^"]+"/'); $expectation->verifyAgainstOther(new BinaryFile( __FILE__, self::TEST_FILE_HASH, )); } }