-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.4.8, 4.5.4, 5.0
-
MOODLE_404_STABLE, MOODLE_405_STABLE, MOODLE_500_STABLE
-
mdl85075-44
-
mdl85075-45
-
mdl85075-main
-
-
-
The mere presence of an additional curl security helper plugin causes a test failure, due to what seems like an incorrect test:
1) core\filelib_test::test_curl_basics_with_security_helper |
Failed asserting that two strings are identical.
|
--- Expected
|
+++ Actual
|
@@ @@
|
-'You shall not pass' |
+'The URL is blocked.'/var/www/moodle/lib/tests/filelib_test.php:303 |
A quick inspection seems to show this is because the tests use a mock helper, but this mock helper is not used when an additional helper is installed, so the tests fail.
In lib/tests/filelib_test.php:3034 is checking the contents returned is 'You shall not pass', but because check_securityhelper_blocklist here:
https://github.com/moodle/moodle/blob/b00c328d2dbbd49dcba8738c9da3ba4302e56c3a/lib/filelib.php#L3742
is returning the curlmanager plugin, instead of the mocked security helper, which would return in the block below but is never reached:
https://github.com/moodle/moodle/blob/b00c328d2dbbd49dcba8738c9da3ba4302e56c3a/lib/filelib.php#L3751
This can probably be fixed by just reordering these blocks so the mock helper is always executed first.
Reproduce:
- Install https://github.com/catalyst/moodle-tool_curlmanager
-
vendor/bin/phpunit --filter=test_curl_basics_with_security_helper