forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranslationMessageSelectorTest.php
More file actions
executable file
·69 lines (59 loc) · 2.27 KB
/
TranslationMessageSelectorTest.php
File metadata and controls
executable file
·69 lines (59 loc) · 2.27 KB
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
60
61
62
63
64
65
66
67
68
69
<?php
namespace Illuminate\Tests\Translation;
use Illuminate\Translation\MessageSelector;
use PHPUnit\Framework\TestCase;
class TranslationMessageSelectorTest extends TestCase
{
/**
* @dataProvider chooseTestData
*/
public function testChoose($expected, $id, $number)
{
$selector = new MessageSelector;
$this->assertEquals($expected, $selector->choose($id, $number, 'en'));
}
public function chooseTestData()
{
return [
['first', 'first', 1],
['first', 'first', 10],
['first', 'first|second', 1],
['second', 'first|second', 10],
['second', 'first|second', 0],
['first', '{0} first|{1}second', 0],
['first', '{1}first|{2}second', 1],
['second', '{1}first|{2}second', 2],
['first', '{2}first|{1}second', 2],
['second', '{9}first|{10}second', 0],
['first', '{9}first|{10}second', 1],
['', '{0}|{1}second', 0],
['', '{0}first|{1}', 1],
['first', '{1.3}first|{2.3}second', 1.3],
['second', '{1.3}first|{2.3}second', 2.3],
['first
line', '{1}first
line|{2}second', 1],
["first \n
line", "{1}first \n
line|{2}second", 1],
['first', '{0} first|[1,9]second', 0],
['second', '{0}first|[1,9]second', 1],
['second', '{0}first|[1,9]second', 10],
['first', '{0}first|[2,9]second', 1],
['second', '[4,*]first|[1,3]second', 1],
['first', '[4,*]first|[1,3]second', 100],
['second', '[1,5]first|[6,10]second', 7],
['first', '[*,4]first|[5,*]second', 1],
['second', '[5,*]first|[*,4]second', 1],
['second', '[5,*]first|[*,4]second', 0],
['first', '{0}first|[1,3]second|[4,*]third', 0],
['second', '{0}first|[1,3]second|[4,*]third', 1],
['third', '{0}first|[1,3]second|[4,*]third', 9],
['first', 'first|second|third', 1],
['second', 'first|second|third', 9],
['second', 'first|second|third', 0],
['first', '{0} first | { 1 } second', 0],
['first', '[4,*]first | [1,3]second', 100],
];
}
}