function testCheckingTheFormIsCancelled()
 {
     $form = new SimpleForm_Form();
     $form->parse($this->getFormHtml('inputform.html'));
     $this->assertFalse($form->isSubmitted());
     $this->assertFalse($form->isCancelled());
     // fake the submission of the form
     $_GET[SimpleForm_Form::SUBMIT_MARKER] = 'inputform';
     // submission does not equal cancelled
     $this->assertTrue($form->isSubmitted());
     $this->assertFalse($form->isCancelled());
     // but it should after cancel has a value
     $_GET[SimpleForm_Form::CANCEL_MARKER] = 'Cancel';
     $this->assertTrue($form->isSubmitted());
     $this->assertTrue($form->isCancelled());
 }
Example #2
0
 /**
  * Forms can detect if they are cancelled
  */
 function testFormsCanDetectCancel()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_POST = array('simpleform_submit_marker' => 'myform', 'cancel' => 'Cancel');
     $form = new SimpleForm_Form();
     $form->parse($this->getFormHtml('complexform.html'));
     $this->assertTrue($form->isCancelled());
     $this->assertTrue($form->isSubmitted());
 }