Repository navigation
test: refactor test suite, upgrade to PHPUnit 13 and fill coverage gaps - #41
Merged
Merged
Conversation
…tests Add a unit-testing skill and convert every test to an it_ snake_case name with a #[Test] attribute. Unset setUp() properties in tearDown(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migrate tests for PHPUnit 13: use stubs for test doubles without expectations, add expects() where with() was used without one, and fix data provider argument counts. Fail on PHPUnit warnings, deprecations and notices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add unit tests for untested behaviour across Toolkit, Bus, Application, Domain, Infrastructure and the Testing fakes, raising line coverage from 92% to 99.7%. The remaining uncovered lines are unreachable. Clean up existing tests to follow the unit-testing skill: one AAA per test, expectations at the end of arrange, exact exception messages, real instances and shipped fakes over mocks, no unused setUp mocks, and no tests of native assert() AssertionErrors. Bugs found in src while writing the tests are recorded in #40. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This brings the whole test suite in line with the
unit-testingClaude skill in.claude/skills/unit-testing/SKILL.md, upgrades to PHPUnit 13, and fills the coverage gaps. All the changes are dev-only, andsrc/is untouched.Commits
it_test names, PHPUnit attributes and tearDown in all testsit_snake_case name with a#[Test]attribute.tearDown()to classes that set properties insetUp()and lacked one, and fixes the unset/parent::tearDown()order.phpunit.xmlto the 13.4 schema and fails on PHPUnit warnings, deprecations and notices.expects(); where no calls are asserted, the mock becomes a stub.ContextualProcessor/RecursiveParser,IdentifierFactory,FakeContainer,FakeLogger, the attribute autowiring on every dispatcher, queue and publisher, and the handler-container error paths.Testingfakes instead of mocks;setUp();assert()AssertionErrors are removed.Results
The 4 lines still uncovered can't be reached by a test: a private constructor, the
function_existsguards infunctions.php(they run at autoload), and the finalthrowinFakeUnitOfWork, which no code path reaches.#[AllowMockObjectsWithoutExpectations]isn't used anywhere.Related
The bugs found in
src/while writing these tests are in #40. They are not fixed here.Test plan
composer allpasses locally on PHP 8.5 (deptrac, phpstan level 10, pint, phpunit).🤖 Generated with Claude Code