Skip to content

Commit 3a1b8cd

Browse files
authored
fix: Incorporate feedback. (#3)
1 parent 6557d2d commit 3a1b8cd

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
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",

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use GuzzleHttp\Exception\GuzzleException;
77
use RuntimeException;
88

9-
class Client
9+
final readonly class Client
1010
{
1111
private string $apiToken;
1212
private HttpClient $httpClient;

src/Container.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@
77
use Testcontainers\Container\GenericContainer;
88
use 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
]);

tests/ClientTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Thenativeweb\Eventsourcingdb\Tests;
4+
35
use PHPUnit\Framework\TestCase;
46
use Thenativeweb\Eventsourcingdb\Client;
57
use 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();

0 commit comments

Comments
 (0)