Commit graph

8549 commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
947512995e Merge branch 'MDL-68635-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2021-04-06 22:23:26 +02:00
sam marshall
fdcb789242 MDL-71215 Acceptance test: Missing Behat for webservice service_users 2021-04-06 15:18:01 +02:00
Adrian Greeve
4025e4d726 Merge branch 'MDL-70817-311-8' of git://github.com/junpataleta/moodle into MOODLE_311_STABLE 2021-04-06 12:55:32 +08:00
Jun Pataleta
25ebbe21f0 MDL-70817 admin: Remove heading for showcompletionconditions
It should be under the "Completion tracking" subheading just like in
the course form.
2021-04-02 21:56:22 +08:00
Simey Lameze
94a8b91cd3 MDL-70781 course: setting for displaying completion conditions
Part of MDL-70817
2021-04-02 21:56:22 +08:00
Simey Lameze
8b47f16926 MDL-70782 course: add setting to show activity dates
Part of MDL-70817
2021-04-02 21:56:22 +08:00
Eloy Lafuente (stronk7)
d1c41b4dbb MDL-37655 phpunit: Avoid having multiple testcase classes in 1 file
Note that there wasn't any case of multiple testcase classes in
1 file. All the cases reported in the issue were false positives
caused but other "mock/fixture" files being named _test.

So all this issue does is:

1) rename any _test suffixed class in test files, because we are
   going to start renaming a lot of test classes to _test.

2) ensure that the 2 test case classes modified in this issue,
   are already observing the filename = classname rule that will
   be implemented soon (and verigy it works).
2021-03-30 19:17:59 +02:00
Paul Holden
6dfbe60b9c MDL-68635 tool_cohortroles: observe user initial table filter. 2021-03-29 14:12:29 +01:00
sam marshall
3c688fd9cb MDL-71131 Admin: Users page incorrectly showing all name fields 2021-03-25 13:50:08 +00:00
sam marshall
3dee5cd74c 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:48:04 +00:00
Eloy Lafuente (stronk7)
b76e9b6551 Merge branch 'MDL-70689-311' of git://github.com/sarjona/moodle into MOODLE_311_STABLE 2021-03-17 23:20:50 +01:00
Jun Pataleta
3a9b41613c Merge branch 'MDL-71036_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2021-03-17 20:05:17 +08:00
Eloy Lafuente (stronk7)
50520ae4ad Merge branch 'MDL-67748-311-managewebservices' of git://github.com/mudrd8mz/moodle into MOODLE_311_STABLE 2021-03-16 19:29:04 +01:00
David Mudrák
2df0bcc7fd 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:47:01 +01:00
David Mudrák
4d49f07bbb MDL-67748 admin: Add filter to the WS tokens management page
The patch adds ability to filter the list of token by the token value,
the user and the service. Also the button to create a new token is made
more prominent and easier to spot.
2021-03-15 19:09:26 +01:00
David Mudrák
741ea63a70 MDL-67748 admin: Improve the display of tokens the user cannot see 2021-03-15 19:09:26 +01:00
David Mudrák
cb7d5a0939 MDL-67748 admin: Refactor tokens management as an external page
No need to have a dedicated admin_setting_managewebservicetokens admin
setting subclass, and yet do not use almost any of its features. So the
patch merges the list and the forms handling into a single external
page.

Similarly, it feels like overkill to have a renderer method for a
simple confirmation widget - especially given that the URLs were
hard-coded in it. So that one was dropped.
2021-03-15 19:09:26 +01:00
David Mudrák
fb91df08b3 MDL-67748 admin: Improve the display of missing capabilities
The patch improves the display of the missing capabilities on the Manage
tokens page and the Select authorised users page. The list of
capabilities is rendered in a collapsible area and does not occupy too
much space by default.

