Commit graph

45 commits

Author SHA1 Message Date
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08: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
Juan Leyva
10a6e99ea2 MDL-73084 enroll: Return timemodified field in get_users_courses 2021-11-23 15:59:04 +01:00
Mathew May
bdffbe3e48 MDL-65799 enrol: Final deprecations 2021-11-10 15:22:43 +08:00
sam marshall
987e55452f MDL-45242 Course: Enrol feature supports custom profile fields 2021-03-10 10:57:11 +00:00
Paul Holden
a251c260c4 MDL-70822 enrol: respect capability to view other users profile.
When retrieving courses of another user via web services, we should
respect the capability to view that users profile in a given course.
2021-03-02 23:44:24 +01:00
Ilya Tregubov
65a1d6e8e0 MDL-69869 enrol: Clean up - switch to [] from array(). 2020-12-08 09:15:15 +02:00
Ilya Tregubov
e53bc6a1f8 MDL-69869 enrol: Add ability to get suspended users through
core_enrol_get_enrolled_users webservice.
2020-12-08 09:15:15 +02:00
Eloy Lafuente (stronk7)
3a5641cb74 MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
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
Dani Palou
25bc7a3d6b MDL-68098 ws: Add unit tests to test mathjax in WS 2020-09-23 11:18:41 +02:00
Simey Lameze
6d76fc107a MDL-66075 enrol: add unit tests for search_users webservice 2019-09-23 13:07:40 +08:00
Shamim Rezaie
2d4ce64dde MDL-66489 enrol: Send all form data to WS and do all busines logic there
It is discouraged to use JS Date functions. We should pass all raw data to PHP.
2019-09-11 20:18:26 +10:00
Juan Leyva
dfcf8342fb MDL-65211 enrol: Return if user is being completion tracked 2019-04-01 18:45:14 +02:00
Eloy Lafuente (stronk7)
c93eedf8dd Merge branch 'MDL-64084-master' of git://github.com/jleyva/moodle 2019-03-12 00:29:58 +01:00
Juan Leyva
1f87a7f653 MDL-64084 core_enrol: Return expect last access course time 2019-02-28 11:11:35 +01:00
Mark Johnson
7d4c345820 MDL-64886 enrol: Make enrolledusercount optional in enrol_get_users_courses 2019-02-27 12:58:17 +00:00
Juan Leyva
8e7b8cf08f MDL-63739 core_enrol: Add completion criteria, hiden and favourited data 2018-11-02 12:10:57 +01:00
Juan Leyva
b36ee81ea6 MDL-63523 enrol: Return extra fields for new dashboard
WebService core_enrol_get_users_courses should return extra information for the app
so we can display all the new dashboard information without having to do extra WS requests.
2018-10-16 13:45:07 +02:00
Juan Leyva
6db2423551 MDL-60738 webservice: Clean theme and lang properly
Sometimes the "theme" and "lang" fields in the user and course tables
in the database are set to incorrect values (uninstalled or
non-existent themes and language packs).
This makes Web Services functions to fail because the WS server
validate the returned data using the validate_param function that clean
parameters.
2017-11-20 09:37:30 +01:00
Mihail Geshoski
c835126185 MDL-60579 enrolments: Applied filters lost on certain actions
AMOS BEGIN
    CPY [invalidrequest,enrol_lti],[invalidrequest,enrol]
