Imported from netresearch/t3x-nr-repurpose (
Tests/AGENTS.md). Install upstream withnpx skills add netresearch/t3x-nr-repurpose --skill Tests. Copyright stays with the author.
AGENTS.md — Tests
Overview
TYPO3 extension test suite. Use the typo3-testing skill for comprehensive guidance.
Key Files
| File | Purpose |
|---|---|
Build/phpunit.xml |
Unit (+ fuzzy/integration testsuite) config |
Build/FunctionalTests.xml |
Functional config (sqlite default) |
Tests/Functional/Persistence/JobProcessingRepositoryTest.php |
Repository/DB reference test |
Tests/Functional/Rendering/FfmpegAudioStitcherTest.php |
Real-binary smoke test (ffmpeg) |
Tests/Unit/Rendering/GdImageCompositorTest.php |
Unit reference (memory guard) |
Golden Samples (follow these patterns)
| Pattern | Reference |
|---|---|
| Functional (DB, CSV fixtures) | Tests/Functional/Persistence/JobProcessingRepositoryTest.php |
| Functional (real binaries) | Tests/Functional/Rendering/PlaywrightHtmlToImageRendererTest.php |
| Unit | Tests/Unit/Rendering/GdImageCompositorTest.php |
Test Structure
Tests/
├── Unit/ # Domain, Fixture, Generator, Ingestion, Pipeline, Rendering, Service, Understanding
├── Functional/ # Domain, Generator, Ingestion, Persistence, Queue, Rendering, Resource, Service
└── Fixtures/ # Pdf/ and Web/ sample inputs shared by both suites
PHPUnit configs live in Build/ (repo root), not under Tests/: Build/phpunit.xml and Build/FunctionalTests.xml — the locations the shared runner finds without a conf.
Running Tests
| Type | Command |
|---|---|
| Unit tests | ./Build/Scripts/runTests.sh -s unit |
| Functional tests | ./Build/Scripts/runTests.sh -s functional (sqlite; -d mariadb for MariaDB) |
| Single file | ./Build/Scripts/runTests.sh -s unit Tests/Unit/Path/To/Test.php (extra args pass through to phpunit) |
| Coverage | ./Build/Scripts/runTests.sh -s unitCoverage |
No composer phpunit scripts exist — the runner is the only test entry point (the
ci:*composer scripts cover cgl/phpstan/rector, not phpunit).-p <8.3|8.4|8.5>selects the PHP version (default 8.5).
Key Patterns (TYPO3-specific)
- Unit tests extend
\TYPO3\TestingFramework\Core\Unit\UnitTestCase - Functional tests extend
\TYPO3\TestingFramework\Core\Functional\FunctionalTestCase - Use
$this->importCSVDataSet()for functional test fixtures - Define
$testExtensionsToLoadfor extension dependencies - Use
GeneralUtility::makeInstance()for DI-aware instantiation in functional tests
Code Style
- Test class name matches source:
MyClass→MyClassTest - Test methods:
testprefix or@testannotation - One assertion concept per test
- Use data providers for multiple similar cases
- Mock external services, never real HTTP calls
PR Checklist
- All tests pass:
./Build/Scripts/runTests.sh -s unitand-s functional - New functionality has tests
- Fixtures are minimal and focused
- No hardcoded credentials or paths
- Coverage hasn't decreased
Setup
Nothing beyond Docker — the runner provisions PHP images itself. First run of
./Build/Scripts/runTests.sh -s composerUpdate installs .Build/.
Security
- Never use real API keys or secrets in tests — mock nr-llm services
- Functional rendering tests use the real local binaries (ffmpeg, chromium), no network
Examples
See Golden Samples above — real tests beat generic snippets.
When stuck
- Verbose run:
./Build/Scripts/runTests.sh -s unit -v - Root
AGENTS.mdfor tool provisioning (cgl/phpstan/rector ship vianetresearch/typo3-ci-workflows)
Skill Reference
For comprehensive TYPO3 testing guidance including fixtures, mocking, CI setup, and runTests.sh: Invoke skill:
typo3-testing