mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
chore: different refactors
This commit is contained in:
@ -47,10 +47,14 @@ final class Container
|
||||
|
||||
/**
|
||||
* Adds the given instance to the container.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add(string $id, object|string $instance): void
|
||||
public function add(string $id, object|string $instance): self
|
||||
{
|
||||
$this->instances[$id] = $instance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -23,12 +23,15 @@ final class StateGenerator
|
||||
$state = new State();
|
||||
|
||||
foreach ($testResult->testErroredEvents() as $testResultEvent) {
|
||||
assert($testResultEvent instanceof Errored);
|
||||
$state->add(\NunoMaduro\Collision\Adapters\Phpunit\TestResult::fromTestCase(
|
||||
$testResultEvent->test(),
|
||||
TestResult::FAIL,
|
||||
$testResultEvent->throwable()
|
||||
));
|
||||
if ($testResultEvent instanceof Errored) {
|
||||
$state->add(TestResult::fromTestCase(
|
||||
$testResultEvent->test(),
|
||||
TestResult::FAIL,
|
||||
$testResultEvent->throwable()
|
||||
));
|
||||
} else {
|
||||
$state->add(TestResult::fromBeforeFirstTestMethodErrored($testResultEvent));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($testResult->testFailedEvents() as $testResultEvent) {
|
||||
|
||||
Reference in New Issue
Block a user