forked from clue/reactphp-zlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompressorTest.php
More file actions
33 lines (26 loc) · 936 Bytes
/
CompressorTest.php
File metadata and controls
33 lines (26 loc) · 936 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
<?php
namespace Clue\Tests\React\Zlib;
use Clue\React\Zlib\Compressor;
class CompressorTest extends TestCase
{
public function testCtorThrowsForInvalidEncoding()
{
$this->expectException(PHP_VERSION_ID >= 80000 ? \ValueError::class : \InvalidArgumentException::class);
new Compressor(0);
}
public function testCtorThrowsForInvalidEncodingAndUnsetsUsedErrorHandler()
{
$handler = set_error_handler(function(){});
restore_error_handler();
try {
new Compressor(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);
}
}