jenkins-bot has submitted this change and it was merged.

Change subject: tests: Fix invalid @covers value in StatusTest.php
......................................................................


tests: Fix invalid @covers value in StatusTest.php

Uusally, phpunit issues a warning and continues to generate the
report but in this case it caused an early exit with no output.
Follows-up 3706dcb5c.

> Trying to @cover not existing method Status::getErrorsOnlyStatus.

Also:
* Increase coverage by adding @covers where missing.
* Use setOK() internally.
* Add test for 'ok' setter.

Change-Id: If6db634079c857f02b2594be199e6910ec49a52a
---
M tests/phpunit/includes/StatusTest.php
1 file changed, 25 insertions(+), 8 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/StatusTest.php 
b/tests/phpunit/includes/StatusTest.php
index ebc2d10..7e56ebf 100644
--- a/tests/phpunit/includes/StatusTest.php
+++ b/tests/phpunit/includes/StatusTest.php
@@ -57,9 +57,11 @@
        }
 
        /**
+        * Test 'ok' and 'errors' getters.
         *
+        * @covers Status::__get
         */
-       public function testOkAndErrors() {
+       public function testOkAndErrorsGetters() {
                $status = Status::newGood( 'foo' );
                $this->assertTrue( $status->ok );
                $status = Status::newFatal( 'foo', 1, 2 );
@@ -74,6 +76,19 @@
                        ],
                        $status->errors
                );
+       }
+
+       /**
+        * Test 'ok' setter.
+        *
+        * @covers Status::__set
+        */
+       public function testOkSetter() {
+               $status = new Status();
+               $status->ok = false;
+               $this->assertFalse( $status->isOK() );
+               $status->ok = true;
+               $this->assertTrue( $status->isOK() );
        }
 
        /**
@@ -98,11 +113,12 @@
 
        /**
         * @dataProvider provideIsOk
-        * @covers Status::isOk
+        * @covers Status::setOK
+        * @covers Status::isOK
         */
        public function testIsOk( $ok ) {
                $status = new Status();
-               $status->ok = $ok;
+               $status->setOK( $ok );
                $this->assertEquals( $ok, $status->isOK() );
        }
 
@@ -128,7 +144,7 @@
         */
        public function testIsGood( $ok, $errors, $expected ) {
                $status = new Status();
-               $status->ok = $ok;
+               $status->setOK( $ok );
                foreach ( $errors as $error ) {
                        $status->warning( $error );
                }
@@ -171,6 +187,7 @@
         * @covers Status::error
         * @covers Status::getErrorsArray
         * @covers Status::getStatusArray
+        * @covers Status::getErrors
         */
        public function testErrorWithMessage( $mockDetails ) {
                $status = new Status();
@@ -361,7 +378,7 @@
                ];
 
                $status = new Status();
-               $status->ok = false;
+               $status->setOK( false );
                $testCases['GoodButNoError'] = [
                        $status,
                        "Internal error: Status::getWikiText: Invalid result 
object: no error text but not OK\n",
@@ -475,7 +492,7 @@
                ];
 
                $status = new Status();
-               $status->ok = false;
+               $status->setOK( false );
                $testCases['GoodButNoError'] = [
                        $status,
                        [ "Status::getMessage: Invalid result object: no error 
text but not OK\n" ],
@@ -647,8 +664,8 @@
 
        /**
         * @dataProvider provideErrorsWarningsOnly
-        * @covers Status::getErrorsOnlyStatus
-        * @covers Status::getWarningsOnlyStatus
+        * @covers Status::splitByErrorType
+        * @covers StatusValue::splitByErrorType
         */
        public function testGetErrorsWarningsOnlyStatus( $errorText, 
$warningText, $type, $errorResult,
                $warningResult

-- 
To view, visit https://gerrit.wikimedia.org/r/312282
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6db634079c857f02b2594be199e6910ec49a52a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to