]> git.mjollnir.org Git - moodle.git/commitdiff
unittests: NOBUG fix outputlib unit tests
authortjhunt <tjhunt>
Wed, 30 Sep 2009 16:55:35 +0000 (16:55 +0000)
committertjhunt <tjhunt>
Wed, 30 Sep 2009 16:55:35 +0000 (16:55 +0000)
lib/outputrenderers.php
lib/simpletest/testoutputlib.php

index 20e1a21f4622d1cc4071cc99b6bde07ddb517713..8a6724ee6829401336836f964ca73dc403bbe1b4 100644 (file)
@@ -1356,7 +1356,7 @@ class moodle_core_renderer extends moodle_renderer_base {
             $link->text = $this->image($image);
 
             if (!empty($link->linktext)) {
-                $link->text = "$link->title &nbsp; $link->text";
+                $link->text = "$link->title &#160; $link->text";
             }
         }
 
@@ -2005,27 +2005,27 @@ class moodle_core_renderer extends moodle_renderer_base {
             $output .= get_string('page') . ':';
 
             if (!empty($pagingbar->previouslink)) {
-                $output .= '&nbsp;(' . $this->link($pagingbar->previouslink) . ')&nbsp;';
+                $output .= '&#160;(' . $this->link($pagingbar->previouslink) . ')&#160;';
             }
 
             if (!empty($pagingbar->firstlink)) {
-                $output .= '&nbsp;' . $this->link($pagingbar->firstlink) . '&nbsp;...';
+                $output .= '&#160;' . $this->link($pagingbar->firstlink) . '&#160;...';
             }
 
             foreach ($pagingbar->pagelinks as $link) {
                 if ($link instanceof html_link) {
-                    $output .= '&nbsp;&nbsp;' . $this->link($link);
+                    $output .= '&#160;&#160;' . $this->link($link);
                 } else {
-                    $output .= "&nbsp;&nbsp;$link";
+                    $output .= "&#160;&#160;$link";
                 }
             }
 
             if (!empty($pagingbar->lastlink)) {
-                $output .= '&nbsp;...' . $this->link($pagingbar->lastlink) . '&nbsp;';
+                $output .= '&#160;...' . $this->link($pagingbar->lastlink) . '&#160;';
             }
 
             if (!empty($pagingbar->nextlink)) {
-                $output .= '&nbsp;&nbsp;(' . $this->link($pagingbar->nextlink) . ')';
+                $output .= '&#160;&#160;(' . $this->link($pagingbar->nextlink) . ')';
             }
         }
 
index dd0ae0feec826e0e591bb9c1f0d4294291f62047..cf198ed386ea6ca5cc918758b8e9bc943b031ad1 100644 (file)
@@ -1065,16 +1065,18 @@ class moodle_core_renderer_test extends UnitTestCase {
         $this->assert(new ContainsTagWithAttributes('form', array('method' => 'post', 'action' => 'http://www.test.com/index.php')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'continue', 'value' => 1)), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('yes'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'singlebutton')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('no'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('cancel'), 'class' => 'singlebutton')), $html);
 
         // Use html_forms with default values, should produce exactly the same output as above
         $formcontinue = new html_form();
         $formcancel = new html_form();
         $formcontinue->url = new moodle_url($continueurl);
         $formcancel->url = new moodle_url($cancelurl);
+        $formcontinue->button->text = get_string('continue');
+        $formcancel->button->text = get_string('cancel');
         $html = $this->renderer->confirm($message, $formcontinue, $formcancel);
         $this->assert(new ContainsTagWithAttributes('div', array('id' => 'notice', 'class' => 'box generalbox')), $html);
         $this->assert(new ContainsTagWithContents('p', $message), $html);
@@ -1083,10 +1085,10 @@ class moodle_core_renderer_test extends UnitTestCase {
         $this->assert(new ContainsTagWithAttributes('form', array('method' => 'post', 'action' => 'http://www.test.com/index.php')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'continue', 'value' => 1)), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('yes'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'singlebutton')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('no'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('cancel'), 'class' => 'singlebutton')), $html);
 
         // Give the buttons some different labels
         $formcontinue = new html_form();
@@ -1107,6 +1109,8 @@ class moodle_core_renderer_test extends UnitTestCase {
         // Change the method and add extra variables
         $formcontinue = new html_form();
         $formcancel = new html_form();
+        $formcontinue->button->text = get_string('continue');
+        $formcancel->button->text = get_string('cancel');
         $formcontinue->url = new moodle_url($continueurl, array('var1' => 'val1', 'var2' => 'val2'));
         $formcancel->url = new moodle_url($cancelurl, array('var3' => 'val3', 'var4' => 'val4'));
         $html = $this->renderer->confirm($message, $formcontinue, $formcancel);
@@ -1115,10 +1119,10 @@ class moodle_core_renderer_test extends UnitTestCase {
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'var1', 'value' => 'val1')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'var2', 'value' => 'val2')), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('yes'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'singlebutton')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'cancel', 'value' => 1)), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())), $html);
-        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('no'), 'class' => 'singlebutton')), $html);
+        $this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => get_string('cancel'), 'class' => 'singlebutton')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'var3', 'value' => 'val3')), $html);
         $this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'var4', 'value' => 'val4')), $html);
 
@@ -1149,7 +1153,7 @@ class moodle_core_renderer_test extends UnitTestCase {
     }
 
     public function test_paging_bar() {
-        global $CFG, $OUTPUT;
+        global $CFG;
 
         $totalcount = 5;
         $perpage = 4;
@@ -1166,7 +1170,7 @@ class moodle_core_renderer_test extends UnitTestCase {
 
         $originalbar = clone($pagingbar);
 
-        $html = $OUTPUT->paging_bar($pagingbar);
+        $html = $this->renderer->paging_bar($pagingbar);
 
         $this->assert(new ContainsTagWithAttribute('div', 'class', 'paging'), $html);
         // the 'Previous' link