diff --git a/composer.json b/composer.json index a6118ea..900451d 100644 --- a/composer.json +++ b/composer.json @@ -30,20 +30,20 @@ }, "require": { "php": "^8.5", - "doctrine/dbal": "^4.4", + "doctrine/dbal": "^4.5", "ramsey/uuid": "^4.9", "tiny-blocks/building-blocks": "^6.0", "tiny-blocks/collection": "^2.6", "tiny-blocks/mapper": "^3.2" }, "require-dev": { - "ergebnis/composer-normalize": "^2.52", - "infection/infection": "^0.34", - "phpstan/phpstan": "^2.2", - "phpunit/phpunit": "^13.2", + "ergebnis/composer-normalize": "^2.54", + "infection/infection": "^0.35", + "phpstan/phpstan": "^2.3", + "phpunit/phpunit": "^13.4", "slevomat/coding-standard": "^8.31", "squizlabs/php_codesniffer": "^4.0", - "tiny-blocks/docker-container": "^3.1", + "tiny-blocks/docker-container": "^5.0", "tiny-blocks/environment-variable": "^2.0" }, "minimum-stability": "stable", @@ -83,7 +83,7 @@ "test-file": "@php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage --filter", "tests": [ "@php -d memory_limit=2G ./vendor/bin/phpunit --configuration phpunit.xml tests", - "@php ./vendor/bin/infection --threads=max --logger-html=reports/coverage/mutation-report.html --coverage=reports/coverage" + "@php ./vendor/bin/infection --threads=max --logger-html=reports/coverage/mutation-report.html" ] } } diff --git a/src/Schema/UniqueConstraint.php b/src/Schema/UniqueConstraint.php index 2b15709..c17418b 100644 --- a/src/Schema/UniqueConstraint.php +++ b/src/Schema/UniqueConstraint.php @@ -13,24 +13,24 @@ private function __construct(public string $name) } /** - * Creates a UniqueConstraint using the default constraint name. + * Creates a UniqueConstraint with the explicit constraint name. * - * @return UniqueConstraint The default unique constraint. + * @param string $name The physical name of the unique constraint in the outbox table. + * @return UniqueConstraint The created unique constraint. */ - public static function default(): UniqueConstraint + public static function named(string $name): UniqueConstraint { - return UniqueConstraint::named(name: 'unq_outbox_events_aggregate_type_aggregate_id_aggregate_version'); + return new UniqueConstraint(name: $name); } /** - * Creates a UniqueConstraint with the explicit constraint name. + * Creates a UniqueConstraint using the default constraint name. * - * @param string $name The physical name of the unique constraint in the outbox table. - * @return UniqueConstraint The created unique constraint. + * @return UniqueConstraint The default unique constraint. */ - public static function named(string $name): UniqueConstraint + public static function default(): UniqueConstraint { - return new UniqueConstraint(name: $name); + return UniqueConstraint::named(name: 'unq_outbox_events_aggregate_type_aggregate_id_aggregate_version'); } /** diff --git a/tests/Integration/Database.php b/tests/Integration/Database.php index 922afc0..5cf70a2 100644 --- a/tests/Integration/Database.php +++ b/tests/Integration/Database.php @@ -10,6 +10,7 @@ use Symfony\Component\Process\Process; use TinyBlocks\DockerContainer\MySQLDockerContainer; use TinyBlocks\EnvironmentVariable\EnvironmentVariable; +use TinyBlocks\Time\Duration; final readonly class Database { @@ -47,8 +48,8 @@ public function start(): void new Process(['docker', 'rm', '-f', sprintf('tiny-blocks-reaper-%s', $this->host)])->run(); new Process(['docker', 'rm', '-f', $this->host])->run(); - MySQLDockerContainer::from(image: 'mysql:8.4', name: $this->host) - ->pullImage() + MySQLDockerContainer::from(image: 'mysql:8.4') + ->withName(name: $this->host) ->withTimezone(timezone: 'UTC') ->withUsername(user: $this->username) ->withPassword(password: $this->password) @@ -57,7 +58,7 @@ public function start(): void ->withRootPassword(rootPassword: 'root') ->withGrantedHosts() ->withoutAutoRemove() - ->withReadinessTimeout(timeoutInSeconds: 60) + ->withReadinessTimeout(timeout: Duration::fromSeconds(seconds: 60)) ->run(); } } diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index 5ce2ada..9c28fc9 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -17,11 +17,6 @@ public static function setUpBeforeClass(): void self::$connection = Database::instance()->connection(); } - protected static function registerTableForCleanup(string $tableName): void - { - self::$customTables[] = $tableName; - } - protected function tearDown(): void { if (self::$connection->isTransactionActive()) { @@ -34,4 +29,9 @@ protected function tearDown(): void self::$customTables = []; } + + protected static function registerTableForCleanup(string $tableName): void + { + self::$customTables[] = $tableName; + } }