mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-68473-master' of git://github.com/vmdef/moodle
This commit is contained in:
commit
53c06b63c5
1 changed files with 32 additions and 26 deletions
|
@ -22,11 +22,13 @@
|
||||||
* @copyright 2020 Victor Deniz <victor@moodle.com>
|
* @copyright 2020 Victor Deniz <victor@moodle.com>
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace core_h5p;
|
namespace core_h5p;
|
||||||
|
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
use advanced_testcase;
|
use advanced_testcase;
|
||||||
use core_h5p\local\library\autoloader;
|
use core_h5p\local\library\autoloader;
|
||||||
use moodleform;
|
|
||||||
use MoodleQuickForm;
|
use MoodleQuickForm;
|
||||||
use page_requirements_manager;
|
use page_requirements_manager;
|
||||||
|
|
||||||
|
@ -42,6 +44,34 @@ use page_requirements_manager;
|
||||||
*/
|
*/
|
||||||
class editor_testcase extends advanced_testcase {
|
class editor_testcase extends advanced_testcase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form object to be used in test case.
|
||||||
|
*/
|
||||||
|
protected function get_test_form() {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
require_once($CFG->libdir . '/formslib.php');
|
||||||
|
|
||||||
|
return new class extends \moodleform {
|
||||||
|
/**
|
||||||
|
* Form definition.
|
||||||
|
*/
|
||||||
|
public function definition(): void {
|
||||||
|
// No definition required.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns form reference.
|
||||||
|
*
|
||||||
|
* @return MoodleQuickForm
|
||||||
|
*/
|
||||||
|
public function getform() {
|
||||||
|
$mform = $this->_form;
|
||||||
|
return $mform;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that existing content is properly set.
|
* Test that existing content is properly set.
|
||||||
*/
|
*/
|
||||||
|
@ -153,7 +183,7 @@ class editor_testcase extends advanced_testcase {
|
||||||
global $PAGE, $CFG;
|
global $PAGE, $CFG;
|
||||||
|
|
||||||
// Get form data.
|
// Get form data.
|
||||||
$form = new temp_form();
|
$form = $this->get_test_form();
|
||||||
$mform = $form->getform();
|
$mform = $form->getform();
|
||||||
|
|
||||||
// Call method.
|
// Call method.
|
||||||
|
@ -249,27 +279,3 @@ class editor_testcase extends advanced_testcase {
|
||||||
$this->assertNotEmpty($out);
|
$this->assertNotEmpty($out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Form object to be used in test case.
|
|
||||||
*/
|
|
||||||
class temp_form extends moodleform {
|
|
||||||
/**
|
|
||||||
* Form definition.
|
|
||||||
*/
|
|
||||||
public function definition(): void {
|
|
||||||
// No definition required.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns form reference.
|
|
||||||
*
|
|
||||||
* @return MoodleQuickForm
|
|
||||||
*/
|
|
||||||
public function getform() {
|
|
||||||
$mform = $this->_form;
|
|
||||||
// Set submitted flag, to simulate submission.
|
|
||||||
$mform->_flagSubmitted = true;
|
|
||||||
return $mform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue