1bb3d210d79abca93b80ad5c5cfd8d993cad8c8e
[yaffs-website] / vendor / symfony / translation / Tests / IntervalTest.php
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\Translation\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Translation\Interval;
16
17 class IntervalTest extends TestCase
18 {
19     /**
20      * @dataProvider getTests
21      */
22     public function testTest($expected, $number, $interval)
23     {
24         $this->assertEquals($expected, Interval::test($number, $interval));
25     }
26
27     /**
28      * @expectedException \InvalidArgumentException
29      */
30     public function testTestException()
31     {
32         Interval::test(1, 'foobar');
33     }
34
35     public function getTests()
36     {
37         return array(
38             array(true, 3, '{1,2, 3 ,4}'),
39             array(false, 10, '{1,2, 3 ,4}'),
40             array(false, 3, '[1,2]'),
41             array(true, 1, '[1,2]'),
42             array(true, 2, '[1,2]'),
43             array(false, 1, ']1,2['),
44             array(false, 2, ']1,2['),
45             array(true, log(0), '[-Inf,2['),
46             array(true, -log(0), '[-2,+Inf]'),
47         );
48     }
49 }