File tree Expand file tree Collapse file tree 8 files changed +36
-26
lines changed Expand file tree Collapse file tree 8 files changed +36
-26
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ language: php
3
3
# lock distro so new future defaults will not break the build
4
4
dist : trusty
5
5
6
- matrix :
6
+ jobs :
7
7
include :
8
8
- php : 5.3
9
9
dist : precise
@@ -16,21 +16,17 @@ matrix:
16
16
- php : 7.3
17
17
- php : 7.4
18
18
- php : hhvm-3.18
19
- install :
20
- - composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit
21
19
allow_failures :
22
20
- php : hhvm-3.18
23
21
24
22
services :
25
23
- redis-server
26
24
27
- sudo : false
28
-
29
25
env :
30
26
- REDIS_URI=localhost
31
27
32
28
install :
33
- - composer install --no-interaction
29
+ - composer install
34
30
35
31
script :
36
32
- vendor/bin/phpunit --coverage-text
Original file line number Diff line number Diff line change 19
19
"react/promise-timer" : " ^1.5" ,
20
20
"react/socket" : " ^1.1"
21
21
},
22
+ "require-dev" : {
23
+ "clue/block-react" : " ^1.1" ,
24
+ "phpunit/phpunit" : " ^9.0 || ^5.7 || ^4.8.35"
25
+ },
22
26
"autoload" : {
23
27
"psr-4" : { "Clue\\ React\\ Redis\\ " : " src/" }
24
28
},
25
29
"autoload-dev" : {
26
30
"psr-4" : { "Clue\\ Tests\\ React\\ Redis\\ " : " tests/" }
27
- },
28
- "require-dev" : {
29
- "clue/block-react" : " ^1.1" ,
30
- "phpunit/phpunit" : " ^7.0 || ^6.0 || ^5.0 || ^4.8.35"
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ class FactoryLazyClientTest extends TestCase
11
11
private $ connector ;
12
12
private $ factory ;
13
13
14
- public function setUp ()
14
+ /**
15
+ * @before
16
+ */
17
+ public function setUpFactory ()
15
18
{
16
19
$ this ->loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
17
20
$ this ->connector = $ this ->getMockBuilder ('React\Socket\ConnectorInterface ' )->getMock ();
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ class FactoryStreamingClientTest extends TestCase
12
12
private $ connector ;
13
13
private $ factory ;
14
14
15
- public function setUp ()
15
+ /**
16
+ * @before
17
+ */
18
+ public function setUpFactory ()
16
19
{
17
20
$ this ->loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
18
21
$ this ->connector = $ this ->getMockBuilder ('React\Socket\ConnectorInterface ' )->getMock ();
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ class FunctionalTest extends TestCase
16
16
private $ factory ;
17
17
private $ uri ;
18
18
19
- public function setUp ()
19
+ /**
20
+ * @before
21
+ */
22
+ public function setUpFactory ()
20
23
{
21
24
$ this ->uri = getenv ('REDIS_URI ' );
22
25
if ($ this ->uri === false ) {
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ class LazyClientTest extends TestCase
21
21
private $ loop ;
22
22
private $ client ;
23
23
24
- public function setUp ()
24
+ /**
25
+ * @before
26
+ */
27
+ public function setUpClient ()
25
28
{
26
29
$ this ->factory = $ this ->getMockBuilder ('Clue\React\Redis\Factory ' )->disableOriginalConstructor ()->getMock ();
27
30
$ this ->loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ class StreamingClientTest extends TestCase
18
18
private $ serializer ;
19
19
private $ client ;
20
20
21
- public function setUp ()
21
+ /**
22
+ * @before
23
+ */
24
+ public function setUpClient ()
22
25
{
23
26
$ this ->stream = $ this ->getMockBuilder ('React\Stream\DuplexStreamInterface ' )->getMock ();
24
27
$ this ->parser = $ this ->getMockBuilder ('Clue\Redis\Protocol\Parser\ParserInterface ' )->getMock ();
Original file line number Diff line number Diff line change @@ -9,37 +9,36 @@ class TestCase extends BaseTestCase
9
9
protected function expectCallableOnce ()
10
10
{
11
11
$ mock = $ this ->createCallableMock ();
12
- $ mock
13
- ->expects ($ this ->once ())
14
- ->method ('__invoke ' );
12
+ $ mock ->expects ($ this ->once ())->method ('__invoke ' );
15
13
16
14
return $ mock ;
17
15
}
18
16
19
17
protected function expectCallableOnceWith ($ argument )
20
18
{
21
19
$ mock = $ this ->createCallableMock ();
22
- $ mock
23
- ->expects ($ this ->once ())
24
- ->method ('__invoke ' )
25
- ->with ($ argument );
20
+ $ mock ->expects ($ this ->once ())->method ('__invoke ' )->with ($ argument );
26
21
27
22
return $ mock ;
28
23
}
29
24
30
25
protected function expectCallableNever ()
31
26
{
32
27
$ mock = $ this ->createCallableMock ();
33
- $ mock
34
- ->expects ($ this ->never ())
35
- ->method ('__invoke ' );
28
+ $ mock ->expects ($ this ->never ())->method ('__invoke ' );
36
29
37
30
return $ mock ;
38
31
}
39
32
40
33
protected function createCallableMock ()
41
34
{
42
- return $ this ->getMockBuilder ('stdClass ' )->setMethods (array ('__invoke ' ))->getMock ();
35
+ if (method_exists ('PHPUnit\Framework\MockObject\MockBuilder ' , 'addMethods ' )) {
36
+ // PHPUnit 9+
37
+ return $ this ->getMockBuilder ('stdClass ' )->addMethods (array ('__invoke ' ))->getMock ();
38
+ } else {
39
+ // legacy PHPUnit 4 - PHPUnit 8
40
+ return $ this ->getMockBuilder ('stdClass ' )->setMethods (array ('__invoke ' ))->getMock ();
41
+ }
43
42
}
44
43
45
44
protected function expectPromiseResolve ($ promise )
You can’t perform that action at this time.
0 commit comments