コード例 #1
0
 function testButtonTag()
 {
     $form = new SimpleForm(new SimpleFormTag(array()), new SimpleUrl('http://host'));
     $widget = new SimpleButtonTag(array('type' => 'submit', 'name' => 'go', 'value' => 'Go', 'id' => '9'));
     $widget->addContent('Go!');
     $form->addWidget($widget);
     $this->assertTrue($form->hasSubmit(new SimpleByName('go')));
     $this->assertTrue($form->hasSubmit(new SimpleByLabel('Go!')));
     $this->assertEqual($form->submitButton(new SimpleByName('go')), new SimpleGetEncoding(array('go' => 'Go')));
     $this->assertEqual($form->submitButton(new SimpleByLabel('Go!')), new SimpleGetEncoding(array('go' => 'Go')));
     $this->assertEqual($form->submitButton(new SimpleById(9)), new SimpleGetEncoding(array('go' => 'Go')));
 }
コード例 #2
0
ファイル: tag_test.php プロジェクト: guicara/simpletest
 public function testButton()
 {
     $tag = new SimpleButtonTag(array('type' => 'submit', 'name' => 's', 'value' => 'do'));
     $tag->addContent('I am a button');
     $this->assertEqual($tag->getName(), 's');
     $this->assertEqual($tag->getValue(), 'do');
     $this->assertEqual($tag->getLabel(), 'I am a button');
     $encoding = new MockSimpleMultipartEncoding();
     $encoding->expectOnce('add', array('s', 'do'));
     $tag->write($encoding);
 }