This repository has been archived by the owner on Nov 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
AlphaTest.php
59 lines (47 loc) · 1.76 KB
/
AlphaTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace DMS\Filter\Rules;
use Tests;
class AlphaTest extends Tests\Testcase
{
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
parent::tearDown();
}
/**
* @dataProvider provideForRule
*/
public function testRule($options, $value, $expectedResult, $unicodeSetting = null)
{
$rule = new Alpha($options);
if ($unicodeSetting !== null) {
$property = new \ReflectionProperty($rule, 'unicodeEnabled');
$property->setAccessible(true);
$property->setValue($rule, $unicodeSetting);
}
$result = $rule->applyFilter($value);
$this->assertEquals($expectedResult, $result);
}
public function provideForRule()
{
return array(
array(false, "My Text", "MyText", true),
array(false, "My Text", "MyText", false),
array(true, "My Text", "My Text", true),
array(true, "My Text", "My Text", false),
array(true, "My Text!", "My Text", true),
array(true, "My Text!", "My Text", false),
array(true, "My Text21!", "My Text", true),
array(true, "My Text21!", "My Text", false),
array(true, "João 2Sorrisão", "João Sorrisão", true),
array(true, "João 2Sorrisão", "Joo Sorriso", false),
array(true, "Helgi Þormar Þorbjörnsson", "Helgi Þormar Þorbjörnsson", true),
array(true, "Helgi Þormar Þorbjörnsson", "Helgi ormar orbjrnsson", false),
array(true, "Helgi Þormar!@#$&*( )(*&%$#@Þorbjörnsson", "Helgi Þormar Þorbjörnsson", true),
array(true, "Helgi Þormar!@#$&*( )(*&%$#@Þorbjörnsson", "Helgi ormar orbjrnsson", false),
);
}
}