-
Bug
-
Resolution: Fixed
-
Minor
-
4.2
-
MOODLE_402_STABLE
-
MOODLE_402_STABLE
-
MDL-78049-master -
This issue has been requested by dobedobedoh after I posted a question about that problem in the developer matrix channel.
With 4.2 the external api has been moved to new classes.
In externallib.php aliases have been created to allow plugin maintainers to keep backwards compatibility and not forcing plugin developers to create a MOODLE_402_STABLE only branch.
For the aliases to work one has to include require_once($CFG->libdir . '/externallib.php'); in the webservice class plugintype/myplugin/classes/external/get_some_info.php.
However, that makes unit tests fail for this plugin. Important: It's about core unit tests which are failing, not unit tests in this plugin. This issue also appears, if the plugin itself does not provide any external api related unit tests.
1) core_external\external_api_test::test_all_external_info with data set "plugintype_myplugin_get_some_info" (stdClass Object (...))
|
coding_exception: Coding error detected, it must be fixed by a programmer: When including this file for a unit test, the test must be run in an isolated process. See the PHPUnit @runInSeparateProcess and @runTestsInSeparateProcesses annotations.
|
|
/var/www/html/lib/setuplib.php:2204
|
/var/www/html/lib/externallib.php:35
|
/var/www/html/plugintype/myplpugin/classes/external/get_some_info.php:30 // this is the require_once line
|
/var/www/html/lib/classes/component.php:144
|
/var/www/html/lib/external/classes/external_api.php:61
|
/var/www/html/lib/external/tests/external_api_test.php:305
|
/var/www/html/lib/phpunit/classes/advanced_testcase.php:94
|
A workaround for sure would be to make a separate branch and not rely on the aliases, so it's ok to remove the require statement for externallib. But this means that a plugin maintainer will be forced to use a separate branch for moodle 4.2 and above.
- is a regression caused by
-
MDL-76583 Move lib/externallib.php to namespaced classes and fix coding style, etc.
- Closed