forked from clue/reactphp-zlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecompressorTest.php
More file actions
34 lines (26 loc) · 945 Bytes
/
DecompressorTest.php
File metadata and controls
34 lines (26 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Clue\Tests\React\Zlib;
use Clue\React\Zlib\Decompressor;
class DecompressorTest extends TestCase
{
public function testCtorThrowsForInvalidEncoding()
{
$this->expectException(PHP_VERSION_ID >= 80000 ? \ValueError::class : \InvalidArgumentException::class);
new Decompressor(0);
}
public function testCtorThrowsForInvalidEncodingAndUnsetsUsedErrorHandler()
{
$handler = set_error_handler(function(){});
restore_error_handler();
try {
new Decompressor(0);
} catch (\ValueError $e) {
// handle Error to unset Error handler afterwards (PHP >= 8.0)
} catch (\InvalidArgumentException $e) {
// handle Error to unset Error handler afterwards (PHP < 8.0)
}
$checkHandler = set_error_handler(function(){});
restore_error_handler();
$this->assertEquals($handler, $checkHandler);
}
}