nette/tester
Nette Tester is a lightweight, enjoyable PHP testing framework with expressive assertions, mocks, code coverage, and parallel test execution. It requires no annotations or complex setup, making it a fast, practical choice for testing PHP projects.
Strengths:
TestCase::run() now runs every test method even after a failure and presents results first, followed by failure details. For Laravel teams debugging large suites, this reduces repeated runs and shortens feedback cycles.redirect('https://…', 302) instead of redirect()), which is directly useful when debugging Laravel HTTP, routing, and helper calls.HttpAssert with follow: true now takes headers from the final response only. This aligns better with Laravel’s HTTP client testing expectations when redirects are followed.--stop-on-fail with parallel jobs now waits for running tests before exiting, and Ctrl+C terminates them. This reduces orphaned processes and shared-state hazards in Laravel’s parallel test environments.tester exits with code 1 when a requested report cannot be generated. Both improve CI reliability and report parsing.Gaps:
phpunit.xml, Pest, Laravel TestCase, service container lifecycle, HTTP client helpers, and database transaction traits. Manual wrappers remain necessary.artisan test integration; invocation remains via ./vendor/bin/tester.Pros:
failures attribute instead of errors. This is more conventional, but it is a breaking change for CI consumers that only read errors.@phpVersion boundary handling is corrected, so version-specific Laravel tests run on the intended PHP versions. This reduces false negatives in multi-version CI matrices.Assert::exception() and Assert::error() now check messages even when they are '' or '0'; passing null skips the check. This removes a subtle source of false positives in Laravel exception and error tests.HttpAssert with follow: true using final-response headers is more consistent with how Laravel’s HTTP client exposes redirected responses.Cons:
errors as failed tests must be updated to read failures.MockFacade, RefreshDatabase, See, assertDatabaseHas(), and similar helpers still require wrappers or aliases.test() syntax and Assert methods.High:
errors to failures can cause failed tests to be under-reported if CI consumers are not updated. This is the most operationally significant change in v2.6.2.tester now exits with code 1 when a requested report cannot be generated. Pipelines must treat this as a real failure and avoid masking it.--stop-on-fail fix improves process cleanup but does not remove the need for explicit isolation.Medium:
Assert::exception() and Assert::error() empty-string message handling may change existing test outcomes. Tests relying on skipped message checks must now pass null.follow: true.assertDatabaseHas(), assertDatabaseCount(), and similar helpers still need wrappers.Low:
Assert::match() masks, FileMock, DomQuery on PHP < 8.4, Dumper, and JUnit invalid UTF-8 handling reduce edge-case failures.CI Reporting Impact:
errors attribute? They must be updated to read failures.Laravel-Specific Testing Needs:
RefreshDatabase, HttpTests, DatabaseTransactions, or Pest macros? How will those be wrapped or replaced?Parallelism and Isolation:
--stop-on-fail parallel fix change existing CI behavior or test runtime expectations?Version-Gated Tests:
@phpVersion boundaries that need re-validation under PHP 8.4.3, 8.1, or < 8.0 conditions?Adoption and Feedback:
TestCase::run() to surface all failures in one run, or keep stop-on-first-failure for speed?Laravel Compatibility:
HttpAssert follow-header fix improves fit for Laravel HTTP client tests involving redirects.DomQuery.composer require nette/tester../vendor/bin/tester tests/Unit or custom Composer scripts.failures semantics and coverage exit code 1.Alternatives Considered:
nette/tester for unit/integration tests until wrappers mature.Assessment Phase:
errors instead of failures.Assert::exception()/Assert::error() empty-string message behavior.@phpVersion boundary tests under PHP 8.4.3, 8.1, and < 8.0 conditions.--stop-on-fail process cleanup.Pilot Migration:
nette/tester.
test('example').TestCase::run() to surface all failures in one run during pilot debugging.errors to failures.HttpAssert with follow: true against Laravel HTTP redirect tests.--stop-on-fail and verify no orphaned processes remain.Full Rollout:
Fallback Plan:
nette/tester for unit/integration tests.nette/tester JUnit formats during transition.| Feature | Compatibility | Workaround |
|---|---|---|
| Laravel TestCase | ❌ No native support | Extend TestCase with custom traits or wrappers. |
| Database Transactions | ⚠️ Manual rollback needed (no RefreshDatabase trait) |
Use DB::transaction() or custom lifecycle hooks. |
| JUnit report semantics | ⚠️ Failed tests now counted in failures, not errors |
Update CI scripts and dashboards to read failures. |
| Coverage report failure | ⚠️ Exits with code 1 when report cannot be generated | Ensure CI treats this as a build failure and alerts appropriately. |
HttpAssert with follow: true |
✅ Headers now taken from final response only | Re-validate tests that asserted intermediate redirect headers. |
Assert::exception() / Assert::error() empty messages |
⚠️ Empty string and '0' messages are now checked |
Pass null to skip message checks. |
@phpVersion boundaries |
✅ Fixed for 8.4.3, 8.1, and < 8.0 |
Re-run version-gated tests to confirm behavior. |
Parallel --stop-on-fail |
✅ Running tests finish before exit; Ctrl+C terminates them | Validate process cleanup in CI. |
Environment::lock() on Windows |
✅ Test retains full time limit after lock wait | Re-test Windows CI jobs. |
| PHP 8.6 | ✅ Supported | None; align with Laravel upgrade roadmap. |
TestCase::run() all-failures behavior |
✅ New feature | Adopt for debugging and full-failure CI runs. |
nette/tester on unit tests with TestCase::run() and parallel execution.failures change requires coordination with CI owners. Document the change and update any dashboards that parse errors.TestCase::run() reduce debugging friction, but developers still need guidance on test() syntax and Assert methods.--stop-on-fail parallel fix improves reliability at scale by ensuring running tests finish and Ctrl+C terminates them.TestCase::run() can increase output volume and runtime when many tests fail, but it reduces repeated CI cycles. Teams should choose between fast-fail and full-failure modes based on workflow.errors may miss failed tests now counted under failures.'' or '0' may fail until null is passed.follow: true.@phpVersion boundary fixes may change which tests run on specific PHP versions.Environment::lock() fix changes timing behavior on Windows; re-validation is advised.test() syntax, Assert methods, and lifecycle differences.TestCase::run() all-failures output reduce ramp-up friction by making failures easier to diagnose.RefreshDatabase, HTTP tests, and database assertions require upfront investment and ongoing ownership.How can I help you explore Laravel packages today?