File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 16
16
MYSQL_ROOT_PASSWORD: root
17
17
MYSQL_DATABASE: mysqlreplication_test
18
18
ports:
19
- - 3306/tcp
19
+ - 3310: 3306
20
20
21
21
steps:
22
22
- name: Checkout
51
51
run: composer install --prefer-dist --no-progress --no-suggest
52
52
53
53
- name: Run tests
54
- run: vendor/bin/phpunit --coverage-text
54
+ run: MYSQL_PORT=3310 vendor/bin/phpunit --coverage-text
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 15
15
use MySQLReplication\Event\DTO\RotateDTO;
16
16
use MySQLReplication\Event\DTO\TableMapDTO;
17
17
use MySQLReplication\MySQLReplicationFactory;
18
+ use MySQLReplication\Tools;
18
19
use PHPUnit\Framework\TestCase;
19
20
use RuntimeException;
20
21
@@ -40,7 +41,7 @@ protected function setUp(): void
40
41
->withUser('root')
41
42
->withHost('0.0.0.0')
42
43
->withPassword('root')
43
- ->withPort(3306)
44
+ ->withPort((int)Tools::getFromEnv('MYSQL_PORT', 3306) )
44
45
->withEventsIgnore($this->getIgnoredEvents());
45
46
46
47
$this->connect();
You can’t perform that action at this time.
0 commit comments