MDL-76181 reportbuilder: sort columns during stress testing.

This commit is contained in:
Paul Holden 2022-11-02 20:40:14 +00:00
parent 12e9d9e1bf
commit 5162a7882d
3 changed files with 13 additions and 8 deletions

View file

@ -220,10 +220,10 @@ class report {
throw new invalid_parameter_exception('Invalid column');
}
return $column
->set('sortenabled', $enabled)
->set('sortdirection', $direction)
->update();
return $column->set_many([
'sortenabled' => $enabled,
'sortdirection' => $direction,
])->update();
}
/**

View file

@ -61,7 +61,8 @@ abstract class core_reportbuilder_testcase extends advanced_testcase {
}
/**
* Stress test a report source by iterating over all it's columns and asserting we can create a report for each
* Stress test a report source by iterating over all it's columns, enabling sorting where possible and asserting we can
* create a report for each
*
* @param string $source
*/
@ -74,10 +75,14 @@ abstract class core_reportbuilder_testcase extends advanced_testcase {
$instance = manager::get_report_from_persistent($report);
// Iterate over each available column, ensure each works correctly independent of any others.
$columnidentifiers = array_keys($instance->get_columns());
foreach ($columnidentifiers as $columnidentifier) {
foreach ($instance->get_columns() as $columnidentifier => $columninstance) {
$column = report::add_report_column($report->get('id'), $columnidentifier);
// Enable sorting of the column where possible.
if ($columninstance->get_is_sortable()) {
report::toggle_report_column_sorting($report->get('id'), $column->get('id'), true, SORT_DESC);
}
// We are only asserting the report returns content without errors, not the content itself.
try {
$content = $this->get_custom_report_content($report->get('id'));

View file

@ -10,7 +10,7 @@ Information provided here is intended especially for developers.
- `data-force-table` to force table view
* New optional parameter `pagesize` in external method `core_reportbuilder_reports_get` to set the displayed rows per page.
* Javascript reports repository module method `getReport` updated to accept new pagesize parameter.
* The `datasource_stress_test_columns` test helper now enables sorting on those columns that support it
=== 4.1 ===