From 7926b22b2e2b65e80c6f74199ca36543007fd386 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sun, 22 Mar 2026 16:54:45 +0000 Subject: [PATCH 1/4] build: upgrade php version --- .github/workflows/ci.yml | 12 ++-- composer.json | 2 +- composer.lock | 147 ++++++++++++++++++++------------------- 3 files changed, 82 insertions(+), 79 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9b4695..aaaeb0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] steps: - uses: actions/checkout@v6 @@ -45,7 +45,7 @@ jobs: needs: [ composer ] strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] outputs: coverage: ${{ steps.store-coverage.outputs.coverage_text }} @@ -80,7 +80,7 @@ jobs: needs: [ phpunit ] strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] steps: - uses: actions/checkout@v4 @@ -103,7 +103,7 @@ jobs: needs: [ composer ] strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] steps: - uses: actions/download-artifact@v4 @@ -127,7 +127,7 @@ jobs: needs: [ composer ] strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] steps: - uses: actions/download-artifact@v4 @@ -151,7 +151,7 @@ jobs: needs: [ composer ] strategy: matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.3, 8.4, 8.5 ] steps: - uses: actions/download-artifact@v4 diff --git a/composer.json b/composer.json index d7210d4..a81ef3c 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "require": { - "php": ">=8.1", + "php": ">=8.3", "ext-PDO": "*", "phpgt/config": "^v1.1.0", "phpgt/cli": "^1.3", diff --git a/composer.lock b/composer.lock index 89a5aa3..c8fd68d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5eee2c3a821a40ece49a135b7f3f1fa5", + "content-hash": "3d8edfe8f708d5fbe860d0d880d3eb80", "packages": [ { "name": "greenlion/php-sql-parser", @@ -119,27 +119,29 @@ }, { "name": "phpgt/cli", - "version": "v1.3.4", + "version": "v1.3.5", "source": { "type": "git", "url": "https://github.com/PhpGt/Cli.git", - "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da" + "reference": "42aeef24ab9789907358002fdcc37cb3a2e26b4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Cli/zipball/71deb9cdc5a3ea8bfb665faa29739badbf61e9da", - "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da", + "url": "https://api.github.com/repos/PhpGt/Cli/zipball/42aeef24ab9789907358002fdcc37cb3a2e26b4b", + "reference": "42aeef24ab9789907358002fdcc37cb3a2e26b4b", "shasum": "" }, "require": { "ext-json": "*", "ext-readline": "*", - "php": ">=8.0", - "phpgt/daemon": "^v1.1" + "php": ">=8.2", + "phpgt/daemon": "^1.1.3" }, "require-dev": { - "phpstan/phpstan": "^v1.8", - "phpunit/phpunit": "^v9.5" + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -166,7 +168,7 @@ ], "support": { "issues": "https://github.com/PhpGt/Cli/issues", - "source": "https://github.com/PhpGt/Cli/tree/v1.3.4" + "source": "https://github.com/PhpGt/Cli/tree/v1.3.5" }, "funding": [ { @@ -174,7 +176,7 @@ "type": "github" } ], - "time": "2023-09-18T10:06:17+00:00" + "time": "2024-05-08T17:45:44+00:00" }, { "name": "phpgt/config", @@ -235,24 +237,27 @@ }, { "name": "phpgt/daemon", - "version": "v1.1.2", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/PhpGt/Daemon.git", - "reference": "6490df99a22818149f30e3af408002ea7f73e035" + "url": "https://github.com/phpgt/Daemon.git", + "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Daemon/zipball/6490df99a22818149f30e3af408002ea7f73e035", - "reference": "6490df99a22818149f30e3af408002ea7f73e035", + "url": "https://api.github.com/repos/phpgt/Daemon/zipball/413e16b54de6e1fd5c2b646b485f88a86dfedd9a", + "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a", "shasum": "" }, "require": { - "php": ">=7.4" + "ext-pcntl": "*", + "php": ">=8.1" }, "require-dev": { - "phpstan/phpstan": ">=0.12.42", - "phpunit/phpunit": "9.*" + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^v1.10", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -263,16 +268,16 @@ "notification-url": "https://packagist.org/downloads/", "description": "Background script execution with cross-platform compatible streaming.", "support": { - "issues": "https://github.com/PhpGt/Daemon/issues", - "source": "https://github.com/PhpGt/Daemon/tree/v1.1.2" + "issues": "https://github.com/phpgt/Daemon/issues", + "source": "https://github.com/phpgt/Daemon/tree/v1.1.5" }, "funding": [ { - "url": "https://github.com/phpgt", + "url": "https://github.com/sponsors/PhpGt", "type": "github" } ], - "time": "2021-02-02T17:33:16+00:00" + "time": "2026-03-11T14:11:10+00:00" }, { "name": "phpgt/sqlbuilder", @@ -2518,34 +2523,34 @@ }, { "name": "symfony/config", - "version": "v6.4.34", + "version": "v7.4.7", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "ce9cb0c0d281aaf188b802d4968e42bfb60701e9" + "reference": "6c17162555bfb58957a55bb0e43e00035b6ae3d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/ce9cb0c0d281aaf188b802d4968e42bfb60701e9", - "reference": "ce9cb0c0d281aaf188b802d4968e42bfb60701e9", + "url": "https://api.github.com/repos/symfony/config/zipball/6c17162555bfb58957a55bb0e43e00035b6ae3d5", + "reference": "6c17162555bfb58957a55bb0e43e00035b6ae3d5", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^5.4|^6.0|^7.0", + "symfony/filesystem": "^7.1|^8.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<5.4", + "symfony/finder": "<6.4", "symfony/service-contracts": "<2.5" }, "require-dev": { - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0|^8.0", + "symfony/finder": "^6.4|^7.0|^8.0", + "symfony/messenger": "^6.4|^7.0|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/yaml": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -2573,7 +2578,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.4.34" + "source": "https://github.com/symfony/config/tree/v7.4.7" }, "funding": [ { @@ -2593,44 +2598,43 @@ "type": "tidelift" } ], - "time": "2026-02-24T17:34:50+00:00" + "time": "2026-03-06T10:41:14+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.35", + "version": "v7.4.7", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "d95712d0e9446b9f244b64811ffb6af7b7434213" + "reference": "0f651e58f4917fb0e2cd261ccbfe3d71e6e0f5db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d95712d0e9446b9f244b64811ffb6af7b7434213", - "reference": "d95712d0e9446b9f244b64811ffb6af7b7434213", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/0f651e58f4917fb0e2cd261ccbfe3d71e6e0f5db", + "reference": "0f651e58f4917fb0e2cd261ccbfe3d71e6e0f5db", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4.20|^7.2.5" + "symfony/service-contracts": "^3.6", + "symfony/var-exporter": "^6.4.20|^7.2.5|^8.0" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<6.1", - "symfony/finder": "<5.4", - "symfony/proxy-manager-bridge": "<6.3", - "symfony/yaml": "<5.4" + "symfony/config": "<6.4", + "symfony/finder": "<6.4", + "symfony/yaml": "<6.4" }, "provide": { "psr/container-implementation": "1.1|2.0", "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^6.1|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/config": "^6.4|^7.0|^8.0", + "symfony/expression-language": "^6.4|^7.0|^8.0", + "symfony/yaml": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -2658,7 +2662,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.35" + "source": "https://github.com/symfony/dependency-injection/tree/v7.4.7" }, "funding": [ { @@ -2678,7 +2682,7 @@ "type": "tidelift" } ], - "time": "2026-02-26T12:16:01+00:00" + "time": "2026-03-03T07:48:48+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2749,25 +2753,25 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.34", + "version": "v7.4.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "01ffe0411b842f93c571e5c391f289c3fdd498c3" + "reference": "3ebc794fa5315e59fd122561623c2e2e4280538e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/01ffe0411b842f93c571e5c391f289c3fdd498c3", - "reference": "01ffe0411b842f93c571e5c391f289c3fdd498c3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3ebc794fa5315e59fd122561623c2e2e4280538e", + "reference": "3ebc794fa5315e59fd122561623c2e2e4280538e", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^5.4|^6.4|^7.0" + "symfony/process": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -2795,7 +2799,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.34" + "source": "https://github.com/symfony/filesystem/tree/v7.4.6" }, "funding": [ { @@ -2815,7 +2819,7 @@ "type": "tidelift" } ], - "time": "2026-02-24T17:51:06+00:00" + "time": "2026-02-25T16:50:00+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3074,26 +3078,25 @@ }, { "name": "symfony/var-exporter", - "version": "v6.4.26", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "466fcac5fa2e871f83d31173f80e9c2684743bfc" + "reference": "7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/466fcac5fa2e871f83d31173f80e9c2684743bfc", - "reference": "466fcac5fa2e871f83d31173f80e9c2684743bfc", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04", + "reference": "7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.4" }, "require-dev": { - "symfony/property-access": "^6.4|^7.0", - "symfony/serializer": "^6.4|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/property-access": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3131,7 +3134,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.26" + "source": "https://github.com/symfony/var-exporter/tree/v8.0.0" }, "funding": [ { @@ -3151,7 +3154,7 @@ "type": "tidelift" } ], - "time": "2025-09-11T09:57:09+00:00" + "time": "2025-11-05T18:53:00+00:00" }, { "name": "theseer/tokenizer", @@ -3210,7 +3213,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.1", + "php": ">=8.3", "ext-pdo": "*" }, "platform-dev": { From 51a8e4a12790330ea79648189ab9bd92fc8079bd Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sun, 22 Mar 2026 17:29:58 +0000 Subject: [PATCH 2/4] feature: pass optional config values to migrate closes #237 --- src/Cli/ExecuteCommand.php | 153 +++++++++++++++++++++--- test/phpunit/Cli/ExecuteCommandTest.php | 98 +++++++++++++++ 2 files changed, 233 insertions(+), 18 deletions(-) diff --git a/src/Cli/ExecuteCommand.php b/src/Cli/ExecuteCommand.php index 13ec17e..dfdb210 100644 --- a/src/Cli/ExecuteCommand.php +++ b/src/Cli/ExecuteCommand.php @@ -3,7 +3,6 @@ use Gt\Cli\Argument\ArgumentValueList; use Gt\Cli\Command\Command; -use Gt\Cli\Parameter\NamedParameter; use Gt\Cli\Parameter\Parameter; use Gt\Config\ConfigFactory; use Gt\Database\Connection\Settings; @@ -18,8 +17,8 @@ public function run(?ArgumentValueList $arguments = null):void { $defaultPath = $this->getDefaultPath($repoBasePath); $config = $this->getConfig($repoBasePath, $defaultPath); - $settings = $this->buildSettingsFromConfig($config, $repoBasePath); - [$migrationPath, $migrationTable] = $this->getMigrationLocation($config, $repoBasePath); + $settings = $this->buildSettingsFromConfig($config, $repoBasePath, $arguments); + [$migrationPath, $migrationTable] = $this->getMigrationLocation($config, $repoBasePath, $arguments); $migrator = new Migrator($settings, $migrationPath, $migrationTable); $migrator->setOutput( @@ -47,18 +46,61 @@ private function isForced(?ArgumentValueList $arguments):bool { } /** Build Settings from config for the current repository. */ - private function buildSettingsFromConfig(\Gt\Config\Config $config, string $repoBasePath): Settings { + protected function buildSettingsFromConfig( + \Gt\Config\Config $config, + string $repoBasePath, + ?ArgumentValueList $arguments = null + ): Settings { + $queryPath = $this->getOverrideOrConfigValue( + $config, + $arguments, + "base-directory", + "database.query_path", + "query" + ); return new Settings( - implode(DIRECTORY_SEPARATOR, [ - $repoBasePath, - $config->get("database.query_path") - ]), - $config->get("database.driver") ?? 'mysql', - $config->get("database.schema"), - $config->get("database.host") ?? "localhost", - (int)($config->get("database.port") ?? "3306"), - $config->get("database.username"), - $config->get("database.password") + $this->resolvePath($repoBasePath, $queryPath), + $this->getOverrideOrConfigValue( + $config, + $arguments, + "driver", + "database.driver", + "mysql" + ), + $this->getOverrideOrConfigValue( + $config, + $arguments, + "database", + "database.schema" + ), + $this->getOverrideOrConfigValue( + $config, + $arguments, + "host", + "database.host", + "localhost" + ), + (int)$this->getOverrideOrConfigValue( + $config, + $arguments, + "port", + "database.port", + "3306" + ), + $this->getOverrideOrConfigValue( + $config, + $arguments, + "username", + "database.username", + "" + ), + $this->getOverrideOrConfigValue( + $config, + $arguments, + "password", + "database.password", + "" + ) ); } @@ -67,10 +109,20 @@ private function buildSettingsFromConfig(\Gt\Config\Config $config, string $repo * * @return list */ - private function getMigrationLocation(\Gt\Config\Config $config, string $repoBasePath): array { + protected function getMigrationLocation( + \Gt\Config\Config $config, + string $repoBasePath, + ?ArgumentValueList $arguments = null + ): array { + $queryPath = $this->getOverrideOrConfigValue( + $config, + $arguments, + "base-directory", + "database.query_path", + "query" + ); $migrationPath = implode(DIRECTORY_SEPARATOR, [ - $repoBasePath, - $config->get("database.query_path") ?? "query", + $this->resolvePath($repoBasePath, $queryPath), $config->get("database.migration_path") ?? "_migration", ]); $migrationTable = $config->get("database.migration_table") ?? "_migration"; @@ -141,7 +193,6 @@ public function getRequiredNamedParameterList():array { } public function getOptionalNamedParameterList():array { -// TODO: It would be an improvement to allow passing database settings here rather than always require a config.ini return []; } @@ -151,6 +202,48 @@ public function getRequiredParameterList():array { public function getOptionalParameterList():array { return [ + new Parameter( + true, + "base-directory", + null, + "Override database.query_path for this command" + ), + new Parameter( + true, + "driver", + null, + "Override database.driver for this command" + ), + new Parameter( + true, + "database", + null, + "Override database.schema for this command" + ), + new Parameter( + true, + "host", + null, + "Override database.host for this command" + ), + new Parameter( + true, + "port", + null, + "Override database.port for this command" + ), + new Parameter( + true, + "username", + null, + "Override database.username for this command" + ), + new Parameter( + true, + "password", + null, + "Override database.password for this command" + ), new Parameter( false, "force", @@ -201,4 +294,28 @@ protected function getConfig(bool|string $repoBasePath, ?string $defaultPath):\G } return $config; } + + protected function getOverrideOrConfigValue( + \Gt\Config\Config $config, + ?ArgumentValueList $arguments, + string $argumentKey, + string $configKey, + ?string $default = null + ): ?string { + if($arguments?->contains($argumentKey)) { + return $arguments->get($argumentKey)->get() ?? $default; + } + + return $config->get($configKey) ?? $default; + } + protected function resolvePath(string $repoBasePath, string $path):string { + if(str_starts_with($path, DIRECTORY_SEPARATOR)) { + return $path; + } + + return implode(DIRECTORY_SEPARATOR, [ + $repoBasePath, + $path, + ]); + } } diff --git a/test/phpunit/Cli/ExecuteCommandTest.php b/test/phpunit/Cli/ExecuteCommandTest.php index 96a51af..9533450 100644 --- a/test/phpunit/Cli/ExecuteCommandTest.php +++ b/test/phpunit/Cli/ExecuteCommandTest.php @@ -3,10 +3,13 @@ use Gt\Cli\Argument\ArgumentValueList; use Gt\Cli\Stream; +use Gt\Config\Config; +use Gt\Config\ConfigSection; use Gt\Database\Cli\ExecuteCommand; use Gt\Database\Connection\Settings; use Gt\Database\Database; use Gt\Database\Test\Helper\Helper; +use Gt\Cli\Parameter\Parameter; use PHPUnit\Framework\TestCase; use SplFileObject; @@ -189,4 +192,99 @@ public function testExecuteWithResetWithNumber():void { chdir($cwdBackup); } } + + public function testOptionalParameterListContainsCliOverrides():void { + $command = new ExecuteCommand(); + $parameterNames = array_map( + fn(Parameter $parameter) => $parameter->getLongOption(), + $command->getOptionalParameterList() + ); + + self::assertContains("base-directory", $parameterNames); + self::assertContains("driver", $parameterNames); + self::assertContains("database", $parameterNames); + self::assertContains("host", $parameterNames); + self::assertContains("port", $parameterNames); + self::assertContains("username", $parameterNames); + self::assertContains("password", $parameterNames); + self::assertContains("force", $parameterNames); + self::assertContains("reset", $parameterNames); + } + + public function testCliArgumentsOverrideConfigValuesWhenBuildingSettings():void { + $repoBasePath = "/tmp/project-root"; + $config = new Config( + new ConfigSection("database", [ + "query_path" => "query", + "driver" => "mysql", + "schema" => "config-db", + "host" => "config-host", + "port" => "3306", + "username" => "config-user", + "password" => "config-pass", + "migration_path" => "_migration", + "migration_table" => "_migration", + ]) + ); + $args = new ArgumentValueList(); + $args->set("base-directory", "custom-query"); + $args->set("driver", "sqlite"); + $args->set("database", "/tmp/override.db"); + $args->set("host", "override-host"); + $args->set("port", "1234"); + $args->set("username", "override-user"); + $args->set("password", "override-pass"); + + $command = $this->createCommandProbe(); + $settings = $command->buildSettingsForTest($config, $repoBasePath, $args); + + self::assertSame("/tmp/project-root/custom-query", $settings->getBaseDirectory()); + self::assertSame("sqlite", $settings->getDriver()); + self::assertSame("/tmp/override.db", $settings->getSchema()); + self::assertSame("override-host", $settings->getHost()); + self::assertSame(1234, $settings->getPort()); + self::assertSame("override-user", $settings->getUsername()); + self::assertSame("override-pass", $settings->getPassword()); + } + + public function testBaseDirectoryOverrideIsUsedForMigrationLocation():void { + $repoBasePath = "/tmp/project-root"; + $config = new Config( + new ConfigSection("database", [ + "query_path" => "query", + "migration_path" => "_migration", + "migration_table" => "migration_log", + ]) + ); + $args = new ArgumentValueList(); + $args->set("base-directory", "alt-query"); + + $command = $this->createCommandProbe(); + [$migrationPath, $migrationTable] = $command->getMigrationLocationForTest($config, $repoBasePath, $args); + + self::assertSame("/tmp/project-root/alt-query/_migration", $migrationPath); + self::assertSame("migration_log", $migrationTable); + } + + private function createCommandProbe():ExecuteCommand { + return new class extends ExecuteCommand { + public function buildSettingsForTest( + Config $config, + string $repoBasePath, + ?ArgumentValueList $arguments = null + ): Settings { + return $this->buildSettingsFromConfig($config, $repoBasePath, $arguments); + } + + /** @return list */ + public function getMigrationLocationForTest( + Config $config, + string $repoBasePath, + ?ArgumentValueList $arguments = null + ): array { + return $this->getMigrationLocation($config, $repoBasePath, $arguments); + } + }; + } + } From 46867719f41aa166020b8f012765399bd421e29d Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sun, 22 Mar 2026 17:32:26 +0000 Subject: [PATCH 3/4] build: php 8.3 compatibility --- composer.lock | 70 ++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/composer.lock b/composer.lock index c8fd68d..fe0fe0b 100644 --- a/composer.lock +++ b/composer.lock @@ -119,29 +119,27 @@ }, { "name": "phpgt/cli", - "version": "v1.3.5", + "version": "v1.3.4", "source": { "type": "git", "url": "https://github.com/PhpGt/Cli.git", - "reference": "42aeef24ab9789907358002fdcc37cb3a2e26b4b" + "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Cli/zipball/42aeef24ab9789907358002fdcc37cb3a2e26b4b", - "reference": "42aeef24ab9789907358002fdcc37cb3a2e26b4b", + "url": "https://api.github.com/repos/PhpGt/Cli/zipball/71deb9cdc5a3ea8bfb665faa29739badbf61e9da", + "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da", "shasum": "" }, "require": { "ext-json": "*", "ext-readline": "*", - "php": ">=8.2", - "phpgt/daemon": "^1.1.3" + "php": ">=8.0", + "phpgt/daemon": "^v1.1" }, "require-dev": { - "phpmd/phpmd": "^2.13", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5", - "squizlabs/php_codesniffer": "^3.7" + "phpstan/phpstan": "^v1.8", + "phpunit/phpunit": "^v9.5" }, "type": "library", "autoload": { @@ -168,7 +166,7 @@ ], "support": { "issues": "https://github.com/PhpGt/Cli/issues", - "source": "https://github.com/PhpGt/Cli/tree/v1.3.5" + "source": "https://github.com/PhpGt/Cli/tree/v1.3.4" }, "funding": [ { @@ -176,7 +174,7 @@ "type": "github" } ], - "time": "2024-05-08T17:45:44+00:00" + "time": "2023-09-18T10:06:17+00:00" }, { "name": "phpgt/config", @@ -237,27 +235,24 @@ }, { "name": "phpgt/daemon", - "version": "v1.1.5", + "version": "v1.1.2", "source": { "type": "git", - "url": "https://github.com/phpgt/Daemon.git", - "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a" + "url": "https://github.com/PhpGt/Daemon.git", + "reference": "6490df99a22818149f30e3af408002ea7f73e035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpgt/Daemon/zipball/413e16b54de6e1fd5c2b646b485f88a86dfedd9a", - "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a", + "url": "https://api.github.com/repos/PhpGt/Daemon/zipball/6490df99a22818149f30e3af408002ea7f73e035", + "reference": "6490df99a22818149f30e3af408002ea7f73e035", "shasum": "" }, "require": { - "ext-pcntl": "*", - "php": ">=8.1" + "php": ">=7.4" }, "require-dev": { - "phpmd/phpmd": "^2.13", - "phpstan/phpstan": "^v1.10", - "phpunit/phpunit": "^10.5", - "squizlabs/php_codesniffer": "^3.7" + "phpstan/phpstan": ">=0.12.42", + "phpunit/phpunit": "9.*" }, "type": "library", "autoload": { @@ -268,16 +263,16 @@ "notification-url": "https://packagist.org/downloads/", "description": "Background script execution with cross-platform compatible streaming.", "support": { - "issues": "https://github.com/phpgt/Daemon/issues", - "source": "https://github.com/phpgt/Daemon/tree/v1.1.5" + "issues": "https://github.com/PhpGt/Daemon/issues", + "source": "https://github.com/PhpGt/Daemon/tree/v1.1.2" }, "funding": [ { - "url": "https://github.com/sponsors/PhpGt", + "url": "https://github.com/phpgt", "type": "github" } ], - "time": "2026-03-11T14:11:10+00:00" + "time": "2021-02-02T17:33:16+00:00" }, { "name": "phpgt/sqlbuilder", @@ -3078,25 +3073,26 @@ }, { "name": "symfony/var-exporter", - "version": "v8.0.0", + "version": "v7.4.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04" + "reference": "03a60f169c79a28513a78c967316fbc8bf17816f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04", - "reference": "7345f46c251f2eb27c7b3ebdb5bb076b3ffcae04", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/03a60f169c79a28513a78c967316fbc8bf17816f", + "reference": "03a60f169c79a28513a78c967316fbc8bf17816f", "shasum": "" }, "require": { - "php": ">=8.4" + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" }, "require-dev": { - "symfony/property-access": "^7.4|^8.0", - "symfony/serializer": "^7.4|^8.0", - "symfony/var-dumper": "^7.4|^8.0" + "symfony/property-access": "^6.4|^7.0|^8.0", + "symfony/serializer": "^6.4|^7.0|^8.0", + "symfony/var-dumper": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -3134,7 +3130,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v8.0.0" + "source": "https://github.com/symfony/var-exporter/tree/v7.4.0" }, "funding": [ { @@ -3154,7 +3150,7 @@ "type": "tidelift" } ], - "time": "2025-11-05T18:53:00+00:00" + "time": "2025-09-11T10:15:23+00:00" }, { "name": "theseer/tokenizer", From 5eb67dd479fd703a23ea1855c99f2c15a732eb12 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sun, 22 Mar 2026 17:41:31 +0000 Subject: [PATCH 4/4] test: ignore float precision --- test/phpunit/Result/RowTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/Result/RowTest.php b/test/phpunit/Result/RowTest.php index 6edb409..4f4865d 100644 --- a/test/phpunit/Result/RowTest.php +++ b/test/phpunit/Result/RowTest.php @@ -93,7 +93,7 @@ public function testGetFloat(array $data) { $row = new Row($data); $float = $row->getFloat("exampleFloat"); self::assertIsFloat($float); - self::assertSame(round($data["exampleFloat"], 5), round($float, 5)); + self::assertSame(round($data["exampleFloat"], 4), round($float, 4)); } /** @dataProvider data_getTestRow */