51 Commits

Author SHA1 Message Date
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)
0c53a3dec8 MDL-73476 phpunit: events, external and search tescase names
All events_test, external_test and search_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 lib/external/tests/external_test.php:
- external is not a valid component
- hence, its only valid namespace is "core"
- also, it's testing lib/external/externallib.php
- hence, the file (and class) have been renamed to external_externallib_test.php
  (to avoid conflicts with other external_test that may exist in core)
2022-01-14 16:18:39 +01:00
Eloy Lafuente (stronk7)
511801cb46 MDL-73352 phpunit: lib_test and locallib_test testcase names
All lib_test and locallib_test classes:

- Namespaced with component (and API whenever makes sense).
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed or add new uses.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under login/tests:

1) The core_login component doesn't exist.
2) But login/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 login_xxxx as prefix.
2021-12-30 16:21:42 +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
Juan Leyva
c7e7229ccd MDL-67807 webservice: Return concurrent sessions information 2021-11-19 14:03:37 +01:00
Paul Holden
797cff78d5 MDL-72464 webservice: fix detection of non-expiring external tokens. 2021-10-10 20:40:14 +01:00
David Mudrák
4a9f864969 MDL-67748 admin: Add Behat tests for tokens filtering features
Credit goes to Andrew for Behat data generators for webservices.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2021-03-16 10:51:39 +01:00
David Mudrák
c07f15d791 MDL-67748 admin: Improve get_missing_capabilities_by_users()
The previous implementation falsely reported all implicit capabilities
inherited from the authenticated user archetype. That caused a lot of
capabilities reported as missing, even if they were correctly granted.

This new implementation uses a different logic. Instead of seeking for
explicitly assigned capabilities, it searches for capabilities that are
not assigned to any of the user's role across the system.

Please refer to the inline documentation. This should be still used for
informative reports only, not for actual permissions evaluation. The
context has been ignored here, as well as all the overrides etc. This
patch just makes it a lesser evil.
2021-03-15 21:24:06 +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
Dani Palou
25bc7a3d6b MDL-68098 ws: Add unit tests to test mathjax in WS 2020-09-23 11:18:41 +02:00
Andrew Nicols
413172521a Merge branch 'MDL-65550-master' of git://github.com/jleyva/moodle 2019-09-05 11:38:36 +08:00
Juan Leyva
cd43240d77 MDL-66376 webservice: Return user private access key for fetching files 2019-08-29 20:02:48 +01:00
Juan Leyva
20570e5d9f MDL-65550 webservice: Return in get_site_info WS if user is admin 2019-08-21 12:31:49 +01:00
Eloy Lafuente (stronk7)
89fbc3ec9a Merge branch 'MDL-65179-master' of https://github.com/sammarshallou/moodle 2019-04-16 22:37:23 +02:00
Mathew May
e00f1c663c MDL-64506 phpunit: Update unit tests to use classic 2019-04-03 19:34:20 +08:00
sam marshall
bb044f5394 MDL-65179 Web service: Token last access is updated too frequently 2019-03-28 17:11:33 +00:00
Juan Leyva
355c37b8c7 MDL-64653 webservice: Return current theme in get_site_info WS 2019-02-07 15:41:23 +01:00
Mihail Geshoski
bb65ee165c MDL-63533 core_webservice: Unit tests for removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-22 12:48:27 +02:00
Frédéric Massart
d21c5e384d MDL-62236 core_webservice: Implement privacy API 2018-04-29 10:08:40 +08:00
Juan Leyva
c851ee5ddb MDL-53501 webservice: Avoid values higher than PHP_INT_MAX
Integers coming from site settings needs casting to int to avoid
returning values higher than PHP_INT_MAX.
2017-10-30 15:55:49 +01:00
Juan Leyva
bef5777fc4 MDL-59214 webservice: Return calendar type in get_site_info 2017-06-20 11:44:04 +01:00
Ilya Tregubov
1138af352a MDL-57768 webservice: Delete manual setting of config in test 2017-02-10 11:49:09 +11:00
Juan Leyva
0c6c86643e MDL-56607 settings: Move mobile settings to top-level
AMOS BEGIN
 MOV [mobilecssurl,core_admin],[mobilecssurl,tool_mobile]
 MOV [configmobilecssurl,core_admin],[configmobilecssurl,tool_mobile]
