189 Commits

Author SHA1 Message Date
Dani Palou
6ab826fb23 MDL-75788 behat: Use profile field generators in existing tests 2022-12-02 14:54:47 +08:00
Andrew Nicols
08a19dbed8 Merge branch 'MDL-76403-master' of https://github.com/junpataleta/moodle 2022-11-24 10:18:22 +08:00
Víctor Déniz
d4de7b630e MDL-76395 lang: Use fixed strings in tests 2022-11-23 17:03:58 +00:00
Helen Foster
74828e8149 MDL-76395 lang: Import fixed English strings (en_fix) 2022-11-23 17:03:58 +00:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Julien Boulen
7321b16ecb MDL-75792 availability: sort groupings list by name 2022-11-14 13:08:04 +01:00
Hien Dinh
59cb744ead MDL-72490 availability: Show error if conflict in date restriction 2022-09-26 11:21:49 +01:00
Tim Hunt
797b9fbd62 MDL-75548 misc: final Required parameter follows optional notices 2022-08-22 15:20:13 +01:00
Eloy Lafuente (stronk7)
ed0913d45b MDL-74358 availability: Avoid php8 problem with array_values(null) 2022-06-17 11:09:46 +02:00
Eloy Lafuente (stronk7)
9f53b0e965 MDL-73971 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- 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:

- Some fixtures, initially defined in the test files have been
  moved to new files in fixtures subdirectory, leaving the unit
  test files clearer:
  - moodle2_course_format_test.php
- Rename wrong named test:
  - baseoptiogroup_test = baseoptigroup_test
2022-05-06 18:29:11 +02:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Dongsheng Cai
f97b86e841 MDL-72991 Course: Partial course cache rebuild
When updating/deleting a section/module, the system now only
invalidate of the element (section/module), not the whole course cache
Also, the system now only recalculate the cache for element (section/module)
if necessary, not the whole course cache

Move module/section purging to course_modinfo:
  + course_modinfo::purge_course_section_cache_by_id was created to purge section by id
  + course_modinfo::purge_course_section_cache_by_number was created to purge section by number
  + course_modinfo::purge_course_module_cache was created to purge module
2022-03-17 15:34:01 +07:00
Eloy Lafuente (stronk7)
4003e31983 MDL-73785 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- 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:

- When belonging to other components and being valid api:
  - analytics related tests have been moved to tests/analytics subdir.
  - backup & restore related tests have been moved to tests/backup subdir.
  - events related tests have been moved to tests/event subdir.
  - privacy related tests have been moved to tests/privacy.
  - task related tests have been moved to tests/task subdir.
- Some simple renames, not including the component part anymore (not
  needed now that they are namespaced):
  - some xxxlib_test.php have been renamed lib_test.php
    (when they where testing the corresponding lib.php).
  - cache stores tests have been all renamed store_test, originally
    each one had its own name (file_test, apcu_test, redis_test...)
  - assign feedback tests have been all renamed feedback_test, originally
    each one had its own name (file_test, editpdf_test...)
