"Fossies" - the Fresh Open Source Software Archive

Member "Symfony/vendor/symfony/symfony/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php" (30 Mar 2020, 1478 Bytes) of package /linux/www/Symfony_Standard_Vendors_3.4.39.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 PHPUnit\Framework\TestCase;
   15 use Symfony\Component\Intl\Collator\Collator;
   16 
   17 /**
   18  * Test case for Collator implementations.
   19  *
   20  * @author Bernhard Schussek <bschussek@gmail.com>
   21  */
   22 abstract class AbstractCollatorTest extends 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 [
   37             /* array, sortFlag, expected */
   38             [
   39                 ['a', 'b', 'c'],
   40                 Collator::SORT_REGULAR,
   41                 ['a', 'b', 'c'],
   42             ],
   43             [
   44                 ['c', 'b', 'a'],
   45                 Collator::SORT_REGULAR,
   46                 [2 => 'a', 1 => 'b',  0 => 'c'],
   47             ],
   48             [
   49                 ['b', 'c', 'a'],
   50                 Collator::SORT_REGULAR,
   51                 [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 }