11 Commits

Author SHA1 Message Date
Andrew Nicols
55126be4ad
MDL-81520 core: Fix test finality 2024-12-11 12:30:21 +08:00
Andrew Nicols
c6942c9bb7
MDL-81521 core: Update all possibly data providers to be static
Note: Some data providers could not be automatically be converted to
being static. These will be handled in a separate issue.
2024-11-18 10:24:55 +08:00
Eloy Lafuente (stronk7)
091b458c52
MDL-81522 phpunit: Add missing void return type to all tests #2
This commit includes more changes, all them also adding the :void
return type to unit tests missing them.

The difference is that all these changes, while also detected
perfectly by the moodle.PHPUnit.TestReturnType sniff, were not
auto-fixed (like the previous commit ones), because all them
do include some "return" statement and, for safety, we don't
fix them.

All the cases have been visually inspected and confirmed that
the existing "return" statements always belong to anon
functions within the test body and not the test own return statement.
2024-06-11 12:18:05 +02:00
Paul Holden
af8da7c737 MDL-70070 phpunit: correct data provider method names.
They should not be prefixed `test_` because that's how actual
test methods containing assertions are identified by PHPUnit.
2023-01-16 08:28:37 +00:00
Eloy Lafuente (stronk7)
9f53b0e965 MDL-73971 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- Some fixtures, initially defined in the test files have been
  moved to new files in fixtures subdirectory, leaving the unit
  test files clearer:
  - moodle2_course_format_test.php
- Rename wrong named test:
  - baseoptiogroup_test = baseoptigroup_test
2022-05-06 18:29:11 +02:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Marina Glancy
47a710177a MDL-58688 calendar: retrieve event module without db queries 2017-05-04 16:53:19 +08:00
Jun Pataleta
20592f5ff2 MDL-58386 calendar: Fixed CI issues
Part of MDL-55611 epic.
2017-04-04 11:01:47 +01:00
Cameron Ball
5ca71c2dc3 MDL-57442 core_calendar: Allow course modules to create actions for events
Course modules can now implement the function mod_{module}_core_calendar_provide_event_action
which allows them to return an action to attach to an event.

Part of MDL-55611 epic.
2017-04-03 11:36:07 +08:00
Cameron Ball
c5478a5b6c MDL-57442 core_calendar: Update proxies to accept a 'base' class
The base class can contain information we would prefer not to
have to hit the database for.

Part of MDL-55611 epic.
2017-04-03 11:36:07 +08:00
Cameron Ball
e46efe3a72 MDL-57599 core_calendar: Add action event class
This patch adds a "regular" calendar event class, and a simple extension
of it which we are calling an action event.

Part of MDL-55611 epic.
2017-04-03 11:35:38 +08:00