1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 declare(strict_types=1); 18 19 namespace core_reportbuilder\external; 20 21 use advanced_testcase; 22 use core_reportbuilder_generator; 23 use core_reportbuilder\manager; 24 use core_user\reportbuilder\datasource\users; 25 26 /** 27 * Unit tests for custom report card view exporter 28 * 29 * @package core_reportbuilder 30 * @covers \core_reportbuilder\external\custom_report_card_view_exporter 31 * @copyright 2022 Paul Holden <paulh@moodle.com> 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class custom_report_card_view_exporter_test extends advanced_testcase { 35 36 /** 37 * Test exported data structure 38 */ 39 public function test_export(): void { 40 global $PAGE; 41 42 $this->resetAfterTest(); 43 44 /** @var core_reportbuilder_generator $generator */ 45 $generator = $this->getDataGenerator()->get_plugin_generator('core_reportbuilder'); 46 47 $report = $generator->create_report(['name' => 'My report', 'source' => users::class]); 48 49 $reportinstance = manager::get_report_from_persistent($report); 50 51 $exporter = new custom_report_card_view_exporter(null, ['report' => $reportinstance]); 52 $export = $exporter->export($PAGE->get_renderer('core_reportbuilder')); 53 54 // The exporter just returns two large pieces of HTML, assert they are non empty. 55 $this->assertNotEmpty($export->form); 56 $this->assertNotEmpty($export->helpicon); 57 } 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body