MDL-76181 reportbuilder: sort columns during stress testing.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
This file describes API changes in /reportbuilder/*
|
||||
Information provided here is intended especially for developers.
|
||||
|
||||
=== 4.1.1 ===
|
||||
|
||||
* The `datasource_stress_test_columns` test helper now enables sorting on those columns that support it
|
||||
|
||||
=== 4.1 ===
|
||||
|
||||
* New method `add_action_divider()` in base system report class, to allow adding a divider to the action menu.
|
||||
* New external method `core_reportbuilder_set_filters` for setting report filter values (plus `setFilters` AJAX repository
|
||||
export for calling from Javascript modules)
|
||||
|
||||
Reference in New Issue
Block a user