chore: different refactors

This commit is contained in:
Nuno Maduro
2023-02-11 16:07:30 +00:00
parent e1406554fc
commit 8eaf4859ff
19 changed files with 207 additions and 165 deletions

View File

@ -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;
}
/**

View File

@ -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) {