Merge "Add @covers tags for more tests"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 2 Jan 2018 12:19:02 +0000 (12:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 2 Jan 2018 12:19:02 +0000 (12:19 +0000)
1  2 
tests/phpunit/includes/FauxRequestTest.php
tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php
tests/phpunit/includes/libs/DeferredStringifierTest.php
tests/phpunit/includes/libs/DnsSrvDiscovererTest.php
tests/phpunit/includes/libs/IPTest.php
tests/phpunit/includes/libs/ProcessCacheLRUTest.php
tests/phpunit/includes/libs/SamplingStatsdClientTest.php
tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php
tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php
tests/phpunit/includes/utils/AvroValidatorTest.php
tests/phpunit/includes/utils/MWCryptHashTest.php

@@@ -3,9 -3,6 +3,9 @@@
  use MediaWiki\Session\SessionManager;
  
  class FauxRequestTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        /**
         * @covers FauxRequest::__construct
         */
                $this->assertEquals( '', $req->getText( 'z' ) );
        }
  
-       // Integration test for parent method.
+       /**
+        * Integration test for parent method
+        * @covers FauxRequest::getVal
+        */
        public function testGetVal() {
                $req = new FauxRequest( [ 'crlf' => "A\r\nb" ] );
                $this->assertSame( "A\r\nb", $req->getVal( 'crlf' ), 'CRLF' );
        }
  
-       // Integration test for parent method.
+       /**
+        * Integration test for parent method
+        * @covers FauxRequest::getRawVal
+        */
        public function testGetRawVal() {
                $req = new FauxRequest( [
                        'x' => 'Value',
@@@ -1,9 -1,9 +1,12 @@@
  <?php
  
+ /**
+  * @covers HTMLRestrictionsField
+  */
  class HTMLRestrictionsFieldTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        public function testConstruct() {
                $field = new HTMLRestrictionsField( [ 'fieldname' => 'restrictions' ] );
                $this->assertNotEmpty( $field->getLabel(), 'has a default label' );
@@@ -1,11 -1,11 +1,13 @@@
  <?php
  
+ /**
+  * @covers DeferredStringifier
+  */
  class DeferredStringifierTest extends PHPUnit_Framework_TestCase {
  
 +      use MediaWikiCoversValidator;
 +
        /**
-        * @covers DeferredStringifier
         * @dataProvider provideToString
         */
        public function testToString( $params, $expected ) {
@@@ -1,11 -1,10 +1,13 @@@
  <?php
  
+ /**
+  * @covers DnsSrvDiscoverer
+  */
  class DnsSrvDiscovererTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        /**
-        * @covers DnsSrvDiscoverer
         * @dataProvider provideRecords
         */
        public function testPickServer( $params, $expected ) {
@@@ -10,9 -10,6 +10,9 @@@
   */
  
  class IPTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        /**
         * @covers IP::isIPAddress
         * @dataProvider provideInvalidIPs
        }
  
        /**
-        * Test for IP::splitHostAndPort().
+        * @covers IP::splitHostAndPort()
         * @dataProvider provideSplitHostAndPort
         */
        public function testSplitHostAndPort( $expected, $input, $description ) {
        }
  
        /**
-        * Test for IP::combineHostAndPort()
+        * @covers IP::combineHostAndPort()
         * @dataProvider provideCombineHostAndPort
         */
        public function testCombineHostAndPort( $expected, $input, $description ) {
        }
  
        /**
-        * Test for IP::sanitizeRange()
+        * @covers IP::sanitizeRange()
         * @dataProvider provideIPCIDRs
         */
        public function testSanitizeRange( $input, $expected, $description ) {
        }
  
        /**
-        * Test for IP::prettifyIP()
+        * @covers IP::prettifyIP()
         * @dataProvider provideIPsToPrettify
         */
        public function testPrettifyIP( $ip, $prettified ) {
@@@ -11,8 -11,6 +11,8 @@@
   */
  class ProcessCacheLRUTest extends PHPUnit_Framework_TestCase {
  
 +      use MediaWikiCoversValidator;
 +
        /**
         * Helper to verify emptiness of a cache object.
         * Compare against an array so we get the cache content difference.
@@@ -60,6 -58,7 +60,7 @@@
  
        /**
         * Highlight diff between assertEquals and assertNotSame
+        * @coversNothing
         */
        public function testPhpUnitArrayEquality() {
                $one = [ 'A' => 1, 'B' => 2 ];
@@@ -3,10 -3,10 +3,13 @@@
  use Liuggio\StatsdClient\Entity\StatsdData;
  use Liuggio\StatsdClient\Sender\SenderInterface;
  
+ /**
+  * @covers SamplingStatsdClient
+  */
  class SamplingStatsdClientTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        /**
         * @dataProvider samplingDataProvider
         */
@@@ -1,12 -1,9 +1,12 @@@
  <?php
- /*
+ /**
   * @group Media
   * @covers MimeAnalyzer
   */
  class MimeAnalyzerTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        /** @var MimeAnalyzer */
        private $mimeAnalyzer;
  
@@@ -3,10 -3,10 +3,13 @@@
  use Wikimedia\Rdbms\TransactionProfiler;
  use Psr\Log\LoggerInterface;
  
+ /**
+  * @covers \Wikimedia\Rdbms\TransactionProfiler
+  */
  class TransactionProfilerTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        public function testAffected() {
                $logger = $this->getMockBuilder( LoggerInterface::class )->getMock();
                $logger->expects( $this->exactly( 3 ) )->method( 'info' );
@@@ -9,10 -9,10 +9,13 @@@
   * dataprovider.
   */
  
+ /**
+  * @covers AvroValidator
+  */
  class AvroValidatorTest extends PHPUnit_Framework_TestCase {
 +
 +      use MediaWikiCoversValidator;
 +
        public function setUp() {
                if ( !class_exists( 'AvroSchema' ) ) {
                        $this->markTestSkipped( 'Avro is required to run the AvroValidatorTest' );
@@@ -1,13 -1,12 +1,14 @@@
  <?php
  /**
-  *
   * @group Hash
+  *
+  * @covers MWCryptHash
   */
  class MWCryptHashTest extends PHPUnit_Framework_TestCase {
  
 +      use MediaWikiCoversValidator;
 +
        public function testHashLength() {
                if ( MWCryptHash::hashAlgo() !== 'whirlpool' ) {
                        $this->markTestSkipped( 'Hash algorithm isn\'t whirlpool' );
@@@ -23,8 -22,9 +24,8 @@@
                }
  
                $data = 'foobar';
 -              // @codingStandardsIgnoreStart Generic.Files.LineLength
 +              // phpcs:ignore Generic.Files.LineLength
                $hash = '9923afaec3a86f865bb231a588f453f84e8151a2deb4109aebc6de4284be5bebcff4fab82a7e51d920237340a043736e9d13bab196006dcca0fe65314d68eab9';
 -              // @codingStandardsIgnoreEnd
  
                $this->assertEquals(
                        hex2bin( $hash ),
@@@ -45,8 -45,9 +46,8 @@@
  
                $data = 'foobar';
                $key = 'secret';
 -              // @codingStandardsIgnoreStart Generic.Files.LineLength
 +              // phpcs:ignore Generic.Files.LineLength
                $hash = 'ddc94177b2020e55ce2049199fd9cc6327f416ff6dc621cc34cb43d9bec61d73372b4790c0e24957f565ecaf2d42821e6303619093e99cbe14a3b9250bda5f81';
 -              // @codingStandardsIgnoreEnd
  
                $this->assertEquals(
                        hex2bin( $hash ),