public function getResult($class)
{
if (!isset($this->results[$class])) {
throw new \RuntimeException(sprintf('Result of class "%s" has not been set', $class));
}
return $this->results[$class];
}
/** * It can have results added in the constructor. */ public function testAddConstructor() { $collection = new ResultCollection([$expected = new TimeResult(10)]); $result = $collection->getResult(TimeResult::class); $this->assertSame($expected, $result); }