MDL-21361 removed invalid unit tests for features that were removed or significantly redesigned
This commit is contained in:
@@ -30,50 +30,5 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
require_once($CFG->libdir . '/deprecatedlib.php');
|
||||
|
||||
class outputlib_methods_test extends UnitTestCase {
|
||||
public function test_print_single_button() {
|
||||
global $PAGE, $CFG;
|
||||
|
||||
// Basic params, absolute URL
|
||||
$link = 'http://www.test.com/index.php';
|
||||
$options = array('param1' => 'value1');
|
||||
$label = 'OK';
|
||||
$method = 'get';
|
||||
$return = true;
|
||||
$tooltip = '';
|
||||
$disabled = false;
|
||||
$jsconfirmmessage = '';
|
||||
$formid = '';
|
||||
|
||||
$html = print_single_button($link, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
|
||||
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
|
||||
|
||||
// URL with & params
|
||||
$newlink = $link . '?param1=value1&param2=value2';
|
||||
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
|
||||
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
|
||||
|
||||
// URL with & params
|
||||
$newlink = $link . '?param1=value1¶m2=value2';
|
||||
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
|
||||
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
|
||||
|
||||
// relative URL with & params
|
||||
$newlink = 'index.php?param1=value1¶m2=value2';
|
||||
|
||||
$oldurl = $PAGE->url;
|
||||
|
||||
$PAGE->set_url('/index.php');
|
||||
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
|
||||
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $CFG->wwwroot . '/index.php')), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
|
||||
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
|
||||
|
||||
$PAGE->set_url($oldurl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user