| [ 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/tests/cases/component/WactRuntimeComponentTest.class.php'; 11 12 class WactRuntimeTagComponentTest extends WactRuntimeComponentTest 13 { 14 function setUp() 15 { 16 parent :: setUp(); 17 $this->component = new WactRuntimeTagComponent('TestId'); 18 } 19 20 function testGetAttribute() 21 { 22 $this->component->setAttribute('foo', 'bar'); 23 $this->assertEqual($this->component->getAttribute('foo'), 'bar'); 24 $this->assertEqual($this->component->getAttribute('FOO'), 'bar');//case insensitive 25 } 26 27 function testGetBoolAttributeFalse() 28 { 29 $this->assertFalse($this->component->getBoolAttribute('foo'));//by default 30 31 $this->component->setAttribute('foo', 'false'); 32 $this->assertFalse($this->component->getBoolAttribute('foo')); 33 34 $this->component->setAttribute('foo', '0'); 35 $this->assertFalse($this->component->getBoolAttribute('foo')); 36 37 $this->component->setAttribute('foo', 'no'); 38 $this->assertFalse($this->component->getBoolAttribute('foo')); 39 40 $this->component->setAttribute('foo', 'none'); 41 $this->assertFalse($this->component->getBoolAttribute('foo')); 42 43 $this->component->setAttribute('foo', false); 44 $this->assertFalse($this->component->getBoolAttribute('foo')); 45 } 46 47 function testGetBoolAttributeTrue() 48 { 49 $this->component->setAttribute('foo', 'true'); 50 $this->assertTrue($this->component->getBoolAttribute('foo')); 51 52 $this->component->setAttribute('foo', '1'); 53 $this->assertTrue($this->component->getBoolAttribute('foo')); 54 } 55 56 function testGetBoolAttributeCaseInsensitive() 57 { 58 $this->component->setAttribute('foo', 'true'); 59 $this->assertTrue($this->component->getBoolAttribute('FOO')); 60 } 61 62 function testGetUnsetAttribute() 63 { 64 $this->assertNull($this->component->getAttribute('class')); 65 } 66 67 function testHasAttributeUnset() 68 { 69 $this->assertFalse($this->component->hasAttribute('class')); 70 } 71 72 function testRenderAttributes() 73 { 74 $this->component->setAttribute('a','red'); 75 $this->component->setAttribute('b','blue'); 76 $this->component->setAttribute('c','green'); 77 ob_start(); 78 $this->component->renderAttributes(); 79 $output = ob_get_contents(); 80 ob_end_clean(); 81 $this->assertEqual(' a="red" b="blue" c="green"',$output); 82 } 83 84 function testRemoveAttribute() 85 { 86 $this->component->setAttribute('foo', 'bar'); 87 $this->component->setAttribute('untouched', 'value'); 88 $this->assertTrue( $this->component->hasAttribute('foo')); 89 $this->component->removeAttribute('FOO'); 90 $this->assertFalse( $this->component->hasAttribute('foo')); 91 } 92 93 function testHasAttribute() 94 { 95 $this->component->setAttribute('foo', 'bar'); 96 $this->component->setAttribute('tricky', NULL); 97 $this->assertTrue( $this->component->hasAttribute('foo')); 98 $this->assertTrue( $this->component->hasAttribute('tricky')); 99 $this->assertFalse( $this->component->hasAttribute('missing')); 100 $this->assertTrue( $this->component->hasAttribute('FOO')); 101 $this->assertTrue( $this->component->hasAttribute('TRICKY')); 102 $this->assertFalse( $this->component->hasAttribute('MISSING')); 103 } 104 105 function testGetAttributeUnset() 106 { 107 $this->assertNull($this->component->getAttribute('foo')); 108 } 109 } 110 111 ?>
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 |