getAction() public method

Absolute URL of the target.
public getAction ( ) : SimpleUrl
return SimpleUrl URL target.
Esempio n. 1
0
 function testDefaultFrameTargetOnForm()
 {
     $tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php', 'id' => '33'));
     $form = new SimpleForm($tag, new SimpleUrl('http://host/a/index.html'));
     $form->setDefaultTarget('frame');
     $expected = new SimpleUrl('http://host/a/here.php');
     $expected->setTarget('frame');
     $this->assertEqual($form->getAction(), $expected);
 }
 function testDefaultFrameTargetOnForm()
 {
     $page = new MockSimplePage();
     $page->expectOnce('expandUrl', array(new SimpleUrl('here.php')));
     $page->setReturnValue('expandUrl', new SimpleUrl('http://host/here.php'));
     $tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php'));
     $form = new SimpleForm($tag, $page);
     $form->setDefaultTarget('frame');
     $expected = new SimpleUrl('http://host/here.php');
     $expected->setTarget('frame');
     $this->assertEqual($form->getAction(), $expected);
 }
Esempio n. 3
0
 /**
  *    Replaces missing form action.
  *    @param SimpleForm $form    Form object to submit.
  *    @return string             URL to send results to.
  *    @access private
  */
 function _getAction(&$form) {
     $action = $form->getAction();
     if ($action === false) {
         return $this->_page->getRequestUrl();
     } elseif ($action === true) {
         return '';
     }
     return $action;
 }
Esempio n. 4
0
 public function TODO_testRemoveGetParamsFromAction()
 {
     Mock::generatePartial('SimplePage', 'MockPartialSimplePage', array('getUrl'));
     $page = new MockPartialSimplePage();
     $page->returns('getUrl', new SimpleUrl('htp://host/'));
     # Keep GET params in "action", if the form has no widgets
     $form = new SimpleForm(new SimpleFormTag(array('action' => '?test=1')), $page);
     $this->assertEqual($form->getAction()->asString(), 'htp://host/');
     $form = new SimpleForm(new SimpleFormTag(array('action' => '?test=1')), $page);
     $form->addWidget(new SimpleTextTag(array('name' => 'me', 'type' => 'text', 'value' => 'a')));
     $this->assertEqual($form->getAction()->asString(), 'htp://host/');
     $form = new SimpleForm(new SimpleFormTag(array('action' => '')), $page);
     $this->assertEqual($form->getAction()->asString(), 'htp://host/');
     $form = new SimpleForm(new SimpleFormTag(array('action' => '?test=1', 'method' => 'post')), $page);
     $this->assertEqual($form->getAction()->asString(), 'htp://host/?test=1');
 }