Merge "Hard deprecate MWNamespace::canTalk()"
[lhc/web/wiklou.git] / tests / phpunit / includes / OutputPageTest.php
index e572be2..abc7c43 100644 (file)
@@ -912,7 +912,7 @@ class OutputPageTest extends MediaWikiTestCase {
         * @param array $args Array of form [ category name => sort key ]
         * @param array $fakeResults Array of form [ category name => value to return from mocked
         *   LinkBatch ]
-        * @param callback $variantLinkCallback Callback to replace findVariantLink() call
+        * @param callable $variantLinkCallback Callback to replace findVariantLink() call
         * @param array $expectedNormal Expected return value of getCategoryLinks['normal']
         * @param array $expectedHidden Expected return value of getCategoryLinks['hidden']
         */
@@ -1744,7 +1744,6 @@ class OutputPageTest extends MediaWikiTestCase {
        // @todo Make sure to test the following in addParserOutputMetadata() as well when we add tests
        // for them:
        //   * addModules()
-       //   * addModuleScripts()
        //   * addModuleStyles()
        //   * addJsConfigVars()
        //   * enableOOUI()
@@ -1806,6 +1805,7 @@ class OutputPageTest extends MediaWikiTestCase {
         * @param string $expectedHTML Expected return value for parseInline(), if different
         */
        public function testParse( array $args, $expectedHTML ) {
+               $this->hideDeprecated( 'OutputPage::parse' );
                $op = $this->newInstance();
                $this->assertSame( $expectedHTML, $op->parse( ...$args ) );
        }
@@ -1820,6 +1820,7 @@ class OutputPageTest extends MediaWikiTestCase {
                        $this->assertTrue( true );
                        return;
                }
+               $this->hideDeprecated( 'OutputPage::parseInline' );
                $op = $this->newInstance();
                $this->assertSame( $expectedHTMLInline ?? $expectedHTML, $op->parseInline( ...$args ) );
        }
@@ -1953,6 +1954,7 @@ class OutputPageTest extends MediaWikiTestCase {
         * @covers OutputPage::parse
         */
        public function testParseNullTitle() {
+               $this->hideDeprecated( 'OutputPage::parse' );
                $this->setExpectedException( MWException::class, 'Empty $mTitle in OutputPage::parseInternal' );
                $op = $this->newInstance( [], null, 'notitle' );
                $op->parse( '' );
@@ -1962,6 +1964,7 @@ class OutputPageTest extends MediaWikiTestCase {
         * @covers OutputPage::parseInline
         */
        public function testParseInlineNullTitle() {
+               $this->hideDeprecated( 'OutputPage::parseInline' );
                $this->setExpectedException( MWException::class, 'Empty $mTitle in OutputPage::parseInternal' );
                $op = $this->newInstance( [], null, 'notitle' );
                $op->parseInline( '' );
@@ -2527,7 +2530,7 @@ class OutputPageTest extends MediaWikiTestCase {
                $nonce->setAccessible( true );
                $nonce->setValue( $out, 'secret' );
                $rl = $out->getResourceLoader();
-               $rl->setMessageBlobStore( new NullMessageBlobStore() );
+               $rl->setMessageBlobStore( $this->createMock( MessageBlobStore::class ) );
                $rl->register( [
                        'test.foo' => new ResourceLoaderTestModule( [
                                'script' => 'mw.test.foo( { a: true } );',
@@ -2643,7 +2646,7 @@ class OutputPageTest extends MediaWikiTestCase {
                        ->method( 'buildCssLinksArray' )
                        ->willReturn( [] );
                $rl = $op->getResourceLoader();
-               $rl->setMessageBlobStore( new NullMessageBlobStore() );
+               $rl->setMessageBlobStore( $this->createMock( MessageBlobStore::class ) );
 
                // Register custom modules
                $rl->register( [
@@ -3047,21 +3050,3 @@ class OutputPageTest extends MediaWikiTestCase {
                return new OutputPage( $context );
        }
 }
-
-/**
- * MessageBlobStore that doesn't do anything
- */
-class NullMessageBlobStore extends MessageBlobStore {
-       public function get( ResourceLoader $resourceLoader, $modules, $lang ) {
-               return [];
-       }
-
-       public function updateModule( $name, ResourceLoaderModule $module, $lang ) {
-       }
-
-       public function updateMessage( $key ) {
-       }
-
-       public function clear() {
-       }
-}