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 2020 "ext-sockets" : " *" ,
2121 "friendsofphp/php-cs-fixer" : " ^2.14" ,
2222 "monolog/monolog" : " ^1.24|^2.0" ,
23- "phpunit/phpunit" : " ^7.1|^8" ,
23+ "phpunit/phpunit" : " ^7.1|^8|^9 " ,
2424 "psr/log" : " ^1.1" ,
2525 "rybakit/msgpack" : " ^0.7" ,
2626 "vimeo/psalm" : " ^3.9"
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public function testParseGreetingWithInvalidSalt(string $greeting) : void
6363 $ client = $ clientBuilder ->setOptions (['username ' => 'guest ' ])->build ();
6464
6565 $ 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)/ ' );
6767
6868 $ client ->ping ();
6969 }
Original file line number Diff line number Diff line change 2121use Tarantool \Client \Exception \CommunicationFailed ;
2222use Tarantool \Client \Handler \Handler ;
2323use Tarantool \Client \Request \Request ;
24+ use Tarantool \Client \Tests \PhpUnitCompat ;
2425
2526abstract class TestCase extends BaseTestCase
2627{
28+ use PhpUnitCompat;
29+
2730 protected const STAT_REQUEST_SELECT = 'SELECT ' ;
2831 protected const STAT_REQUEST_AUTH = 'AUTH ' ;
2932
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 1616use Tarantool \Client \Keys ;
1717use Tarantool \Client \Packer \Packer ;
1818use Tarantool \Client \Packer \PeclPacker ;
19+ use Tarantool \Client \Tests \PhpUnitCompat ;
1920
2021/**
2122 * @requires extension msgpack
2223 */
2324final class PeclPackerTest extends PackerTest
2425{
26+ use PhpUnitCompat;
27+
2528 protected function createPacker () : Packer
2629 {
2730 return new PeclPacker ();
@@ -33,7 +36,7 @@ protected function createPacker() : Packer
3336 public function testThrowExceptionOnBadUnpackData (string $ data ) : void
3437 {
3538 $ this ->expectException (\RuntimeException::class);
36- $ this ->expectExceptionMessageRegExp ('/Unable to unpack response (header|body)/ ' );
39+ $ this ->expectExceptionMessageMatches ('/Unable to unpack response (header|body)/ ' );
3740
3841 $ this ->packer ->unpack ($ data )->tryGetBodyField (Keys::DATA );
3942 }
You can’t perform that action at this time.
0 commit comments