MDL-86073 reportbuilder: fix external assertions of button property.

The tests from c439e2d3 tried to assert they were empty, when in fact
they didn't exist at all. Caused PHPUnit warnings.
This commit is contained in:
Paul Holden
2025-07-18 18:49:16 +01:00
parent ef6df9e70e
commit 130f7c48c9
2 changed files with 8 additions and 4 deletions
@@ -68,12 +68,14 @@ final class custom_report_exporter_test extends advanced_testcase {
$this->assertEmpty($export->attributes);
// The following are all generated by additional exporters.
$this->assertEmpty($export->button);
$this->assertNotEmpty($export->sidebarmenucards);
$this->assertNotEmpty($export->conditions);
$this->assertNotEmpty($export->filters);
$this->assertNotEmpty($export->sorting);
$this->assertNotEmpty($export->cardview);
// The following should not be present when editing.
$this->assertObjectNotHasProperty('button', $export);
}
/**
@@ -112,7 +114,7 @@ final class custom_report_exporter_test extends advanced_testcase {
// The following are all generated by additional exporters.
$this->assertNotEmpty($export->button);
// The following should not be present when not editing.
// The following should not be present when viewing.
$this->assertObjectNotHasProperty('sidebarmenucards', $export);
$this->assertObjectNotHasProperty('conditions', $export);
$this->assertObjectNotHasProperty('filters', $export);
+4 -2
View File
@@ -70,7 +70,6 @@ final class get_test extends externallib_advanced_testcase {
$this->assertEquals($result['source'], users::class);
$this->assertNotEmpty($result['table']);
$this->assertNotEmpty($result['javascript']);
$this->assertEmpty($result['button']);
$this->assertEquals('Hello', $result['infocontainer']);
$this->assertFalse($result['filterspresent']);
$this->assertEmpty($result['filtersform']);
@@ -87,6 +86,9 @@ final class get_test extends externallib_advanced_testcase {
$this->assertEquals($filteremail->get('id'), $result['filters']['activefilters'][1]['id']);
$this->assertNotEmpty($result['sorting']);
$this->assertNotEmpty($result['cardview']);
// The following should not be present when editing.
$this->assertArrayNotHasKey('button', $result);
}
/**
@@ -135,7 +137,7 @@ final class get_test extends externallib_advanced_testcase {
$this->assertNotEmpty($result['filtersform']);
$this->assertFalse($result['editmode']);
// Confirm editor-specific data is not returned.
// The following should not be present when viewing.
$this->assertArrayNotHasKey('sidebarmenucards', $result);
$this->assertArrayNotHasKey('conditions', $result);
$this->assertArrayNotHasKey('filters', $result);