Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Class: ip_utils_test  - X-Ref

This tests the static helper functions contained in the class '\core\ip_utils'.

test_is_domain_name($domainname, $expected)   X-Ref
Test for \core\ip_utils::is_domain_name().

param: string $domainname the domain name to validate.
param: bool $expected the expected result.

domain_name_data_provider()   X-Ref
Data provider for test_is_domain_name().

return: array

test_is_domain_matching_pattern($str, $expected)   X-Ref
Test for \core\ip_utils::is_domain_matching_pattern().

param: string $str the string to evaluate.
param: bool $expected the expected result.

domain_matching_patterns_data_provider()   X-Ref
Data provider for test_is_domain_matching_pattern().

return: array

test_is_ip_address($address, $expected)   X-Ref
Test for \core\ip_utils::is_ip_address().

param: string $address the address to validate.
param: bool $expected the expected result.

ip_address_data_provider()   X-Ref
Data provider for test_is_ip_address().

return: array

test_is_ipv4_address($address, $expected)   X-Ref
Test for \core\ip_utils::is_ipv4_address().

param: string $address the address to validate.
param: bool $expected the expected result.

ipv4_address_data_provider()   X-Ref
Data provider for test_is_ipv4_address().

return: array

test_is_ipv4_range($addressrange, $expected)   X-Ref
Test for \core\ip_utils::is_ipv4_range().

param: string $addressrange the address range to validate.
param: bool $expected the expected result.

ipv4_range_data_provider()   X-Ref
Data provider for test_is_ipv4_range().

return: array

test_is_ipv6_address($address, $expected)   X-Ref
Test for \core\ip_utils::is_ipv6_address().

param: string $address the address to validate.
param: bool $expected the expected result.

ipv6_address_data_provider()   X-Ref
Data provider for test_is_ipv6_address().

return: array

test_is_ipv6_range($addressrange, $expected)   X-Ref
Test for \core\ip_utils::is_ipv6_range().

param: string $addressrange the address range to validate.
param: bool $expected the expected result.

ipv6_range_data_provider()   X-Ref
Data provider for test_is_ipv6_range().

return: array

test_check_domain_against_allowed_domains($expected, $domain)   X-Ref
Test checking domains against a list of allowed domains.

param: bool $expected Expected result
param: string $domain domain address

data_domain_addresses()   X-Ref
Data provider for test_check_domain_against_allowed_domains.

return: array

data_is_ip_in_subnet_list()   X-Ref
Data provider for test_is_ip_in_subnet_list.

return: array

test_is_ip_in_subnet_list($expected, $ip, $list, $delim)   X-Ref
Test checking ips against a list of allowed domains.

param: bool $expected Expected result
param: string $ip IP address
param: string $list list of  IP subnets
param: string $delim delimiter of list