2use Wikimedia\ScopedCallback;
17 $this->
title = Title::newFromText(
'SomeTitle' );
18 $this->target = Title::newFromText(
'TestTarget' );
21 $this->user_comment =
'<User comment about action>';
22 $this->context = RequestContext::newExtraneousContext( $this->
title );
31 $actorId =
$user->getActorId();
33 $row =
new stdClass();
35 $row->rc_timestamp =
'20150921134808';
36 $row->rc_deleted =
'bar';
37 $row->rc_comment_text =
'comment';
38 $row->rc_comment_data =
null;
39 $row->rc_user =
$user->getId();
41 $rc = RecentChange::newFromRow( $row );
45 'rc_timestamp' =>
'20150921134808',
46 'rc_deleted' =>
'bar',
47 'rc_comment' =>
'comment',
48 'rc_comment_text' =>
'comment',
49 'rc_comment_data' =>
null,
50 'rc_user' =>
$user->getId(),
51 'rc_user_text' =>
$user->getName(),
52 'rc_actor' => $actorId,
54 $this->assertEquals( $expected, $rc->getAttributes() );
56 $row =
new stdClass();
58 $row->rc_timestamp =
'20150921134808';
59 $row->rc_deleted =
'bar';
60 $row->rc_comment =
'comment';
61 $row->rc_user =
$user->getId();
63 Wikimedia\suppressWarnings();
64 $rc = RecentChange::newFromRow( $row );
65 Wikimedia\restoreWarnings();
69 'rc_timestamp' =>
'20150921134808',
70 'rc_deleted' =>
'bar',
71 'rc_comment' =>
'comment',
72 'rc_comment_text' =>
'comment',
73 'rc_comment_data' =>
null,
74 'rc_user' =>
$user->getId(),
75 'rc_user_text' =>
$user->getName(),
76 'rc_actor' => $actorId,
78 $this->assertEquals( $expected, $rc->getAttributes() );
94 'a:1:{s:4:"root";a:2:{s:1:"A";i:1;s:1:"B";s:3:"two";}}'
119 $rc->
setAttribs( [
'rc_params' => $rawRcParams ] );
121 $actualParseParams = $rc->parseParams();
123 $this->assertEquals( $expectedParseParams, $actualParseParams );
131 [ 6000, -3000, 0,
true ],
132 [ 3000, -6000, 0,
false ],
133 [ 6000, -3000, 6000,
true ],
134 [ 3000, -6000, 6000,
true ],
147 $timestamp = time() + $offset;
148 $this->assertEquals( $expected, RecentChange::isInRCLifespan( $timestamp, $tolerance ) );
166 $this->assertEquals(
$type, RecentChange::parseFromRCType( $rcType ) );
174 $this->assertEquals( $rcType, RecentChange::parseToRCType(
$type ) );
181 return $this->getMockBuilder( PageProps::class )
182 ->disableOriginalConstructor()
198 $categoryTitle = Title::newFromText(
'CategoryPage',
NS_CATEGORY );
201 $pageProps->expects( $this->once() )
202 ->method(
'getProperties' )
203 ->with( $categoryTitle,
'hiddencat' )
204 ->will( $this->returnValue( $isHidden ? [ $categoryTitle->getArticleID() =>
'' ] : [] ) );
208 $rc = RecentChange::newForCategorization(
214 $categoryTitle->getLatestRevID(),
215 $categoryTitle->getLatestRevID(),
220 $this->assertEquals( $isHidden, $rc->getParam(
'hidden-cat' ) );
222 ScopedCallback::consume( $scopedOverride );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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 newFromName( $name, $validate='valid')
Static factory method for creation from username.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
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
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