Commit graph

2906 commits

Author SHA1 Message Date
Jun Pataleta
4b39124bf8 Merge branch 'MDL-72701-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2021-12-23 12:10:53 +08:00
Andrew Nicols
f58768ee9e MDL-72701 unit tests: Fix broken @covers annotations 2021-12-21 09:24:06 +08:00
Eloy Lafuente (stronk7)
eac985d755 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:09 +01:00
Eloy Lafuente (stronk7)
d6e00bc466 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:09 +01:00
Paul Holden
e61a1e9ec3 MDL-72728 behat: switch import course steps to native execute method.
The previous iteration using the behat_form_field class directly
didn't explicitly require the file that defines this class, and in
Goutte runs this led to fatal errors (class not found).
2021-11-26 19:07:46 +00:00
Eloy Lafuente (stronk7)
0de172734c MDL-72950 restore: Avoid qcat conflicts with matching contexts
Though it's really rare for this to happen (it only was discovered
when running unit tests with Oracle), it's possible to get
problems restoring courses when context ids in the backup file
do match existing contexts in the restore target site in certain
ways (see the issue for more information).

This change just ensures that every call to the method (that
happens 4 times, for sys, coursecat, course and module levels):

prechek_precheck_qbanks_by_level()

Is processed always for that level. Before the patch it was
possible (hardly but possible) to return question categories
belonging to another level when some qcats contexts were matching
between the backup file and the target site.
2021-11-06 11:06:35 +01:00
Paul Holden
294fa223c9 MDL-70823 blocks: safer unserializing during block restore. 2021-11-03 16:57:15 +01:00
Paul Holden
30830852bf MDL-72309 course: make category a required field in forms.
Course category fields were changed en masse from simple select
elements to autocompletes in 93d72205, but weren't defined as
required fields. This could lead to exceptions and/or unexpected
behaviour if their values were cleared prior to form submission.
2021-10-04 08:11:40 +01:00
Eloy Lafuente (stronk7)
0bc281384d Merge branch '71093-moodle311-backup-honor-formatstringstriptags' of https://github.com/DSI-Universite-Rennes2/moodle into MOODLE_311_STABLE 2021-09-14 22:22:15 +02:00
Eloy Lafuente (stronk7)
4053ab14d6 Merge branch 'MDL-71121-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2021-08-31 23:13:07 +02:00
Andrew Nicols
81ee8fe275 MDL-71055 behat: Update core settings to use generator
These changes have only been applied to settings which were already
using settings names and values, but which were still using the UI.
2021-08-23 12:23:03 +08:00
Julien Boulen
63e37835e0 MDL-71093 backup: fix backup when activity names use HTML tags 2021-08-19 11:24:34 +02:00
Tim Hunt
1c25e9ec53 MDL-72265 backup: fix checking of override capabilites on restore
Thanks to Peter Dias <peter@moodle.com> for his help with the unit test.
2021-08-05 14:28:37 +01:00
Paul Holden
f8cffa2803 MDL-71121 backup: apply config defaults for async backups. 2021-08-02 23:35:03 +01:00
Andrew Nicols
613cd69cbd MDL-71113 javascript: Improve basic JS Documentation 2021-06-18 09:38:05 +08:00
Andrew Nicols
e214af5720 MDL-71113 js: Fix all jsdoc warnings 2021-06-18 09:38:05 +08:00
Eloy Lafuente (stronk7)
370a38484f Merge branch 'MDL-71580-311-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_311_STABLE 2021-05-12 23:00:00 +02:00
David Mudrák
857d7b613f MDL-71580 lang: Fix reworded strings in tests 2021-05-12 17:11:57 +02:00
Eloy Lafuente (stronk7)
71d0cfefab MDL-71583 versions: bump all versions and requires near release
version = 2021051700 release version
requires= 2021051100 current rc1 (week7roll1) version

Note that, because we are under parallel development period,
this is being done in the branch that is going to be released
(MOODLE_311_STABLE already existing) for Moodle 3.11.0 and
not in master, that is the one getting the bump under normal
(non-parallel) periods.
2021-05-11 18:50:34 +02:00
Ilya Tregubov
be5eff78ab MDL-66431 core: Fix behat tests.
Move activity creation to data generators. Only fixing those
tests failing due to removing usemodchooser preference.
2021-05-01 16:18:56 +02:00
Jun Pataleta
b4edfb9031 Merge branch 'MDL-71455-311' of https://github.com/dcai/moodle into MOODLE_311_STABLE 2021-04-29 18:05:17 +08:00
Dongsheng Cai
0ebdf3f1b4 MDL-71455 core_backup: fix course completion options when backup/restore 2021-04-29 11:42:47 +10:00
Adrian Greeve
702ea8590e Merge branch 'MDL-71051-311-2' of git://github.com/marinaglancy/moodle into MOODLE_311_STABLE 2021-04-29 09:22:37 +08:00
Marina Glancy
3c9e54eafa MDL-71051 core_user: always use API when working with profile fields 2021-04-28 11:49:27 +02:00
Andrew Nicols
1d7bbdfc08 Merge branch 'MDL-71389-311' of git://github.com/marinaglancy/moodle into MOODLE_311_STABLE 2021-04-28 09:49:48 +08:00
Sara Arjona
7ccfb2410a Merge branch 'MDL-71136_311' of https://github.com/TomoTsuyuki/moodle into MOODLE_311_STABLE 2021-04-22 13:56:43 +02:00
abgreeve
3f1727adcf Merge branch 'MDL-28452-311' of git://github.com/bmbrands/moodle into MOODLE_311_STABLE 2021-04-22 09:35:18 +08:00
Marina Glancy
6d107d48c9 MDL-71389 various: changes to unittests due to php8 changes:
- some engine error messages changed
- some warning levels changed
- the carriage return symbol randomly appears
- one phpunit assertion fails and not really representative of anything
2021-04-21 12:39:02 +02:00
Bas Brands
37f26f211f MDL-28452 core_user: migrate social profile fields
Create a new profile field type, move all existing content of the fields
'icq', 'skype', 'aim', 'yahoo', 'msn' and 'url' in the mdl_user table to
theses new profile fields if needed.