Additionally on the later page, the patch improves the display of the
list of existing authorised users so that it respects the configured
identity fields.
2021-03-15 19:09:26 +01:00
David Mudrák
582745e5b9 MDL-67748 admin: Move the web service token form to its own file 2021-03-15 16:30:16 +01:00
David Mudrák
1ab5c29ead MDL-67748 admin: Move the web services under the server administration
I suppose the original reasoning was that the web services protocols are
pluggable and that plugins can provide external function. But those are
not good reasons to put the whole Web services section under plugins.
Web services are not a plugin type and they always felt very
counter-intuitive there.

From the server administrtaion perspective, web services are similar to
scheduled tasks and therefore, they should live in the same section.
2021-03-15 16:21:23 +01:00
Mihail Geshoski
8a7fadc4ee MDL-44613 tool_behat: Update datetime format usages to strftime
Updates all existing datetime format usages to strftime in the
'time to timestamp' transformation in tool_behat behat tests.
2021-03-15 08:26:17 +08:00
Sara Arjona
c9110ffdce MDL-70689 oauth2: unit tests for new IMS OBv2.1
Apart from adding new unit tests for covering new IMS OBv2.1 issuer,
some extra tests have been added to test existing issuers and confirm
they are still working as expected after the changes.
2021-03-12 12:33:54 +01:00
Sara Arjona
a7229e4ad9 MDL-70689 oauth2: deprecate unused strings 2021-03-12 12:33:54 +01:00
Sara Arjona
9941e04857 MDL-70689 oauth2: self-register IMS OBv2.1 services
IMS OBv2.1 services have a registration endpoint to get client id
and secret.
This patch adds and implements the "register" method for the IMS
Open Badges Connect discovery system, to get the proper client id
and secret values.
2021-03-12 12:33:54 +01:00
Sara Arjona
84e51fb0fd MDL-70689 oauth2: add support to IMS OBv2.1 service
In order to make easier to create and maintain new OAuth2 services,
a couple of classes have been added:

- discovery\* contains methods related to the discovery system. Until
now, only OpenID Connect was supported by Moodle so all the code was
centralised in api.php.
With this patch, as IMS OBv2.1 has a different discovery system, a new
abstract class (base_definition) has been added to be called and let
every discovery system (OpenID Connect, IMS Badge Connect...)
implement their own methods.

- service\* . Instead of keep adding methods to the api, the service
namespace has been created to store all the standard issuer services.
An interface (issuer_interface) has been created and all the services
should implement it.
This patch creates the "IMS OBv2.1" and "Custom" services and moves
the methods for "Google" service because it uses the OpenID connect
discovery system.
2021-03-12 12:33:53 +01:00
Eloy Lafuente (stronk7)
0357efb1fc MDL-71036 phpunit: Coding style changes, 99% whitespace only
I've gone over a few of the mofified files (those
which were showing warnings and errors to CiBoT. Some of them
have been fixed completely, while others only have fixed
for the lines belonging to this issue (lib/tests/moodlelib_test.php)
for example.
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
790237a77f MDL-71036 phpunit: xml config - switch coverage info to new includes
This applies the "whitelist" => "include" changes to all the core
phpunit_coverage_info occurrences, so core won't emit any deprecation
warning (see previous commit).

At the same time, modified a bunch of comments in coverage files
to be more readable/understandable.
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
2d693cda7a MDL-71036 phpunit: Mock->setMethods() silently deprecated
The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.

Basically the now deprecated method has been split into:

- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
  artifact.

In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.

Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.

Link: https://github.com/sebastianbergmann/phpunit/issues/3770
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
3dd26fe334 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
c989d6ec61 MDL-71036 phpunit: Renamed various regexp-related assertions
In PHPUnit 9.1, the following regexp-related assertions
have been deprecated and there are new alternatives for
all them:
    - assertRegExp()     -> assertMatchesRegularExpression()
    - assertNotRegExp()  -> assertDoesNotMatchRegularExpression()

This is about to, simply, move all cases to the new alternatives.

Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md

Regexp to find all them:

    ag 'assertRegExp|assertNotRegExp' -li
