Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-38719 forms: add some missing types.

This just adds some missing types to different places
causing phpunit tests to fail.
  • Loading branch information...
commit f35f07e9f74d343827f54c109b3c5ec62bbbe233 1 parent 3a7e4a8
@stronk7 stronk7 authored
Showing with 11 additions and 3 deletions.
  1. +4 −1 cache/forms.php
  2. +7 −2 lib/tests/formslib_test.php
View
5 cache/forms.php
@@ -49,7 +49,9 @@ class cachestore_addinstance_form extends moodleform {
$locks = $this->_customdata['locks'];
$form->addElement('hidden', 'plugin', $plugin);
+ $form->setType('plugin', PARAM_PLUGIN);
$form->addElement('hidden', 'editing', !empty($this->_customdata['store']));
+ $form->setType('editing', PARAM_BOOL);
if (!$store) {
$form->addElement('text', 'name', get_string('storename', 'cache'));
@@ -59,6 +61,7 @@ class cachestore_addinstance_form extends moodleform {
} else {
$form->addElement('hidden', 'name', $store);
$form->addElement('static', 'name-value', get_string('storename', 'cache'), $store);
+ $form->setType('name', PARAM_TEXT);
}
if (is_array($locks)) {
@@ -214,4 +217,4 @@ protected function definition() {
$this->add_action_buttons();
}
-}
View
9 lib/tests/formslib_test.php
@@ -204,7 +204,12 @@ public function definition() {
$repeatels = array(
$this->_form->createElement('text', 'text', 'Type something')
);
- $this->repeat_elements($repeatels, 2, array(), 'numtexts', 'addtexts');
+ // TODO: The repeat_elements() is far from perfect. Everything should be
+ // repeated auto-magically by default with options only defining exceptions.
+ // Surely this is caused because we are storing some element information OUT
+ // from the element (type...) at form level. Anyway, the method should do its
+ // work better, no matter of that.
+ $this->repeat_elements($repeatels, 2, array('text' => array('type' => PARAM_RAW)), 'numtexts', 'addtexts');
$this->_form->addElement('radio', 'radio', 'Label', 'Choice label', 'choice_value');
@@ -217,4 +222,4 @@ public function definition() {
);
$this->repeat_elements($repeatels, 3, array(), 'numradios', 'addradios');
}
-}
Please sign in to comment.
Something went wrong with that request. Please try again.