AMOS BEGIN
MOV [aimid,core],[aimid,courseimage,profilefield_social]
MOV [yahooid,core],[yahooid,profilefield_social]
MOV [skypeid,core],[skypeid,profilefield_social]
MOV [icqnumber,core],[icqnumber,profilefield_social]
MOV [msnid,core],[msnid,profilefield_social]
MOV [webpage,core],[webpage,profilefield_social]
AMOS END
2021-04-21 11:24:34 +02:00
Eloy Lafuente (stronk7)
52dff48650 Merge branch 'MDL-63381_311_v3' of https://github.com/TomoTsuyuki/moodle into MOODLE_311_STABLE 2021-04-20 23:58:48 +02:00
Eloy Lafuente (stronk7)
cb6cdc0fd3 Merge branch 'MOODLE_311_STABLE-MDL-71190-backup-lastaccess' of https://github.com/ScottVerbeek/moodle into MOODLE_311_STABLE 2021-04-19 18:52:30 +02:00
ScottVerbeek
d687a56fed MDL-71190 backup: Include users last access to course
Backup the table user_lastaccess which holds data for when a user last accessed a course.
And also restore to the table user_lastaccess from the .xml file created in the backup.
2021-04-19 12:04:30 +10:00
Eloy Lafuente (stronk7)
c86f286543 MDL-71367 unit tests: Add missing ->destroy() call to test backups
As part of the tests preparations, some backups are created, but
the tests aren't calling to their ->destroy() method at the end.

The destroy() method is needed to go cleaning and unsetting various
objects that, only then, will free resources, like memory, open files...

This isn't critical under Unix OSs... but Windows is really sensible
and keeps all open files locked, so any write operation on them fails.
2021-04-19 00:03:46 +02:00
Sara Arjona
b3209c0ac5 MDL-69331 core_h5p: fix behat errors 2021-04-16 13:07:09 +02:00
Andrew Nicols
b816aa102d Merge branch 'MOODLE_311_MDL-71233' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2021-04-16 08:06:23 +01:00
Sara Arjona
d3b93906d5 MDL-69331 core_h5p: Add missing @core_h5p tag 2021-04-15 09:33:02 +02:00
Sara Arjona
d0d7fc835e MDL-69331 core_h5p: Add missing library files to behat tests
Some of the pre-existing behat tests were creating content into the
content bank using the generator but the H5P content-type libraries
weren't uploaded.
Since MDL-69331, libraries need to be deployed previously (so fake
H5P content-type won't be displayed if these libraries don't exist).
2021-04-15 09:33:02 +02:00
Tomo Tsuyuki
c12ef07260 MDL-63381 backup: Have an option to import permissions
Add options to use permission settings for import / restore
2021-04-13 13:21:54 +10:00
Amaia Anabitarte
78a10f1724 MDL-71107 core_contentbank: Fill content author when copying a course
'usercreated' and 'usermodified' fields can not be always mapped.
We are filling those fields with 'old' users when working on the same
site, or with current user when working on a different instance.
2021-04-07 10:03:38 +02:00
Tomo Tsuyuki
cf176f2a7f MDL-71136 backup: Fix moodle_exception path. 2021-03-30 10:56:30 +11:00
Mikhail Golenkov
0b4161c14d MDL-71233 backup: Fix Moodle version for MDL-69418 2021-03-30 10:43:53 +11: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
Mihail Geshoski
66f592e71b MDL-67870 backup: Skip value change if setting is locked by hierarchy
The given condition in the if statement did not take into account cases
when the setting is locked by hierarchy. Settings which are locked by
hierarchy should should keep their current values which were inherited
from the parent.
2021-03-22 15:33:39 +08:00
Eloy Lafuente (stronk7)
c0c276e49d Merge branch 'MDL-70901-311' of git://github.com/marinaglancy/moodle into MOODLE_311_STABLE 2021-03-18 00:40:55 +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)
88847544c4 Merge branch 'MOODLE_311_MDL-71044_v3' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2021-03-16 22:39:02 +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)
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
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
Mikhail Golenkov
68588a8f47 MDL-71044 backup: backup_cleanup_task task to remove old files 2021-03-07 21:48:47 +11:00