Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7446971
ReplacementValidatorTest.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
ReplacementValidatorTest.php
View Options
<?php
declare
(
strict_types
=
1
);
use
MediaWiki\Extension\Translate\Validation\Validators\ReplacementValidator
;
/**
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @covers \MediaWiki\Extension\Translate\Validation\Validators\ReplacementValidator
*/
class
ReplacementValidatorTest
extends
BaseValidatorTestCase
{
/** @dataProvider provideTestCases */
public
function
test
(
$constructorParams
,
...
$params
)
{
$validator
=
new
ReplacementValidator
(
$constructorParams
);
$this
->
runValidatorTests
(
$validator
,
'replacement'
,
...
$params
);
}
public
static
function
provideTestCases
()
{
yield
[
[
'search'
=>
'rude'
,
'replace'
=>
'nice'
],
'Grumpy bunny is kind'
,
'Grumpy bunny is rude'
,
[
'replacement'
],
'Search match is an issue'
];
yield
[
[
'search'
=>
'rude'
,
'replace'
=>
'nice'
],
'Grumpy bunny is kind'
,
'Grumpy bunny is nice'
,
[],
'No match is not an issue'
];
}
/** @dataProvider provideBadTestCases */
public
function
testBadValues
(
$params
)
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
new
ReplacementValidator
(
$params
);
}
public
static
function
provideBadTestCases
()
{
yield
[
[
'oma maa'
]
];
yield
[
[
'source'
=>
'mansikka'
]
];
yield
[
[
'replacement'
=>
'mustikka'
]
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 18:55 (1 d, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
65/eb/8dc85bdbdad683cc6445761152f8
Default Alt Text
ReplacementValidatorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment