1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- declare(strict_types=1);
- namespace PhpCsFixer\Tests\FixerConfiguration;
- use PhpCsFixer\FixerConfiguration\FixerOption;
- use PhpCsFixer\FixerConfiguration\FixerOptionSorter;
- use PhpCsFixer\Tests\TestCase;
- final class FixerOptionSorterTest extends TestCase
- {
- public function testSortAcceptsEmptyArray(): void
- {
- $unsorted = [];
- $sorter = new FixerOptionSorter();
- $expected = [];
- self::assertSame($expected, $sorter->sort($unsorted));
- }
- public function testSortSortsArrayOfOptionsByName(): void
- {
- $fooOption = new FixerOption('foo', 'Bar.');
- $bazOption = new FixerOption('baz', 'Qux.');
- $unsorted = [
- $fooOption,
- $bazOption,
- ];
- $sorter = new FixerOptionSorter();
- $expected = [
- $bazOption,
- $fooOption,
- ];
- self::assertSame($expected, $sorter->sort($unsorted));
- }
- public function testSortAcceptsEmptyIterable(): void
- {
- $unsorted = new \ArrayIterator();
- $sorter = new FixerOptionSorter();
- $expected = [];
- self::assertSame($expected, $sorter->sort($unsorted));
- }
- public function testSortSortsIterableOfOptionsByName(): void
- {
- $fooOption = new FixerOption('foo', 'Bar.');
- $bazOption = new FixerOption('baz', 'Qux.');
- $unsorted = new \ArrayIterator([
- $fooOption,
- $bazOption,
- ]);
- $sorter = new FixerOptionSorter();
- $expected = [
- $bazOption,
- $fooOption,
- ];
- self::assertSame($expected, $sorter->sort($unsorted));
- }
- }
|