-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
2.0.3
-
MOODLE_20_STABLE
-
I was trying to write some simpletests to verify the correctness of our Moodbile Web Services when I realised that it was impossible.
External_api::validate_context method calls require_login function, which modifies $PAGE when "Unit Testing" page printing has already started. So I get this error:
Exception: local/moodbileserver/mod/forum/simpletest/testforumexternal.php / ▶ forumexternal_test / ▶ test_get_forum_by_id
|
Unexpected exception of type [coding_exception] with message [Coding error detected, it must be fixed by a programmer: The theme has already been set up for this page ready for output. Therefore, you can no longer change the theme, or anything that might affect what the current theme is, for example, the course.] in [/Users/jpiguillem/DFWikiLABS/projectes/Moodbile20/lib/pagelib.php line 1508]
|
|
Debug info:
|
|
Stack trace when the theme was set up:
|
|
line 1244 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output()
|
line ? of unknownfile: call to bootstrap_renderer->__call()
|
line 5664 of /lib/adminlib.php: call to bootstrap_renderer->single_button()
|
line 30 of /admin/report/unittest/index.php: call to admin_externalpage_setup()
|
|
line 727 of /lib/pagelib.php: call to moodle_page->ensure_theme_not_set()
|
line 799 of /lib/pagelib.php: call to moodle_page->set_course()
|
line 2347 of /lib/moodlelib.php: call to moodle_page->set_cm()
|
line 314 of /lib/externallib.php: call to require_login()
|
line 52 of /local/moodbileserver/mod/forum/externallib.php: call to external_api::validate_context()
|
line 74 of /local/moodbileserver/mod/forum/simpletest/testforumexternal.php: call to moodbileserver_forum_external::get_forum_by_id()
|
line ... of ...
|
|
Can it be considered a bug? An specific require_login function for Web Services might be implemented? I've seen that you haven't write any simpletest for externals, but you have written tests for SOAP, XML-RPC, etc.
- has a non-specific relationship to
-
MDL-35021 core_enrol_get_users_courses() throws a require_login_exception exception
-
- Closed
-
- has been marked as being related by
-
MDL-41746 external_api::validate_context() only works once (throws debugging)
-
- Closed
-
-
MDL-46101 Do not call require_login() from external_api::validate_context()
-
- Closed
-
- will be (partly) resolved by
-
MDL-35388 Cannot run PHP unit tests for the new assignment module web services
-
- Closed
-