Skip to content

test(php): add BDD suite wiring#3410

Open
countradooku wants to merge 5 commits into
apache:masterfrom
countradooku:issue-3310-php-bdd
Open

test(php): add BDD suite wiring#3410
countradooku wants to merge 5 commits into
apache:masterfrom
countradooku:issue-3310-php-bdd

Conversation

@countradooku
Copy link
Copy Markdown
Contributor

@countradooku countradooku commented Jun 3, 2026

Summary

  • add bdd/php with a PHPUnit implementation of the shared basic messaging BDD scenario
  • wire php-bdd into the shared Docker Compose BDD runner and scripts/run-bdd-tests.sh
  • add bdd-php component detection and include PHP BDD paths in sdk-php

Closes #3310.

Verification

  • php -l bdd/php/tests/BasicMessagingFeatureTest.php
  • parsed bdd/php/phpunit.xml.dist with PHP SimpleXMLElement
  • bash -n scripts/run-bdd-tests.sh
  • git diff --check
  • docker compose -f bdd/docker-compose.yml config
  • component YAML validation for bdd-php task/dependencies
  • PHP BDD container against local Iggy server: OK (1 test, 38 assertions)

Notes

A full local ./scripts/run-bdd-tests.sh php run on macOS failed before PHP tests because the shared BDD server image copied local target/debug Mach-O binaries into a Linux container. CI builds Linux binaries before invoking the BDD runner, so the shared path should be valid there.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jun 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.40%. Comparing base (d254604) to head (7889936).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3410      +/-   ##
============================================
- Coverage     74.43%   74.40%   -0.04%     
  Complexity      943      943              
============================================
  Files          1245     1245              
  Lines        121293   121293              
  Branches      97599    97628      +29     
============================================
- Hits          90285    90242      -43     
- Misses        28054    28059       +5     
- Partials       2954     2992      +38     
Components Coverage Δ
Rust Core 75.56% <ø> (-0.01%) ⬇️
Java SDK 58.44% <ø> (ø)
C# SDK 69.41% <ø> (-0.52%) ⬇️
Python SDK 81.06% <ø> (ø)
PHP SDK 83.57% <ø> (ø)
Node SDK 91.22% <ø> (-0.13%) ⬇️
Go SDK 40.20% <ø> (ø)
see 28 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@countradooku
Copy link
Copy Markdown
Contributor Author

/ready

Add PHP to the shared BDD runner and component graph so PHP SDK scenario changes are detected and routed like the other foreign SDKs. The initial suite reuses the repository's shared basic messaging feature and runs it through PHPUnit with the existing PHP SDK test bootstrap.

Constraint: PHP SDK requires PHP >=8.3, so the BDD image uses the trixie Rust base and the SDK composer.lock

Rejected: Add Behat as a new BDD dependency | PHPUnit is already the PHP SDK test runner and can execute the shared scenario without expanding dependencies

Confidence: high

Scope-risk: narrow

Directive: Keep bdd-php paths and sdk-php dependencies aligned when PHP SDK test tooling changes

Tested: PHP syntax check for BasicMessagingFeatureTest.php

Tested: PHPUnit XML parse

Tested: docker compose config render for bdd/docker-compose.yml

Tested: bdd-php component YAML dependency/task validation

Tested: PHP BDD container against local Iggy server, OK (1 test, 38 assertions)

Not-tested: Full ./scripts/run-bdd-tests.sh php on macOS because the shared BDD server image consumed local Mach-O target/debug binaries instead of Linux CI-built binaries
Keep PHP BDD files owned by the bdd-php component instead of the sdk-php component. The bdd-php component already depends on sdk-php, which gives BDD jobs the SDK prerequisites without running PHP SDK lint/build/test for BDD-only changes.

Also stop copying foreign/php/composer.lock into the PHP BDD image because that file is not tracked in CI.

Constraint: Component detection should route bdd/php changes to BDD tasks, not PHP SDK pre-merge tasks

Rejected: Track composer.lock for the SDK | broader package-management decision outside this BDD wiring fix

Confidence: high

Scope-risk: narrow

Tested: component ownership YAML validation

Tested: PHP syntax check for BasicMessagingFeatureTest.php

Tested: PHPUnit XML parse

Tested: docker compose config render for bdd/docker-compose.yml

Not-tested: Full Docker BDD run locally because Docker daemon is unavailable in this session
The PHP BDD image compiles cargo-php and then the PHP extension in separate Docker layers. CI ran out of disk during the extension build because the cargo install cache remained in the image filesystem before compiling the SDK.

Constraint: GitHub Actions runners have limited Docker build disk for BDD images

Rejected: Drop PHP BDD from the matrix | leaves issue apache#3310 only partially wired

Rejected: Remove generated PHP extension install | the BDD suite needs the real SDK extension

Confidence: medium

Scope-risk: narrow

Directive: Keep the BDD image cargo-php version aligned with the PHP SDK CI action

Tested: git diff --check

Tested: bash -n scripts/run-bdd-tests.sh

Tested: php -l bdd/php/tests/BasicMessagingFeatureTest.php

Tested: docker compose -f bdd/docker-compose.yml config

Tested: docker compose -f bdd/docker-compose.yml build php-bdd

Not-tested: Full ./scripts/run-bdd-tests.sh php after image build in this turn
The PHP test job was restoring the shared dev Rust cache, which had grown large enough to fill the GitHub runner during extraction before PHP tests could run. PHP builds only need their own extension artifacts, so use a PHP-specific cache namespace instead of the global workspace cache.

Constraint: GitHub Actions PHP test runners had 28 GiB free after cleanup but the shared cache extraction still exhausted disk

Rejected: Disable Rust setup entirely | PHP still needs the pinned Rust toolchain and system setup

Confidence: medium

Scope-risk: narrow

Directive: Do not point PHP SDK jobs back at the shared dev cache without checking cache size on CI

Tested: YAML parse for .github/actions/php/pre-merge/action.yml

Tested: cargo fmt --manifest-path foreign/php/Cargo.toml -- --check

Tested: cargo metadata --manifest-path foreign/php/Cargo.toml --format-version 1 --no-deps

Tested: php composer.json JSON parse and php -l foreign/php PHP files

Tested: git diff --check

Not-tested: Full PHP CI job locally because the failure is specific to GitHub cache extraction
The PR now runs against the updated master license checker, which uses HawkEye instead of addlicense. Format the PHP BDD XML header with HawkEye and keep the strict PHP test file on its existing valid in-PHP Apache header by excluding it from HawkEye's generic PHP mapping.

Constraint: Current HawkEye config maps generic PHP files to double-slash headers before <?php, which breaks strict PHP files

Rejected: Keep HawkEye-generated double-slash header before <?php | emits output and breaks strict_types parsing

Confidence: high

Scope-risk: narrow

Directive: Do not remove the BasicMessagingFeatureTest.php exclusion unless the global PHP HawkEye mapping is fixed for strict PHP files

Tested: ./scripts/ci/license-headers.sh --check with hawkeye 6.5.1

Tested: php -l bdd/php/tests/BasicMessagingFeatureTest.php

Tested: php SimpleXMLElement parse for bdd/php/phpunit.xml.dist

Tested: bash -n scripts/run-bdd-tests.sh

Tested: docker compose -f bdd/docker-compose.yml config

Tested: ./scripts/ci/taplo.sh --check --ci licenserc.toml

Tested: shellcheck scripts/ci/license-headers.sh

Tested: git diff --check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP SDK: add BDD scenarios and bdd-php component

1 participant