Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4106834
TrackingCategoriesTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
TrackingCategoriesTest.php
View Options
<?php
use
MediaWiki\Category\TrackingCategories
;
use
MediaWiki\Config\ServiceOptions
;
use
MediaWiki\Logger\LoggerFactory
;
use
MediaWiki\Page\PageReferenceValue
;
use
MediaWiki\Parser\ParserOutput
;
/**
* @covers \MediaWiki\Parser\ParserOutput
* @covers \MediaWiki\Parser\CacheTime
* @group Database
* ^--- trigger DB shadowing because we are using Title magic
*/
class
TrackingCategoriesTest
extends
MediaWikiLangTestCase
{
/**
* @covers \MediaWiki\Category\TrackingCategories::addTrackingCategory
*/
public
function
testAddTrackingCategory
()
{
$services
=
$this
->
getServiceContainer
();
$tc
=
new
TrackingCategories
(
new
ServiceOptions
(
TrackingCategories
::
CONSTRUCTOR_OPTIONS
,
$services
->
getMainConfig
()
),
$services
->
getNamespaceInfo
(),
$services
->
getTitleParser
(),
LoggerFactory
::
getInstance
(
'TrackingCategories'
)
);
$po
=
new
ParserOutput
;
$po
->
setUnsortedPageProperty
(
'defaultsort'
,
'foobar'
);
$page
=
PageReferenceValue
::
localReference
(
NS_USER
,
'Testing'
);
$tc
->
addTrackingCategory
(
$po
,
'index-category'
,
$page
);
// from CORE_TRACKING_CATEGORIES
$tc
->
addTrackingCategory
(
$po
,
'sitenotice'
,
$page
);
// should be "-", which is ignored
$tc
->
addTrackingCategory
(
$po
,
'brackets-start'
,
$page
);
// invalid text
// TODO: assert proper handling of non-existing messages
$expected
=
wfMessage
(
'index-category'
)
->
page
(
$page
)
->
inContentLanguage
()
->
text
();
// Note that the DEFAULTSORT is applied when the category links table
// is updated, so 'foobar' does not appear in the CategoryMap here.
$expected
=
strtr
(
$expected
,
' '
,
'_'
);
$this
->
assertSame
(
[
$expected
=>
''
],
$po
->
getCategoryMap
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:46 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
50/bc/fe1aad124e2ae51a608ef34da9fa
Default Alt Text
TrackingCategoriesTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment