normalize sanitizerTest and add coverage tips
authorAntoine Musso <hashar@free.fr>
Thu, 22 Nov 2012 10:23:13 +0000 (11:23 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 18 Jan 2013 13:43:39 +0000 (13:43 +0000)
* @cover let us mention which function the test is using, help out when
  building coverage report to make sure we only record traces for that
  function.
* Normalized test functions so they look alike and make use of an
  optional message.

Change-Id: I3e431b28e377f2ca21d06300537f63b2df4a3a99

tests/phpunit/includes/SanitizerTest.php

index 5930d6c..72b35fa 100644 (file)
@@ -156,13 +156,17 @@ class SanitizerTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideDeprecatedAttributes
+        * @cover Sanitizer::fixTagAttributes
         */
-       function testDeprecatedAttributesUnaltered( $inputAttr, $inputEl ) {
-
-               $this->assertEquals( " $inputAttr", Sanitizer::fixTagAttributes( $inputAttr, $inputEl ) );
+       function testDeprecatedAttributesUnaltered( $inputAttr, $inputEl, $message = '' ) {
+               $this->assertEquals( " $inputAttr",
+                       Sanitizer::fixTagAttributes( $inputAttr, $inputEl ),
+                       $message
+               );
        }
 
        public static function provideDeprecatedAttributes() {
+               /** array( <attribute>, <element>, [message] ) */
                return array(
                        array( 'clear="left"', 'br' ),
                        array( 'clear="all"', 'br' ),
@@ -180,10 +184,10 @@ class SanitizerTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideCssCommentsFixtures
+        * @cover Sanitizer::checkCss
         */
        function testCssCommentsChecking( $expected, $css, $message = '' ) {
-               $this->assertEquals(
-                       $expected,
+               $this->assertEquals( $expected,
                        Sanitizer::checkCss( $css ),
                        $message
                );