30 Commits

Author SHA1 Message Date
Andrew Nicols
c370c0cc5e
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-15 12:50:44 +08:00
Huong Nguyen
ccd8089de9
Merge branch 'MDL-80907' of https://github.com/marinaglancy/moodle 2024-07-04 11:12:50 +07:00
Eloy Lafuente (stronk7)
674497a12c
MDL-81523 phpunit: Add all missing setUp/tearDown parent calls
All setUp(), tearDown(), setUpBeforeClass() and tearDownAfterClass()
must, always, call to parent, to ensure that everything is properly
set and cleaned.

While in a lot of situations this is not needed (parents may not
have anything to run), with PHPUnit >= 10 this can become more
important because we are going to move the reset code from current
placement @ runBare() to setUp()/tearDown().

Note that all the changes performed in this commit have been detected
and fixed by moodle-cs (ParentSetUpTearDownSniffTest).
2024-06-14 16:04:57 +02:00
Eloy Lafuente (stronk7)
01148a0816
MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.

All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
2024-06-11 11:55:07 +02:00
Marina Glancy
49ab83c1a4 MDL-80907 various: fixes to incorrect column selectors in behat 2024-05-07 19:27:14 +01:00
Paul Holden
33a63ca639
MDL-76295 reportbuilder: implement default datasource sorting.
Update all existing report sources to use the new default sorting
API from 064eccd4, updating existing tests to assert behaviour.
2023-08-23 15:32:50 +01:00
Paul Holden
d8df4ad675
MDL-78117 reportbuilder: use context entity in report sources.
Deprecate existing columns, to be replaced by corresponding elements
from the new entity.
2023-08-02 08:05:50 +01:00
Paul Holden
76327f04ac MDL-76591 comment: create test generators and Behat scenarios.
The added scenarios cover the management of comments: viewing,
filtering and deletion.
2023-01-30 16:00:25 +00:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Paul Holden
fdf2f8f31b MDL-75352 comment: implement comments datasource for custom reporting.
Create entity definition for a comment, join with user entity in new
report source to provide data for reportbuilder editor.
2022-10-20 13:37:56 +01: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)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- 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 tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01: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
Neill Magill
7603ca3080 MDL-64525 comments: Tests for deleting frozen comments 2020-08-24 07:59:27 +01:00
Jake Dallimore
93ea6612bd MDL-64588 core_comment: make external test code use helper method
Instead of using setUp to create testing objects, use a helper.
2019-10-02 09:23:43 +08:00
Juan Leyva
09899abc55 MDL-64588 comment: New WebService core_comment_delete_comment 2019-10-01 09:26:01 +08:00
Juan Leyva
8e4a9ed854 MDL-64588 comment: New WebService core_comment_add_comment 2019-10-01 09:26:01 +08:00
Juan Leyva
2234b6c9dc MDL-64588 comment: Return whether the user can post in a comments area 2019-10-01 09:25:36 +08:00
Juan Leyva
48f5ca7bee MDL-66061 comments: Support pagination and sorting in get_comments WS 2019-08-19 10:42:25 +01:00
Michael Hawkins
d744b15bc6 MDL-63495 comment: Added provider::delete_comments_for_users
This issue is a part of the MDL-62560 Epic.
2018-10-17 13:12:18 +08:00
Marina Glancy
70703d4c51 MDL-61937 comment: do not use API in provider
When exporting comments we can not use comments API because:
- we don't need to call component validate, comments may be disabled right now but
  are still stored
- we don't need to call display callback
- we need to export all comments and not only first 15 of them
2018-05-04 11:22:14 +08:00
Adrian Greeve
1b33e410b5 MDL-62035 core_comment: Update to deletion methods.
Also clarification with the export method to clarify that it
is only for one context.
2018-04-20 10:42:24 +08:00
Andrew Nicols
e98f0cf7ff MDL-61307 privacy: Rename deletion functions 2018-03-13 08:48:13 +08:00
Andrew Nicols
70f0923499 MDL-61307 core: Remove deletion_criteria 2018-03-13 08:48:12 +08:00
Adrian Greeve
5be028ab82 MDL-61307 core_comment: Add implementation of privacy API 2018-03-09 12:24:38 +08:00
Juan Leyva
e7f4cf2ab7 MDL-49203 webservices: Fix unit tests for avoid random order issues
This problem usually happens in Postgres where a set of records is
ordered by a timestamp column and there are two or more records with
the same value
2015-04-02 12:57:22 +02:00
Juan Leyva
2016c7d4d0 MDL-49203 webservices: Unit tests for the new external function 2015-03-26 15:59:15 +01:00
Costantino Cito
be9854162f MDL-49203 webservices: New WS core_comment_get_comments 2015-03-26 15:57:21 +01:00