MDL-23979 fixed old style url init
authorPetr Skoda <skodak@moodle.org>
Sat, 28 Aug 2010 12:29:58 +0000 (12:29 +0000)
committerPetr Skoda <skodak@moodle.org>
Sat, 28 Aug 2010 12:29:58 +0000 (12:29 +0000)
lib/simpletest/testpagelib_moodlepage.php

index 6d37793..3e9f170 100644 (file)
@@ -292,7 +292,7 @@ class moodle_page_test extends UnitTestCase {
     public function test_set_url_root() {
         global $CFG;
         // Exercise SUT
-        $this->testpage->set_url('');
+        $this->testpage->set_url('/');
         // Validate
         $this->assertEqual($CFG->wwwroot . '/', $this->testpage->url->out());
     }
@@ -300,7 +300,7 @@ class moodle_page_test extends UnitTestCase {
     public function test_set_url_one_param() {
         global $CFG;
         // Exercise SUT
-        $this->testpage->set_url('mod/quiz/attempt.php', array('attempt' => 123));
+        $this->testpage->set_url('/mod/quiz/attempt.php', array('attempt' => 123));
         // Validate
         $this->assertEqual($CFG->wwwroot . '/mod/quiz/attempt.php?attempt=123', $this->testpage->url->out());
     }
@@ -308,7 +308,7 @@ class moodle_page_test extends UnitTestCase {
     public function test_set_url_two_params() {
         global $CFG;
         // Exercise SUT
-        $this->testpage->set_url('mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
+        $this->testpage->set_url('/mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
         // Validate
         $this->assertEqual($CFG->wwwroot . '/mod/quiz/attempt.php?attempt=123&amp;page=7', $this->testpage->url->out());
     }
@@ -323,19 +323,9 @@ class moodle_page_test extends UnitTestCase {
         $this->assertEqual($CFG->wwwroot . '/mod/workshop/allocation.php?cmid=29&amp;method=manual', $this->testpage->url->out());
     }
 
-    public function test_set_url_using_moodle_url_and_params() {
-        global $CFG;
-        // Fixture setup
-        $url = new moodle_url('/mod/workshop/allocation.php', array('cmid' => 29, 'method' => 'manual'));
-        // Set expectation
-        $this->expectException('coding_exception');
-        // Exercise SUT
-        $this->testpage->set_url($url, array('notallowed' => 666));
-    }
-
     public function test_set_url_sets_page_type() {
         // Exercise SUT
-        $this->testpage->set_url('mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
+        $this->testpage->set_url('/mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
         // Validate
         $this->assertEqual('mod-quiz-attempt', $this->testpage->pagetype);
     }
@@ -344,7 +334,7 @@ class moodle_page_test extends UnitTestCase {
         // Setup fixture
         $this->testpage->set_pagetype('a-page-type');
         // Exercise SUT
-        $this->testpage->set_url('mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
+        $this->testpage->set_url('/mod/quiz/attempt.php', array('attempt' => 123, 'page' => 7));
         // Validate
         $this->assertEqual('a-page-type', $this->testpage->pagetype);
     }
@@ -372,7 +362,7 @@ class moodle_page_test extends UnitTestCase {
 
     public function test_default_pagelayout() {
         // Exercise SUT and Validate
-        $this->assertEqual('normal', $this->testpage->pagelayout);
+        $this->assertEqual('base', $this->testpage->pagelayout);
     }
 
     public function test_set_pagelayout() {