PhpBench\Tabular\Tests\Unit\SortTest::testSort PHP Метод

testSort() публичный Метод

It should sort and preserve order for unchanging comparisons.
public testSort ( )
    public function testSort()
    {
        $array = [['col1' => 20, 'col2' => 20], ['col1' => 20, 'col2' => 10], ['col1' => 10, 'col2' => 50], ['col1' => 10, 'col2' => 10], ['col1' => 10, 'col2' => 20]];
        $expected = [['col1' => 10, 'col2' => 50], ['col1' => 10, 'col2' => 10], ['col1' => 10, 'col2' => 20], ['col1' => 20, 'col2' => 20], ['col1' => 20, 'col2' => 10]];
        Sort::mergesort($array, function ($row1, $row2) {
            return strcmp($row1['col1'], $row2['col1']);
        });
        $this->assertEquals($expected, $array);
    }
SortTest