Page MenuHomeWickedGov Phorge

InsertableRegexValidatorTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

InsertableRegexValidatorTest.php

<?php
declare( strict_types = 1 );
use MediaWiki\Extension\Translate\Validation\Validators\InsertableRegexValidator;
/**
* @license GPL-2.0-or-later
* @covers \MediaWiki\Extension\Translate\Validation\Validators\InsertableRegexValidator
*/
class InsertableRegexValidatorTest extends BaseValidatorTestCase {
/** @dataProvider provideTestCases */
public function test( $constructorParams, ...$params ) {
$validator = new InsertableRegexValidator( $constructorParams );
$this->runValidatorTests( $validator, 'variable', ...$params );
}
public static function provideTestCases() {
yield [
'/\$[a-z0-9]+/',
'$contacts is $diff less than that.',
'$contacts2 as $diff2 less.',
[ 'missing', 'unknown' ],
'should correctly identifiy the missing and unknown parameters.'
];
yield [
[ 'regex' => '/\$[a-z0-9]+/' ],
'$contacts is $diff less than that.',
'$contacts less.',
[ 'missing' ],
'should correctly identifiy the missing parameters.'
];
yield [
'/<[a-z]+>/',
'<hello> <world>',
'<hello> <world> <msg>',
[ 'unknown' ],
'should correctly identify the unknown parameters.'
];
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 22, 18:40 (1 d, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
57/15/531cce1521b03e85fb2b0eaf9ff5
Default Alt Text
InsertableRegexValidatorTest.php (1 KB)

Event Timeline