121 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
40de097e65 MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
d95c378771 MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:00 +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
comete-upn
f86f0debd8 MDL-69667 competencies: fix competencies count always 0 in frameworks. 2020-09-21 23:19:52 +02:00
eWallah
d051b3fc19 MDL-67413 competencies: do nothing upon activity completion 2020-08-27 11:11:51 +08:00
Peter
7d6f66b422 MDL-60126 competency: Unit tests 2020-02-04 08:36:21 +08:00
Simey Lameze
2595d450e0 MDL-60126 competency: delete content upon user delete 2020-02-04 08:00:19 +08:00
Eloy Lafuente (stronk7)
4621917c62 MDL-67114 core: php74 fix. Fix use of scalar as array in core
There are various places where it's not guaranteed that the
variable being used is array, and instead, can be null, bool, int...

We need to check that because php74 warns about it.

Where possible we have used the coalesce operator as
replacement for isset() ternary operations.
2020-01-03 11:33:15 +01:00
Eloy Lafuente (stronk7)
f4feabb83f MDL-66968 php74: array_key_exists() for objects is deprecated
Replace it for correct property_exists() when the element
being inspected is a property of object/class.

Amended and squased changes:
- keep mongo unmodified. The information is array, hence correct.
- fix a couple of messaging phpdocs that were incorrect.

Amended take#2:
- As far as mongo resturns BSONDocument that is ArrayObject, aka
implements ArrayAccess, we have decided to explicitly cast results
to array so existing array_key_exists() and other accesses will
continue working the same.
2019-10-25 00:49:04 +02:00
Juan Leyva
dcadc8c54c MDL-65968 notifications: Use f1 size avatars for Push notifications 2019-09-17 16:29:02 +02:00
Damyon Wiese
bde97497ef MDL-65078 competencies: webservices
The webservice list_course_module_competencies calls a function that does not exist and
is not exposed as a webservice.
2019-07-24 09:14:28 +08:00
Marina Glancy
5ecbc5d9f7 MDL-65782 roles: allow several roles with user/frontpage archetype 2019-06-04 11:49:23 +02:00
Adrian Greeve
e3e44b2d2f Merge branch 'MDL-65178-master' of git://github.com/damyon/moodle 2019-05-01 11:56:35 +08:00
Juan Leyva
2356454f21 MDL-60680 notifications: Include action buttons information 2019-04-25 14:55:57 +02:00
Juan Leyva
36fa0ec900 MDL-60680 notifications: Return custom data in notifications 2019-04-25 14:55:18 +02:00
Damyon Wiese
bdba44193d MDL-65178 competencies: count_competencies fix
Fix sql error in course_module_competency::count_competencies() function.
2019-03-26 09:47:09 +08:00
Damyon Wiese
f44557d045 MDL-63876 badges: Competency deletion
Do not delete a competency if it is a criteria for a badge.
2019-03-29 11:31:15 +08:00
Damyon Wiese
6bdaf20462 MDL-63876 competencies: Skip enabled check
Allow rendering a competency summary if competencies are disabled, but do not include
links to competencies pages.
2019-03-29 11:31:15 +08:00
Damyon Wiese
8aff6f6f14 MDL-63876 badges: Coding style
Add comments to document function params and template example context.
2019-03-29 11:31:15 +08:00
Andrew Nicols
c40f6adbe0 MDL-64971 access: Ensure that the capability exists when fetching 2019-03-06 10:16:06 +08:00
Damyon Wiese
be56aa864b MDL-64864 core_competency: Include course category
These courses are passed through to the course_summary_exporter which
requires a category id in each course record.
2019-03-05 08:52:17 +08:00
Sara Arjona
0ebfd1c47b Merge branch 'MDL-55135-master-competencies-manage-in-coursecontext' of https://github.com/wjroes/moodle 2019-02-27 11:51:30 +01:00
willem
e42d429c7b MDL-55135 competencies: fix capabilities managing course competencies
Capability check in a course was using global competency capabilities 
moodle/competency:competencyview and  moodle/competency:competencymanage 
instead of the course equivalents. Users outside the course context 
could not manage course competencies.
2019-02-18 08:07:38 +01:00
Damyon Wiese
c0417b04ff MDL-53346 competencies: Show user learning plans
On the course competencies page, show the user their learning plans
that contain each of the course competencies.
2019-02-06 08:33:55 +08:00
Amaia Anabitarte
45cc006c91 MDL-60518 core_competency: Set $USER global variable for tests 2018-12-14 10:28:34 +01:00
Damyon Wiese
afd5c94dbf MDL-64283 competency: Correct numbering in tests 2018-11-30 09:30:50 +08:00
David Monllao
0422a13c90 Merge branch 'MDL-63764-master' of git://github.com/mickhawkins/moodle 2018-11-05 12:46:12 +01:00
Eloy Lafuente (stronk7)
bd5fdcfccd MDL-63422 general: review core loop / switch / case / continue
This commit reviews all continue uses in core happening within a
loop / switch / case hierarchy. This does not cover:

