Page MenuHomeWickedGov Phorge

BraceBalanceValidatorTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

BraceBalanceValidatorTest.php

<?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

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)

Event Timeline