Fix #20505: ArrayDataProvider key handling with flexible path support

This commit is contained in:
AIZAWA Hina
2025-08-30 20:02:12 +09:00
committed by GitHub
parent c4e920f054
commit 9b417e5f6d
3 changed files with 24 additions and 12 deletions

View File

@ -183,6 +183,25 @@ class ArrayDataProviderTest extends TestCase
];
$dataProvider = new ArrayDataProvider(['allModels' => $mixedArray, 'pagination' => $pagination]);
$this->assertEquals(['key1', 9], $dataProvider->getKeys());
$nestedArray = [
['foo' => ['bar' => 'key1']],
['foo' => ['bar' => 'key2']],
['foo' => ['bar' => 'key3']],
];
$dataProvider = new ArrayDataProvider([
'allModels' => $nestedArray,
'key' => ['foo', 'bar'],
'pagination' => $pagination,
]);
$this->assertEquals(['key1', 'key2'], $dataProvider->getKeys());
$dataProvider = new ArrayDataProvider([
'allModels' => $nestedArray,
'key' => 'foo.bar',
'pagination' => $pagination,
]);
$this->assertEquals(['key1', 'key2'], $dataProvider->getKeys());
}
public function testSortFlags()