Merge "Relicense jquery.placeholder.js to MIT"
[lhc/web/wiklou.git] / tests / phpunit / includes / HTMLCheckMatrixTest.php
index 5bbafd3..39c3959 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
 /**
- * Unit tests for the HTMLCheckMatrix form field
+ * Unit tests for the HTMLCheckMatrix + HTMLFormField
+ * @todo the tests for the two classes could be split up
  */
 class HtmlCheckMatrixTest extends MediaWikiTestCase {
        static private $defaultOptions = array(
@@ -10,6 +11,9 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                'fieldname' => 'test',
        );
 
+       /**
+        * @covers HTMLCheckMatrix::__construct
+        */
        public function testPlainInstantiation() {
                try {
                        $form = new HTMLCheckMatrix( array() );
@@ -21,11 +25,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 );
                $this->assertTrue( true ); // form instantiation must throw exception on failure
        }
 
+       /**
+        * @covers HTMLFormField::validate
+        */
        public function testValidateCallsUserDefinedValidationCallback() {
                $called = false;
                $field = new HTMLCheckMatrix( self::$defaultOptions + array(
@@ -38,6 +48,9 @@ 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 ) );
@@ -47,11 +60,17 @@ 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() ) );
@@ -65,6 +84,7 @@ 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(
@@ -79,6 +99,9 @@ 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' ),