Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDL-38719 forms: add some missing types.
This just adds some missing types to different places
causing phpunit tests to fail.
  • Loading branch information
stronk7 committed Mar 26, 2013
1 parent 3a7e4a8 commit f35f07e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cache/forms.php
Expand Up @@ -49,7 +49,9 @@ protected final function definition() {
$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'));
Expand All @@ -59,6 +61,7 @@ protected final function definition() {
} 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)) {
Expand Down Expand Up @@ -214,4 +217,4 @@ protected function definition() {

$this->add_action_buttons();
}
}
}
9 changes: 7 additions & 2 deletions lib/tests/formslib_test.php
Expand Up @@ -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');

Expand All @@ -217,4 +222,4 @@ public function definition() {
);
$this->repeat_elements($repeatels, 3, array(), 'numradios', 'addradios');
}
}
}

0 comments on commit f35f07e

Please sign in to comment.