Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5978578
ParserCacheFactoryTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ParserCacheFactoryTest.php
View Options
<?php
namespace
MediaWiki\Tests\Parser
;
use
MediaWiki\Config\ServiceOptions
;
use
MediaWiki\Json\JsonCodec
;
use
MediaWiki\MainConfigNames
;
use
MediaWiki\MainConfigSchema
;
use
MediaWiki\Page\WikiPageFactory
;
use
MediaWiki\Parser\ParserCache
;
use
MediaWiki\Parser\ParserCacheFactory
;
use
MediaWiki\Parser\RevisionOutputCache
;
use
MediaWiki\Title\TitleFactory
;
use
MediaWikiUnitTestCase
;
use
Psr\Log\NullLogger
;
use
Wikimedia\ObjectCache\HashBagOStuff
;
use
Wikimedia\ObjectCache\WANObjectCache
;
use
Wikimedia\Stats\StatsFactory
;
use
Wikimedia\UUID\GlobalIdGenerator
;
/**
* @covers \MediaWiki\Parser\ParserCacheFactory
*/
class
ParserCacheFactoryTest
extends
MediaWikiUnitTestCase
{
/**
* @return ParserCacheFactory
*/
private
function
newParserCacheFactory
()
{
$options
=
new
ServiceOptions
(
ParserCacheFactory
::
CONSTRUCTOR_OPTIONS
,
[
MainConfigNames
::
CacheEpoch
=>
'20200202112233'
,
MainConfigNames
::
OldRevisionParserCacheExpireTime
=>
60
,
MainConfigNames
::
ParserCacheFilterConfig
=>
MainConfigSchema
::
getDefaultValue
(
MainConfigNames
::
ParserCacheFilterConfig
),
]
);
return
new
ParserCacheFactory
(
new
HashBagOStuff
(),
new
WANObjectCache
(
[
'cache'
=>
new
HashBagOStuff
()
]
),
$this
->
createHookContainer
(),
new
JsonCodec
(),
StatsFactory
::
newNull
(),
new
NullLogger
(),
$options
,
$this
->
createNoOpMock
(
TitleFactory
::
class
),
$this
->
createNoOpMock
(
WikiPageFactory
::
class
),
$this
->
createNoOpMock
(
GlobalIdGenerator
::
class
)
);
}
public
function
testGetParserCache
()
{
$factory
=
$this
->
newParserCacheFactory
();
$a
=
$factory
->
getParserCache
(
'test'
);
$this
->
assertInstanceOf
(
ParserCache
::
class
,
$a
);
$b
=
$factory
->
getParserCache
(
'test'
);
$this
->
assertSame
(
$a
,
$b
);
$c
=
$factory
->
getParserCache
(
'xyzzy'
);
$this
->
assertNotSame
(
$a
,
$c
);
}
public
function
testGetRevisionOutputCache
()
{
$factory
=
$this
->
newParserCacheFactory
();
$a
=
$factory
->
getRevisionOutputCache
(
'test'
);
$this
->
assertInstanceOf
(
RevisionOutputCache
::
class
,
$a
);
$b
=
$factory
->
getRevisionOutputCache
(
'test'
);
$this
->
assertSame
(
$a
,
$b
);
$c
=
$factory
->
getRevisionOutputCache
(
'xyzzy'
);
$this
->
assertNotSame
(
$a
,
$c
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:28 (3 d, 22 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
30/f8/a541c2d2a3080538be6cb4dd470d
Default Alt Text
ParserCacheFactoryTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment