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]

Contains the test class testing the \core\ip_utils static helper class functions.

Copyright: 2016 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 407 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: core_ip_utils_testcase  - 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