Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7444465
RenameDbPrefixTest.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
RenameDbPrefixTest.php
View Options
<?php
namespace
MediaWiki\Tests\Maintenance
;
use
RenameDbPrefix
;
/**
* @covers \RenameDbPrefix
* @author Dreamy Jazz
*/
class
RenameDbPrefixTest
extends
MaintenanceBaseTestCase
{
protected
function
getMaintenanceClass
()
{
return
RenameDbPrefix
::
class
;
}
/** @dataProvider provideExecuteForFatalError */
public
function
testExecuteForFatalError
(
$options
,
$expectedOutputRegex
)
{
foreach
(
$options
as
$name
=>
$value
)
{
$this
->
maintenance
->
setOption
(
$name
,
$value
);
}
$this
->
expectCallToFatalError
();
$this
->
expectOutputRegex
(
$expectedOutputRegex
);
$this
->
maintenance
->
execute
();
}
public
static
function
provideExecuteForFatalError
()
{
return
[
'--old is invalid'
=>
[
[
'old'
=>
'$£"!abc**;'
],
'/Invalid prefix/'
],
'--new is invalid'
=>
[
[
'new'
=>
'$£"!abc**;'
],
'/Invalid prefix/'
],
'--new and --old are invalid'
=>
[
[
'new'
=>
'$£"!abc**;'
,
'old'
=>
'!"£$'
],
'/Invalid prefix/'
],
];
}
/** @dataProvider provideExecuteForOldAndNewTheSame */
public
function
testExecuteWhenOldAndNewTheSame
(
$prefix
)
{
$this
->
maintenance
->
setOption
(
'old'
,
$prefix
);
$this
->
maintenance
->
setOption
(
'new'
,
$prefix
);
$this
->
expectOutputString
(
"Same prefix. Nothing to rename!
\n
"
);
$this
->
maintenance
->
execute
();
}
public
static
function
provideExecuteForOldAndNewTheSame
()
{
return
[
'--old and --new are "abc"'
=>
[
'abc_'
,
'abc_'
],
'--old and --new are empty'
=>
[
null
,
null
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 17:37 (1 d, 5 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3c/46/91b5fca337be4b86ac17486e5f61
Default Alt Text
RenameDbPrefixTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment