File tree Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -4,23 +4,25 @@ on: [push, pull_request]
44
55jobs :
66 build :
7-
8- runs-on : ubuntu-latest
9-
7+ runs-on : ${{ matrix.operating-system }}
8+ strategy :
9+ matrix :
10+ operating-system : [ubuntu-latest]
11+ php-versions : ['7.1', '7.2', '7.3']
1012 steps :
1113 - uses : actions/checkout@v1
1214 - name : Start Container
1315 run : |
1416 docker pull lkdevelopment/hetzner-cloud-api-mock
1517 docker run -d -p 127.0.0.1:4000:8080 lkdevelopment/hetzner-cloud-api-mock
1618 docker ps -a
19+ - name : Setup PHP
20+ uses : shivammathur/setup-php@v1
21+ with :
22+ php-version : ${{ matrix.php-versions }}
1723 - name : Install depdendencies
1824 run : |
1925 composer global require hirak/prestissimo
2026 composer install
21- - name : PHP 7.1
22- run : php7.1 vendor/bin/phpunit
23- - name : PHP 7.2
24- run : php7.2 vendor/bin/phpunit
25- - name : PHP 7.3
26- run : php7.3 vendor/bin/phpunit
27+ - name : Run phpunit
28+ run : php vendor/bin/phpunit
Original file line number Diff line number Diff line change 22
33namespace LKDev \HetznerCloud ;
44
5+ use GuzzleHttp \Client ;
56use LKDev \HetznerCloud \Clients \GuzzleClient ;
67use LKDev \HetznerCloud \Models \Actions \Actions ;
78use LKDev \HetznerCloud \Models \Datacenters \Datacenters ;
@@ -110,6 +111,7 @@ public function setBaseUrl(string $baseUrl): self
110111 $ this ->baseUrl = $ baseUrl ;
111112 return $ this ;
112113 }
114+
113115 /**
114116 * @return GuzzleClient
115117 */
@@ -118,6 +120,15 @@ public function getHttpClient(): GuzzleClient
118120 return $ this ->httpClient ;
119121 }
120122
123+ /**
124+ * @return GuzzleClient
125+ */
126+ public function setHttpClient (GuzzleClient $ client ): self
127+ {
128+ $ this ->httpClient = $ client ;
129+ return $ this ;
130+ }
131+
121132 /**
122133 * @param \Psr\Http\Message\ResponseInterface $response
123134 * @throws \LKDev\HetznerCloud\APIException
Original file line number Diff line number Diff line change 88
99namespace Tests ;
1010
11+ use LKDev \HetznerCloud \Clients \GuzzleClient ;
1112use LKDev \HetznerCloud \HetznerAPIClient ;
1213use LKDev \HetznerCloud \Models \Actions \Actions ;
1314use LKDev \HetznerCloud \Models \Datacenters \Datacenters ;
@@ -61,6 +62,17 @@ public function testSetUserAgent()
6162 $ this ->assertEquals ("changed " , $ client ->getUserAgent ());
6263 }
6364
65+ /**
66+ *
67+ */
68+ public function testSetHttpClient ()
69+ {
70+ $ client = new HetznerAPIClient ('IAmTheTestToken ' , '' );
71+ $ httpClient = new GuzzleClient ($ client );
72+ $ client ->setHttpClient ($ httpClient );
73+ $ this ->assertEquals ($ httpClient , $ client ->getHttpClient ());
74+ }
75+
6476 /**
6577 *
6678 */
You can’t perform that action at this time.
0 commit comments