Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7447771
PrintfValidatorTest.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
PrintfValidatorTest.php
View Options
<?php
declare
(
strict_types
=
1
);
use
MediaWiki\Extension\Translate\Validation\Validators\PrintfValidator
;
/**
* @license GPL-2.0-or-later
* @covers \MediaWiki\Extension\Translate\Validation\Validators\PrintfValidator
*/
class
PrintfValidatorTest
extends
BaseValidatorTestCase
{
/** @dataProvider provideTestCases */
public
function
test
(
...
$params
)
{
$this
->
runValidatorTests
(
new
PrintfValidator
(),
'variable'
,
...
$params
);
}
public
static
function
provideTestCases
()
{
$key
=
'key'
;
$code
=
'en'
;
yield
[
'%2$f'
,
'a'
,
[
'missing'
],
'missing positional variable is an issue'
];
yield
[
'%2$f'
,
'%3$d'
,
[
'missing'
,
'unknown'
],
'typoed variable is two issues'
];
yield
[
'abc'
,
'%4$d'
,
[
'unknown'
],
'unknown positional variable is an issue'
];
yield
[
'%2$f'
,
'%2$f'
,
[],
'all variables are used, no issues'
];
yield
[
'%2$.2f'
,
'%2$f'
,
[
'missing'
,
'unknown'
],
'changing precision is not supported'
];
yield
[
'%.2f'
,
'%2$f'
,
[
'missing'
,
'unknown'
],
'changing precision and position is not supported'
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 19:18 (1 d, 11 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c8/3b/4d5d4c22607d8dd3e514604ed9c6
Default Alt Text
PrintfValidatorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment