115 Commits

Author SHA1 Message Date
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
6d2df90a0c MDL-65959 badges: Unit and Behat tests 2020-10-27 00:27:19 +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
Sara Arjona
705c94a98b MDL-69054 core_badges: allow editing OBv1.0 backpacks 2020-08-14 17:09:10 +02:00
Sara Arjona
cbe0bb91fd MDL-68905 core_badges: remove issuer details from edit page
In MDL-68746 issuer details fields were removed from the badges
form, because they are filled from the site settings.
This is a regression because these fields should be removed also
from the edit page.
2020-06-03 19:38:09 +02:00
Sara Arjona
dcbc830cfa MDL-68746 core_badges: fix behat error with issuername 2020-05-28 11:20:46 +02:00
Jake Dallimore
b08e4b5cd6 Merge branch 'MDL-68746-master' of git://github.com/sarjona/moodle 2020-05-28 11:56:23 +08:00
Sara Arjona
a80541ea90 MDL-68567 badges: add/remove site backpacks 2020-05-22 09:01:59 +02:00
Sara Arjona
630a19ebd5 MDL-68746 core_badges: remove Issuer details from badges form
When OBv2.0 support was added, the issuername and issuercontact
fields were changed to static.
In order to avoid confusion for the user, these fields shouldn't
be displayed for OBv2.0 or higher.
2020-05-20 08:51:52 +02:00
Tung Thai
15a00bead1 MDL-66992 core_badges: Add support to Open Badges 2.1 2020-05-17 20:01:55 +07:00
Andrew Nicols
7afd16ad84 MDL-66109 behat: Require newline at EOF
This change enables the gherkinlint rule to require a new line at the
end of the file. This change is in keeping with existing Moodle coding
style guidelines.
2020-05-11 11:07:49 +08:00
Sara Arjona
f958f5c19b MDL-66357 core_badges: remove mozilla backpack references
Mozilla backpack closed a few months ago. It was moved to Badgr.io
(as OBv1.0) but as we're also supporting Badgr.io OBv2.0, it
makes no sense to leave old references to Mozilla backpack there.
2020-04-03 08:09:55 +02:00
Silvia Pinheiro
ae1556ad93 MDL-62836 badges: Add behat test for the new group selector 2019-07-12 18:13:37 +02:00
Damyon Wiese
8f7fba80d1 MDL-65544 badges: Any all criteria
When testing any vs all aggregation method, we expect a different result
when we have looped all the competencies and they all passed or failed.
2019-05-13 10:50:05 +08:00
Damyon Wiese
7444ba743f MDL-63262 badges: More changes for badgr.io
This commit combines several changes:
* Show authentication errors.
* Show more detailed authentication errors
* When the site backpack is different to the user backpack, show a warning
* Do not duplicate the apiversion and backpackurls in each user backpack.
* Do not support different issuer information for each badge with Open Badges v2.
* Add obversion to assertion url
* Combine separate badges upgrade steps and bump the version number.
* Don't show private collections.
* Push the larger image size to backpacks (512x512).
* BADGE_BACKPACKURL is deprecated
* Don't use property alignments, only alignment
2019-05-03 15:00:01 +08:00
Damyon Wiese
1837b1d5fd MDL-63262 badges: Coding style 2019-05-03 15:00:00 +08:00
Damyon Wiese
aae219acce MDL-63262 badges: Add badgr.io
Upgrade the support for Open Badges 2 to support a real open badges 2 backpack.
Moodle can only talk to one backpack at a time, so after switching backpacks, users
will have to manually disconnect and then reconnect their backpack to the new one.

This commit combines several changes:
* Split classes into badges namespace
* Publish expiry data with a badge
* Publish badge alignments in badges exported to the backpack.
* Export the criteria for a badge to the backpack.
2019-05-03 15:00:00 +08:00
Sara Arjona
bef6805656 Merge branch 'MDL-64702-master' of git://github.com/damyon/moodle 2019-04-29 08:34:21 +02: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
0dc93da62a MDL-64702 badges: Add to privacy
Add endorsement, related badges and alignment to privacy export.
2019-04-23 11:13:55 +08:00
Damyon Wiese
da5e19a128 MDL-63876 badges: Do not call tool_lp directly 2019-03-29 11:31:15 +08:00
Damyon Wiese
f94786e0e1 MDL-63876 badges: Add competency criteria
Properly integration badges with competencies provided in Moodle.

