원클릭으로
원클릭으로
Stabilize flaky Testo tests with
Migrate an existing PHPUnit test suite to Testo. Use when the user says "migrate from PHPUnit", "port phpunit tests", "convert TestCase to Testo", or has files extending PHPUnit\Framework\TestCase that need to move to Testo's attribute-based style.
Author a Testo plugin — event listeners, interceptors, custom container bindings, or new test attributes. Use when the user wants to extend Testo's behaviour (custom reporters, lifecycle hooks across the suite, attribute-driven middleware, integrating an external system) rather than writing a single test.
Write or modify tests in a project that uses the Testo PHP testing framework. Use when adding a
Set up or edit `testo.php` — the Testo application config. Use when the user is bootstrapping a project (including running `vendor/bin/testo init`), adding/removing a suite, scoping a finder, wiring an application-wide plugin (coverage, JUnit), or asking "where do I configure Testo" / "how do I initialize Testo".
Parameterize Testo tests with
| name | testo-benchmarks |
| description | Write or tune Testo performance benchmarks with |
#[Bench])#[Bench] runs a method many times, collects timing statistics, and reports
Mean, Median, RStDev, with outlier rejection. The stability target is RStDev < 2% —
above that, the result is noisy and shouldn't be used to draw conclusions.
Requires the BenchmarkPlugin to be enabled for the suite. Fetch
https://php-testo.github.io/llms.txt for the current #[Bench] parameter list — they evolve.
<?php
declare(strict_types=1);
namespace App\Bench;
use Testo\Bench;
final class SerializationBench
{
#[Bench(
callables: [
'json_encode' => 'json_encode',
'native_serial' => 'serialize',
'custom' => [self::class, 'customEncode'],
],
arguments: [['a' => 1, 'b' => [2, 3, 4], 'c' => 'x']],
calls: 1000,
iterations: 5,
)]
public static function encode(): void
{
// Body is unused when `callables` is set — the listed callables are compared head-to-head.
}
public static function customEncode(array $data): string
{
return MyEncoder::encode($data);
}
}
Key parameters:
callables — map of label => callable to compare. Use it for A/B comparisons.arguments — array of positional arguments, applied to every callable.calls — invocations per iteration (the inner loop). Increase until per-iteration time is well above timer resolution.iterations — number of iterations (the outer loop). Drives the statistics (Mean/Median/RStDev).callables. Don't bench json_encode($small) against serialize($large).When reporting comparison results, always include RStDev for each variant. A "30% faster" claim with 8% RStDev is noise.
#[Test] or #[TestInline] — keep benchmark classes separate.