118 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
1093256560
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 12:18:04 +02:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Andrew Nicols
7e35c70376
Merge branch 'MDL-78170' of https://github.com/paulholden/moodle 2023-05-23 10:27:28 +08:00
Meirza
6856a84f17 MDL-77350 rating: Added class properties that are not declared
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-05-16 00:33:19 +07:00
Paul Holden
dafc92b454
MDL-78170 rating: consistently calculate average rating aggregation.
Ensure it's always cast by the database as a float, to avoid loss of
precision.
2023-05-09 15:39:00 +01:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Marina Glancy
4d765cd699 MDL-77164 privacy: typehint test content writer 2023-04-13 09:43:15 +01:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Eloy Lafuente (stronk7)
caf55abf17 MDL-74413 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:

- Moved to the level2 "privacy" namespace:
  - \mod_assign\privacy\feedback_legacy_polyfill_test
  - \mod_assign\privacy\submission_legacy_polyfill_test

- Moved to the level2 "task" namespace:
  - \core_message\task\migrate_message_data_test
  - \ltiservice_gradebookservices\task\cleanup_test
  - \message_email\task\send_email_test
  - \mod_lti\task\clean_access_tokens_test
  - \mod_workshop\task\cron_task_test

- Moved to the level2 "event" namespace:
  - \core_h5p\event\deleted_test
  - \core_h5p\event\viewed_test

- Renamed to a better name:
  - backup_forum_activity_task_test.php (missing "task")
2022-05-07 20:32:30 +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
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00: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
Juan Leyva
a927fcdc7b MDL-65042 rating: Fix incorrect image generated for user in rating 2019-08-16 15:41:21 +01:00
Andrew Nicols
9f3bf966c4 MDL-64652 rating: Add optional inner join option to sql 2019-03-05 10:12:22 +08:00
Andrew Nicols
c96cd71102 MDL-63924 privacy: Add shared user providers to subsytsems 2018-11-08 21:26:18 +08:00
Andrew Nicols
e2ca4224f2 MDL-63495 core_rating: Add helper to fetch users in context
This issue is a part of the MDL-62560 Epic.
2018-10-17 13:12:18 +08:00
Andrew Nicols
38e6852140 MDL-62384 core_rating: Move WHERE clauses to JOIN 2018-05-11 09:15:30 +08:00
Marina Glancy
e5ec530a44 MDL-61937 rating: delete method in privacy provider 2018-05-04 11:22:14 +08:00
Andrew Nicols
cbc6325253 MDL-61307 core_rating: Add implementation of Privacy API 2018-03-09 12:24:38 +08:00
Juan Leyva
bb7c514845 MDL-57407 core_rating: Add new external util class for handling ratings
This util class handles all the tasks related to retrieve and format
ratings for external functions.
2017-09-08 13:49:07 +02:00
Juan Leyva
1896b8009a MDL-56307 course: API changes to support retrieve by time 2016-10-25 10:10:52 +01:00
Juan Leyva
afb7799a6d MDL-55786 rating: New Web Service core_rating_add_rating 2016-10-03 12:22:29 +01:00
Juan Leyva
a497458c89 MDL-55786 rating: Move common code to new function 2016-10-03 12:17:09 +01:00
Andrew Nicols
03b5351f88 MDL-54620 rating: Add tests for get_aggregate_string 2016-05-18 12:13:52 +08:00
Kevin Wiliarty
393890e168 MDL-54620 ratings: display '0' when aggregate = 0 2016-05-18 07:21:28 +08:00
Juan Leyva
d85bedf796 MDL-49823 webservice: Support gravatar profile images 2015-10-01 09:36:31 +02:00
Ankit Agarwal
731c2712e7 MDL-50173 ratings: Use proper checks to ensure ratings are viewable.
Mainly to verify groups visibility this new callback has been created.

Note this was originally 3 commits but for amending purposes they have
been squashed.
2015-09-09 04:07:21 +02:00
Juan Leyva
d982713ad3 MDL-49763 webservices: Handle correctly deleted users for ratings 2015-04-10 22:21:34 +02:00
Juan Leyva
a955fcb608 MDL-49347 rating: Unit tests for core_rating_get_item_ratings 2015-04-07 21:13:25 +02:00
Juan Leyva
46e41e6339 MDL-49347 rating: Several fixes and code clean up
- Use correct return values types
- Fix the warnings declaration
- Fix the pluginfile URL
2015-04-07 21:13:24 +02:00
Costantino Cito
db5b697158 MDL-49347 rating: New external function core_rating_get_item_ratings 2015-04-02 17:13:44 +02:00
David Monllao
81ce169dce Merge branch 'MDL-49346-master' of git://github.com/jleyva/moodle 2015-03-10 15:31:51 +08:00
Juan Leyva
9502a19c3c MDL-49346 ratings: ratingarea should be a required parameter 2015-03-06 11:34:21 +01:00
Juan Leyva
c73b8d85c5 MDL-49351 ratings: Correct check of viewallratings permission 2015-03-06 11:33:56 +01:00
Marina Glancy
2e6188a7f2 Merge branch 'MDL-46448_rating_ajax2' of git://github.com/andyjdavis/moodle 2014-08-12 15:22:19 +08:00
Andrew Davis
c568d478db MDL-46448 core_rating: now only formats rating aggregate if user can see it 2014-08-06 18:28:56 +08:00
Andrew Davis
27dbf2628f MDL-46447 core_rate: made sure non-ajax files don't return JSON data 2014-08-04 15:12:50 +08:00
Andrew Davis
d28a6a5f4b MDL-46446 core_rating: fixed coding style problems 2014-07-23 19:30:53 +08:00
Andrew Nicols
af64bc6179 MDL-33099 Javascript: Deprecate the ajaxenabled function 2014-02-17 14:11:21 +08:00
Eloy Lafuente (stronk7)
fb1788c598 Merge branch 'MDL-40424-master' of git://github.com/FMCorz/moodle
Conflicts:
	admin/oacleanup.php
2013-07-17 01:21:51 +02:00
Petr Škoda
56da374e1e MDL-40220 use new core_component::normalize_component() 2013-07-16 22:41:00 +02:00
Frederic Massart
2e4c0c9181 MDL-40424 libraries: Deprecate context_instance_preload_sql() 2013-07-12 17:41:49 +08:00
Dan Poltawski
0e35ba6ffc MDL-36357 cleanup - remove double semicolons 2012-11-15 09:51:26 +08:00
Andrew Davis
94e40193a4 MDL-32649 rating: fixed the sorting in /rating/index.php 2012-06-04 09:13:26 +07:00
Petr Skoda
f59f03ad2d MDL-32569 drop more core simpletests that were already migrated 2012-04-21 16:27:30 +02:00
Andrew Davis
08f06b1c24 MDL-30955 rating: corrected /rating/index.php as it was determining the maximum rating incorrectly for custom scales 2012-04-10 12:01:52 +07:00