Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
}
}
18 changes: 9 additions & 9 deletions src/Schema/UniqueConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/Integration/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand All @@ -57,7 +58,7 @@ public function start(): void
->withRootPassword(rootPassword: 'root')
->withGrantedHosts()
->withoutAutoRemove()
->withReadinessTimeout(timeoutInSeconds: 60)
->withReadinessTimeout(timeout: Duration::fromSeconds(seconds: 60))
->run();
}
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Integration/IntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -34,4 +29,9 @@ protected function tearDown(): void

self::$customTables = [];
}

protected static function registerTableForCleanup(string $tableName): void
{
self::$customTables[] = $tableName;
}
}