typo3-testing
npx machina-cli add skill netresearch/typo3-testing-skill/typo3-testing --openclawTYPO3 Testing Skill
Templates, scripts, and references for comprehensive TYPO3 extension testing.
Test Type Selection
| Type | Use When | Speed |
|---|---|---|
| Unit | Pure logic, no DB, validators, utilities | Fast |
| Functional | DB interactions, repositories, controllers | Medium |
| Architecture | Layer constraints, dependency rules (phpat) | Fast |
| E2E (Playwright) | User workflows, browser, accessibility | Slow |
| Integration | HTTP client, API mocking, OAuth flows | Medium |
| Fuzz | Security, parsers, malformed input | Manual |
| Crypto | Encryption, secrets, key management | Fast |
| Mutation | Test quality verification, 70%+ coverage | CI/Release |
Setup and Running Tests
# Setup
<skill-dir>/scripts/setup-testing.sh [--with-e2e] # Initialize testing
<skill-dir>/scripts/validate-setup.sh # Validate existing setup
<skill-dir>/scripts/generate-test.sh <Type> <Class> # Generate test file
# Run tests
Build/Scripts/runTests.sh -s unit # Unit tests
Build/Scripts/runTests.sh -s functional # Functional tests
Build/Scripts/runTests.sh -s architecture # Architecture tests (phpat)
Build/Scripts/runTests.sh -s e2e # E2E tests (Playwright)
Build/Scripts/runTests.sh -s lint # Linting
Build/Scripts/runTests.sh -s phpstan # Static analysis
Build/Scripts/runTests.sh -s mutation # Mutation testing
After creating or modifying a test, always verify it fails before the fix and passes after. Run the full suite to ensure no regressions.
Scoring Requirements
| Criterion | Requirement |
|---|---|
| Unit tests | Required, 70%+ coverage |
| Functional tests | Required for DB operations |
| Architecture tests | phpat required for full points |
| PHPStan | Level 10 (max) |
References
| Reference | Topic |
|---|---|
unit-testing.md | UnitTestCase, mocking, FakeClock |
functional-testing.md | FunctionalTestCase, CSV fixtures, TSFE limitations |
functional-test-patterns.md | PHPUnit 10+ migration, container reset |
integration-testing.md | PSR-18 mocking, OAuth flows |
e2e-testing.md | Playwright, Page Object Model |
ddev-testing.md | Local multi-version matrix |
test-runners.md | runTests.sh, Docker orchestration |
architecture-testing.md | phpat, layer constraints |
ci-debugging.md | Multi-version CI failure analysis |
ci-cd.md | GitHub Actions, GitLab CI |
quality-tools.md | PHPStan, PHP-CS-Fixer, Rector |
mutation-testing.md | Infection, MSI |
typo3-v14-final-classes.md | Interface extraction, mock strategies |
javascript-testing.md | Jest, frontend testing |
enforcement-rules.md | E2E CI rules, troubleshooting |
All references in references/ directory.
Explicit Content Triggers
When debugging CI test failures across TYPO3 versions, load references/ci-debugging.md for multi-version error comparison and debugging checklist.
When writing functional tests that need frontend context (parseFunc, typoLink, TSFE), load references/functional-testing.md for known limitations and workarounds.
External Resources
- TYPO3 Testing Documentation
- Tea Extension (reference implementation)
- phpat documentation
- Infection PHP documentation
- DDEV documentation
Contributing: https://github.com/netresearch/typo3-testing-skill
Source
git clone https://github.com/netresearch/typo3-testing-skill/blob/main/skills/typo3-testing/SKILL.mdView on GitHub Overview
Templates, scripts, and references for comprehensive TYPO3 extension testing. It covers setup, test generation, and per-type runtimes, plus CI/CD integration and multi-version debugging for TYPO3 v13/v14.
How This Skill Works
The skill ships templates and CLI scripts under the skill directory to scaffold tests, configure PHPUnit, and run unit, functional, architecture, and E2E tests. Use the provided workflows (setup-testing.sh, validate-setup.sh, generate-test.sh, and Build/Scripts/runTests.sh) to manage test lifecycles, while leveraging mutation testing and mocking tooling alongside PHPStan and phpat as needed.
When to Use It
- Setting up TYPO3 extension test infrastructure
- Writing unit, functional, architecture, or E2E tests
- Configuring PHPUnit, PHPStan, and test runners for TYPO3
- Configuring CI/CD for TYPO3 extensions
- Debugging failing tests in CI across TYPO3 v13/v14
Quick Start
- Step 1: Run setup: <skill-dir>/scripts/setup-testing.sh [--with-e2e]
- Step 2: Validate setup: <skill-dir>/scripts/validate-setup.sh
- Step 3: Generate and run tests: <skill-dir>/scripts/generate-test.sh <Type> <Class> && Build/Scripts/runTests.sh -s <Type>
Best Practices
- Verify a test fails before applying a fix and passes after, then run the full suite to prevent regressions
- Target 70%+ coverage for unit tests; ensure functional tests cover DB interactions
- Use architecture tests via phpat and keep PHPStan at level 10
- Leverage the provided scripts for setup, test generation, and per-type execution
- Consult references/ci-debugging.md and references/ci-cd.md for multi-version CI debugging and workflows
Example Use Cases
- Initialize a TYPO3 extension's test infra with unit and functional tests and wire up CI
- Migrate tests to PHPUnit 10+ and adjust functional tests for TSFE limitations
- Add phpat-based architecture tests to enforce layering constraints
- Configure a CI pipeline to run mutation testing (Infection/MSI) and a multi-version matrix
- Debug a flaky test in CI by applying the multi-version debugging checklist