Last active
March 29, 2018 10:44
-
-
Save mrself/5a9e5b5ed35e4b6178f15d86058a74e3 to your computer and use it in GitHub Desktop.
Revisions
-
mrself revised this gist
Mar 29, 2018 . 2 changed files with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ public function testSmth() { $this->client = static::createClient(); $crawler = $this->client->request('GET', '/my-test-page'); if ($this->client->getResponse()->getStatusCode() !== 200) { dump($crawler->filter('.text-exception')->first()->text()); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ 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()); } -
mrself created this gist
Mar 29, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ public function testSmth() { $crawler = $this->client->request('GET', '/my-test-page'); if ($this->client->getResponse()->getStatusCode() !== 200) { dump($crawler->filter('.text-exception')->first()->text()); dump($crawler->filter('.traces > li')->eq(0)->text()); dump($crawler->filter('.traces > li')->eq(1)->text()); throw new \Exception('Request to /my-test-page was not successfull'); }