| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 require_once 'limb/wact/src/components/form/form.inc.php'; 11 12 class WactCheckableInputComponentTest extends WactTemplateTestCase 13 { 14 protected $checkbox; 15 protected $form; 16 17 function setUp() 18 { 19 parent :: setUp(); 20 21 $this->form = new WactFormComponent('test_form'); 22 $this->checkbox = new WactCheckableInputComponent('my_checkbox'); 23 $this->form->addChild($this->checkbox); 24 } 25 26 function testGetValue() 27 { 28 $this->form->set('my_checkbox', 'whatever'); 29 $this->assertEqual($this->checkbox->getValue(), 'whatever'); 30 } 31 32 function testCheckedIfNotValueAndCheckedAttribute() 33 { 34 $this->checkbox->setAttribute('checked', true); 35 $this->assertTrue($this->checkbox->isChecked()); 36 } 37 38 function testCheckedIfNoValueAttributeAndFormValue() 39 { 40 $this->form->set('my_checkbox', 3); 41 42 $this->assertTrue($this->checkbox->isChecked()); 43 } 44 45 function testCheckedIfValueAttributeEqualFormValue() 46 { 47 $this->form->set('my_checkbox', 3); 48 $this->checkbox->setAttribute('value', 3); 49 50 $this->assertTrue($this->checkbox->isChecked()); 51 } 52 53 function testNotCheckedIfValueAttributeNotEqualFormValue() 54 { 55 $this->form->set('my_checkbox', 3); 56 $this->checkbox->setAttribute('value', 2); 57 58 $this->assertFalse($this->checkbox->isChecked()); 59 } 60 61 function testCheckedIfValueAttributeInFormValueArray() 62 { 63 $this->form->set('my_checkbox', array(1,3)); 64 $this->checkbox->setAttribute('value', 3); 65 66 $this->assertTrue($this->checkbox->isChecked()); 67 } 68 69 function testNotCheckedIfValueAttributeNotInFormValueArray() 70 { 71 $this->form->set('my_checkbox', array(1,3)); 72 $this->checkbox->setAttribute('value', 2); 73 74 $this->assertFalse($this->checkbox->isChecked()); 75 } 76 } 77 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 04:06:23 2009 | Cross-referenced by PHPXref 0.7 |