Skip to content

Fix PHPUnit shim arg parsing for DB test runner (--dsn with space-separated value) - #80

Merged
se7enxweb merged 2 commits into
mainfrom
copilot/fix-database-tests-failure
Aug 18, 2026
Merged

Fix PHPUnit shim arg parsing for DB test runner (--dsn with space-separated value)#80
se7enxweb merged 2 commits into
mainfrom
copilot/fix-database-tests-failure

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown

The Database tests (mysql, PHP 8.3) workflow fails before test execution because the legacy PHPUnit command shim forwards --dsn to PHPUnit 11 as an unknown option. The failure is triggered by tests/runtests.php --dsn <value> (space-separated form), which the shim did not consume.

  • Root cause

    • PHPUnit_TextUI_Command shim in tests/bootstrap.php only handled:
      • --opt=value
      • --flag
    • It did not handle --opt value for options declared with = (e.g. dsn=), so --dsn leaked to PHPUnit.
  • Change: shim option parser

    • Reworked run() argument iteration to index-based parsing.
    • Added handling for long options with required values in both forms:
      • --dsn=value
      • --dsn value
    • Existing flag behavior (e.g. --db-per-test) remains unchanged.
  • Change: focused regression coverage

    • Added tests/tests/lib/ezutils/PHPUnitTextUICommandShimTest.php.
    • Covers both accepted --dsn forms and asserts the option is consumed by the shim (not treated as unknown by PHPUnit).
if ( str_ends_with( $opt, '=' ) && $arg === "--{$key}" && ( $index + 1 ) < $argc )
{
    $value = $argv[$index + 1];
    $this->$handler( $value );
    $index += 2;
    continue 2;
}

Co-authored-by: se7enxweb <51429274+se7enxweb@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Database tests (mysql, PHP 8.3) Fix PHPUnit shim arg parsing for DB test runner (--dsn with space-separated value) Aug 18, 2026
Copilot AI requested a review from se7enxweb August 18, 2026 12:24
@se7enxweb
se7enxweb marked this pull request as ready for review August 18, 2026 12:24
@se7enxweb
se7enxweb merged commit ec71ca9 into main Aug 18, 2026
0 of 7 checks passed
@se7enxweb
se7enxweb deleted the copilot/fix-database-tests-failure branch August 18, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants