Skip to content

Phase 1: Test infrastructure (unit/functional split, DAMA + Liip + messenger-test)#75

Merged
turegjorup merged 6 commits into
developfrom
feature/test-coverage
Apr 20, 2026
Merged

Phase 1: Test infrastructure (unit/functional split, DAMA + Liip + messenger-test)#75
turegjorup merged 6 commits into
developfrom
feature/test-coverage

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Summary

First of four PRs implementing the test coverage plan. This PR lands the test infrastructure only — no new tests are added yet (those come in Phases 2–4).

  • Split phpunit.xml.dist into unit and functional suites; existing 8 test files moved under tests/Unit/ (git-renamed, namespaces updated to App\Tests\Unit\*).
  • Added test infrastructure bundles:
    • dama/doctrine-test-bundle — auto transaction rollback per test (wired as PHPUnit extension).
    • liip/test-fixtures-bundle — reload fixtures from the existing src/DataFixtures/ classes.
    • zenstruck/messenger-test — fluent transport assertions for the Messenger pipeline tests in Phase 2.
    • ergebnis/phpunit-slow-test-detector — flags tests exceeding 1s duration.
  • Bumped phpunit/phpunit from ^10.3 to ^12 (latest 12.5.23). All existing tests pass unchanged.
  • Removed symfony/phpunit-bridge: simple-phpunit never ran (real PHPUnit is a direct dep), SYMFONY_DEPRECATIONS_HELPER was set to 999999 (effectively disabled), and no ClockMock/DnsMock/ExpectDeprecationTrait references exist. bin/phpunit simplified accordingly.
  • Added tests/Fixtures/TestUserFixtures.php — one user per role (SUPER_ADMIN, ADMIN, EDITOR, ORG_ADMIN, two ORG_EDITORs scoped to different orgs) for the functional tests that land in Phase 3.
  • Added tests/Functional/AbstractAdminTestCase.phpWebTestCase base with loginAs($email) and loadFixtures() helpers.
  • Configured .env.test with MAILER_DSN=null://null.

Test plan

  • task test — 22/22 passing under PHPUnit 12.5.23
  • task code-analysis:phpstan — clean
  • composer run coding-standards-check — clean
  • CI green on this PR

Next PRs on this branch sequence:

  1. feature/test-coverage-pipeline — MessageHandler + Factory + E2E golden-path tests (uses zenstruck/messenger-test)
  2. feature/test-coverage-security — Voter unit tests + auth/dashboard/CRUD functional tests (uses AbstractAdminTestCase + TestUserFixtures)
  3. feature/test-coverage-ci — split CI steps per suite, Codecov flags

🤖 Generated with Claude Code

turegjorup and others added 4 commits April 20, 2026 10:43
- Split phpunit.xml.dist into `unit` and `functional` test suites
- Add dama/doctrine-test-bundle for per-test transaction rollback
- Add liip/test-fixtures-bundle for reloading fixtures from src/DataFixtures
- Bump symfony/phpunit-bridge to ^7.3 to match Symfony 7.x
- Move existing tests under tests/Unit/; update namespaces
- Add tests/Fixtures/TestUserFixtures.php with one user per role
- Add tests/Functional/AbstractAdminTestCase.php base class with loginAs() + loadFixtures()
- Configure .env.test with null mailer transport
- Update CHANGELOG.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The bridge was effectively unused: `simple-phpunit` never runs because
phpunit/phpunit is a direct dep, SYMFONY_DEPRECATIONS_HELPER was set to
999999 (unlimited), and ClockMock/DnsMock/ExpectDeprecationTrait have no
references in the codebase. Drop the dep, simplify bin/phpunit to a
single require, and clean up the .gitignore/recipe remnants.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Upgrade from ^10.3 to ^12 (latest 12.5.23). All 22 existing tests pass
unchanged; PHPStan and CS checks remain green. DAMA doctrine-test-bundle,
liip test-fixtures-bundle, and phpstan-phpunit are all compatible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- zenstruck/messenger-test: fluent transport assertions for the upcoming
  Messenger pipeline tests (Phase 2). Bundle auto-enabled in test env.
- ergebnis/phpunit-slow-test-detector: flags tests exceeding 1s as a
  CI hygiene signal. Registered as PHPUnit extension.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@turegjorup turegjorup self-assigned this Apr 20, 2026
@codecov-commenter

codecov-commenter commented Apr 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.71%. Comparing base (bcfcd2c) to head (37c1290).
⚠️ Report is 14 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##             develop     #75   +/-   ##
=========================================
  Coverage       3.70%   3.71%           
- Complexity      1251    1261   +10     
=========================================
  Files            162     162           
  Lines           4448    4440    -8     
=========================================
  Hits             165     165           
+ Misses          4283    4275    -8     
Flag Coverage Δ
unittests 3.71% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

turegjorup and others added 2 commits April 20, 2026 10:55
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@turegjorup turegjorup merged commit 92c2d00 into develop Apr 20, 2026
12 checks passed
@turegjorup turegjorup deleted the feature/test-coverage branch April 20, 2026 09:01
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