From 543e189bbdd41d339d24ab7d0fa00877976e8324 Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Thu, 15 Oct 2026 17:39:58 -0300 Subject: [PATCH] style: Order the chained builder calls by name length and link the license badge to the repository. --- README.md | 8 ++++---- tests/Unit/MySQLDockerContainerTest.php | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3e80876..46fd18e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Docker container -[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) +[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/tiny-blocks/docker-container/blob/main/LICENSE) * [Overview](#overview) * [Installation](#installation) @@ -346,13 +346,13 @@ use TinyBlocks\DockerContainer\MySQLDockerContainer; $mySQLStarted = MySQLDockerContainer::from(image: 'mysql:8.4') ->withName(name: 'my-database') + ->withDatabase(database: 'my_database') + ->withPassword(password: 'secret') ->withTimezone(timezone: 'America/Sao_Paulo') ->withUsername(user: 'app_user') - ->withPassword(password: 'secret') - ->withDatabase(database: 'my_database') ->withPortMapping(portOnHost: 0, portOnContainer: 3306) - ->withRootPassword(rootPassword: 'root') ->withGrantedHosts() + ->withRootPassword(rootPassword: 'root') ->run(); ``` diff --git a/tests/Unit/MySQLDockerContainerTest.php b/tests/Unit/MySQLDockerContainerTest.php index f1ccb45..1461da6 100644 --- a/tests/Unit/MySQLDockerContainerTest.php +++ b/tests/Unit/MySQLDockerContainerTest.php @@ -121,13 +121,13 @@ public function testRunMySQLContainerSuccessfully(): void $container = MySQLDockerContainer::from(image: 'mysql:8.1', client: $this->client) ->withName(name: 'test-db') ->withNetwork(name: 'my-net') + ->withDatabase(database: 'test_adm') + ->withPassword(password: 'secret') ->withTimezone(timezone: 'America/Sao_Paulo') ->withUsername(user: 'app_user') - ->withPassword(password: 'secret') - ->withDatabase(database: 'test_adm') ->withPortMapping(portOnHost: 3306, portOnContainer: 3306) - ->withRootPassword(rootPassword: 'root') ->withGrantedHosts() + ->withRootPassword(rootPassword: 'root') ->withoutAutoRemove() ->withVolumeMapping(pathOnHost: '/var/lib/mysql', pathOnContainer: '/var/lib/mysql'); @@ -378,8 +378,8 @@ public function testRunMySQLContainerWithCopyToContainer(): void /** @Given a MySQL container with files to copy */ $container = MySQLDockerContainer::from(image: 'mysql:8.1', client: $this->client) ->withName(name: 'copy-db') - ->withRootPassword(rootPassword: 'root') - ->copyToContainer(pathOnHost: '/host/init', pathOnContainer: '/docker-entrypoint-initdb.d'); + ->copyToContainer(pathOnHost: '/host/init', pathOnContainer: '/docker-entrypoint-initdb.d') + ->withRootPassword(rootPassword: 'root'); /** @And the Docker daemon returns valid responses */ $this->client->withDockerCreateResponse(output: InspectResponseFixture::containerId()); @@ -482,8 +482,8 @@ public function testRunMySQLContainerWithSingleGrantedHost(): void $container = MySQLDockerContainer::from(image: 'mysql:8.1', client: $this->client) ->withName(name: 'single-grant') ->withDatabase(database: 'test_db') - ->withRootPassword(rootPassword: 'root') - ->withGrantedHosts(hosts: ['%']); + ->withGrantedHosts(hosts: ['%']) + ->withRootPassword(rootPassword: 'root'); /** @And the Docker daemon returns valid responses */ $this->client->withDockerCreateResponse(output: InspectResponseFixture::containerId()); @@ -665,8 +665,8 @@ public function testRunMySQLContainerWithGrantedHostsButNoDatabase(): void /** @Given a MySQL container with granted hosts but no database */ $container = MySQLDockerContainer::from(image: 'mysql:8.1', client: $this->client) ->withName(name: 'grants-only') - ->withRootPassword(rootPassword: 'root') - ->withGrantedHosts(hosts: ['%']); + ->withGrantedHosts(hosts: ['%']) + ->withRootPassword(rootPassword: 'root'); /** @And the Docker daemon returns valid responses without MYSQL_DATABASE */ $this->client->withDockerCreateResponse(output: InspectResponseFixture::containerId());