mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MNT Re-implement static test data for main eagerloading test
This commit is contained in:
parent
3bf845a9e6
commit
ed4c34b9d9
@ -108,8 +108,7 @@ class DataListEagerLoadingTest extends SapphireTest
|
||||
|
||||
$dataList = EagerLoadObject::get()->eagerLoad(...$eagerLoad);
|
||||
list($results, $selectCount) = $this->iterateEagerLoadData($dataList);
|
||||
// We can rely on the non-eager-loaded data being correct, since it's validated by other unit tests
|
||||
list($expectedResults, $_) = $this->iterateEagerLoadData(EagerLoadObject::get());
|
||||
$expectedResults = $this->expectedEagerLoadRelations();
|
||||
// Sort because the order of the results doesn't really matter - and has proven to be different in postgres
|
||||
sort($expectedResults);
|
||||
sort($results);
|
||||
@ -305,6 +304,158 @@ class DataListEagerLoadingTest extends SapphireTest
|
||||
];
|
||||
}
|
||||
|
||||
private function expectedEagerLoadRelations(): array
|
||||
{
|
||||
return [
|
||||
'obj 0',
|
||||
'hasOneObj 0',
|
||||
'hasOneSubObj 0',
|
||||
'hasOneSubSubObj 0',
|
||||
'belongsToObj 0',
|
||||
'belongsToSubObj 0',
|
||||
'belongsToSubSubObj 0',
|
||||
'hasManyObj 0 0',
|
||||
'hasManySubObj 0 0 0',
|
||||
'hasManySubSubObj 0 0 0 0',
|
||||
'hasManySubSubObj 0 0 0 1',
|
||||
'hasManySubObj 0 0 1',
|
||||
'hasManySubSubObj 0 0 1 0',
|
||||
'hasManySubSubObj 0 0 1 1',
|
||||
'hasManyObj 0 1',
|
||||
'hasManySubObj 0 1 0',
|
||||
'hasManySubSubObj 0 1 0 0',
|
||||
'hasManySubSubObj 0 1 0 1',
|
||||
'hasManySubObj 0 1 1',
|
||||
'hasManySubSubObj 0 1 1 0',
|
||||
'hasManySubSubObj 0 1 1 1',
|
||||
'manyManyObj 0 0',
|
||||
'manyManySubObj 0 0 0',
|
||||
'manyManySubSubObj 0 0 0 0',
|
||||
'manyManySubSubObj 0 0 0 1',
|
||||
'manyManySubObj 0 0 1',
|
||||
'manyManySubSubObj 0 0 1 0',
|
||||
'manyManySubSubObj 0 0 1 1',
|
||||
'manyManyObj 0 1',
|
||||
'manyManySubObj 0 1 0',
|
||||
'manyManySubSubObj 0 1 0 0',
|
||||
'manyManySubSubObj 0 1 0 1',
|
||||
'manyManySubObj 0 1 1',
|
||||
'manyManySubSubObj 0 1 1 0',
|
||||
'manyManySubSubObj 0 1 1 1',
|
||||
'manyManyThroughObj 0 0',
|
||||
'manyManyThroughSubObj 0 0 0',
|
||||
'manyManyThroughSubSubObj 0 0 0 0',
|
||||
'manyManyThroughSubSubObj 0 0 0 1',
|
||||
'manyManyThroughSubObj 0 0 1',
|
||||
'manyManyThroughSubSubObj 0 0 1 0',
|
||||
'manyManyThroughSubSubObj 0 0 1 1',
|
||||
'manyManyThroughObj 0 1',
|
||||
'manyManyThroughSubObj 0 1 0',
|
||||
'manyManyThroughSubSubObj 0 1 0 0',
|
||||
'manyManyThroughSubSubObj 0 1 0 1',
|
||||
'manyManyThroughSubObj 0 1 1',
|
||||
'manyManyThroughSubSubObj 0 1 1 0',
|
||||
'manyManyThroughSubSubObj 0 1 1 1',
|
||||
'belongsManyManyObj 0 0',
|
||||
'belongsManyManySubObj 0 0 0',
|
||||
'belongsManyManySubSubObj 0 0 0 0',
|
||||
'belongsManyManySubSubObj 0 0 0 1',
|
||||
'belongsManyManySubObj 0 0 1',
|
||||
'belongsManyManySubSubObj 0 0 1 0',
|
||||
'belongsManyManySubSubObj 0 0 1 1',
|
||||
'belongsManyManyObj 0 1',
|
||||
'belongsManyManySubObj 0 1 0',
|
||||
'belongsManyManySubSubObj 0 1 0 0',
|
||||
'belongsManyManySubSubObj 0 1 0 1',
|
||||
'belongsManyManySubObj 0 1 1',
|
||||
'belongsManyManySubSubObj 0 1 1 0',
|
||||
'belongsManyManySubSubObj 0 1 1 1',
|
||||
'mixedManyManyObj 0 0',
|
||||
'mixedHasManyObj 0 0 0',
|
||||
'mixedHasOneObj 0 0 0 1',
|
||||
'mixedHasManyObj 0 0 1',
|
||||
'mixedHasOneObj 0 0 1 1',
|
||||
'mixedManyManyObj 0 1',
|
||||
'mixedHasManyObj 0 1 0',
|
||||
'mixedHasOneObj 0 1 0 1',
|
||||
'mixedHasManyObj 0 1 1',
|
||||
'mixedHasOneObj 0 1 1 1',
|
||||
'obj 1',
|
||||
'hasOneObj 1',
|
||||
'hasOneSubObj 1',
|
||||
'hasOneSubSubObj 1',
|
||||
'belongsToObj 1',
|
||||
'belongsToSubObj 1',
|
||||
'belongsToSubSubObj 1',
|
||||
'hasManyObj 1 0',
|
||||
'hasManySubObj 1 0 0',
|
||||
'hasManySubSubObj 1 0 0 0',
|
||||
'hasManySubSubObj 1 0 0 1',
|
||||
'hasManySubObj 1 0 1',
|
||||
'hasManySubSubObj 1 0 1 0',
|
||||
'hasManySubSubObj 1 0 1 1',
|
||||
'hasManyObj 1 1',
|
||||
'hasManySubObj 1 1 0',
|
||||
'hasManySubSubObj 1 1 0 0',
|
||||
'hasManySubSubObj 1 1 0 1',
|
||||
'hasManySubObj 1 1 1',
|
||||
'hasManySubSubObj 1 1 1 0',
|
||||
'hasManySubSubObj 1 1 1 1',
|
||||
'manyManyObj 1 0',
|
||||
'manyManySubObj 1 0 0',
|
||||
'manyManySubSubObj 1 0 0 0',
|
||||
'manyManySubSubObj 1 0 0 1',
|
||||
'manyManySubObj 1 0 1',
|
||||
'manyManySubSubObj 1 0 1 0',
|
||||
'manyManySubSubObj 1 0 1 1',
|
||||
'manyManyObj 1 1',
|
||||
'manyManySubObj 1 1 0',
|
||||
'manyManySubSubObj 1 1 0 0',
|
||||
'manyManySubSubObj 1 1 0 1',
|
||||
'manyManySubObj 1 1 1',
|
||||
'manyManySubSubObj 1 1 1 0',
|
||||
'manyManySubSubObj 1 1 1 1',
|
||||
'manyManyThroughObj 1 0',
|
||||
'manyManyThroughSubObj 1 0 0',
|
||||
'manyManyThroughSubSubObj 1 0 0 0',
|
||||
'manyManyThroughSubSubObj 1 0 0 1',
|
||||
'manyManyThroughSubObj 1 0 1',
|
||||
'manyManyThroughSubSubObj 1 0 1 0',
|
||||
'manyManyThroughSubSubObj 1 0 1 1',
|
||||
'manyManyThroughObj 1 1',
|
||||
'manyManyThroughSubObj 1 1 0',
|
||||
'manyManyThroughSubSubObj 1 1 0 0',
|
||||
'manyManyThroughSubSubObj 1 1 0 1',
|
||||
'manyManyThroughSubObj 1 1 1',
|
||||
'manyManyThroughSubSubObj 1 1 1 0',
|
||||
'manyManyThroughSubSubObj 1 1 1 1',
|
||||
'belongsManyManyObj 1 0',
|
||||
'belongsManyManySubObj 1 0 0',
|
||||
'belongsManyManySubSubObj 1 0 0 0',
|
||||
'belongsManyManySubSubObj 1 0 0 1',
|
||||
'belongsManyManySubObj 1 0 1',
|
||||
'belongsManyManySubSubObj 1 0 1 0',
|
||||
'belongsManyManySubSubObj 1 0 1 1',
|
||||
'belongsManyManyObj 1 1',
|
||||
'belongsManyManySubObj 1 1 0',
|
||||
'belongsManyManySubSubObj 1 1 0 0',
|
||||
'belongsManyManySubSubObj 1 1 0 1',
|
||||
'belongsManyManySubObj 1 1 1',
|
||||
'belongsManyManySubSubObj 1 1 1 0',
|
||||
'belongsManyManySubSubObj 1 1 1 1',
|
||||
'mixedManyManyObj 1 0',
|
||||
'mixedHasManyObj 1 0 0',
|
||||
'mixedHasOneObj 1 0 0 1',
|
||||
'mixedHasManyObj 1 0 1',
|
||||
'mixedHasOneObj 1 0 1 1',
|
||||
'mixedManyManyObj 1 1',
|
||||
'mixedHasManyObj 1 1 0',
|
||||
'mixedHasOneObj 1 1 0 1',
|
||||
'mixedHasManyObj 1 1 1',
|
||||
'mixedHasOneObj 1 1 1 1',
|
||||
];
|
||||
}
|
||||
|
||||
private function createEagerLoadData(
|
||||
int $numBaseRecords = 2,
|
||||
int $numLevel1Records = 2,
|
||||
|
Loading…
Reference in New Issue
Block a user