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]

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