File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 1111
1212use GuzzleHttp \Client ;
1313use GuzzleHttp \Handler \MockHandler ;
14+ use LKDev \HetznerCloud \Clients \GuzzleClient ;
1415use LKDev \HetznerCloud \HetznerAPIClient ;
1516
1617abstract class TestCase extends \PHPUnit \Framework \TestCase
@@ -28,8 +29,8 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
2829 public function setUp (): void
2930 {
3031 $ this ->mockHandler = new MockHandler ();
31- $ this ->hetznerApi = new HetznerAPIClient ('abcdef ' , 'http://localhost:4000/v1/ ' );
32- $ this ->hetznerApi ->setHttpClient (new Client ( ['handler ' => $ this ->mockHandler ]));
32+ $ this ->hetznerApi = new HetznerAPIClient ('abcdef ' , '' );
33+ $ this ->hetznerApi ->setHttpClient (new GuzzleClient ( $ this -> hetznerApi , ['handler ' => $ this ->mockHandler ]));
3334 }
3435
3536 public function tearDown (): void
Original file line number Diff line number Diff line change 1010namespace LKDev \Tests \Unit ;
1111
1212use GuzzleHttp \Client ;
13+ use LKDev \HetznerCloud \Clients \GuzzleClient ;
1314use LKDev \HetznerCloud \HetznerAPIClient ;
1415use LKDev \HetznerCloud \Models \Actions \Actions ;
1516use LKDev \HetznerCloud \Models \Datacenters \Datacenters ;
@@ -61,7 +62,7 @@ public function testSetUserAgent()
6162 public function testSetHttpClient ()
6263 {
6364 $ client = new HetznerAPIClient ('IAmTheTestToken ' , '' );
64- $ httpClient = new Client ( );
65+ $ httpClient = new GuzzleClient ( $ client );
6566 $ client ->setHttpClient ($ httpClient );
6667 $ this ->assertEquals ($ httpClient , $ client ->getHttpClient ());
6768 }
You can’t perform that action at this time.
0 commit comments