MINOR: Minor fixes to FunctionalTest

This commit is contained in:
Sam Minnee 2011-08-30 23:40:29 +12:00 committed by Ingo Schommer
parent 6fcbad1a31
commit b43bf68f9c

View File

@ -96,8 +96,12 @@ class TestSession {
$form->setField(new SimpleByName($k), $v); $form->setField(new SimpleByName($k), $v);
} }
if($button) $submission = $form->submitButton(new SimpleByName($button)); if($button) {
else $submission = $form->submit(); $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()); $url = Director::makeRelative($form->getAction()->asString());
@ -137,6 +141,15 @@ class TestSession {
return $this->lastResponse; return $this->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 * Get the most recent response's content
*/ */