2022-03-03 12:19:30 +01:00
Simey Lameze
047a947879 MDL-73756 availability: remove modinfo parameter from get_data call 2022-03-01 10:21:56 +08:00
Andrew Nicols
641240ce63 Merge branch 'MDL-72837-master' of https://github.com/sammarshallou/moodle 2022-02-25 10:59:54 +08:00
sam marshall
416e0bc27f MDL-72837 core_availability: Fix minor problem with test script
The test script did not correctly rebuild course cache after changing a
cached value in database. While this did not cause failures in the past,
it will after upcoming changes.
2022-02-23 16:38:37 +00:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Jake Dallimore
b6e9d54a38 MDL-73758 availability: fix info::is_available_for_all()
Should only return true early when the config setting is disabled,
not when it's enabled.
2022-02-03 16:41:44 +08:00
Bas Brands
3652222ec9 MDL-71691 block_social_activities: activity styling 2021-12-08 13:14:05 +01:00
Bas Brands
35a5288554 MDL-71691 core_behat: behat fixes for changed course design 2021-12-08 13:14:05 +01:00
Bas Brands
70d86ac570 MDL-71691 core_availability: add show more link 2021-12-06 10:54:05 +01:00
Mathew May
b983003e2e MDL-70197 navigation: Remove old navigation elements and migrate behat 2021-11-29 15:47:42 +08:00
Adrian Greeve
b72fa5fbae MDL-71912 behat: Updating various tests using assign steps. 2021-11-09 11:24:08 +08:00
Víctor Déniz
6c920c9f56 Merge branch 'MDL-72995-master' of https://github.com/ilyatregubov/moodle 2021-11-04 23:42:31 +00:00
Ilya Tregubov
ac93013cd1 MDL-72995 core_course: Revert "MDL-55231: Partial course cache rebuild"
This reverts commits c1468388bcecec43e671335db8edfc839494e710,
c1468388bcecec43e671335db8edfc839494e710 and
9a900492bc14176c4f56b8e600ef459069a3ec7a.
2021-11-04 11:57:58 +02:00
Angelia Dela Cruz
89c4c803e8 MDL-72655 behat: Use assign generators
Replace steps that manually add assignment instances via the UI
and use Behat generators. This improves the speed of Behat test
runs.
2021-11-03 11:34:26 +08:00
Dongsheng Cai
9a900492bc MDL-55231 core_course: Partial course cache rebuild 2021-10-26 19:08:15 +11:00
abgreeve
edb655e35c Merge branch 'MDL-72578-master' of git://github.com/ferranrecio/moodle 2021-10-08 09:12:57 +08:00
Ferran Recio
41b4625693 MDL-72578 course: activity render to output classes 2021-10-07 17:17:29 +02:00
sam marshall
4dd7f2ac54 MDL-72339 core_availability: Unsafe to use format_string in description
The availability condition get_description method is called while
gathering data for the modinfo object. As such it is not safe to
call other functions which might rely on modinfo, such as format_string
(if using filters which access modinfo).

This change provides a mechanism to call format_string later, and also
a general callback to do other stuff later as well if needed. It uses
the same approach already taken to make activity names work correctly
in the availability_condition class.
2021-10-06 11:28:26 +01:00
Jun Pataleta
385438b463 Merge branch 'MDL-72589' of https://github.com/stronk7/moodle 2021-09-16 09:46:56 +08:00
Eloy Lafuente (stronk7)
8fac400199 MDL-72589 behat: Create course with 3 sections (workaround)
With the default 5 sections course, after editing the activities, the
"log out" link is exactly on the edge of the view port. It's one of
those cases where Chrome fails to click/press it (have tried both).

So just make the course to have 3 sections is enough to avoid the
problem. Some day Chrome will fix that problem but, until then...
we cannot do much apart from changing the window size or try to
configure things to show differently.
2021-09-15 20:25:33 +02:00
Mihail Geshoski
7d821080f0 MDL-72093 navigation: Update behat tests 2021-09-14 12:02:35 +08:00
Andrew Nicols
776f4bd80c MDL-72179 behat: Make use of page resolvers 2021-07-26 15:14:28 +08:00
Víctor Déniz
e41ff4f15e Merge branch 'MDL-71402' of git://github.com/paulholden/moodle 2021-05-06 16:46:19 +01:00
Paul Holden
2877501ad8 MDL-71402 availability: fix group restriction button in mod form.
* The button to "Add group/grouping access restriction" under
   common module settings should only be present if corresponding
   availability plugins are enabled; and
 * Prevent the same button behaving as a submit button, which
   intercepted the user hitting return in the form and added a
   restriction without deliberate action taken by the user.
2021-05-06 14:20:37 +01:00
Ilya Tregubov
cf1cf222e7 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:22:03 +02:00
Marina Glancy
8974874018 MDL-71051 core_user: create user profile field form is now modal form 2021-04-28 11:47:22 +02:00
Marina Glancy
ef3d6a3d70 MDL-71051 core_user: use user profile generator in all tests 2021-04-28 11:47:21 +02:00
Bas Brands
f9e1c2587a 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:22:25 +02:00
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)
3ed772f418 Merge branch 'MDL-71099-master' of https://github.com/sammarshallou/moodle 2021-03-27 10:17:43 +01:00
Víctor Déniz
4d0292b3b5 Merge branch 'MDL-70537-master' of https://github.com/sammarshallou/moodle 2021-03-26 20:14:19 +00: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
sam marshall
c89ea6733c MDL-70537 Availability: Avoid recursive calls to $cm->name
These recursive calls didn't work in PHP 7.3 and below, but in PHP
7.4 they also cause a fatal error which means if you have invalid
availability data, the whole page might die.
2021-03-18 15:54:17 +00:00
Eloy Lafuente (stronk7)
ba5b6089d5 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 19:22:24 +01: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
Eloy Lafuente (stronk7)
40de097e65 MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
2020-10-21 12:46:00 +02:00