24 ->disableOriginalConstructor()
34 $this->assertSame(
$user, $item->getUser() );
35 $this->assertSame( $linkTarget, $item->getLinkTarget() );
36 $this->assertSame( $notifTimestamp, $item->getNotificationTimestamp() );
39 $this->assertInstanceOf(
'Title', $item->getTitle() );
40 $this->assertSame( $linkTarget->
getDBkey(), $item->getTitle()->getDBkey() );
41 $this->assertSame( $linkTarget->
getFragment(), $item->getTitle()->getFragment() );
42 $this->assertSame( $linkTarget->
getNamespace(), $item->getTitle()->getNamespace() );
43 $this->assertSame( $linkTarget->
getText(), $item->getTitle()->getText() );
51 $store->expects( $this->once() )
52 ->method(
'loadWatchedItem' )
53 ->with(
$user, $linkTarget )
59 $this->assertEquals(
$user, $item->getUser() );
60 $this->assertEquals( $linkTarget, $item->getLinkTarget() );
61 $this->assertEquals(
$timestamp, $item->getNotificationTimestamp() );
74 $store->expects( $this->once() )
75 ->method(
'resetNotificationTimestamp' )
77 ->will( $this->returnCallback(
80 $this->assertInstanceOf(
'Title', $title );
81 $this->assertSame( $linkTarget->getDBkey(), $title->
getDBkey() );
82 $this->assertSame( $linkTarget->getFragment(), $title->
getFragment() );
83 $this->assertSame( $linkTarget->getNamespace(), $title->
getNamespace() );
84 $this->assertSame( $linkTarget->getText(), $title->
getText() );
92 $item->resetNotificationTimestamp( $force, $oldid );
104 $user->expects( $this->once() )
105 ->method(
'addWatch' )
106 ->with(
$title, $checkRights );
109 $this->assertTrue( $item->addWatch() );
119 $user->expects( $this->once() )
120 ->method(
'removeWatch' )
121 ->with(
$title, $checkRights );
124 $this->assertTrue( $item->removeWatch() );
144 $user->expects( $this->once() )
145 ->method(
'isWatched' )
146 ->with(
$title, $checkRights )
147 ->will( $this->returnValue( $returnValue ) );
150 $this->assertEquals( $returnValue, $item->isWatched() );
158 $store->expects( $this->once() )
159 ->method(
'duplicateAllAssociatedEntries' )
177 $store->expects( $this->exactly( 2 ) )
178 ->method(
'addWatchBatchForUser' );
179 $store->expects( $this->at( 0 ) )
180 ->method(
'addWatchBatchForUser' )
184 $itemOne->getTitle()->getSubjectPage(),
185 $itemOne->getTitle()->getTalkPage(),
188 $store->expects( $this->at( 1 ) )
189 ->method(
'addWatchBatchForUser' )
193 $itemTwo->getTitle()->getSubjectPage(),
194 $itemTwo->getTitle()->getTalkPage(),
static batchAddWatch(array $items)
getFragment()
Get the Title fragment (i.e.
getText()
Get the text form (spaces not underscores) of the main part.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
processing should stop and the error should be shown to the user * false
Represents a page (or page fragment) title within MediaWiki.
static newFromId($id)
Static factory method for creation from a given user ID.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Represents a title within MediaWiki.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
testResetNotificationTimestamp($user, $linkTarget, $timestamp)
provideUserTitleTimestamp
getDBkey()
Get the main part with underscores.
static duplicateEntries(Title $oldTitle, Title $newTitle)
testConstruction($user, LinkTarget $linkTarget, $notifTimestamp)
provideUserTitleTimestamp
static overrideDefaultInstance(WatchedItemStore $store=null)
Overrides the default instance of this class This is intended for use while testing and will fail if ...
Representation of a pair of user and title for watchlist entries.
namespace and then decline to actually register it file or subcat img or subcat $title
getNamespace()
Get the namespace index, i.e.
testIsWatched($returnValue)
provideBooleans
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
testFromUserTitle($user, $linkTarget, $timestamp)
provideUserTitleTimestamp
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
provideUserTitleTimestamp()
static consume(ScopedCallback &$sc=null)
Trigger a scoped callback and destroy it.
getMockWatchedItemStore()
static fromUserTitle($user, $title, $checkRights=User::CHECK_USER_RIGHTS)