File tree 6 files changed +43
-40
lines changed 6 files changed +43
-40
lines changed Original file line number Diff line number Diff line change
1
+ /.gitattributes export-ignore
2
+ /.gitignore export-ignore
3
+ /.travis.yml export-ignore
4
+ /examples / export-ignore
5
+ /phpunit.xml.dist export-ignore
6
+ /tests / export-ignore
Original file line number Diff line number Diff line change 1
1
language : php
2
2
3
- php :
4
- # - 5.3 # requires old distro
5
- - 5.4
6
- - 5.5
7
- - 5.6
8
- - 7.0
9
- - 7.1
10
- - 7.2
11
- - hhvm # ignore errors, see below
12
-
13
3
# lock distro so new future defaults will not break the build
14
4
dist : trusty
15
5
16
6
matrix :
17
7
include :
18
8
- php : 5.3
19
9
dist : precise
10
+ - php : 5.4
11
+ - php : 5.5
12
+ - php : 5.6
13
+ - php : 7.0
14
+ - php : 7.1
15
+ - php : 7.2
16
+ - php : 7.3
17
+ - php : 7.4
18
+ - php : hhvm-3.18
20
19
allow_failures :
21
- - php : hhvm
20
+ - php : hhvm-3.18
22
21
23
22
sudo : false
24
23
Original file line number Diff line number Diff line change 17
17
"rize/uri-template" : " ^0.3"
18
18
},
19
19
"require-dev" : {
20
- "phpunit/phpunit" : " ^6.0 || ^5.7 || ^4.8.35"
20
+ "phpunit/phpunit" : " ^7.0 || ^ 6.0 || ^5.7 || ^4.8.35"
21
21
},
22
22
"autoload" : {
23
23
"psr-4" : { "Clue\\ React\\ Packagist\\ Api\\ " : " src/" }
24
+ },
25
+ "autoload-dev" : {
26
+ "psr-4" : { "Clue\\ Tests\\ React\\ Api\\ " : " tests/" }
24
27
}
25
28
}
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
3
- <phpunit bootstrap =" tests/bootstrap.php"
4
- colors =" true"
5
- convertErrorsToExceptions =" true"
6
- convertNoticesToExceptions =" true"
7
- convertWarningsToExceptions =" true"
8
- >
3
+ <phpunit bootstrap =" vendor/autoload.php" colors =" true" >
9
4
<testsuites >
10
5
<testsuite name =" Packagist React Test Suite" >
11
6
<directory >./tests/</directory >
16
11
<directory >./src/</directory >
17
12
</whitelist >
18
13
</filter >
19
- </phpunit >
14
+ </phpunit >
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ namespace Clue \Tests \React \Api ;
4
+
3
5
use Clue \React \Packagist \Api \Client ;
4
6
use React \Promise \Deferred ;
5
7
use RingCentral \Psr7 \Response ;
@@ -68,7 +70,7 @@ public function testSearchPagination()
68
70
public function testSearchRejectsWhenRequestRejects ()
69
71
{
70
72
$ this ->browser ->expects ($ this ->once ())->method ('get ' )->willReturn (
71
- $ this ->createRejectedPromise (new RuntimeException ())
73
+ $ this ->createRejectedPromise (new \ RuntimeException ())
72
74
);
73
75
74
76
$ promise = $ this ->client ->search ('foo ' );
@@ -103,7 +105,7 @@ public function testSearchCancelPendingPromiseWillCancelNextRequestWhenInitialIs
103
105
104
106
public function testHttpError ()
105
107
{
106
- $ this ->setupBrowser ('/packages/clue%2Finvalid.json ' , $ this ->createRejectedPromise (new RuntimeException ('error ' )));
108
+ $ this ->setupBrowser ('/packages/clue%2Finvalid.json ' , $ this ->createRejectedPromise (new \ RuntimeException ('error ' )));
107
109
108
110
$ this ->expectPromiseReject ($ this ->client ->get ('clue/invalid ' ));
109
111
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PHPUnit \ Framework \ TestCase as BaseTestCase ;
3
+ namespace Clue \ Tests \ React \ Api ;
4
4
5
- require_once __DIR__ . ' /../vendor/autoload.php ' ;
5
+ use PHPUnit \ Framework \ TestCase as BaseTestCase ;
6
6
7
7
class TestCase extends BaseTestCase
8
8
{
9
9
protected function expectCallableOnce ()
10
10
{
11
11
$ mock = $ this ->createCallableMock ();
12
12
13
+ $ mock
14
+ ->expects ($ this ->once ())
15
+ ->method ('__invoke ' );
16
+
17
+ return $ mock ;
18
+ }
19
+
20
+ protected function expectCallableOnceWith ($ value )
21
+ {
22
+ $ mock = $ this ->createCallableMock ();
13
23
14
- if (func_num_args () > 0 ) {
15
- $ mock
16
- ->expects ($ this ->once ())
17
- ->method ('__invoke ' )
18
- ->with ($ this ->equalTo (func_get_arg (0 )));
19
- } else {
20
- $ mock
21
- ->expects ($ this ->once ())
22
- ->method ('__invoke ' );
23
- }
24
+ $ mock
25
+ ->expects ($ this ->once ())
26
+ ->method ('__invoke ' )
27
+ ->with ($ value );
24
28
25
29
return $ mock ;
26
30
}
@@ -37,13 +41,7 @@ protected function expectCallableNever()
37
41
38
42
protected function expectCallableOnceParameter ($ type )
39
43
{
40
- $ mock = $ this ->createCallableMock ();
41
- $ mock
42
- ->expects ($ this ->once ())
43
- ->method ('__invoke ' )
44
- ->with ($ this ->isInstanceOf ($ type ));
45
-
46
- return $ mock ;
44
+ return $ this ->expectCallableOnceWith ($ this ->isInstanceOf ($ type ));
47
45
}
48
46
49
47
protected function createCallableMock ()
You can’t perform that action at this time.
0 commit comments