Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7445639
BraceBalanceValidatorTest.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
BraceBalanceValidatorTest.php
View Options
<?php
declare
(
strict_types
=
1
);
use
MediaWiki\Extension\Translate\Validation\Validators\BraceBalanceValidator
;
/**
* @license GPL-2.0-or-later
* @covers \MediaWiki\Extension\Translate\Validation\Validators\BraceBalanceValidator
*/
class
BraceBalanceValidatorTest
extends
BaseValidatorTestCase
{
/** @dataProvider provideTestCases */
public
function
test
(
...
$params
)
{
$this
->
runValidatorTests
(
new
BraceBalanceValidator
(),
'balance'
,
...
$params
);
}
public
static
function
provideTestCases
()
{
yield
[
'{{ Hello }}'
,
'{{ Hello }}}'
,
[
'brace'
],
'should return an issue for a message containing non-matching braces.'
];
yield
[
'[[ Hello ]]'
,
'[[ Hello ]]'
,
[],
'should not set any issue for a balanced translation.'
];
yield
[
'Hello :]'
,
'Hello :]'
,
[],
'should not set any issue if definition is unbalanced.'
];
yield
[
'Hello :]'
,
'Hello :)'
,
[
'brace'
],
'balancedness only applies to one brace type, for other types still raise an issue.'
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 18:13 (1 d, 6 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c8/4d/2ea6f25e4a6f103b5a86c16048a2
Default Alt Text
BraceBalanceValidatorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment