Skip to content

Commit

Permalink
Fixed test to be consitant across php versions (RFC: stable_sorting)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Jan 15, 2022
1 parent 110afdf commit bf6c16e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/Config/ConfigFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,21 +544,23 @@ public function testSortUsort()

$config->set([
'a' => 'a',
'c' => 'c',
'b' => 'b'
]);

$config->sort(function ($a, $b) {
return $a->key->value === 'b' || $b->key->value === 'b' ? 0 : 1;
static $i;
if (!isset($i)) {
$i = 1;
}
return $i--;
});

$expected = <<<PHP
<?php
return [
'c' => 'c',
'a' => 'a',
'b' => 'b',
'a' => 'a',
];
PHP;
Expand Down

0 comments on commit bf6c16e

Please sign in to comment.