public function testSmth() { $this->client = static::createClient(); $crawler = $this->client->request('GET', '/my-test-page'); if ($this->client->getResponse()->getStatusCode() !== 200) { $profile = $this->client->getProfile(); $exceptionProfile = $profile->getCollector('exception'); $trace = $exceptionProfile->getTrace(); $trace = array_slice($trace, 0, 5); $trace = array_map(function($i) { unset($i['short_class']); unset($i['namespace']); if ($i['file']) { $root = $this->container->getParameter('kernel.root_dir'); $root = str_replace('app', '', $root); $i['file'] = str_replace($root, '', $i['file']); unset($i['class']); $i['file'] .= $i['type'] . $i['function'] . ':' . $i['line']; unset($i['line']); unset($i['type']); unset($i['function']); } return $i; }, $trace); dump($trace); throw new \Exception($exceptionProfile->getMessage()); }