Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

HTTPS find and replace Tests

Copyright: Copyright (c) 2016 Blackboard Inc. (http://www.blackboard.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 427 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: httpsreplace_test  - X-Ref

Tests the httpsreplace tool.

upgrade_http_links_provider()   X-Ref
Data provider for test_upgrade_http_links


get_converted_http_link($path)   X-Ref
Convert the HTTP external test file URL to use HTTPS.

Note: We *must not* use getExternalTestFileUrl with the True option
here, becase it is reasonable to have only one of these set due to
issues with SSL certificates.

param: string  $path Path to be rewritten
return: string

test_upgrade_http_links($content, $ouputregex, $expectedcontent)   X-Ref
Test upgrade_http_links

param: string $content Example content that we'll attempt to replace.
param: string $ouputregex Regex for what output we expect.
param: string $expectedcontent What content we are expecting afterwards.

http_link_stats_provider()   X-Ref
Data provider for test_http_link_stats


test_http_link_stats($content, $domain, $expectedcount)   X-Ref
Test http_link_stats

param: string $content Example content that we'll attempt to replace.
param: string $domain The domain we will check was replaced.
param: string $expectedcount Number of urls from that domain that we expect to be replaced.

test_links_and_text()   X-Ref
Test links and text are not changed


test_httpwwwroot()   X-Ref
If we have an http wwwroot then we shouldn't report it.


test_upgrade_http_links_excluded_tables()   X-Ref
Test that links in excluded tables are not replaced


test_renames()   X-Ref
Test renamed domains


test_multiple()   X-Ref
When there are many different pieces of contents from the same site, we should only run replace once


test_reserved_words()   X-Ref
Test the tool when the column name is a reserved word in SQL (in this case 'where')


Class: tool_httpreplace_url_finder_test  - X-Ref

Class tool_httpreplace_url_finder_test for testing replace tool without calling curl

check_domain_availability($url)   X-Ref
Check if url is available (check hardcoded for unittests)

param: string $url
return: bool