Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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