]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php
twig implementation
[github/wallabag/wallabag.git] / vendor / symfony / intl / Symfony / Component / Intl / Tests / Collator / AbstractCollatorTest.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\Intl\Tests\Collator;
13
14 use Symfony\Component\Intl\Collator\Collator;
15 use Symfony\Component\Intl\Locale;
16
17 /**
18 * Test case for Collator implementations.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22 abstract class AbstractCollatorTest extends \PHPUnit_Framework_TestCase
23 {
24 /**
25 * @dataProvider asortProvider
26 */
27 public function testAsort($array, $sortFlag, $expected)
28 {
29 $collator = $this->getCollator('en');
30 $collator->asort($array, $sortFlag);
31 $this->assertSame($expected, $array);
32 }
33
34 public function asortProvider()
35 {
36 return array(
37 /* array, sortFlag, expected */
38 array(
39 array('a', 'b', 'c'),
40 Collator::SORT_REGULAR,
41 array('a', 'b', 'c'),
42 ),
43 array(
44 array('c', 'b', 'a'),
45 Collator::SORT_REGULAR,
46 array(2 => 'a', 1 => 'b', 0 => 'c'),
47 ),
48 array(
49 array('b', 'c', 'a'),
50 Collator::SORT_REGULAR,
51 array(2 => 'a', 0 => 'b', 1 => 'c'),
52 ),
53 );
54 }
55
56 /**
57 * @param string $locale
58 *
59 * @return \Collator
60 */
61 abstract protected function getCollator($locale);
62 }