catalyst / moodle-tool_cloudmetrics

Realtime metrics for Moodle
https://moodle.org/plugins/tool_cloudmetrics
GNU General Public License v3.0
0 stars 3 forks source link

Issue #106: Incorrect data returned by cltr::get_enabled_plugins() causes uses unit test failure in Moodle #107 #109

Closed katerynadegtyariova closed 2 years ago

katerynadegtyariova commented 2 years ago

The function get_enabled_plugins() is used by the plugin manager to return the plugin names as an array containing $pluginname => $pluginname.For this reason the getting plugin instances is moved in a separate function. Add unit tests to test cltr::get_enabled_plugins() and cltr::get_enabled_plugin_instances().

The error message and instructions to repeat can be found in the description of Issue #106. After applying the fix, the existing test passes successfully:

root@a98befdc0147:/var/www/macquarie# vendor/bin/phpunit "core_plugin_manager_testcase" lib/tests/plugin_manager_test.php 
Moodle 3.9.14+ (Build: 20220701), 1b0ca9c4ded8c25141a6a62b728323800ca036c8
Php: 7.4.29, pgsql: 9.6.24, OS: Linux 5.15.0-37-generic x86_64
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

.........................................                         41 / 41 (100%)

Time: 6.89 seconds, Memory: 93.00 MB

OK (41 tests, 6620 assertions)

The new tests added to tool_cloudmetrics_lib_test:

root@a98befdc0147:/var/www/macquarie# vendor/bin/phpunit --filter '/tool_cloudmetrics_lib_test/'
Moodle 3.9.14+ (Build: 20220701), 1b0ca9c4ded8c25141a6a62b728323800ca036c8
Php: 7.4.29, pgsql: 9.6.24, OS: Linux 5.15.0-37-generic x86_64
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

...................................                               35 / 35 (100%)

Time: 25.73 seconds, Memory: 738.00 MB

OK (35 tests, 38 assertions)
jaypha commented 2 years ago

Is this PR ready for review?

katerynadegtyariova commented 2 years ago

Is this PR ready for review?

It is not yet ready for review because of the CI failures. The CI workflow issue needs to be reviewed first (which is a different PR). Then I will have to reset it to use the @master branch for reusable workflows.

jaypha commented 2 years ago

Sure. Ping me when it's ready.

katerynadegtyariova commented 2 years ago

CI workflows are fixed, the tests are passing