MDL-75759 courseformat: Fix stateactions test

* Require lib/externallib.php in
\core_courseformat\output\local\state\cm::export_for_template()
* Point @coversDefaultClass to the proper class.
This commit is contained in:
Jun Pataleta 2022-09-15 20:25:14 +08:00
parent 35f39c45b7
commit dbf67c06bb
2 changed files with 4 additions and 2 deletions

View file

@ -18,6 +18,7 @@ namespace core_courseformat\output\local\state;
use core_courseformat\base as course_format;
use completion_info;
use renderer_base;
use section_info;
use cm_info;
use renderable;
@ -70,8 +71,9 @@ class cm implements renderable {
* @param renderer_base $output typically, the renderer that's calling this function
* @return stdClass data context for a mustache template
*/
public function export_for_template(\renderer_base $output): stdClass {
public function export_for_template(renderer_base $output): stdClass {
global $USER, $CFG;
require_once($CFG->libdir . '/externallib.php');
$format = $this->format;
$section = $this->section;

View file

@ -26,7 +26,7 @@ use stdClass;
* @category test
* @copyright 2021 Sara Arjona (sara@moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \core_course\stateactions
* @coversDefaultClass \core_courseformat\stateactions
*/
class stateactions_test extends \advanced_testcase {