File tree Expand file tree Collapse file tree 5 files changed +40
-3
lines changed Expand file tree Collapse file tree 5 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 20
20
"ext-sockets" : " *" ,
21
21
"friendsofphp/php-cs-fixer" : " ^2.14" ,
22
22
"monolog/monolog" : " ^1.24|^2.0" ,
23
- "phpunit/phpunit" : " ^7.1|^8" ,
23
+ "phpunit/phpunit" : " ^7.1|^8|^9 " ,
24
24
"psr/log" : " ^1.1" ,
25
25
"rybakit/msgpack" : " ^0.7" ,
26
26
"vimeo/psalm" : " ^3.9"
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public function testParseGreetingWithInvalidSalt(string $greeting) : void
63
63
$ client = $ clientBuilder ->setOptions (['username ' => 'guest ' ])->build ();
64
64
65
65
$ this ->expectException (\RuntimeException::class);
66
- $ this ->expectExceptionMessageRegExp ('/(Unable to decode salt|Salt is too short)/ ' );
66
+ $ this ->expectExceptionMessageMatches ('/(Unable to decode salt|Salt is too short)/ ' );
67
67
68
68
$ client ->ping ();
69
69
}
Original file line number Diff line number Diff line change 21
21
use Tarantool \Client \Exception \CommunicationFailed ;
22
22
use Tarantool \Client \Handler \Handler ;
23
23
use Tarantool \Client \Request \Request ;
24
+ use Tarantool \Client \Tests \PhpUnitCompat ;
24
25
25
26
abstract class TestCase extends BaseTestCase
26
27
{
28
+ use PhpUnitCompat;
29
+
27
30
protected const STAT_REQUEST_SELECT = 'SELECT ' ;
28
31
protected const STAT_REQUEST_AUTH = 'AUTH ' ;
29
32
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Tarantool Client package.
5
+ *
6
+ * (c) Eugene Leonovich <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ declare (strict_types=1 );
13
+
14
+ namespace Tarantool \Client \Tests ;
15
+
16
+ /**
17
+ * A compatibility layer for the legacy PHPUnit 7.
18
+ */
19
+ trait PhpUnitCompat
20
+ {
21
+ public function expectExceptionMessageMatches (string $ regularExpression ) : void
22
+ {
23
+ if (is_callable ('parent::expectExceptionMessageRegExp ' )) {
24
+ parent ::expectExceptionMessageRegExp ($ regularExpression );
25
+
26
+ return ;
27
+ }
28
+
29
+ parent ::expectExceptionMessageMatches ($ regularExpression );
30
+ }
31
+ }
Original file line number Diff line number Diff line change 16
16
use Tarantool \Client \Keys ;
17
17
use Tarantool \Client \Packer \Packer ;
18
18
use Tarantool \Client \Packer \PeclPacker ;
19
+ use Tarantool \Client \Tests \PhpUnitCompat ;
19
20
20
21
/**
21
22
* @requires extension msgpack
22
23
*/
23
24
final class PeclPackerTest extends PackerTest
24
25
{
26
+ use PhpUnitCompat;
27
+
25
28
protected function createPacker () : Packer
26
29
{
27
30
return new PeclPacker ();
@@ -33,7 +36,7 @@ protected function createPacker() : Packer
33
36
public function testThrowExceptionOnBadUnpackData (string $ data ) : void
34
37
{
35
38
$ this ->expectException (\RuntimeException::class);
36
- $ this ->expectExceptionMessageRegExp ('/Unable to unpack response (header|body)/ ' );
39
+ $ this ->expectExceptionMessageMatches ('/Unable to unpack response (header|body)/ ' );
37
40
38
41
$ this ->packer ->unpack ($ data )->tryGetBodyField (Keys::DATA );
39
42
}
You can’t perform that action at this time.
0 commit comments