Skip to content

Let environment variables override PHPUnit "<server>" values - #118

Open
aik099 wants to merge 1 commit into
minkphp:masterfrom
aik099:env-var-overrides
Open

aik099 wants to merge 1 commit into
minkphp:masterfrom
aik099:env-var-overrides

Conversation

@aik099

@aik099 aik099 commented Oct 13, 2026

Copy link
Copy Markdown
Member

Follow-up to minkphp/webdriver-classic-driver#44 (comment)

AbstractConfig now reads WEB_FIXTURES_HOST, TEST_MACHINE_BASE_PATH and DRIVER_MACHINE_BASE_PATH through a new getEnvVar() method: getenv() first, then $_SERVER.

Right now a <server> in a driver's phpunit.xml.dist overwrites the same variable given from the shell/CI, so it can't be overridden without a custom phpunit.xml. With this change:

  • the shell/CI value wins over the XML one;
  • drivers that use <server> keep working as before;
  • drivers can switch their XML to <env> whenever they want (it doesn't write $_SERVER, so that only works after this change).

Once this is merged, the draft PRs minkphp/webdriver-classic-driver#66 and minkphp/MinkSelenium2Driver#415 would use getEnvVar() instead of reading $_SERVER, and replace all <server> with <env> in their phpunit*.xml files, with no commented-out <server> left.

getenv() isn't thread safe, but this is test-suite code only, so I think that's fine here.

Tested locally: all 4 combinations of XML value (set or not) and shell value (set or not), PHPStan, and the MinkBrowserKitDriver suite.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant