Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

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: 426 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_mock  - X-Ref

Class tool_httpreplace_url_finder_mock 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