Files
pest/src/Subscribers/EnsureTiaResultsAreCollected.php
T
Jeffrey van Hees 047753c836 fix: key Tia results per dataset row (#1799)
The result cache was keyed `Class::method` on both sides, so every row of a
`->with()` test shared one entry and the last writer won. On replay that single
status was handed to every row.

`TestMethod::id()` already appends `#dataSetName`, and `TestCase` reaches the
same value object through `valueObjectForEvents()`, so both sides can use it.
2026-08-02 21:43:15 -04:00

28 lines
649 B
PHP

<?php
declare(strict_types=1);
namespace Pest\Subscribers;
use Pest\Plugins\Tia\ResultCollector;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Event\Test\PreparationStarted;
use PHPUnit\Event\Test\PreparationStartedSubscriber;
/**
* @internal
*/
final readonly class EnsureTiaResultsAreCollected implements PreparationStartedSubscriber
{
public function __construct(private ResultCollector $collector) {}
public function notify(PreparationStarted $event): void
{
$test = $event->test();
if ($test instanceof TestMethod) {
$this->collector->testPrepared($test->id(), $test->file());
}
}
}