- Changes to libraries. Will be handled in another issue / commit.
- Uses out from loops, will be reviewed by other commit.

The policy followed has been:
- When possible, take rid of the continue.
- When clearly the intention was to jump to next element in loop
  change to continue 2
- When it was not clear, keep old behavior switching to break, no
  matter how weird the behavior may be.
2018-10-31 00:17:59 +01:00
Michael Hawkins
cabea2fc04 MDL-63764 core_competency: Add support for removal of context users
This issue is a part of the MDL-62560 Epic.
2018-10-29 12:59:55 +08:00
Michael Hawkins
b03e9322bf MDL-63764 core_competency: Support bulk user delete course competencies
This issue is a part of the MDL-62560 Epic.
Also made user IDs optional, so user course competencies can be deleted by course ID only.
2018-10-29 12:59:55 +08:00
Adrian Greeve
3714fe7e6e MDL-57244 general: Remove old class renames. 2018-07-23 15:54:13 +08:00
Eloy Lafuente (stronk7)
4f510bea17 Merge branch 'MDL-62384-master' of git://github.com/andrewnicols/moodle 2018-05-11 18:12:45 +02:00
Adrian Greeve
5a329d81f9 MDL-62384 core_competency: Update to sql to increase performance. 2018-05-11 09:15:27 +08:00
Marina Glancy
468c8d39c3 MDL-62351 privacy: check that subsystem/plugintype exist 2018-05-09 17:37:31 +08:00
Frédéric Massart
9967731256 MDL-61877 core_competency: False negative due to random ordering 2018-05-04 11:18:42 +02:00
Frédéric Massart
739b59610a MDL-61877 core_competency: Handle comments in privacy API 2018-04-27 11:29:30 +08:00
Frédéric Massart
f8a6a533c2 MDL-61877 core_competency: Implement privacy API 2018-04-27 11:29:29 +08:00
Eloy Lafuente (stronk7)
a4e7e6f345 Merge branch 'MDL-60567-master' of git://github.com/damyon/moodle 2017-12-19 11:30:08 +01:00
Jun Pataleta
24131d08c0 Merge branch 'MDL-59970-master' of git://github.com/damyon/moodle 2017-12-12 18:52:49 +13:00
Simey Lameze
f9bb74c037 MDL-58058 competency: replace other sortorder usages 2017-12-08 15:58:52 +08:00
Frederic Massart
f250cdbb34 MDL-58058 competency: Allow unspecified sortorder for new competencies 2017-12-08 15:58:52 +08:00
Damyon Wiese
9a7671da80 MDL-59970 competencies: performance
Remove useless get_records call in get_least_proficient_competencies_for_course function.
On big sites this would cause huge memory usage.
2017-11-22 15:35:20 +08:00
Damyon Wiese
1518ce952f MDL-60567 competencies: test list_competencies 2017-10-27 11:50:11 +08:00
Damyon Wiese
f09f01fcad MDL-60567 competencies: list_competencies wrong type
"validate_params" returns arrays in external functions.
2017-10-27 11:49:13 +08:00
Jake Dallimore
54ec93885c MDL-60243 competencies: fix ordering bug in api_test unit test
list_user_competencies_to_review() orders by shortname, but the test
creates 2 user competencies with the same short name, resulting in
unpredictable results. This patch fixes that.
2017-09-27 09:19:32 +08:00
Simey Lameze
2fc95ecf80 MDL-59994 competency: improve user competency unit test 2017-09-18 08:32:12 +08:00
Simey Lameze
8c13028c9d MDL-59994 competency: dont list competencies from deleted users 2017-09-18 08:32:12 +08:00
Tony Levi
95c0b810bf
MDL-49398 accesslib: Change competency to use new accesslib function 2017-06-02 10:04:09 +01:00
Simey Lameze
b991325da2 MDL-58884 core_competency: add exporter required course fields 2017-05-17 13:02:48 +08:00
Issam Taboubi
013982e3c4 MDL-58884 competency: Inaccurate stats proficient competencies in course 2017-05-10 15:08:21 -04:00