Merge "API: Warn when unsupported PHP array syntax is used"
[lhc/web/wiklou.git] / tests / phpunit / includes / HtmlTest.php
index 1c62d03..e934965 100644 (file)
@@ -41,6 +41,9 @@ class HtmlTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers Html::element
+        */
        public function testElementBasics() {
                $this->assertEquals(
                        '<img>',
@@ -89,11 +92,15 @@ class HtmlTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider dataXmlMimeType
+        * @covers Html::isXmlMimeType
         */
        public function testXmlMimeType( $mimetype, $isXmlMimeType ) {
                $this->assertEquals( $isXmlMimeType, Html::isXmlMimeType( $mimetype ) );
        }
 
+       /**
+        * @covers HTML::expandAttributes
+        */
        public function testExpandAttributesSkipsNullAndFalse() {
 
                ### EMPTY ########
@@ -111,6 +118,9 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers HTML::expandAttributes
+        */
        public function testExpandAttributesForBooleans() {
                $this->assertEquals(
                        '',
@@ -146,6 +156,7 @@ class HtmlTest extends MediaWikiTestCase {
        /**
         * Test for Html::expandAttributes()
         * Please note it output a string prefixed with a space!
+        * @covers Html::expandAttributes
         */
        public function testExpandAttributesVariousExpansions() {
                ### NOT EMPTY ####
@@ -198,6 +209,7 @@ class HtmlTest extends MediaWikiTestCase {
         * Html::expandAttributes has special features for HTML
         * attributes that use space separated lists and also
         * allows arrays to be used as values.
+        * @covers Html::expandAttributes
         */
        public function testExpandAttributesListValueAttributes() {
                ### STRING VALUES
@@ -249,6 +261,7 @@ class HtmlTest extends MediaWikiTestCase {
        /**
         * Test feature added by r96188, let pass attributes values as
         * a PHP array. Restricted to class,rel, accesskey.
+        * @covers Html::expandAttributes
         */
        public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
                $this->assertEquals(
@@ -273,6 +286,7 @@ class HtmlTest extends MediaWikiTestCase {
         * The later will take precedence.
         *
         * Feature added by r96188
+        * @covers Html::expandAttributes
         */
        public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
                $this->assertEquals(
@@ -285,6 +299,9 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers Html::namespaceSelector
+        */
        public function testNamespaceSelector() {
                $this->assertEquals(
                        '<select id=namespace name=namespace>' . "\n" .
@@ -415,6 +432,7 @@ class HtmlTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideHtml5InputTypes
+        * @covers Html::element
         */
        public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
                $this->assertEquals(
@@ -572,7 +590,8 @@ class HtmlTest extends MediaWikiTestCase {
                # see remarks on http://msdn.microsoft.com/en-us/library/ie/ms535211%28v=vs.85%29.aspx
                $cases[] = array( '<button type=submit></button>',
                        'button', array( 'type' => 'submit' ),
-                       'According to standard the default type is "submit". Depending on compatibility mode IE might use "button", instead.',
+                       'According to standard the default type is "submit". '
+                               . 'Depending on compatibility mode IE might use "button", instead.',
                );
 
                # <select> specifc handling
@@ -617,15 +636,32 @@ class HtmlTest extends MediaWikiTestCase {
                return $ret;
        }
 
+       /**
+        * @covers Html::expandAttributes
+        */
        public function testFormValidationBlacklist() {
                $this->assertEmpty(
-                       Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 2 ) ),
+                       Html::expandAttributes( array(
+                               'min' => 1,
+                               'max' => 100,
+                               'pattern' => 'abc',
+                               'required' => true,
+                               'step' => 2
+                       ) ),
                        'Blacklist form validation attributes.'
                );
                $this->assertEquals(
                        ' step=any',
-                       Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 'any' ) ),
-                       'Allow special case "step=any".'
+                       Html::expandAttributes(
+                               array(
+                                       'min' => 1,
+                                       'max' => 100,
+                                       'pattern' => 'abc',
+                                       'required' => true,
+                                       'step' => 'any'
+                               ),
+                               'Allow special case "step=any".'
+                       )
                );
        }
 }