mirror of
https://github.com/pestphp/pest.git
synced 2026-09-05 22:33:35 +02:00
047753c836
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.
28 lines
649 B
PHP
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());
|
|
}
|
|
}
|
|
}
|