Skip to content

Commit cba342c

Browse files
committed
debug
1 parent a10e9f8 commit cba342c

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
MYSQL_ROOT_PASSWORD: root
1717
MYSQL_DATABASE: mysqlreplication_test
1818
ports:
19-
- 3306/tcp
19+
- 3310:3306
2020

2121
steps:
2222
- name: Checkout
@@ -51,4 +51,4 @@ jobs:
5151
run: composer install --prefer-dist --no-progress --no-suggest
5252

5353
- name: Run tests
54-
run: vendor/bin/phpunit --coverage-text
54+
run: MYSQL_PORT=3310 vendor/bin/phpunit --coverage-text

src/MySQLReplication/Tools.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MySQLReplication;
6+
7+
class Tools
8+
{
9+
public static function getFromEnv(string $name, null|int|string $default = null): null|int|string
10+
{
11+
$value = $_ENV[$name] ?: null;
12+
return $value ?? $default;
13+
}
14+
}

tests/Integration/BaseCase.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use MySQLReplication\Event\DTO\RotateDTO;
1616
use MySQLReplication\Event\DTO\TableMapDTO;
1717
use MySQLReplication\MySQLReplicationFactory;
18+
use MySQLReplication\Tools;
1819
use PHPUnit\Framework\TestCase;
1920
use RuntimeException;
2021

@@ -40,7 +41,7 @@ protected function setUp(): void
4041
->withUser('root')
4142
->withHost('0.0.0.0')
4243
->withPassword('root')
43-
->withPort(3306)
44+
->withPort((int)Tools::getFromEnv('MYSQL_PORT', 3306))
4445
->withEventsIgnore($this->getIgnoredEvents());
4546

4647
$this->connect();

0 commit comments

Comments
 (0)