From: addshore Date: Fri, 15 Nov 2013 23:45:43 +0000 (+0100) Subject: Cleanup HTMLCheckMatrixTest. X-Git-Tag: 1.31.0-rc.0~17367 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/message.php?a=commitdiff_plain;h=b97109f113d6589743254d056acdd4488fd74a74;p=lhc%2Fweb%2Fwiklou.git Cleanup HTMLCheckMatrixTest. Fix Covers tags, looks like we need more testcases for all other HTML* classes Change-Id: I166464da3373b45564dd770feecacafacb301604 --- diff --git a/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php b/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php index 39c39595e2..c41acef1b9 100644 --- a/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php +++ b/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php @@ -1,8 +1,8 @@ 'test', ); - /** - * @covers HTMLCheckMatrix::__construct - */ public function testPlainInstantiation() { try { - $form = new HTMLCheckMatrix( array() ); + new HTMLCheckMatrix( array() ); } catch ( MWException $e ) { $this->assertInstanceOf( 'HTMLFormFieldRequiredOptionsException', $e ); return; @@ -25,32 +22,23 @@ 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 ) { - $called = true; - return false; - }, - ) ); + 'validation-callback' => function() use ( &$called ) { + $called = true; + return false; + }, + ) ); $this->assertEquals( false, $this->validate( $field, array() ) ); $this->assertTrue( $called ); } - /** - * @covers HTMLFormField::validate - */ public function testValidateRequiresArrayInput() { $field = new HTMLCheckMatrix( self::$defaultOptions ); $this->assertEquals( false, $this->validate( $field, null ) ); @@ -60,17 +48,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 +66,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 +80,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 +100,5 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { array( self::$defaultOptions['fieldname'] => $submitted ) ); } + }