Skip to content

CC integration: Unit test rules - #4323

Merged
stracker-phil merged 3 commits into
dev/PCP-6288-cc-integrationfrom
dev/PCP-6288-cc-unit-test-rules
Jul 21, 2026
Merged

CC integration: Unit test rules#4323
stracker-phil merged 3 commits into
dev/PCP-6288-cc-integrationfrom
dev/PCP-6288-cc-unit-test-rules

Conversation

@stracker-phil

@stracker-phil stracker-phil commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds Claude Code developer tooling to standardize PHP unit test writing across the project.

What's included

  • .claude/agents/unit-test-writer.md: A sub-agent with instructions for writing PHPUnit tests in this codebase. It includes:
    • GIVEN/WHEN/THEN doc blocks on every test method
    • A general naming convention
    • Stub-over-mock preference, with a decision table to justify mocks
    • Data providers with descriptive string keys
    • Required patterns: stateful fixture closures, testable subclasses for protected methods
    • A quality checklist the agent must verify before delivering
    • Relevant DDEV test commands
  • .claude/rules/unit-test-conventions.md: A Claude Code rule scoped to tests/PHPUnit/**/*.php that instructs the assistant to always delegate test writing to the new unit-test-writer agent, never inline.
  • .gitignore update: Adds general support to track relevant claude code files (include all .claude/ content, but exclude all *.local.* files in all folders).

Why

Test quality has been inconsistent - missing doc blocks, mocks where stubs suffice, no data providers, tests asserting implementation details. Routing all test work through a specialized agent with hard-wired conventions prevents regressions in test quality without requiring manual review of every test PR.

Samples

Test files created by this agent:

@stracker-phil
stracker-phil marked this pull request as ready for review May 8, 2026 11:34
@stracker-phil
stracker-phil changed the base branch from dev/develop to dev/PCP-6288-cc-integration July 21, 2026 16:53
@stracker-phil
stracker-phil merged commit 26b1650 into dev/PCP-6288-cc-integration Jul 21, 2026
2 checks passed
@stracker-phil
stracker-phil deleted the dev/PCP-6288-cc-unit-test-rules branch July 21, 2026 16:59
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

🔗 Test this pull request with WordPress Playground

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v4.1.1-pr4323-29851033239-gba2d8cb (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 4.1.1-pr4323-29851033239-gba2d8cb
  • Commit: b9d735e
  • Artifact: woocommerce-paypal-payments-4.1.1-pr4323-29851033239-gba2d8cb

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit b9d735e • Last updated: 2026-07-21T17:04:47.382Z

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