Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7418696
LocalRenameUserJobTest.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
LocalRenameUserJobTest.php
View Options
<?php
/**
* @section LICENSE
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace
MediaWiki\Extension\CentralAuth\Hooks\Tests\Unit\LocalRenameJob
;
use
MediaWiki\Extension\CentralAuth\GlobalRename\LocalRenameJob\LocalRenameUserJob
;
use
ReflectionClass
;
use
ReflectionMethod
;
/**
* @covers \MediaWiki\Extension\CentralAuth\GlobalRename\LocalRenameJob\LocalRenameUserJob
* @copyright © 2018 Wikimedia Foundation and contributors
*/
class
LocalRenameUserJobTest
extends
\PHPUnit\Framework\TestCase
{
protected
ReflectionMethod
$escapeReplacement
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$clazz
=
new
ReflectionClass
(
LocalRenameUserJob
::
class
);
$this
->
escapeReplacement
=
$clazz
->
getMethod
(
'escapeReplacement'
);
$this
->
escapeReplacement
->
setAccessible
(
true
);
}
/**
* @dataProvider provideEscapeReplacement
*/
public
function
testEscapeReplacement
(
$given
,
$expect
)
{
$escaped
=
$this
->
escapeReplacement
->
invokeArgs
(
null
,
[
$given
]
);
$this
->
assertSame
(
$expect
,
$escaped
,
'Replacement is escaped'
);
}
public
static
function
provideEscapeReplacement
()
{
return
[
'$n'
=>
[
'Drytime%$1600'
,
'Drytime%
\\
$1600'
],
'${n}'
=>
[
'That${1}'
,
'That
\\
${1}'
],
'$'
=>
[
'End$'
,
'End$'
],
'
\\
n'
=>
[
'This
\\
1'
,
'This
\\\\
1'
],
'
\\
'
=>
[
'VeryU
\\
niqueAccount'
,
'VeryU
\\
niqueAccount'
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 04:04 (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
46/3d/6212570edcf3bbfcb7fcd3cd0078
Default Alt Text
LocalRenameUserJobTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment