Merge "Mark mediawiki.page.watch.ajax as targetable to mobile"
authorJdlrobson <jrobson@wikimedia.org>
Fri, 27 Sep 2019 23:03:21 +0000 (23:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 27 Sep 2019 23:03:21 +0000 (23:03 +0000)
15 files changed:
Gruntfile.js
tests/phpunit/includes/changes/CategoryMembershipChangeTest.php
tests/phpunit/includes/content/WikitextContentTest.php
tests/phpunit/includes/db/LBFactoryTest.php
tests/phpunit/includes/db/LoadBalancerTest.php
tests/phpunit/includes/filebackend/FileBackendTest.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/pager/RangeChronologicalPagerTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php
tests/phpunit/includes/session/CookieSessionProviderTest.php
tests/phpunit/unit/includes/FauxResponseTest.php
tests/phpunit/unit/includes/changes/ChangesListFilterGroupTest.php
tests/phpunit/unit/includes/diff/DiffOpTest.php
tests/phpunit/unit/includes/language/LanguageCodeTest.php
tests/phpunit/unit/includes/session/SessionUnitTest.php

index 8115ea2..9615330 100644 (file)
@@ -117,7 +117,7 @@ module.exports = function ( grunt ) {
                                        included: true,
                                        served: false
                                } ],
-                               logLevel: 'DEBUG',
+                               logLevel: ( process.env.ZUUL_PROJECT ? 'DEBUG' : 'INFO' ),
                                frameworks: [ 'qunit' ],
                                reporters: [ 'mocha' ],
                                singleRun: true,
index 31929d3..4e062ed 100644 (file)
@@ -85,9 +85,9 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
                $this->assertSame( 0, self::$lastNotifyArgs[5] );
                $this->assertSame( 0, self::$lastNotifyArgs[6] );
-               $this->assertEquals( null, self::$lastNotifyArgs[7] );
+               $this->assertNull( self::$lastNotifyArgs[7] );
                $this->assertEquals( 1, self::$lastNotifyArgs[8] );
-               $this->assertEquals( null, self::$lastNotifyArgs[9] );
+               $this->assertSame( '', self::$lastNotifyArgs[9] );
                $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
@@ -105,9 +105,9 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
                $this->assertSame( 0, self::$lastNotifyArgs[5] );
                $this->assertSame( 0, self::$lastNotifyArgs[6] );
-               $this->assertEquals( null, self::$lastNotifyArgs[7] );
+               $this->assertNull( self::$lastNotifyArgs[7] );
                $this->assertEquals( 1, self::$lastNotifyArgs[8] );
-               $this->assertEquals( null, self::$lastNotifyArgs[9] );
+               $this->assertSame( '', self::$lastNotifyArgs[9] );
                $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
@@ -126,7 +126,7 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
                $this->assertEquals( self::$pageRev->getParentId(), self::$lastNotifyArgs[5] );
                $this->assertEquals( $revision->getId(), self::$lastNotifyArgs[6] );
-               $this->assertEquals( null, self::$lastNotifyArgs[7] );
+               $this->assertNull( self::$lastNotifyArgs[7] );
                $this->assertSame( 0, self::$lastNotifyArgs[8] );
                $this->assertEquals( '127.0.0.1', self::$lastNotifyArgs[9] );
                $this->assertSame( 0, self::$lastNotifyArgs[10] );
@@ -147,7 +147,7 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
                $this->assertEquals( self::$pageRev->getParentId(), self::$lastNotifyArgs[5] );
                $this->assertEquals( $revision->getId(), self::$lastNotifyArgs[6] );
-               $this->assertEquals( null, self::$lastNotifyArgs[7] );
+               $this->assertNull( self::$lastNotifyArgs[7] );
                $this->assertSame( 0, self::$lastNotifyArgs[8] );
                $this->assertEquals( '127.0.0.1', self::$lastNotifyArgs[9] );
                $this->assertSame( 0, self::$lastNotifyArgs[10] );
index cd7cc10..fc1c42d 100644 (file)
@@ -390,7 +390,7 @@ just a test"
                $this->assertEquals( 'hello world.', $wikitext,
                        'Wikitext passed to hook was not as expected'
                );
