Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2752968
CentralAuthWikiListServiceTest.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
CentralAuthWikiListServiceTest.php
View Options
<?php
use
MediaWiki\Config\ServiceOptions
;
use
MediaWiki\Extension\CentralAuth\CentralAuthWikiListService
;
/**
* @covers MediaWiki\Extension\CentralAuth\CentralAuthWikiListService
*/
class
CentralAuthWikiListServiceTest
extends
MediaWikiUnitTestCase
{
/**
* @dataProvider provideConfigValues
*/
public
function
testGetWikiListFromConfig
(
array
$configValue
)
{
$wikiListService
=
new
CentralAuthWikiListService
(
new
ServiceOptions
(
CentralAuthWikiListService
::
CONSTRUCTOR_OPTIONS
,
[
'LocalDatabases'
=>
$configValue
]
),
$this
->
createHookContainer
()
);
$this
->
assertArrayEquals
(
$configValue
,
$wikiListService
->
getWikiList
()
);
}
public
static
function
provideConfigValues
():
array
{
return
[
'Empty'
=>
[
[]
],
'With values'
=>
[
[
'foowiki'
,
'barwiki'
]
],
];
}
/**
* @dataProvider provideHooks
*/
public
function
testGetWikiListFromHook
(
array
$hooks
,
array
$expected
)
{
$hookContainer
=
$this
->
createHookContainer
();
foreach
(
$hooks
as
$hook
)
{
$hookContainer
->
register
(
'CentralAuthWikiList'
,
$hook
);
}
$wikiListService
=
new
CentralAuthWikiListService
(
new
ServiceOptions
(
CentralAuthWikiListService
::
CONSTRUCTOR_OPTIONS
,
[
'LocalDatabases'
=>
[
'configuredwiki'
]
]
),
$hookContainer
);
$this
->
assertArrayEquals
(
$expected
,
$wikiListService
->
getWikiList
()
);
}
public
static
function
provideHooks
()
{
return
[
'One hook'
=>
[
[
static
function
(
?
array
&
$wikiList
)
{
$wikiList
=
[
'barwiki'
];
}
],
[
'barwiki'
],
],
'Multiple hooks, with aborting'
=>
[
[
static
function
(
?
array
&
$wikiList
)
{
$wikiList
=
[
'foowiki'
];
return
true
;
},
static
function
(
?
array
&
$wikiList
)
{
$wikiList
=
[
'barwiki'
];
return
false
;
},
static
function
(
?
array
&
$wikiList
)
{
$wikiList
=
[
'bazwiki'
];
},
],
[
'barwiki'
],
],
'Multiple hooks, with aborting before setting a value'
=>
[
[
static
function
(
?
array
&
$wikiList
)
{
return
false
;
},
static
function
(
?
array
&
$wikiList
)
{
$wikiList
=
[
'bazwiki'
];
},
],
[
'configuredwiki'
],
],
'No hooks'
=>
[
[],
[
'configuredwiki'
],
]
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 20:37 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5f/22/143c0fcfeb65b97db01cbb82c47f
Default Alt Text
CentralAuthWikiListServiceTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment