diff options
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/Util')
-rw-r--r-- | vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php | 111 | ||||
-rw-r--r-- | vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php | 87 |
2 files changed, 198 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php new file mode 100644 index 00000000..d1a7e8c1 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php | |||
@@ -0,0 +1,111 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Intl\Tests\Util; | ||
13 | |||
14 | use Symfony\Component\Intl\Util\IcuVersion; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class IcuVersionTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | public function normalizeProvider() | ||
22 | { | ||
23 | return array( | ||
24 | array(null, '1', '10'), | ||
25 | array(null, '1.2', '12'), | ||
26 | array(null, '1.2.3', '12.3'), | ||
27 | array(null, '1.2.3.4', '12.3.4'), | ||
28 | array(1, '1', '10'), | ||
29 | array(1, '1.2', '12'), | ||
30 | array(1, '1.2.3', '12'), | ||
31 | array(1, '1.2.3.4', '12'), | ||
32 | array(2, '1', '10'), | ||
33 | array(2, '1.2', '12'), | ||
34 | array(2, '1.2.3', '12.3'), | ||
35 | array(2, '1.2.3.4', '12.3'), | ||
36 | array(3, '1', '10'), | ||
37 | array(3, '1.2', '12'), | ||
38 | array(3, '1.2.3', '12.3'), | ||
39 | array(3, '1.2.3.4', '12.3.4'), | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * @dataProvider normalizeProvider | ||
45 | */ | ||
46 | public function testNormalize($precision, $version, $result) | ||
47 | { | ||
48 | $this->assertSame($result, IcuVersion::normalize($version, $precision)); | ||
49 | } | ||
50 | |||
51 | public function compareProvider() | ||
52 | { | ||
53 | return array( | ||
54 | array(null, '1', '==', '1', true), | ||
55 | array(null, '1.0', '==', '1.1', false), | ||
56 | array(null, '1.0.0', '==', '1.0.1', false), | ||
57 | array(null, '1.0.0.0', '==', '1.0.0.1', false), | ||
58 | array(null, '1.0.0.0.0', '==', '1.0.0.0.1', false), | ||
59 | |||
60 | array(null, '1', '==', '10', true), | ||
61 | array(null, '1.0', '==', '11', false), | ||
62 | array(null, '1.0.0', '==', '10.1', false), | ||
63 | array(null, '1.0.0.0', '==', '10.0.1', false), | ||
64 | array(null, '1.0.0.0.0', '==', '10.0.0.1', false), | ||
65 | |||
66 | array(1, '1', '==', '1', true), | ||
67 | array(1, '1.0', '==', '1.1', false), | ||
68 | array(1, '1.0.0', '==', '1.0.1', true), | ||
69 | array(1, '1.0.0.0', '==', '1.0.0.1', true), | ||
70 | array(1, '1.0.0.0.0', '==', '1.0.0.0.1', true), | ||
71 | |||
72 | array(1, '1', '==', '10', true), | ||
73 | array(1, '1.0', '==', '11', false), | ||
74 | array(1, '1.0.0', '==', '10.1', true), | ||
75 | array(1, '1.0.0.0', '==', '10.0.1', true), | ||
76 | array(1, '1.0.0.0.0', '==', '10.0.0.1', true), | ||
77 | |||
78 | array(2, '1', '==', '1', true), | ||
79 | array(2, '1.0', '==', '1.1', false), | ||
80 | array(2, '1.0.0', '==', '1.0.1', false), | ||
81 | array(2, '1.0.0.0', '==', '1.0.0.1', true), | ||
82 | array(2, '1.0.0.0.0', '==', '1.0.0.0.1', true), | ||
83 | |||
84 | array(2, '1', '==', '10', true), | ||
85 | array(2, '1.0', '==', '11', false), | ||
86 | array(2, '1.0.0', '==', '10.1', false), | ||
87 | array(2, '1.0.0.0', '==', '10.0.1', true), | ||
88 | array(2, '1.0.0.0.0', '==', '10.0.0.1', true), | ||
89 | |||
90 | array(3, '1', '==', '1', true), | ||
91 | array(3, '1.0', '==', '1.1', false), | ||
92 | array(3, '1.0.0', '==', '1.0.1', false), | ||
93 | array(3, '1.0.0.0', '==', '1.0.0.1', false), | ||
94 | array(3, '1.0.0.0.0', '==', '1.0.0.0.1', true), | ||
95 | |||
96 | array(3, '1', '==', '10', true), | ||
97 | array(3, '1.0', '==', '11', false), | ||
98 | array(3, '1.0.0', '==', '10.1', false), | ||
99 | array(3, '1.0.0.0', '==', '10.0.1', false), | ||
100 | array(3, '1.0.0.0.0', '==', '10.0.0.1', true), | ||
101 | ); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * @dataProvider compareProvider | ||
106 | */ | ||
107 | public function testCompare($precision, $version1, $operator, $version2, $result) | ||
108 | { | ||
109 | $this->assertSame($result, IcuVersion::compare($version1, $version2, $operator, $precision)); | ||
110 | } | ||
111 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php new file mode 100644 index 00000000..60cec6c0 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php | |||
@@ -0,0 +1,87 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Intl\Tests\Util; | ||
13 | |||
14 | use Symfony\Component\Intl\Util\Version; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class VersionTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | public function normalizeProvider() | ||
22 | { | ||
23 | return array( | ||
24 | array(null, '1', '1'), | ||
25 | array(null, '1.2', '1.2'), | ||
26 | array(null, '1.2.3', '1.2.3'), | ||
27 | array(null, '1.2.3.4', '1.2.3.4'), | ||
28 | array(1, '1', '1'), | ||
29 | array(1, '1.2', '1'), | ||
30 | array(1, '1.2.3', '1'), | ||
31 | array(1, '1.2.3.4', '1'), | ||
32 | array(2, '1', '1'), | ||
33 | array(2, '1.2', '1.2'), | ||
34 | array(2, '1.2.3', '1.2'), | ||
35 | array(2, '1.2.3.4', '1.2'), | ||
36 | array(3, '1', '1'), | ||
37 | array(3, '1.2', '1.2'), | ||
38 | array(3, '1.2.3', '1.2.3'), | ||
39 | array(3, '1.2.3.4', '1.2.3'), | ||
40 | array(4, '1', '1'), | ||
41 | array(4, '1.2', '1.2'), | ||
42 | array(4, '1.2.3', '1.2.3'), | ||
43 | array(4, '1.2.3.4', '1.2.3.4'), | ||
44 | ); | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * @dataProvider normalizeProvider | ||
49 | */ | ||
50 | public function testNormalize($precision, $version, $result) | ||
51 | { | ||
52 | $this->assertSame($result, Version::normalize($version, $precision)); | ||
53 | } | ||
54 | |||
55 | public function compareProvider() | ||
56 | { | ||
57 | return array( | ||
58 | array(null, '1', '==', '1', true), | ||
59 | array(null, '1.0', '==', '1.1', false), | ||
60 | array(null, '1.0.0', '==', '1.0.1', false), | ||
61 | array(null, '1.0.0.0', '==', '1.0.0.1', false), | ||
62 | |||
63 | array(1, '1', '==', '1', true), | ||
64 | array(1, '1.0', '==', '1.1', true), | ||
65 | array(1, '1.0.0', '==', '1.0.1', true), | ||
66 | array(1, '1.0.0.0', '==', '1.0.0.1', true), | ||
67 | |||
68 | array(2, '1', '==', '1', true), | ||
69 | array(2, '1.0', '==', '1.1', false), | ||
70 | array(2, '1.0.0', '==', '1.0.1', true), | ||
71 | array(2, '1.0.0.0', '==', '1.0.0.1', true), | ||
72 | |||
73 | array(3, '1', '==', '1', true), | ||
74 | array(3, '1.0', '==', '1.1', false), | ||
75 | array(3, '1.0.0', '==', '1.0.1', false), | ||
76 | array(3, '1.0.0.0', '==', '1.0.0.1', true), | ||
77 | ); | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * @dataProvider compareProvider | ||
82 | */ | ||
83 | public function testCompare($precision, $version1, $operator, $version2, $result) | ||
84 | { | ||
85 | $this->assertSame($result, Version::compare($version1, $version2, $operator, $precision)); | ||
86 | } | ||
87 | } | ||