AMOS END

From Plugins / Web Services / Mobile to Appearance / Mobile
2016-11-07 09:53:29 +00:00
Dani Palou
43695b6a72 MDL-56160 ws: Return site course ID in get_site_info 2016-09-28 12:26:32 +02:00
Frederic Massart
4f9b94fdd5
Revert "MDL-44626 files: Show the PHP max upload size instead of 'unlimited'"
This reverts commit 6f0768618a38c11eca90a97c0dff31ec8ce434d1.
2016-06-23 11:51:44 +08:00
Damyon Wiese
11c16f5fc8 MDL-53772 externallib: Deprecate external_function_info() 2016-04-14 15:07:41 +08:00
David Monllao
82e1b645eb Merge branch 'MDL-52208-master-2' of git://github.com/junpataleta/moodle 2016-02-16 14:39:46 +08:00
Jun Pataleta
79c7fffce3 MDL-52208 webservice_soap: Remove Zend from webservice_soap 2016-02-16 14:14:11 +08:00
Andrew Nicols
6f0768618a MDL-44626 files: Show the PHP max upload size instead of 'unlimited'
Even when a user has the appropriate capability to upload any sized files,
they are still restricted to the PHP post_max_size, and upload_max_filesize
values.

Rather than showing a value of "Unlimited', we should always restrict to
this value.
2016-02-11 10:55:54 +08:00
Juan Leyva
333e77703d MDL-52586 webservices: Return the default user home page 2015-12-22 16:50:58 +01:00
Eloy Lafuente (stronk7)
33d65f705b MDL-49425 webservices: Fix unit test dependent of php.ini 2015-03-25 03:09:24 +01:00
Juan Leyva
116c4a62c7 MDL-49425 webservices: Unit tests for the new settings 2015-03-20 14:44:19 +01:00
Juan Leyva
14ae63be25 MDL-49333 webservices: Additional unit tests for core_get_site_info 2015-03-06 11:34:42 +01:00
Rajesh Taneja
623a32e50d MDL-43736 Events: Updated unit test to test context not used in event 2014-01-29 11:39:50 +08:00
Frederic Massart
26422a66ad MDL-40050 webservice: Moving new events test file to right location 2013-10-02 13:10:45 +08:00
Frederic Massart
ee2df1a8b2 MDL-40050 webservice: Remove token from events 2013-10-02 13:00:28 +08:00
Frederic Massart
d733a8ccc3 MDL-40050 webservice: Replace add_to_log() with new events 2013-09-24 15:20:18 +08:00
Damyon Wiese
106c55fb9c MDL-22236 Webservice file upload - Allow webservice file uploads direct to a draft filearea.
Via post to /webservice/upload.php
2013-08-08 09:57:57 +08: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
Damyon Wiese
44b3927b70 MDL-39563: Change to use $CFG consistently 2013-07-15 15:01:39 +08:00
Juan Leyva
9184d44ded MDL-39563 Fixing mobilecssurl is not being returned in WebService, phpunit tests 2013-07-11 16:25:17 +02: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
Jerome Mouneyrac
87ede25c9b MDL-35593 core_webservice_get_site_info returns version number set to PARAM_TEXT and PARAM_FLOAT 2012-12-03 10:47:38 +08:00
Jerome Mouneyrac
92fa81d387 MDL-35998 get_site_info return current_language() 2012-11-02 18:03:20 +08:00
Jerome Mouneyrac
33af788210 MDL-35998 New mobile menu: with CSS url + existing enable mobile web services 2012-10-31 14:25:30 +08:00
Eloy Lafuente (stronk7)
498bc10c36 MDL-34962 Tidy up tests a bit 2012-09-11 19:38:12 +02:00
Paul Charsley
639bc8b2f3 MDL-34962 added release number to returned values 2012-09-07 18:19:01 +12:00
Dan Poltawski
1b1ad55b9f MDL-33995 - unit tests: fix class name collision 2012-07-02 14:53:32 +08:00