Pass phpcs-strict on some test files (8/11)
[lhc/web/wiklou.git] / tests / phpunit / includes / htmlform / HTMLCheckMatrixTest.php
index 39c3959..5a822f5 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
 /**
- * Unit tests for the HTMLCheckMatrix + HTMLFormField
- * @todo the tests for the two classes could be split up
+ * Unit tests for the HTMLCheckMatrix
+ * @covers HTMLCheckMatrix
  */
 class HtmlCheckMatrixTest extends MediaWikiTestCase {
        static private $defaultOptions = array(
@@ -11,12 +11,9 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                'fieldname' => 'test',
        );
 
-       /**
-        * @covers HTMLCheckMatrix::__construct
-        */
        public function testPlainInstantiation() {
                try {
-                       $form = new HTMLCheckMatrix( array() );
+                       new HTMLCheckMatrix( array() );
                } catch ( MWException $e ) {
                        $this->assertInstanceOf( 'HTMLFormFieldRequiredOptionsException', $e );
                        return;
@@ -25,22 +22,17 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                $this->fail( 'Expected MWException indicating missing parameters but none was thrown.' );
        }
 
-       /**
-        * @covers HTMLCheckMatrix::__construct
-        */
        public function testInstantiationWithMinimumRequiredParameters() {
-               $form = new HTMLCheckMatrix( self::$defaultOptions );
+               new HTMLCheckMatrix( self::$defaultOptions );
                $this->assertTrue( true ); // form instantiation must throw exception on failure
        }
 
-       /**
-        * @covers HTMLFormField::validate
-        */
        public function testValidateCallsUserDefinedValidationCallback() {
                $called = false;
                $field = new HTMLCheckMatrix( self::$defaultOptions + array(
-                       'validation-callback' => function() use ( &$called ) {
+                       'validation-callback' => function () use ( &$called ) {
                                $called = true;
+
                                return false;
                        },
                ) );
@@ -48,9 +40,6 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                $this->assertTrue( $called );
        }
 
-       /**
-        * @covers HTMLFormField::validate
-        */
        public function testValidateRequiresArrayInput() {
                $field = new HTMLCheckMatrix( self::$defaultOptions );
                $this->assertEquals( false, $this->validate( $field, null ) );
@@ -60,17 +49,11 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                $this->assertEquals( true, $this->validate( $field, array() ) );
        }
 
-       /**
-        * @covers HTMLFormField::validate
-        */
        public function testValidateAllowsOnlyKnownTags() {
                $field = new HTMLCheckMatrix( self::$defaultOptions );
                $this->assertInternalType( 'string', $this->validate( $field, array( 'foo' ) ) );
        }
 
-       /**
-        * @covers HTMLFormField::validate
-        */
        public function testValidateAcceptsPartialTagList() {
                $field = new HTMLCheckMatrix( self::$defaultOptions );
                $this->assertTrue( $this->validate( $field, array() ) );
@@ -84,12 +67,11 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
         * foreach ( $field->filterDataForSubmit( $data ) as $k => $v ) {
         *     $user->setOption( $k, $v );
         * }
-        * @covers HTMLFormField::filterDataForSubmit
         */
        public function testValuesForcedOnRemainOn() {
                $field = new HTMLCheckMatrix( self::$defaultOptions + array(
-                       'force-options-on' => array( 'c2-r1' ),
-               ) );
+                               'force-options-on' => array( 'c2-r1' ),
+                       ) );
                $expected = array(
                        'c1-r1' => false,
                        'c1-r2' => false,
@@ -99,13 +81,10 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $field->filterDataForSubmit( array() ) );
        }
 
-       /**
-        * @covers HTMLFormField::filterDataForSubmit
-        */
        public function testValuesForcedOffRemainOff() {
                $field = new HTMLCheckMatrix( self::$defaultOptions + array(
-                       'force-options-off' => array( 'c1-r2', 'c2-r2' ),
-               ) );
+                               'force-options-off' => array( 'c1-r2', 'c2-r2' ),
+                       ) );
                $expected = array(
                        'c1-r1' => true,
                        'c1-r2' => false,
@@ -122,4 +101,5 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                        array( self::$defaultOptions['fieldname'] => $submitted )
                );
        }
+
 }