Merge "JsonContent: Remove never-used caption styles"
[lhc/web/wiklou.git] / tests / phpunit / includes / watcheditem / WatchedItemQueryServiceUnitTest.php
index 50e6c20..63c2b82 100644 (file)
@@ -72,7 +72,8 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                return new WatchedItemQueryService(
                        $this->getMockLoadBalancer( $mockDb ),
                        $this->getMockCommentStore(),
-                       $this->getMockActorMigration()
+                       $this->getMockActorMigration(),
+                       $this->getMockWatchedItemStore()
                );
        }
 
@@ -139,6 +140,22 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                return $mock;
        }
 
+       /**
+        * @param PHPUnit_Framework_MockObject_MockObject|Database $mockDb
+        * @return PHPUnit_Framework_MockObject_MockObject|WatchedItemStore
+        */
+       private function getMockWatchedItemStore() {
+               $mock = $this->getMockBuilder( WatchedItemStore::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'getLatestNotificationTimestamp' )
+                       ->will( $this->returnCallback( function ( $timestamp ) {
+                               return $timestamp;
+                       } ) );
+               return $mock;
+       }
+
        /**
         * @param int $id
         * @return PHPUnit_Framework_MockObject_MockObject|User
@@ -187,8 +204,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                        } ) );
                $mock->expects( $this->any() )
                        ->method( 'isAllowedAny' )
-                       ->will( $this->returnCallback( function () use ( $notAllowedAction ) {
-                               $actions = func_get_args();
+                       ->will( $this->returnCallback( function ( ...$actions ) use ( $notAllowedAction ) {
                                return !in_array( $notAllowedAction, $actions );
                        } ) );
 
@@ -263,7 +279,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                ],
                                [
                                        'watchlist' => [
-                                               'INNER JOIN',
+                                               'JOIN',
                                                [
                                                        'wl_namespace=rc_namespace',
                                                        'wl_title=rc_title'
@@ -386,7 +402,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                ],
                                [
                                        'watchlist' => [
-                                               'INNER JOIN',
+                                               'JOIN',
                                                [
                                                        'wl_namespace=rc_namespace',
                                                        'wl_title=rc_title'
@@ -888,7 +904,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                $expectedJoinConds = array_merge(
                        [
                                'watchlist' => [
-                                       'INNER JOIN',
+                                       'JOIN',
                                        [
                                                'wl_namespace=rc_namespace',
                                                'wl_title=rc_title'
@@ -1121,7 +1137,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                $this->isType( 'string' ),
                                $this->isType( 'array' ),
                                array_merge( [
-                                       'watchlist' => [ 'INNER JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' ] ],
+                                       'watchlist' => [ 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' ] ],
                                        'page' => [ 'LEFT JOIN', 'rc_cur_id=page_id' ],
                                ], $expectedExtraJoins )
                        )
@@ -1159,7 +1175,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                [],
                                [
                                        'watchlist' => [
-                                               'INNER JOIN',
+                                               'JOIN',
                                                [
                                                        'wl_namespace=rc_namespace',
                                                        'wl_title=rc_title'
@@ -1282,7 +1298,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                [],
                                [
                                        'watchlist' => [
-                                               'INNER JOIN',
+                                               'JOIN',
                                                [
                                                        'wl_namespace=rc_namespace',
                                                        'wl_title=rc_title'
@@ -1328,7 +1344,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase {
                                [],
                                [
                                        'watchlist' => [
-                                               'INNER JOIN',
+                                               'JOIN',
                                                [
                                                        'wl_namespace=rc_namespace',
                                                        'wl_title=rc_title'