Permalink
Browse files

MINOR: Minor fixes to FunctionalTest

  • Loading branch information...
1 parent 6fcbad1 commit b43bf68f9c5b1396ae50db6a1ea087efb7b3b19f @sminnee sminnee committed with chillu Aug 30, 2011
Showing with 15 additions and 2 deletions.
  1. +15 −2 dev/TestSession.php
View
17 dev/TestSession.php
@@ -96,8 +96,12 @@ public function submitForm($formID, $button = null, $data = array()) {
$form->setField(new SimpleByName($k), $v);
}
- if($button) $submission = $form->submitButton(new SimpleByName($button));
- else $submission = $form->submit();
+ if($button) {
+ $submission = $form->submitButton(new SimpleByName($button));
+ if(!$submission) throw new Exception("Can't find button '$button' to submit as part of test.");
+ } else {
+ $submission = $form->submit();
+ }
$url = Director::makeRelative($form->getAction()->asString());
@@ -138,6 +142,15 @@ public function lastResponse() {
}
/**
+ * Return the fake HTTP_REFERER; set each time get() or post() is called.
+ *
+ * @return string
+ */
+ public function lastUrl() {
+ return $this->lastUrl;
+ }
+
+ /**
* Get the most recent response's content
*/
public function lastContent() {

0 comments on commit b43bf68

Please sign in to comment.