/** * @covers ::executeOrFail */ public function testExecuteOrFailTimeout() { $callback = function () { return false; }; $attempt = new Attempt($callback); $attempt->setTimeout(80); $this->setExpectedException('RuntimeException', 'Timed out attempting to execute callback'); $attempt->executeOrFail(); }
/** * @param Query\AbstractQuery $query * @param string $parentId * @return array */ public function queryIds(Query\AbstractQuery $query, $parentId = null) { $attempt = new Attempt(function () use($query, $parentId) { $ids = $parentId === null ? $this->getElementIds($query) : $this->getChildElementIds($query, $parentId); return $query->getFilters()->matchAll($this, (array) $ids); }); return $attempt->execute(); }