-               $this->assertEquals( null, $redirectTarget, 'Redirect seen in hook was not null' );
+               $this->assertNull( $redirectTarget, 'Redirect seen in hook was not null' );
                $this->assertEquals( $title, $options->getRedirectTarget(),
                        'ParserOptions\' redirectTarget was changed'
                );
@@ -417,8 +417,7 @@ just a test"
                        $redirectTarget->getFullText(),
                        'Redirect seen in hook was not the expected title'
                );
-               $this->assertEquals(
-                       null,
+               $this->assertNull(
                        $options->getRedirectTarget(),
                        'ParserOptions\' redirectTarget was changed'
                );
index f00499f..c018744 100644 (file)
@@ -412,7 +412,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                $cpIndex = null;
                $cp->shutdown( null, 'sync', $cpIndex );
 
-               $this->assertEquals( null, $cpIndex, "CP write index retained" );
+               $this->assertNull( $cpIndex, "CP write index retained" );
 
                $this->assertEquals( '45e93a9c215c031d38b7c42d8e4700ca', $cp->getClientId() );
        }
index 981b4ad..a542936 100644 (file)
@@ -434,7 +434,7 @@ class LoadBalancerTest extends MediaWikiTestCase {
                $lb = $this->newSingleServerLocalLoadBalancer();
 
                $i = $lb->getWriterIndex();
-               $this->assertEquals( null, $lb->getAnyOpenConnection( $i ) );
+               $this->assertFalse( $lb->getAnyOpenConnection( $i ) );
 
                $conn1 = $lb->getConnection( $i );
                $this->assertNotEquals( null, $conn1 );
@@ -446,7 +446,7 @@ class LoadBalancerTest extends MediaWikiTestCase {
                $this->assertFalse( $conn2->getFlag( DBO_TRX ) );
 
                if ( $lb->getServerAttributes( $i )[Database::ATTR_DB_LEVEL_LOCKING] ) {
-                       $this->assertEquals( null,
+                       $this->assertFalse(
                                $lb->getAnyOpenConnection( $i, $lb::CONN_TRX_AUTOCOMMIT ) );
                        $this->assertEquals( $conn1,
                                $lb->getConnection(
index 7bc7918..afa8283 100644 (file)
@@ -1567,11 +1567,11 @@ class FileBackendTest extends MediaWikiTestCase {
 
                $tmpFile = $this->backend->getLocalCopy( [
                        'src' => "$base/unittest-cont1/not-there" ] );
-               $this->assertEquals( null, $tmpFile, "Local copy of not existing file is null ($backendName)." );
+               $this->assertNull( $tmpFile, "Local copy of not existing file is null ($backendName)." );
 
                $tmpFile = $this->backend->getLocalReference( [
                        'src' => "$base/unittest-cont1/not-there" ] );
-               $this->assertEquals( null, $tmpFile, "Local ref of not existing file is null ($backendName)." );
+               $this->assertNull( $tmpFile, "Local ref of not existing file is null ($backendName)." );
        }
 
        /**
@@ -2484,7 +2484,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        "Scoped locking of files succeeded with OK status ($backendName)." );
 
                ScopedLock::release( $sl );
-               $this->assertEquals( null, $sl,
+               $this->assertNull( $sl,
                        "Scoped unlocking of files succeeded ($backendName)." );
                $this->assertEquals( [], $status->getErrors(),
                        "Scoped unlocking of files succeeded ($backendName)." );
index 72ac567..0c084e0 100644 (file)
@@ -407,8 +407,8 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $v = $cache->getWithSetCallback(
                        $key, 30, $checkFunc, [ 'staleTTL' => 50 ] + $extOpts );
                $this->assertEquals( 'xxx1', $v, "Value returned" );
-               $this->assertEquals( false, $oldValReceived, "Callback got no stale value" );
-               $this->assertEquals( null, $oldAsOfReceived, "Callback got no stale value" );
+               $this->assertFalse( $oldValReceived, "Callback got no stale value" );
+               $this->assertNull( $oldAsOfReceived, "Callback got no stale value" );
 
                $mockWallClock += 40;
                $v = $cache->getWithSetCallback(
@@ -423,8 +423,8 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        $key, 30, $checkFunc, [ 'staleTTL' => 50 ] + $extOpts );
                $this->assertEquals( 'xxx3', $v, "Value still returned after expired" );
                $this->assertEquals( 3, $wasSet, "Value recalculated while expired" );
-               $this->assertEquals( false, $oldValReceived, "Callback got no stale value" );
-               $this->assertEquals( null, $oldAsOfReceived, "Callback got no stale value" );
+               $this->assertFalse( $oldValReceived, "Callback got no stale value" );
+               $this->assertNull( $oldAsOfReceived, "Callback got no stale value" );
 
                $mockWallClock = ( $priorTime - $cache::HOLDOFF_TTL - 1 );
                $wasSet = 0;
@@ -440,8 +440,8 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                );
                $this->assertEquals( 'xxx1', $v, "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value computed" );
-               $this->assertEquals( false, $oldValReceived, "Callback got no stale value" );
-               $this->assertEquals( null, $oldAsOfReceived, "Callback got no stale value" );
+               $this->assertFalse( $oldValReceived, "Callback got no stale value" );
+               $this->assertNull( $oldAsOfReceived, "Callback got no stale value" );
 
                $mockWallClock += $cache::TTL_HOUR; // some time passes
                $v = $cache->getWithSetCallback(
@@ -1499,7 +1499,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $this->assertEquals( $valueV2, $v, "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value regenerated" );
                $this->assertEquals( false, $priorValue, "Old value not given due to old format" );
-               $this->assertEquals( null, $priorAsOf, "Old value not given due to old format" );
+               $this->assertNull( $priorAsOf, "Old value not given due to old format" );
 
                $wasSet = 0;
                $v = $cache->getWithSetCallback( $key, 30, $funcV2, $verOpts + $extOpts );
index 72390ac..f11a2a2 100644 (file)
@@ -85,7 +85,7 @@ class RangeChronologicalPagerTest extends MediaWikiLangTestCase {
         */
        public function testGetDateRangeCondInvalid( $start, $end ) {
                $pager = $this->getMockForAbstractClass( RangeChronologicalPager::class );
-               $this->assertEquals( null, $pager->getDateRangeCond( $start, $end ) );
+               $this->assertNull( $pager->getDateRangeCond( $start, $end ) );
        }
 
        public function getDateRangeCondInvalidProvider() {
index c748e2c..6039bd2 100644 (file)
@@ -26,10 +26,10 @@ class ResourceLoaderContextTest extends PHPUnit\Framework\TestCase {
                // Request parameters
                $this->assertEquals( [], $ctx->getModules() );
                $this->assertEquals( 'qqx', $ctx->getLanguage() );
-               $this->assertEquals( false, $ctx->getDebug() );
-               $this->assertEquals( null, $ctx->getOnly() );
+               $this->assertFalse( $ctx->getDebug() );
+               $this->assertNull( $ctx->getOnly() );
                $this->assertEquals( 'fallback', $ctx->getSkin() );
-               $this->assertEquals( null, $ctx->getUser() );
+               $this->assertNull( $ctx->getUser() );
                $this->assertNull( $ctx->getContentOverrideCallback() );
 
                // Misc
@@ -67,11 +67,11 @@ class ResourceLoaderContextTest extends PHPUnit\Framework\TestCase {
                        $ctx->getModules(),
                        [ 'foo', 'foo.quux', 'foo.baz', 'foo.bar', 'baz.quux' ]
                );
-               $this->assertEquals( false, $ctx->getDebug() );
+               $this->assertFalse( $ctx->getDebug() );
                $this->assertEquals( 'zh', $ctx->getLanguage() );
                $this->assertEquals( 'styles', $ctx->getOnly() );
                $this->assertEquals( 'fallback', $ctx->getSkin() );
-               $this->assertEquals( null, $ctx->getUser() );
+               $this->assertNull( $ctx->getUser() );
 
                // Misc
                $this->assertEquals( 'ltr', $ctx->getDirection() );
index 33bc29f..3eb7498 100644 (file)
@@ -376,7 +376,7 @@ class CookieSessionProviderTest extends MediaWikiTestCase {
                ] );
 
                $request = new \FauxRequest();
-               $this->assertEquals( null, $provider->suggestLoginUsername( $request ) );
+               $this->assertNull( $provider->suggestLoginUsername( $request ) );
 
                $request->setCookies( [
                        'xUserName' => 'Example',
index 5e208ac..0cca53b 100644 (file)
@@ -47,7 +47,7 @@ class FauxResponseTest extends \MediaWikiUnitTestCase {
                        'expire' => $expire,
                ];
 
-               $this->assertEquals( null, $this->response->getCookie( 'xkey' ), 'Non-existing cookie' );
+               $this->assertNull( $this->response->getCookie( 'xkey' ), 'Non-existing cookie' );
                $this->response->setCookie( 'key', 'val', $expire, [
                        'prefix' => 'x',
                        'path' => '/path',
@@ -67,7 +67,7 @@ class FauxResponseTest extends \MediaWikiUnitTestCase {
         * @covers FauxResponse::header
         */
        public function testHeader() {
-               $this->assertEquals( null, $this->response->getHeader( 'Location' ), 'Non-existing header' );
+               $this->assertNull( $this->response->getHeader( 'Location' ), 'Non-existing header' );
 
                $this->response->header( 'Location: http://localhost/' );
                $this->assertEquals(
index bd54d50..efa0564 100644 (file)
@@ -71,8 +71,7 @@ class ChangesListFilterGroupTest extends \MediaWikiUnitTestCase {
                        $group->getFilter( 'foo' )->getName()
                );
 
-               $this->assertEquals(
-                       null,
+               $this->assertNull(
                        $group->getFilter( 'bar' )
                );
        }
index 17487ac..6566e14 100644 (file)
@@ -42,7 +42,7 @@ class DiffOpTest extends \MediaWikiUnitTestCase {
                $this->assertEquals( 'foo', $obj->getClosing( 0 ) );
                $this->assertEquals( 'bar', $obj->getClosing( 1 ) );
                $this->assertEquals( 'baz', $obj->getClosing( 2 ) );
-               $this->assertEquals( null, $obj->getClosing( 3 ) );
+               $this->assertNull( $obj->getClosing( 3 ) );
        }
 
        /**
index f3a7ae4..e8562cf 100644 (file)
@@ -38,7 +38,7 @@ class LanguageCodeTest extends MediaWikiUnitTestCase {
        public function testReplaceDeprecatedCodes() {
                $this->assertEquals( 'gsw', LanguageCode::replaceDeprecatedCodes( 'als' ) );
                $this->assertEquals( 'gsw', LanguageCode::replaceDeprecatedCodes( 'gsw' ) );
-               $this->assertEquals( null, LanguageCode::replaceDeprecatedCodes( null ) );
+               $this->assertNull( LanguageCode::replaceDeprecatedCodes( null ) );
        }
 
        /**
index b6e1d3a..7b2b299 100644 (file)
@@ -104,7 +104,7 @@ class SessionUnitTest extends MediaWikiUnitTestCase {
                $this->assertEquals( 'zero', $session->get( 0 ) );
                $this->assertFalse( $backend->dirty );
 
-               $this->assertEquals( null, $session->get( 'null' ) );
+               $this->assertNull( $session->get( 'null' ) );
                $this->assertEquals( 'default', $session->get( 'null', 'default' ) );
                $this->assertFalse( $backend->dirty );
 
@@ -165,7 +165,7 @@ class SessionUnitTest extends MediaWikiUnitTestCase {
                $this->assertFalse( $backend->dirty );
 
                $logger->setCollect( true );
-               $this->assertEquals( null, $session['null'] );
+               $this->assertNull( $session['null'] );
                $logger->setCollect( false );
                $this->assertFalse( $backend->dirty );
                $this->assertSame( [