File tree Expand file tree Collapse file tree 6 files changed +43
-40
lines changed Expand file tree Collapse file tree 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 11language : php
22
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-
133# lock distro so new future defaults will not break the build
144dist : trusty
155
166matrix :
177 include :
188 - php : 5.3
199 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
2019 allow_failures :
21- - php : hhvm
20+ - php : hhvm-3.18
2221
2322sudo : false
2423
Original file line number Diff line number Diff line change 1717 "rize/uri-template" : " ^0.3"
1818 },
1919 "require-dev" : {
20- "phpunit/phpunit" : " ^6.0 || ^5.7 || ^4.8.35"
20+ "phpunit/phpunit" : " ^7.0 || ^ 6.0 || ^5.7 || ^4.8.35"
2121 },
2222 "autoload" : {
2323 "psr-4" : { "Clue\\ React\\ Packagist\\ Api\\ " : " src/" }
24+ },
25+ "autoload-dev" : {
26+ "psr-4" : { "Clue\\ Tests\\ React\\ Api\\ " : " tests/" }
2427 }
2528}
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22
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" >
94 <testsuites >
105 <testsuite name =" Packagist React Test Suite" >
116 <directory >./tests/</directory >
1611 <directory >./src/</directory >
1712 </whitelist >
1813 </filter >
19- </phpunit >
14+ </phpunit >
Original file line number Diff line number Diff line change 11<?php
22
3+ namespace Clue \Tests \React \Api ;
4+
35use Clue \React \Packagist \Api \Client ;
46use React \Promise \Deferred ;
57use RingCentral \Psr7 \Response ;
@@ -68,7 +70,7 @@ public function testSearchPagination()
6870 public function testSearchRejectsWhenRequestRejects ()
6971 {
7072 $ this ->browser ->expects ($ this ->once ())->method ('get ' )->willReturn (
71- $ this ->createRejectedPromise (new RuntimeException ())
73+ $ this ->createRejectedPromise (new \ RuntimeException ())
7274 );
7375
7476 $ promise = $ this ->client ->search ('foo ' );
@@ -103,7 +105,7 @@ public function testSearchCancelPendingPromiseWillCancelNextRequestWhenInitialIs
103105
104106 public function testHttpError ()
105107 {
106- $ this ->setupBrowser ('/packages/clue%2Finvalid.json ' , $ this ->createRejectedPromise (new RuntimeException ('error ' )));
108+ $ this ->setupBrowser ('/packages/clue%2Finvalid.json ' , $ this ->createRejectedPromise (new \ RuntimeException ('error ' )));
107109
108110 $ this ->expectPromiseReject ($ this ->client ->get ('clue/invalid ' ));
109111 }
Original file line number Diff line number Diff line change 11<?php
22
3- use PHPUnit \ Framework \ TestCase as BaseTestCase ;
3+ namespace Clue \ Tests \ React \ Api ;
44
5- require_once __DIR__ . ' /../vendor/autoload.php ' ;
5+ use PHPUnit \ Framework \ TestCase as BaseTestCase ;
66
77class TestCase extends BaseTestCase
88{
99 protected function expectCallableOnce ()
1010 {
1111 $ mock = $ this ->createCallableMock ();
1212
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 ();
1323
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 );
2428
2529 return $ mock ;
2630 }
@@ -37,13 +41,7 @@ protected function expectCallableNever()
3741
3842 protected function expectCallableOnceParameter ($ type )
3943 {
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 ));
4745 }
4846
4947 protected function createCallableMock ()
You can’t perform that action at this time.
0 commit comments