574 Commits

Author SHA1 Message Date
Jun Pataleta
1c15796a75 MDL-70821 behat: Use new activity completion steps for Behat tests
Replace usages of completion Behat steps that check for the completion
checkboxes with the new activity completion Behat steps.
2021-04-12 11:41:37 +08:00
Eloy Lafuente (stronk7)
7467584517 Merge branch 'MDL-69102-master' of https://github.com/martygilbert/moodle 2021-04-11 23:52:41 +02:00
Eloy Lafuente (stronk7)
377d6dc12a
MDL-69102 phpunit: Add test to cover ALL cohort criteria
That way we can check that the expectations are
working ok for every database. Previously only the
ANY case was being tested.

Also, convert them to course badges and check, via
review_all_criteria() that the SQL structures returned
by award_criteria_cohort->get_completed_criteria_sql()
doesn't fail and return the expected counters.
2021-04-10 12:31:22 -04:00
Marty Gilbert
d8085396de
MDL-69102 badge: Fixes broken WHERE clause
When buildilng the 'WHERE' clause, the SQL generated
a query that selected any user who was a member of the
**last** group, not all of the groups.

I believe the query has to be re-worked so that it only
returns users who are in ALL of the groups. This can
be done by a GROUP BY and HAVING.
2021-04-10 12:26:22 -04:00
Víctor Déniz
25b8cb9783 Merge branch 'MDL-71116-master' of git://github.com/sarjona/moodle 2021-04-08 01:01:15 +01:00
Eloy Lafuente (stronk7)
67b2e62fe7 Merge branch 'MDL-70963-master' of git://github.com/sarjona/moodle 2021-03-29 12:39:32 +02:00
Sara Arjona
51ec496f75 MDL-70963 core_badges: Use expected JSON format for OBv2.1
This patch adds some changes to guarantee that OpenBadges 2.1 (OBv2.1)
will return always the same JSON format that OBv2.0 (because the only
difference between both versions it's the BadgeConnect API).
2021-03-29 10:02:58 +02: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
Sara Arjona
50e9e5b2bd MDL-69792 core_badges: deprecated backpack.js and BADGE_BACKPACKURL
Final deprecation for constant BADGE_BACKPACKURL (it has been removed)
and badges/backpack.js file (it has been removed too).
Besides, some methods have started the deprecation process too:
 - badges_check_backpack_accessibility
 - badges_setup_backpack_js()
 - badges_local_backpack_js()

Apart from that, string 'addbackpack' has been deprecated here
because it's not used anywhere.
2021-03-19 15:13:03 +01:00
Sara Arjona
2c8de780d5 MDL-71116 core_badges: Backpack URLs with more than 50 chars
Backpack URLs (web and API) can have up to 255. However, the form
for creating/editing them, doesn't allow URLs with more than 50
characters. This patch align limitation to DB value (255).
2021-03-19 15:08:12 +01:00
Jun Pataleta
8eab098f26 Merge branch 'MDL-70911-master' of git://github.com/sarjona/moodle 2021-03-11 17:41:46 +08:00
Sara Arjona
0a0729f48e MDL-70911 core_badges: Add navigation menu in classic
Manage backpacks page wasn't displaying the navigation and administration
menus when using classic theme (it's unrelated to changes done here).
This patch fixes this unexpected behaviour (raised thanks to behat tests).
2021-03-11 09:00:35 +01:00
Eloy Lafuente (stronk7)
90db228323 Merge branch 'MDL-70726-master' of https://github.com/NashTechOpenUniversity/moodle 2021-03-11 00:11:15 +01:00
Jun Pataleta
5a7c629f7c Merge branch 'MDL-45242-master' of https://github.com/sammarshallou/moodle 2021-03-10 23:39:30 +08:00
sam marshall
987e55452f MDL-45242 Course: Enrol feature supports custom profile fields 2021-03-10 10:57:11 +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
Jun Pataleta
644f32784d Merge branch 'MDL-70911-master' of git://github.com/sarjona/moodle 2021-03-10 16:15:43 +08:00
Sara Arjona
49c1d41a60 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:09:05 +01:00
Sara Arjona
066e998400 MDL-70911 core_badges: Add support to backpacks sortorder
Before removing $CFG->badges_site_backpack setting, admins should be
able to re-order the existing site-backpacks (because then, the first
one will be treated as the default one).
This patch adds the sort order feature to the backpack list.
2021-03-10 08:29:47 +01:00
Eloy Lafuente (stronk7)
9e1da41763 Merge branch 'MDL-63961-master' of git://github.com/sarjona/moodle 2021-03-10 00:19:31 +01:00
Sara Arjona
a306fd7a18 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-08 09:24:53 +01:00
Amaia Anabitarte
d0bea8aa5e 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:19:55 +07:00
Eloy Lafuente (stronk7)
476a0ad905 Merge branch 'MDL-67974-master' of git://github.com/sarjona/moodle 2021-03-01 22:33:17 +01:00
Sara Arjona
9e5655b7c7 MDL-70913 core_badges: Use and update properly sortorder
Sortorder field in badge_external_backpack was updated with a wrong
value. This patch fixes this behaviour and adds sortorder as
sorting criteria for displaying the list of site backpacks.

In the phpunit method reviewed for covering this, a couple of
assertEquals() calls have been changed too to put the expected value
first.
2021-03-01 13:04:00 +01:00
Sara Arjona
5b4204a584 MDL-67974 core_badges: Badge expiry date when hover
Text displayed for expired badges when the user hovers over the
warning (!) icon has been fixed in the "Issued badge information"
page.
2021-02-23 15:23:56 +01:00
Sara Arjona
49c5b85eba MDL-63961 core_badges: Use high-resolution image
High-resolution image for a badge (f3) should be sent to external
backpacks through JSON and WS methods.
Besides, when a badge is cloned, the high-resolution image should be
used to avoid the copied looks blurry.
2021-02-22 12:43:06 +01:00
Sara Arjona
329b87720a MDL-70264 badges: remove badges/oauth2callback.php
File badges/oauth2callback.php has been removed and now badges
API will use admin/oauth2callback.php because it makes no sense having
it twice.

Credits go to Andrew Nicols for raising it!
2021-02-11 16:56:56 +01:00
Sara Arjona
e85c7179b2 MDL-70139 core_badges: fix invalid request when sending to backpack
Having mixed $data in badge exporters is causing some issues.
As all these exporters are using $data as an object, $data can be
converted to object in the constructor, to avoid errors and get
the expected behaviour always.
2020-11-06 16:05:44 +01:00
Andrew Nicols
7d713f6060 Merge branch 'MDL-70066-master' of git://github.com/lameze/moodle 2020-11-05 10:00:33 +08:00
Ferran Recio
9ca1707f5a MDL-70119 core_badges: fix tab names 2020-11-04 12:49:12 +01:00
Simey Lameze
edf2df07fe MDL-70066 badges: change usages of array_key_exists to isset 2020-11-04 15:50:15 +08:00
Sara Arjona
ee0c9d2efd MDL-70059 core_badges: avoid duplicate key error
When 2 or more backpack were created without credentials,
a "Duplicate key value violates unique constraint" error
was raised because externalbackpackid was not taking the
correct value.
Other improvements have been done to the code too in order
to make it more readable.
2020-11-02 10:41:38 +01:00
Peter Dias
ef447fc7ef MDL-65959 badges: Allow cross domain/protocol functionality - obv2 2020-10-27 00:28:16 +08:00
Peter Dias
d3af959238 MDL-65959 badge: Enable OB2.1 *connection* with cross domain ability 2020-10-27 00:27:20 +08:00
Peter Dias
f451ef06cd MDL-65959 badge: Reset external_identifiers if backpack details modified 2020-10-27 00:27:19 +08:00
Peter Dias
8308d10561 MDL-65959 badge: Confirm assertion data is updated before awarding 2020-10-27 00:27:19 +08:00
Peter Dias
6d2df90a0c MDL-65959 badges: Unit and Behat tests 2020-10-27 00:27:19 +08:00
Peter Dias
96ec45cb17 MDL-65959 badges: Do not use badge user preference after verification 2020-10-27 00:27:19 +08:00
Peter Dias
3cae9421a8 MDL-65959 badges: Update the implementation to use admin set backpack 2020-10-27 00:27:19 +08:00
Peter
b6435e0934 MDL-65959 core_badges: Allow ability to upload badges cross domain. 2020-10-27 00:27:18 +08:00
Peter
1c4620bce6 MDL-65959 core_badges: Unrestricted user's badger account
* Restructure the email to be backpack specific
* Amended table defintion and functions
2020-10-25 23:03:59 +08:00
Eloy Lafuente (stronk7)
a293b3aea8 MDL-67673 phpunit: Remove deprecated non-public attribute assertions
With PHPUnit 8 a good number of assertions, all them related with
operations on non-public attributes have been deprecated. And will
be removed with PHPUnit 9.

The main point is that unit tests shouldn't be testing non-public
APIs (good practice) and those assertions were an error originally.

See https://github.com/sebastianbergmann/phpunit/issues/3338 for
the complete list and other details.

When possible (the attributes being checked are public), the change
is simple, just switching to normal assertions.

When the attributes are not public we need to find a workaround
to be able to test the same using public APIs, or use Reflection,
or remove the tests.

For the records, this is the regexp used to find all the cases:

ag '>(assertAttribute|attribute\(|readAttributte|getStaticAttribute| \
    getObjectAttribute)' -G "test.php"
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
f94195c320 MDL-67673 phpunit: Remove deprecated assertInternalType()
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

assertInternalType() is deprecated and will be removed in
PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(),
assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(),
assertIsResource(), assertIsString(), assertIsScalar(),
assertIsCallable(), or assertIsIterable() instead.
2020-10-21 12:45:59 +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
Juan Leyva
417e5b9f84 MDL-65976 completion: New course completion message provider 2020-09-29 13:40:32 +02:00
Paul Holden
ad7d46ed2e MDL-63387 course: use renamed role names, update Behat tests.
Specify that we want both role names (renamed course role plus
original).
2020-09-01 12:05:20 +01:00
Adrian Greeve
ea1437df64 Merge branch 'MDL-69055-master' of git://github.com/sarjona/moodle 2020-08-20 12:00:51 +08:00
Andrew Nicols
0fe7780c2f Merge branch 'MDL-69054-master' of git://github.com/sarjona/moodle 2020-08-20 07:28:19 +08:00
Andrew Nicols
d48a0a9a5d Merge branch 'MDL-61215-master' of git://github.com/sarjona/moodle 2020-08-20 07:14:15 +08:00
Bas Brands
4394f9e358 MDL-67735 theme_boost: remove bs2 and bs4alpha compatibility css 2020-08-17 08:16:42 +00:00