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.

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

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

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

Defines 2 classes

collator_test:: (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: collator_test  - 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