Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
TestsGenerator: do not throw exceptions - failure is not an option
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnzlml committed Jul 31, 2016
1 parent 5134803 commit c94ea10
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Scaffold/TestsGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,18 @@ public function generateTests($outputFolder)
try {
$form->onSuccess($form, $form->getValues());
$testClass->addMethod('test' . ucfirst($testMethod))->addBody(
"\$this->checkForm(?, ?, [\n" .
$controls .
"], ?);", [$destination . ':', $action, FALSE]);
"\$this->checkForm(?, ?, [\n" . $controls . '], ?);',
[$destination . ':', $action, FALSE]
);
} catch (\Nette\Application\AbortException $exc) {
$extra = $this->getResponse($service);
$path = $extra ? preg_replace('~^https?://([/a-z0-9]+).*~i', '$1', $extra->getUrl()) : '/';
$testClass->addMethod('test' . ucfirst($testMethod))->addBody(
"\$this->checkForm(?, ?, [\n" .
$controls .
"], ?);", [$destination . ':', $action, $path]);
"\$this->checkForm(?, ?, [\n" . $controls . '], ?);',
[$destination . ':', $action, $path]
);
} catch (\Exception $exc) {
//This sucks but we have to move on - failure is not an option
}
}

Expand Down

0 comments on commit c94ea10

Please sign in to comment.