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]

Collator unit tests.

Copyright: 2011 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 333 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

core_collator_testcase:: (8 methods):
  setUp()
  tearDown()
  test_asort()
  test_asort_objects_by_method()
  test_asort_objects_by_property()
  test_asort_array_of_arrays_by_key()
  get_ordered_names()
  test_ksort()

string_test_class:: (3 methods):
  __construct()
  get_protected_name()
  get_private_name()


Class: core_collator_testcase  - X-Ref

Unit tests for our utf-8 aware collator which is used for sorting.

setUp()   X-Ref
Prepares things for this test case.


tearDown()   X-Ref
Cleans things up after this test case has run.


test_asort()   X-Ref
Tests the static asort method.


test_asort_objects_by_method()   X-Ref
Tests the static asort_objects_by_method method.


test_asort_objects_by_property()   X-Ref
Tests the static asort_objects_by_method method.


test_asort_array_of_arrays_by_key()   X-Ref
Tests the sorting of an array of arrays by key.


get_ordered_names($objects, $methodproperty = 'get_protected_name')   X-Ref
Returns an array of sorted names.

param: array $objects
param: string $methodproperty
return: array

test_ksort()   X-Ref
Tests the static ksort method.


Class: string_test_class  - X-Ref

Simple class used to work with the unit test.

__construct($name)   X-Ref
Constructs the test instance.

param: string $name

get_protected_name()   X-Ref
Returns the protected property.

return: string

get_private_name()   X-Ref
Returns the protected property.

return: string