You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/subsystems/external/testing.md
+14-16Lines changed: 14 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,18 @@ Writing unit tests for an external service function is no different to writing u
20
20
21
21
## How to write an external function PHPUnit test
22
22
23
-
You should create one unit test testcase for each external service file, and it should be named after the file that it tests.
23
+
You should create one unit test testcase for each external service class, and it should be named after the class that it tests.
24
24
25
25
For example, if you have written a service function in `[componentfolder]/classes/external/get_fruit.php`, you should write a unit test in `[componentfolder]/tests/external/get_fruit_test.php`.
26
26
27
+
:::note External Services Testcase
28
+
29
+
An external testcase has been created to make testing external services easier.
30
+
31
+
When creating your tests, you can extend the `\core_external\tests\externallib_testcase` class instead of `\advanced_testcase`.
Copy file name to clipboardExpand all lines: docs/devupdate.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,11 @@ The `maxsections` setting in course formats is now deprecated. Previously, this
28
28
Although the `maxsections` setting remains available for now, it is marked as deprecated and will be removed in Moodle 6.0. Also, the `get_max_sections` from `core_courseformat\base` is also deprecated and will be removed in Moodle 6.0.
29
29
30
30
If your format plugin relies on `maxsections`, you should add a custom setting in your plugin to control section limits. For reference, see the week format plugin, which now uses its own setting for this functionality.
A new `\core_external\tests\externallib_testcase` has been introduced to replace the `\externallib_advanced_testcase` class. The new class can be autoloaded, and is available from Moodle 4.4 onwards.
0 commit comments