client = static::createClient(); } /** * {@inheritdoc} */ protected function onNotSuccessfulTest(Throwable $exception) { $message = null; if ($this->client->getCrawler() && count($this->client->getCrawler()->filter('.exception-message')) > 0) { $message = preg_replace('#\s{2,}#', '', $this->client->getCrawler()->filter('.exception-message')->text()); } if ($message) { $exceptionClass = get_class($exception); throw new $exceptionClass($exception->getMessage() . ' | ' . $message); } throw $exception; } /** * @param string $id * @return Poll * @throws \Doctrine\DBAL\DBALException */ protected function getPollById(string $id): Poll { return $this->client->getContainer()->get('framadate.poll_service.public')->findById($id); } }