Automatically grant the badge when the defined competencies are marked as proficient.
2019-03-29 11:31:15 +08:00
Damyon Wiese
e8bfd9b4a9 MDL-63876 badges: Remove invalid table from badges 2019-03-29 11:30:09 +08:00
Sara Arjona
22348a3b96 MDL-62631 badges: Add manage/add badges buttons on Badges page
Direct access from the navigation Badges section to the "Manage badges"
and "Add a new badge" buttons.
2019-02-22 08:02:35 +01:00
Stephen Bourget
3e42942d73 MDL-63614 badges: Add COMPLETION_FAIL support to badge criteria 2018-12-19 10:16:51 -05:00
David Mudrák
94693027e0 MDL-63976 lang: Update the Behat scenarios with the new strings 2018-11-19 19:18:53 +01:00
dpalou
ce908f76a6 MDL-63729 badges: Fix course badge test 2018-11-13 10:40:27 +01:00
dpalou
5bb1889f43 MDL-63729 badges: Return new DB tables data in WS 2018-11-09 12:39:53 +01:00
dpalou
18d27ac2eb MDL-63729 badges: Return new fields in badge table in WS 2018-11-09 12:11:04 +01:00
Jun Pataleta
9639cb487e MDL-58454 badges: Fix related badge deletion
* When deleting a badge, delete badge_related records where this badge
is also set as the related badge.
2018-11-06 11:47:20 +08:00
Sara Arjona
5a1ea82835 MDL-58454 badges: Fix some minor errors for Open Badges v2 2018-11-05 18:41:54 +01:00
Tung Thai
d363a5c2e6 MDL-58454 badges: Open Badges Specification Version 2.0 Changes 2018-11-05 14:20:46 +01:00
Mihail Geshoski
541982c01e MDL-63606 core_badges: Add support for removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-30 16:41:44 +08:00
Víctor Déniz Falcón
02fda279ed MDL-57281 behat: deprecated step definition I navigate to node in
Definition step deprecated and affected tests modified.
2018-08-20 12:53:26 +01:00
Frédéric Massart
d498287fd7 MDL-62167 core_badges: Implement privacy API 2018-04-27 10:49:48 +08:00
David Monllao
27fef51d48 MDL-55491 badges: Add missing format_string call
Extra version bump + trailing whitespace removal.
2018-04-11 17:55:45 +02:00
Stephen Bourget
75653a3068 MDL-55491 badges: Add cohort as badge criteria 2018-04-09 11:03:30 +02:00
Stephen Bourget
cfdd8d12dd MDL-61203 badges: Allow profile picture as badge criteria 2018-01-16 10:18:23 -05:00
Jun Pataleta
ccb8edbff5 MDL-50666 behat: Make feature names unique
* We need to have unique feature names for our Behat tests.
* I also removed the custom Behat tag @role_visibility as we only allow
Behat tags with the component name in Frankenstyle format.
2017-12-20 13:37:28 +13:00
Andrew Hancox
a63cd3e2ca MDL-50666 core: Add function get_viewable_roles to set role visibility 2017-12-19 13:53:23 +13:00
Damyon Wiese
a569a33097 Merge branch 'MDL-59875_m35v1' of https://github.com/sbourget/moodle 2017-12-06 19:53:31 +13:00
Stephen Bourget
a7370e0dd0 MDL-59875 Badges: Allow badges to be criteria for other badges 2017-11-28 08:03:02 -05:00
Sara Arjona
d77a6026d2 MDL-46768 core_badges: changed badge name type from FILE to TEXT 2017-11-24 11:34:15 +01:00
Simey Lameze
7698ecb2c0 MDL-58438 core_badges: fix behat issues on award badge feature
Part of MDL-55611 epic.
2017-04-04 11:01:55 +01:00
Simey Lameze
fdeeaff954 MDL-58265 core_test: replace I turn editing on steps
Also remove few more unnecessary steps that redirects behat to
site home page to actually get to the course.

Part of MDL-55611 epic.
2017-04-03 11:37:07 +08:00
Simey Lameze
c987d1b2ef MDL-58265 core_test: replace all uses of I follow course steps
Part of MDL-55611 epic.
2017-04-03 11:37:07 +08:00