2use Wikimedia\ScopedCallback;
17 $this->title = Title::newFromText(
'SomeTitle' );
18 $this->target = Title::newFromText(
'TestTarget' );
19 $this->user = User::newFromName(
'UserName' );
21 $this->user_comment =
'<User comment about action>';
30 $row =
new stdClass();
32 $row->rc_timestamp =
'20150921134808';
33 $row->rc_deleted =
'bar';
34 $row->rc_comment_text =
'comment';
35 $row->rc_comment_data =
null;
41 'rc_timestamp' =>
'20150921134808',
42 'rc_deleted' =>
'bar',
43 'rc_comment' =>
'comment',
44 'rc_comment_text' =>
'comment',
45 'rc_comment_data' =>
null,
47 $this->assertEquals( $expected, $rc->getAttributes() );
49 $row =
new stdClass();
51 $row->rc_timestamp =
'20150921134808';
52 $row->rc_deleted =
'bar';
53 $row->rc_comment =
'comment';
55 MediaWiki\suppressWarnings();
57 MediaWiki\restoreWarnings();
61 'rc_timestamp' =>
'20150921134808',
62 'rc_deleted' =>
'bar',
63 'rc_comment' =>
'comment',
64 'rc_comment_text' =>
'comment',
65 'rc_comment_data' =>
null,
67 $this->assertEquals( $expected, $rc->getAttributes() );
83 'a:1:{s:4:"root";a:2:{s:1:"A";i:1;s:1:"B";s:3:"two";}}'
108 $rc->
setAttribs( [
'rc_params' => $rawRcParams ] );
110 $actualParseParams = $rc->parseParams();
112 $this->assertEquals( $expectedParseParams, $actualParseParams );
120 [ 6000, -3000, 0,
true ],
121 [ 3000, -6000, 0,
false ],
122 [ 6000, -3000, 6000,
true ],
123 [ 3000, -6000, 6000,
true ],
136 $timestamp = time() + $offset;
170 return $this->getMockBuilder( PageProps::class )
171 ->disableOriginalConstructor()
187 $categoryTitle = Title::newFromText(
'CategoryPage',
NS_CATEGORY );
190 $pageProps->expects( $this->once() )
191 ->method(
'getProperties' )
192 ->with( $categoryTitle,
'hiddencat' )
193 ->will( $this->returnValue( $isHidden ? [ $categoryTitle->getArticleID() =>
'' ] : [] ) );
203 $categoryTitle->getLatestRevID(),
204 $categoryTitle->getLatestRevID(),
209 $this->assertEquals( $isHidden, $rc->getParam(
'hidden-cat' ) );
211 ScopedCallback::consume( $scopedOverride );
static overrideInstance(PageProps $store=null)
Overrides the default instance of this class This is intended for use while testing and will fail if ...
testParseFromRCType( $rcType, $type)
provideRCTypes RecentChange::parseFromRCType
testNewFromRow()
RecentChange::newFromRow RecentChange::loadFromRow.
testParseParams()
RecentChange::parseParams.
testHiddenCategoryChange( $isHidden)
provideCategoryContent RecentChange::newForCategorization
testParseToRCType( $rcType, $type)
provideRCTypes RecentChange::parseToRCType
testIsInRCLifespan( $maxAge, $offset, $tolerance, $expected)
RecentChange::isInRCLifespan provideIsInRCLifespan.
assertParseParams( $expectedParseParams, $rawRcParams)
Utility class for creating new RC entries.
static parseToRCType( $type)
Parsing text to RC_* constants.
static newForCategorization( $timestamp, Title $categoryTitle, User $user=null, $comment, Title $pageTitle, $oldRevId, $newRevId, $lastTimestamp, $bot, $ip='', $deleted=0, $added=null)
Constructs a RecentChange object for the given categorization This does not call save() on the object...
static isInRCLifespan( $timestamp, $tolerance=0)
Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recent...
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
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
processing should stop and the error should be shown to the user * false