private function executeTestMethod(\ReflectionMethod $method) { $this->tryExecute('beforeMethod'); $test = new FunctionTest([$this->class, $method->getName()]); $results = $test->execute(); $this->tryExecute('afterMethod'); return Arrays::first($results); }
function testExecutionShouldCollectExecutionTime() { $ms = 10; $test = new FunctionTest(function () use($ms) { usleep($ms * 1000); }); $result = $test->execute()[0]; $this->assertGreaterThanOrEqual($ms, $result->getExecutionTimeInMs()); }