Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
krowinski committed Dec 23, 2024
1 parent a10e9f8 commit cba342c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysqlreplication_test
ports:
- 3306/tcp
- 3310:3306

steps:
- name: Checkout
Expand Down Expand Up @@ -51,4 +51,4 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run tests
run: vendor/bin/phpunit --coverage-text
run: MYSQL_PORT=3310 vendor/bin/phpunit --coverage-text
14 changes: 14 additions & 0 deletions src/MySQLReplication/Tools.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace MySQLReplication;

class Tools
{
public static function getFromEnv(string $name, null|int|string $default = null): null|int|string
{
$value = $_ENV[$name] ?: null;
return $value ?? $default;
}
}
3 changes: 2 additions & 1 deletion tests/Integration/BaseCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use MySQLReplication\Event\DTO\RotateDTO;
use MySQLReplication\Event\DTO\TableMapDTO;
use MySQLReplication\MySQLReplicationFactory;
use MySQLReplication\Tools;
use PHPUnit\Framework\TestCase;
use RuntimeException;

Expand All @@ -40,7 +41,7 @@ protected function setUp(): void
->withUser('root')
->withHost('0.0.0.0')
->withPassword('root')
->withPort(3306)
->withPort((int)Tools::getFromEnv('MYSQL_PORT', 3306))
->withEventsIgnore($this->getIgnoredEvents());

$this->connect();
Expand Down

0 comments on commit cba342c

Please sign in to comment.