File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
4
4
5
+ ## 2.0.2
6
+
7
+ ### Fixed
8
+
9
+ - Bug with double slashes when using enterprise URL.
5
10
6
11
## 2.0.0
7
12
Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ private function setEnterpriseUrl($enterpriseUrl)
315
315
$ builder ->removePlugin (PathPrepend::class);
316
316
317
317
$ builder ->addPlugin (new Plugin \AddHostPlugin (UriFactoryDiscovery::find ()->createUri ($ enterpriseUrl )));
318
- $ builder ->addPlugin (new PathPrepend (sprintf ('/api/%s/ ' , $ this ->getApiVersion ())));
318
+ $ builder ->addPlugin (new PathPrepend (sprintf ('/api/%s ' , $ this ->getApiVersion ())));
319
319
}
320
320
321
321
/**
Original file line number Diff line number Diff line change 7
7
use Github \Exception \BadMethodCallException ;
8
8
use Github \HttpClient \Builder ;
9
9
use Github \HttpClient \Plugin \Authentication ;
10
+ use GuzzleHttp \Psr7 \Response ;
10
11
use Http \Client \Common \Plugin ;
12
+ use Http \Client \HttpClient ;
13
+ use Psr \Http \Message \RequestInterface ;
11
14
12
15
class ClientTest extends \PHPUnit_Framework_TestCase
13
16
{
@@ -205,4 +208,25 @@ public function getApiClassesProvider()
205
208
array ('meta ' , Api \Meta::class)
206
209
);
207
210
}
211
+
212
+ /**
213
+ * Make sure that the URL is correct when using enterprise.
214
+ */
215
+ public function testEnterpriseUrl ()
216
+ {
217
+ $ httpClientMock = $ this ->getMockBuilder (HttpClient::class)
218
+ ->setMethods (['sendRequest ' ])
219
+ ->getMock ();
220
+
221
+ $ httpClientMock ->expects ($ this ->once ())
222
+ ->method ('sendRequest ' )
223
+ ->with ($ this ->callback (function (RequestInterface $ request ) {
224
+ return (string ) $ request ->getUri () === 'https://foobar.com/api/v3/enterprise/stats/all ' ;
225
+ }))
226
+ ->willReturn (new Response (200 , [], '[] ' ));
227
+
228
+ $ httpClientBuilder = new Builder ($ httpClientMock );
229
+ $ client = new Client ($ httpClientBuilder , null , 'https://foobar.com ' );
230
+ $ client ->enterprise ()->stats ()->show ('all ' );
231
+ }
208
232
}
You can’t perform that action at this time.
0 commit comments