diff --git a/tests/editform_test.php b/tests/editform_test.php index b5f03f6b1e0..39b71a461e4 100644 --- a/tests/editform_test.php +++ b/tests/editform_test.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace qtype_stack; + defined('MOODLE_INTERNAL') || die(); global $CFG; @@ -29,22 +31,22 @@ * @group qtype_stack * @covers \qtype_stack_edit_form */ -class editform_test extends qtype_stack_edit_form { +class editform_test extends \qtype_stack_edit_form { public function __construct($questiontext, $specificfeedback) { global $USER; - $syscontext = context_system::instance(); + $syscontext = \context_system::instance(); $category = question_make_default_categories(array($syscontext)); - $fakequestion = new stdClass(); + $fakequestion = new \stdClass(); $fakequestion->qtype = 'stack'; $fakequestion->category = $category->id; $fakequestion->contextid = $syscontext->id; $fakequestion->createdby = $USER->id; $fakequestion->modifiedby = $USER->id; $fakequestion->questiontext = $questiontext; - $fakequestion->options = new stdClass(); + $fakequestion->options = new \stdClass(); $fakequestion->options->specificfeedback = $specificfeedback; - $fakequestion->formoptions = new stdClass(); + $fakequestion->formoptions = new \stdClass(); $fakequestion->formoptions->movecontext = null; $fakequestion->formoptions->repeatelements = true; $fakequestion->inputs = null; @@ -52,9 +54,9 @@ public function __construct($questiontext, $specificfeedback) { if (class_exists('\core_question\local\bank\question_edit_contexts')) { $contexts = new \core_question\local\bank\question_edit_contexts($syscontext); } else { - $contexts = new question_edit_contexts($syscontext); + $contexts = new \question_edit_contexts($syscontext); } - parent::__construct(new moodle_url('/'), $fakequestion, $category, $contexts); + parent::__construct(new \moodle_url('/'), $fakequestion, $category, $contexts); } } @@ -67,31 +69,31 @@ public function __construct($questiontext, $specificfeedback) { * @group qtype_stack * @covers \qtype_stack_edit_form */ -class qtype_stack_edit_form_test extends advanced_testcase { +class qtype_stack_edit_form_test extends \advanced_testcase { protected function get_form($questiontext, $specificfeedback) { $this->setAdminUser(); $this->resetAfterTest(); - return new qtype_stack_edit_form_testable($questiontext, $specificfeedback); + return new \qtype_stack_edit_form_testable($questiontext, $specificfeedback); } public function test_get_input_names_from_question_text_default() { - $form = $this->get_form(qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, - qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); - $qtype = new qtype_stack(); + $form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, + \qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); + $qtype = new \qtype_stack(); $this->assertEquals(array('ans1' => array(1, 1)), - $qtype->get_input_names_from_question_text(qtype_stack_edit_form::DEFAULT_QUESTION_TEXT)); + $qtype->get_input_names_from_question_text(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT)); } public function test_get_prt_names_from_question_default() { - $form = $this->get_form(qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, - qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); - $qtype = new qtype_stack(); + $form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, + \qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); + $qtype = new \qtype_stack(); $this->assertEquals(array('prt1' => 1), - $qtype->get_prt_names_from_question(qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, - qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK)); + $qtype->get_prt_names_from_question(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, + \qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK)); } }