2021-03-11 23:07:30 +01:00
Eloy Lafuente (stronk7)
bb4d5dbc25 Merge branch 'MDL-70726-3.11' of https://github.com/NashTechOpenUniversity/moodle into MOODLE_311_STABLE 2021-03-11 00:11:44 +01:00
Jun Pataleta
b535cf958a Merge branch 'MDL-45242-m311' of https://github.com/sammarshallou/moodle into MOODLE_311_STABLE 2021-03-10 23:38:42 +08:00
sam marshall
1d7d3c984d MDL-45242 Admin: User list supports custom profile fields 2021-03-10 10:58:09 +00:00
sam marshall
0919a04311 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:58:09 +00:00
Jun Pataleta
5e7aeb7841 Merge branch 'MDL-70911-311' of git://github.com/sarjona/moodle into MOODLE_311_STABLE 2021-03-10 16:15:36 +08:00
Sara Arjona
52fd43f54d MDL-70911 core_badges: Remove $CFG->badges_site_backpack
The $CFG->badges_site_backpack setting has been completely removed
because it's not required anymore. From now, the primary site
backpack will be the first one in the "Manage backpacks" list (so,
the one with lower sortorder value).
2021-03-10 09:10:32 +01:00
Sara Arjona
1a2db1297b MDL-70911 core_badges: Move "External backpack" to badges settings
Setting "External backpack connection" has been moved from "Backpack
settings" to "Badges settings" in order to make easier to find and
configure it.
Some extra tests have been added to cover existing behaviour and
confirm is still working as expected.
2021-03-10 08:31:22 +01:00
Sara Arjona
6e2a35733d Merge branch 'MDL-70608-311-langimportasync' of git://github.com/mudrd8mz/moodle into MOODLE_311_STABLE 2021-03-09 16:43:01 +01:00
Sara Arjona
217377d30f Merge branch 'MDL-70766-auth-config-log-MOODLE_311_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_311_STABLE 2021-03-08 11:39:19 +01:00
sam marshall
5b7b1b9a06 MDL-45242 Lib: Replace direct references to ->showuseridentity 2021-03-08 09:17:04 +00:00
sam marshall
68e576b0ed MDL-45242 Lib: Allow custom profile fields in showuseridentity 2021-03-08 09:17:03 +00:00
Amaia Anabitarte
291ff443a5 MDL-70726 behat: Fixing existing fail tests
Some of the current behat tests were wrong but not failing because of the bug in 'should not exist' step.
Once the bug is fixed, we must fix also wrong behats.
2021-03-05 14:06:43 +07:00
Ilya Tregubov
4bc3faf193 MDL-69680 lib: Replace deprecated jQuery functions 2021-03-04 12:48:06 +08:00
Eloy Lafuente (stronk7)
67c851ff81 Merge branch 'MDL-70424-auth-avoid-changes-MOODLE_311_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_311_STABLE 2021-03-04 00:29:07 +01:00
Marina Glancy
7ab4eafc02 MDL-65552 user: escape idnumber and email in table_sql 2021-03-03 23:14:54 +08:00
Paul Holden
2474bc765f MDL-65552 user: escape idnumber field on output.
This commit also corrects parameter definition of the field to
match core_user.
2021-03-03 23:14:54 +08:00
Sara Arjona
56630bd392 Merge branch 'MDL-67515-311' of git://github.com/vmdef/moodle into MOODLE_311_STABLE 2021-03-02 11:21:27 +01:00
Víctor Déniz
b46b9092b7 MDL-67515 tool_customlang: Ignore invalid component strings
After uninstalling a plugin, the translated strings remain in
tool_customlang table, throwing an exception when trying to localise
any strings. Currently there is no mechanism to
clean up customlang tables and files during the uninstall process,
so with this patch the invalid components will be ignored.
2021-03-02 09:09:08 +00:00
Sara Arjona
addd1937c1 Merge branch 'MDL-68735_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2021-03-01 16:17:32 +01:00
Eloy Lafuente (stronk7)
c886b6cf07 Merge branch 'MDL-70931-311-xmldbeol' of git://github.com/mudrd8mz/moodle into MOODLE_311_STABLE 2021-03-01 10:01:05 +01:00