-
- ScopedCallback::consume( $scopedOverride );
- }
-
- /**
- * @dataProvider provideUserTitleTimestamp
- */
- public function testResetNotificationTimestamp( $user, $linkTarget, $timestamp ) {
- $force = 'XXX';
- $oldid = 999;
-
- $store = $this->getMockWatchedItemStore();
- $store->expects( $this->once() )
- ->method( 'resetNotificationTimestamp' )
- ->with( $user, $this->isInstanceOf( Title::class ), $force, $oldid )
- ->will( $this->returnCallback(
- function ( $user, Title $title, $force, $oldid ) use ( $linkTarget ) {
- /** @var LinkTarget $linkTarget */
- $this->assertInstanceOf( 'Title', $title );
- $this->assertSame( $linkTarget->getDBkey(), $title->getDBkey() );
- $this->assertSame( $linkTarget->getFragment(), $title->getFragment() );
- $this->assertSame( $linkTarget->getNamespace(), $title->getNamespace() );
- $this->assertSame( $linkTarget->getText(), $title->getText() );
-
- return true;
- }
- ) );
- $scopedOverride = WatchedItemStore::overrideDefaultInstance( $store );
-
- $item = new WatchedItem( $user, $linkTarget, $timestamp );
- $item->resetNotificationTimestamp( $force, $oldid );
-
- ScopedCallback::consume( $scopedOverride );