Skip to content

Commit dbf01d5

Browse files
committed
fix integration tests
1 parent 2bbc527 commit dbf01d5

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- "18.1"
4545

4646
env:
47-
DB_URL: 'pdo-pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8'
47+
POSTGRES_URI: 'pdo-pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8'
4848

4949
steps:
5050
- name: "Checkout"
@@ -99,7 +99,7 @@ jobs:
9999
- "12.1"
100100

101101
env:
102-
DB_URL: 'mongodb://localhost:27017'
102+
MONGODB_URI: 'mongodb://localhost:27017'
103103

104104
steps:
105105
- name: "Checkout"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ phpstan-baseline: vendor
2323

2424
.PHONY: phpunit
2525
phpunit: vendor ## run phpunit tests
26-
XDEBUG_MODE=coverage vendor/bin/phpunit
26+
MONGODB_URI="mongodb://localhost:27017" POSTGRES_URI="pgsql:host=localhost;port=5432;dbname=eventstore;user=postgres;password=postgres" XDEBUG_MODE=coverage vendor/bin/phpunit
2727

2828
.PHONY: infection
2929
infection: vendor ## run infection

tests/MongoIntegrationTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ final class MongoIntegrationTest extends IntegrationTest
1515
{
1616
protected function getClient(): Client
1717
{
18-
$uri = getenv('MONGODB_URI') ?: 'mongodb://localhost:27017';
18+
return new Client(getenv('MONGODB_URI'));
19+
}
1920

21+
protected function setUp(): void
22+
{
2023
if (!class_exists(Client::class)) {
2124
$this->markTestSkipped('mongodb/mongodb is not installed');
2225
}
2326

24-
return new Client($uri);
27+
getenv('MONGODB_URI') ?: $this->markTestSkipped('MONGODB_URI is not set');
28+
29+
parent::setUp();
2530
}
2631

2732
protected function getCollection(): Collection

tests/PostgresIntegrationTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212

1313
final class PostgresIntegrationTest extends IntegrationTest
1414
{
15-
protected function getClient(): Client
15+
protected function setUp(): void
1616
{
17-
$uri = getenv('POSTGRES_URI') ?: 'pgsql:host=localhost;port=5432;dbname=eventstore;user=postgres;password=postgres';
17+
parent::setUp();
18+
19+
getenv('POSTGRES_URI') ?: $this->markTestSkipped('POSTGRES_URI is not set');
20+
}
1821

19-
return new Client($uri);
22+
protected function getClient(): Client
23+
{
24+
return new Client(getenv('POSTGRES_URI'));
2025
}
2126

2227
protected function getCollection(): Collection

0 commit comments

Comments
 (0)