registration: Add @codeCoverageIgnore for statement that can't be covered
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 18 Jan 2019 21:57:43 +0000 (13:57 -0800)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 18 Jan 2019 21:57:43 +0000 (13:57 -0800)
MW_PHPUNIT_TEST will always be defined during tests, so we can't have a
test that requires it to be undefined.

Change-Id: I67b011af31026bc9c568725f8f294359b63f2fd5

includes/registration/ExtensionRegistry.php

index e3bd542..88d9fd3 100644 (file)
@@ -433,9 +433,11 @@ class ExtensionRegistry {
         * @since 1.33
         */
        public function setAttributeForTest( $name, array $value ) {
+               // @codeCoverageIgnoreStart
                if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
                        throw new RuntimeException( __METHOD__ . ' can only be used in tests' );
                }
+               // @codeCoverageIgnoreEnd
                if ( isset( $this->testAttributes[$name] ) ) {
                        throw new Exception( "The attribute '$name' has already been overridden" );
                }