AMOS END
2017-11-07 16:17:00 +08:00
Jun Pataleta
58c20c8108 MDL-59369 enrol: New ws core_enrol_external::edit_user_enrolment 2017-07-26 09:43:16 +08:00
Juan Leyva
01c26702d3 MDL-58659 enroll: Add start and end date fields required by overview
Those fields are required to display the courses overview for final
users.
2017-04-20 13:00:15 +02:00
Rajesh Taneja
52f3e060e4
MDL-55091 phpunit: Following has been deprecated.
1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
2016-07-26 10:11:30 +08:00
Juan Leyva
d889b58747 MDL-54955 webservice: Apply external_format_string in course names 2016-06-20 13:16:52 +01:00
Juan Leyva
4323a973d5 MDL-52072 enrol: Fix course visibility checks in external functions 2016-01-05 10:31:23 +00:00
Eloy Lafuente (stronk7)
ed4e707577 MDL-51861 enrol: added missing external cleanup for formal compliance 2015-11-06 10:58:28 +01:00
Andrew Nicols
af8472a91f Merge branch 'MDL-51861' of git://github.com/stronk7/moodle 2015-11-06 15:01:20 +08:00
Andrew Nicols
1d1f08a045 MDL-51685-master Fix unit tests following change
These unit tests were modifying the PAGE and other globals in the middle of
tests and were failing as a result.

Broke the tests up into separate tests where the functionality is now
tested individually.
2015-11-06 10:36:06 +08:00
Eloy Lafuente (stronk7)
f076ce2834 MDL-51861 enrol: new unit test to verify all conditions and filters
This unit test does not verify contents, details, but only
that the returned users for every group mode, for every
filtering (active, groupid and withcapability) together
with permissions are correct.
2015-11-06 02:26:02 +01:00
Juan Leyva
b4896308dc MDL-45131 enrol: Add validation for returned parameters in WS tests 2015-04-16 10:25:25 +02:00
Juan Leyva
ba62015b8e MDL-49606 webservices: Minor style fixes 2015-03-27 12:19:52 +01:00
Daniel Ureña
9b78f0e98b MDL-49606 webservices: Improved unit tests for get_users_courses 2015-03-27 10:12:47 +01:00
Frederic Massart
457b82f238 MDL-43337 enrol: Missing break in get_enrolled_users WS 2014-02-13 12:06:04 +08:00
Frederic Massart
e06d359917 MDL-43337 enrol: More tests for get_enrolled_users_with_capability 2014-02-13 12:06:04 +08:00
Marina Glancy
9be9b412b1 Merge branch 'wip-mdl-40126' of git://github.com/rajeshtaneja/moodle 2013-08-06 22:53:19 +10:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Rajesh Taneja
be9bf94e4a MDL-40126 Enrolments: Implemented two webservices to get enrolment instance info
1. core_enrol_get_course_enrolment_methods() which returns all enrolment method instances
which implement get_enrol_info()
2. enrol_self_get_instance_info() will return information about self enrolment instance.
2013-07-29 15:07:37 +08:00
Ankit Agarwal
235b5c680a MDL-39152 phpunit: Move core_role_external_testcase() to a new file
It is not recommended to have multiple test classes in a single phpunit file
2013-06-14 11:50:25 +08:00
Ankit Agarwal
95a3bb4dc8 MDL-39152 phpunit: improve tests for assign_roles()
core_role_external::assign_roles() now support alternative paramaters instead of contextid. Test working of those. Also test the parameters validation a bit, since these are no longer automatically tested being optional now
2013-06-14 11:50:25 +08:00
Jerome Mouneyrac
909f27acf4 MDL-37410 External PHPunit test: used ->getDataGenerator()->enrol_user instead to manually enrol the user. + improve the unassignUserCapability to remove a capability assigned by getDataGenerator->enrol_users 2013-02-12 11:15:15 +08:00
Jerome Mouneyrac
fb695f6e3d MDL-37354 clean return value for each externallib PHPUnit tests 2013-01-09 13:47:01 +08:00
Dan Poltawski
21d3bfb39a MDL-31859 - fix more trailing whitespace 2012-09-26 14:44:42 +08:00
Paul Charsley
b6b6c7acb6 MDL-31859 added get_enrolled_users_with_capability web service function 2012-09-21 09:37:06 +12:00
Jerome Mouneyrac
566596abd7 MDL-34967 PHPunit test: enrol/externallib.php and enrol/manual/externallib.php 2012-09-04 12:26:21 +08:00