diff --git a/test/Compress/SnappyTest.php b/test/Compress/SnappyTest.php index f8e5500a..2cd4db09 100644 --- a/test/Compress/SnappyTest.php +++ b/test/Compress/SnappyTest.php @@ -44,12 +44,15 @@ public function testANonStringWillYieldATypeErrorDuringCompression(): void throw new TypeError($message); }); - $this->expectException(TypeError::class); - $this->expectExceptionMessage('snappy_compress : expects parameter to be string'); - /** @psalm-suppress InvalidArgument, InvalidCast */ - (new SnappyCompression())->compress([]); - - restore_error_handler(); + try { + /** @psalm-suppress InvalidArgument, InvalidCast */ + (new SnappyCompression())->compress([]); + self::fail('An exception was expected'); + } catch (TypeError $e) { + self::assertStringContainsString('snappy_compress : expects parameter to be string', $e->getMessage()); + } finally { + restore_error_handler(); + } } public function testNonScalarInputCausesAnException(): void