<?php setlocale(int $category, string $locales, string ...$rest): string|false
<?php #[DataProvider('collectionClassProvider')] public function testSortByMany($collection) { $defaultLocale = setlocale(LC_ALL, 0); $data = new $collection([['item' => '1'], ['item' => '10'], ['item' => 5], ['item' => 20]]); $expected = $data->pluck('item')->toArray();
<?php $data = $data->sortBy(['item'], SORT_LOCALE_STRING); $this->assertEquals($data->pluck('item')->toArray(), $expected); setlocale(LC_ALL, 'de_DE'); sort($expected, SORT_LOCALE_STRING); $data = $data->sortBy(['item'], SORT_LOCALE_STRING);
<?php $data = $data->sortBy(['item'], SORT_LOCALE_STRING); $this->assertEquals($data->pluck('item')->toArray(), $expected); setlocale(LC_ALL, $defaultLocale); } #[DataProvider('collectionClassProvider')]