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 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 287 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: date_test  - X-Ref

Unit tests for date report filter

get_sql_filter_simple_provider()   X-Ref
Data provider for {@see test_get_sql_filter_simple}

return: array

test_get_sql_filter_simple(int $operator, bool $expectuser)   X-Ref
Test getting filter SQL

param: int $operator
param: bool $expectuser

test_get_sql_filter_date_range()   X-Ref
Test getting filter SQL while specifying a date range


get_sql_filter_current_week_provider()   X-Ref
Data provider for {@see test_get_sql_filter_current_week}

return: array

test_get_sql_filter_current_week(int $startweekday)   X-Ref
Test getting filter SQL for the current week. Note that relative dates are hard to test, here we are asserting that
the current time is always within the current week regardless of calendar configuration/preferences

param: int $startweekday

get_sql_filter_current_week_no_match_provider()   X-Ref
Data provider for {@see test_get_sql_filter_current_week_no_match}

return: array

test_get_sql_filter_current_week_no_match(int $startweekday, string $timecreated)   X-Ref
Test getting filter SQL for the current week excludes dates that don't match (outside week time range)

param: int $startweekday
param: string $timecreated Relative time suitable for passing to {@see strtotime}

get_sql_filter_relative_provider()   X-Ref
Data provider for {@see test_get_sql_filter_relative}

return: array

test_get_sql_filter_relative(int $operator, ?int $unitvalue, ?int $unit, ?string $timecreated = null)   X-Ref
Unit tests for filtering relative dates

param: int $operator
param: int|null $unitvalue
param: int|null $unit
param: string|null $timecreated Relative time suitable for passing to {@see strtotime} (or null for current time)