File tree Expand file tree Collapse file tree 4 files changed +21
-9
lines changed
Expand file tree Collapse file tree 4 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 88 "Thenativeweb\\ Eventsourcingdb\\ " : " src/"
99 }
1010 },
11+ "autoload-dev" : {
12+ "psr-4" : {
13+ "Thenativeweb\\ Eventsourcingdb\\ Tests\\ " : " tests/"
14+ }
15+ },
1116 "authors" : [
1217 {
1318 "name" : " the native web GmbH" ,
Original file line number Diff line number Diff line change 66use GuzzleHttp \Exception \GuzzleException ;
77use RuntimeException ;
88
9- class Client
9+ final readonly class Client
1010{
1111 private string $ apiToken ;
1212 private HttpClient $ httpClient ;
Original file line number Diff line number Diff line change 77use Testcontainers \Container \GenericContainer ;
88use Testcontainers \Container \StartedGenericContainer ;
99
10- class Container
10+ final class Container
1111{
12- private string $ imageName = ' thenativeweb/eventsourcingdb ' ;
13- private string $ imageTag = ' latest ' ;
14- private int $ internalPort = 3000 ;
15- private string $ apiToken = ' secret ' ;
16- private ?StartedGenericContainer $ container = null ;
12+ private string $ imageName ;
13+ private string $ imageTag ;
14+ private int $ internalPort ;
15+ private string $ apiToken ;
16+ private ?StartedGenericContainer $ container ;
1717 private HttpClient $ httpClient ;
1818
1919 public function __construct ()
2020 {
21+ $ this ->imageName = 'thenativeweb/eventsourcingdb ' ;
22+ $ this ->imageTag = 'latest ' ;
23+ $ this ->internalPort = 3000 ;
24+ $ this ->apiToken = 'secret ' ;
25+ $ this ->container = null ;
2126 $ this ->httpClient = new HttpClient ([
2227 'http_errors ' => false
2328 ]);
Original file line number Diff line number Diff line change 11<?php
22
3+ namespace Thenativeweb \Eventsourcingdb \Tests ;
4+
35use PHPUnit \Framework \TestCase ;
46use Thenativeweb \Eventsourcingdb \Client ;
57use Thenativeweb \Eventsourcingdb \Container ;
@@ -29,7 +31,7 @@ public function testPingFailsWhenServerIsUnreachable(): void
2931 $ port = $ container ->getMappedPort ();
3032 $ client = new Client ("http://non-existent-host: {$ port }" , $ container ->getApiToken ());
3133
32- $ this ->expectException (Throwable::class);
34+ $ this ->expectException (\ Throwable::class);
3335 $ client ->ping ();
3436 } finally {
3537 $ container ->stop ();
@@ -59,7 +61,7 @@ public function testVerifyApiTokenThrowsAnErrorIfTheTokenIsInvalid(): void
5961 $ baseUrl = $ container ->getBaseUrl ();
6062 $ apiToken = $ container ->getApiToken () . '-invalid ' ;
6163 $ client = new Client ($ baseUrl , $ apiToken );
62- $ this ->expectException (Throwable::class);
64+ $ this ->expectException (\ Throwable::class);
6365 $ client ->verifyApiToken ();
6466 } finally {
6567 $ container ->stop ();
You can’t perform that action at this time.
0 commit comments