Index: trunk/phase3/tests/phpunit/includes/XmlSelectTest.php |
— | — | @@ -102,4 +102,40 @@ |
103 | 103 | <option value="foo2">foo2</option></select>', $this->select->getHTML() ); |
104 | 104 | } |
105 | 105 | |
| 106 | + public function testGetAttributes() { |
| 107 | + # create some attributes |
| 108 | + $this->select->setAttribute( 'dummy', 0x777 ); |
| 109 | + $this->select->setAttribute( 'string', 'euro €' ); |
| 110 | + $this->select->setAttribute( 1911, 'razor' ); |
| 111 | + |
| 112 | + # verify we can retrieve them |
| 113 | + $this->assertEquals( |
| 114 | + $this->select->getAttribute( 'dummy' ), |
| 115 | + 0x777 |
| 116 | + ); |
| 117 | + $this->assertEquals( |
| 118 | + $this->select->getAttribute( 'string' ), |
| 119 | + 'euro €' |
| 120 | + ); |
| 121 | + $this->assertEquals( |
| 122 | + $this->select->getAttribute( 1911 ), |
| 123 | + 'razor' |
| 124 | + ); |
| 125 | + |
| 126 | + # inexistant keys should give us 'null' |
| 127 | + $this->assertEquals( |
| 128 | + $this->select->getAttribute( 'I DO NOT EXIT' ), |
| 129 | + null |
| 130 | + ); |
| 131 | + |
| 132 | + # verify string / integer |
| 133 | + $this->assertEquals( |
| 134 | + $this->select->getAttribute( '1911' ), |
| 135 | + 'razor' |
| 136 | + ); |
| 137 | + $this->assertEquals( |
| 138 | + $this->select->getAttribute( 'dummy' ), |
| 139 | + 0x777 |
| 140 | + ); |
| 141 | + } |
106 | 142 | } |