From f69bdd006d3ae22bd889f3b1e42afc78fa8fd860 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 30 Sep 2009 16:34:41 +0000 Subject: [PATCH] unittests: NOBUG further pagelib unit test fixes --- lib/simpletest/testpagelib_moodlepage.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/simpletest/testpagelib_moodlepage.php b/lib/simpletest/testpagelib_moodlepage.php index affa5ff6c5..de156291dd 100644 --- a/lib/simpletest/testpagelib_moodlepage.php +++ b/lib/simpletest/testpagelib_moodlepage.php @@ -104,7 +104,7 @@ class moodle_page_test extends UnitTestCase { public function test_setting_course_works() { // Setup fixture $course = $this->create_a_course(); - $this->testpage->set_context(new stdClass); // Avoid trying to set the context. + $this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM)); // Avoid trying to set the context. // Exercise SUT $this->testpage->set_course($course); // Validate @@ -115,7 +115,7 @@ class moodle_page_test extends UnitTestCase { global $COURSE, $PAGE; // Setup fixture $course = $this->create_a_course(); - $this->testpage->set_context(new stdClass); // Avoid trying to set the context. + $this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM)); // Avoid trying to set the context. $PAGE = $this->testpage; // Exercise SUT $this->testpage->set_course($course); @@ -128,7 +128,7 @@ class moodle_page_test extends UnitTestCase { $originalcourse = $COURSE; // Setup fixture $course = $this->create_a_course(); - $this->testpage->set_context(new stdClass); // Avoid trying to set the context. + $this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM)); // Avoid trying to set the context. // Exercise SUT $this->testpage->set_course($course); // Validate @@ -157,7 +157,7 @@ class moodle_page_test extends UnitTestCase { public function test_cannot_set_category_once_course_set() { // Setup fixture $course = $this->create_a_course(); - $this->testpage->set_context(new stdClass); // Avoid trying to set the context. + $this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM)); // Avoid trying to set the context. $this->testpage->set_course($course); // Set expectation. $this->expectException(); @@ -169,7 +169,7 @@ class moodle_page_test extends UnitTestCase { // Setup fixture $course = $this->create_a_course(); $course->category = 0; - $this->testpage->set_context(new stdClass); // Avoid trying to set the context. + $this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM)); // Avoid trying to set the context. $this->testpage->set_course($course); // Exercise SUT and validate. $this->assertEqual(array(), $this->testpage->categories); -- 2.39.5