Skip to content

Commit 2eb4082

Browse files
committed
configurable host
1 parent d3f8924 commit 2eb4082

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/workflows/platform-matrix-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
tests:
1313
name: "Platform matrix test"
1414
runs-on: "ubuntu-latest"
15+
env:
16+
MYSQL_HOST: localhost
17+
PGSQL_HOST: localhost
1518

1619
strategy:
1720
fail-fast: false
@@ -41,7 +44,6 @@ jobs:
4144
services:
4245
postgres:
4346
image: "postgres:latest"
44-
options: --hostname pgsql
4547
env:
4648
POSTGRES_PASSWORD: "secret"
4749
POSTGRES_USER: root
@@ -51,7 +53,6 @@ jobs:
5153

5254
mysql:
5355
image: "mysql:latest"
54-
options: --hostname mysql
5556
env:
5657
MYSQL_ALLOW_EMPTY_PASSWORD: yes
5758
MYSQL_ROOT_PASSWORD: secret

tests/Platform/QueryResultTypeWalkerFetchTypeMatrixTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use function function_exists;
3131
use function get_class;
3232
use function get_debug_type;
33+
use function getenv;
3334
use function gettype;
3435
use function is_resource;
3536
use function method_exists;
@@ -276,7 +277,7 @@ public function provideCases(): iterable
276277
];
277278

278279
yield 'mysqli, no native numbers' => [
279-
'connection' => ['driver' => 'mysqli', 'host' => 'mysql'],
280+
'connection' => ['driver' => 'mysqli', 'host' => getenv('MYSQL_HOST')],
280281
'php80-' => $nativeMysql,
281282
'php81+' => $nativeMysql,
282283
'setup' => [
@@ -289,14 +290,14 @@ public function provideCases(): iterable
289290
];
290291

291292
yield 'mysqli, native numbers' => [
292-
'connection' => ['driver' => 'mysqli', 'host' => 'mysql'],
293+
'connection' => ['driver' => 'mysqli', 'host' => getenv('MYSQL_HOST')],
293294
'php80-' => $nativeMysql,
294295
'php81+' => $nativeMysql,
295296
'setup' => [MYSQLI_OPT_INT_AND_FLOAT_NATIVE => true],
296297
];
297298

298299
yield 'pdo_mysql, stringify, no emulate' => [
299-
'connection' => ['driver' => 'pdo_mysql', 'host' => 'mysql'],
300+
'connection' => ['driver' => 'pdo_mysql', 'host' => getenv('MYSQL_HOST')],
300301
'php80-' => $stringified,
301302
'php81+' => $stringified,
302303
'setup' => [
@@ -306,21 +307,21 @@ public function provideCases(): iterable
306307
];
307308

308309
yield 'pdo_mysql, no stringify, no emulate' => [
309-
'connection' => ['driver' => 'pdo_mysql', 'host' => 'mysql'],
310+
'connection' => ['driver' => 'pdo_mysql', 'host' => getenv('MYSQL_HOST')],
310311
'php80-' => $nativeMysql,
311312
'php81+' => $nativeMysql,
312313
'setup' => [PDO::ATTR_EMULATE_PREPARES => false],
313314
];
314315

315316
yield 'pdo_mysql, no stringify, emulate' => [
316-
'connection' => ['driver' => 'pdo_mysql', 'host' => 'mysql'],
317+
'connection' => ['driver' => 'pdo_mysql', 'host' => getenv('MYSQL_HOST')],
317318
'php80-' => $stringified,
318319
'php81+' => $nativeMysql,
319320
'setup' => [], // defaults
320321
];
321322

322323
yield 'pdo_mysql, stringify, emulate' => [
323-
'connection' => ['driver' => 'pdo_mysql', 'host' => 'mysql'],
324+
'connection' => ['driver' => 'pdo_mysql', 'host' => getenv('MYSQL_HOST')],
324325
'php80-' => $stringified,
325326
'php81+' => $stringified,
326327
'setup' => [
@@ -329,22 +330,22 @@ public function provideCases(): iterable
329330
];
330331

331332
yield 'pdo_pgsql, stringify' => [
332-
'connection' => ['driver' => 'pdo_pgsql', 'host' => 'pgsql'],
333+
'connection' => ['driver' => 'pdo_pgsql', 'host' => getenv('PGSQL_HOST')],
333334

334335
'php80-' => $stringifiedOldPostgre,
335336
'php81+' => $stringified,
336337
'setup' => [PDO::ATTR_STRINGIFY_FETCHES => true],
337338
];
338339

339340
yield 'pdo_pgsql, no stringify' => [
340-
'connection' => ['driver' => 'pdo_pgsql', 'host' => 'pgsql'],
341+
'connection' => ['driver' => 'pdo_pgsql', 'host' => getenv('PGSQL_HOST')],
341342
'php80-' => $nativePdoPg,
342343
'php81+' => $nativePdoPg,
343344
'setup' => [],
344345
];
345346

346347
yield 'pgsql' => [
347-
'connection' => ['driver' => 'pgsql', 'host' => 'pgsql'],
348+
'connection' => ['driver' => 'pgsql', 'host' => getenv('PGSQL_HOST')],
348349
'php80-' => $nativePg,
349350
'php81+' => $nativePg,
350351
'setup' => [],

tests/Platform/docker/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ services:
2424
build:
2525
context: .
2626
dockerfile: ./Dockerfile80
27+
environment:
28+
MYSQL_HOST: mysql
29+
PGSQL_HOST: pgsql
2730
working_dir: /app
2831
user: ${UID:-1000}:${GID:-1000}
2932
volumes:
@@ -34,6 +37,9 @@ services:
3437
build:
3538
context: .
3639
dockerfile: ./Dockerfile81
40+
environment:
41+
MYSQL_HOST: mysql
42+
PGSQL_HOST: pgsql
3743
working_dir: /app
3844
user: ${UID:-1000}:${GID:-1000}
3945
volumes:

0 commit comments

Comments
 (0)