r87930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87929‎ | r87930 | r87931 >
Date:20:07, 12 May 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
tests for XmlSelect::GetAttributes()
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/XmlSelectTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/XmlSelectTest.php
@@ -102,4 +102,40 @@
103103 <option value="foo2">foo2</option></select>', $this->select->getHTML() );
104104 }
105105
 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+ }
106142 }

Comments

#Comment by Platonides (talk | contribs)   17:19, 13 May 2011

The most documented test!

Status & tagging log