Commit graph

190 commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
875591f589 MDL-74413 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:

- Moved to the level2 "privacy" namespace:
  - \mod_assign\privacy\feedback_legacy_polyfill_test
  - \mod_assign\privacy\submission_legacy_polyfill_test

- Moved to the level2 "task" namespace:
  - \core_message\task\migrate_message_data_test
  - \ltiservice_gradebookservices\task\cleanup_test
  - \message_email\task\send_email_test
  - \mod_lti\task\clean_access_tokens_test
  - \mod_workshop\task\cron_task_test

- Moved to the level2 "event" namespace:
  - \core_h5p\event\deleted_test
  - \core_h5p\event\viewed_test

- Renamed to a better name:
  - backup_forum_activity_task_test.php (missing "task")
2022-05-07 20:33:48 +02:00
Paul Holden
3dd97076d9 MDL-74283 dml: replace hardcoded concat SQL with appropriate API. 2022-03-22 17:32:41 +00:00
Sara Arjona
1e8a05b13a Merge branch 'MDL-74123_h5p_duplicate_file_311' of https://github.com/davosmith/moodle into MOODLE_311_STABLE 2022-03-10 08:41:01 +01:00
Davo Smith
a1fa5e7178 MDL-74123 h5p: delete any existing files when downloading new files 2022-03-09 13:36:07 +00:00
cescobedo
15c282d1e5 MDL-71722 h5plib_v124: Add required changes after lib upgrade 2022-03-08 10:04:21 +01:00
cescobedo
d8ce474882 MDL-71722 h5plib_v124: Upgrade ckeditor to 4.17.1 2022-03-08 10:04:21 +01:00
Andrew Nicols
6fc3618bd5 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:51:44 +08:00
Eloy Lafuente (stronk7)
f773514761 MDL-73476 phpunit: events, external and search tescase names
All events_test, external_test and search_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- 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 lib/external/tests/external_test.php:
- external is not a valid component
- hence, its only valid namespace is "core"
- also, it's testing lib/external/externallib.php
- hence, the file (and class) have been renamed to external_externallib_test.php
  (to avoid conflicts with other external_test that may exist in core)
2022-01-14 16:19:51 +01:00
Eloy Lafuente (stronk7)
5ef22c2458 MDL-73502 libraries: Avoid uses of get_magic_quotes_xxx() functions
They were deprecated in PHP 7.4 (warning) and have been removed in
PHP 8.0 (error). Plus they were returning false since ages ago (PHP
5.x).

Hence, adding conditional check to see if they are available (h5p
editor) or removing the unreachable code-block when they evaluated
to true.

Also, modified the corresponding moodle_readme files to document
the change.
2022-01-07 00:40:53 +01:00
Sara Arjona
06eb4fd769 Merge branch 'MDL-69467-311' of https://github.com/sebastianberm/moodle into MOODLE_311_STABLE 2021-12-13 17:34:45 +01:00
Sebastian Berm
b8335d5474 MDL-69467 core_h5p: User uniqueness by id instead of email 2021-12-10 14:37:54 +01:00
Eloy Lafuente (stronk7)
2c30590d5d MDL-73278 phpunit: Rename already namespaced classes to match file name
These are the only cases 100% safe to apply the renaming of the
testcase class names to match the file names.

All other cases are not safe, because they are missing namespace
and may enter into name conflicts. Adding namespaces is not as
simple as imagined because it implies to, also, add a good number
of modifications to core. See the issue for more details.
2021-12-07 23:54:34 +01:00
Sara Arjona
8e1463334c MDL-71970 h5plib_v124: Replace references to new Moodle\H5Pxxx namespace
The joubel/core and joubel/editor libraries have been moved to Moodle
namespace.
This commit adds the new namespace to the places where these classes
are used.
Besides, a couple of minor changes have been done to replace the _test.php
classname and remove some unnecessary defined('MOODLE_INTERNAL').
2021-09-27 11:42:28 +02:00
Sara Arjona
79aa88fddd MDL-71970 h5plib_v124: Add namespace to H5P editor library
The joubel/editor is a third-party library. A namespace has been added to
avoid collision with other plugins using it (such as mod_hvp).
That way, they will be able to have a different version without
side effects.
2021-09-27 11:42:28 +02:00
Sara Arjona
88c5228e61 MDL-71970 h5plib_v124: Add namespace to H5P core library
The joubel/core is a third-party library. A namespace has been added to
avoid collision with other plugins using it (such as mod_hvp).
That way, they will be able to have a different version without
side effects.
2021-09-27 11:42:27 +02:00
Paul Holden
37716dc58e MDL-71050 h5p: account for parent languages retrieving translations.
Take account of parent languages when requesting given library
translation. For example if we are currently using "de_kids" as the
current language, we need to recurse each language pack looking for
a matching H5P translation ("de_kids" -> "de_du" -> "de").
2021-07-12 13:17:07 +01:00
Andrew Nicols
e214af5720 MDL-71113 js: Fix all jsdoc warnings 2021-06-18 09:38:05 +08:00
Eloy Lafuente (stronk7)
0524a0b9f9 MDL-71583 versions: Add all the missing full-stops to version/requires
It seems that the new phpcs3 checker is now controlling those
line comments that previously were ignored.

This commit just looks for all the cases and bulk-add
them when needed. The bash script (mac) used to add all them is:

while read -r line; do
    arr=(${line//:/ })
    if [[ -n ${arr[0]} ]] && [[ -n ${arr[1]} ]]; then
        echo "  file ${arr[0]}, line ${arr[1]}"
        sed -i "${arr[1]}s/\$/\./" ${arr[0]}
    fi
done < <(find . -name version.php | xargs ag --nomultiline '>(version|requires) *=.*//.*[^;\.]$')
2021-05-11 20:00:11 +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
Eloy Lafuente (stronk7)
5f4ac36853 NOBUG: Fixed SVG browser compatibility 2021-05-07 16:55:20 +02:00
Eloy Lafuente (stronk7)
9ad6dce459 Merge branch 'MDL-71343-m311' of https://github.com/rjnl/moodle into MOODLE_311_STABLE 2021-05-06 23:07:37 +02:00
Sara Arjona
b3996aebb4 MDL-71408 h5plib_v124: Add required changes after lib upgrade
- The mbstring extension is required since Moodle 3.9 onwards so
the upgrading steps have been removed because they are not
required any more.
- The pull-request for fixing some minor PHP7.4 problems has been
integrated so this patch is not required.
2021-05-04 17:22:21 +02:00
Sara Arjona
3a1aa38bac MDL-71408 h5plib_v124: Upgrade H5P core library to 1.24.02 2021-05-04 17:22:21 +02:00
Rajneel Totaram
c217daf2a4 MDL-71343 core_h5p: Convert all line-endings to UNIX format 2021-05-01 00:05:30 +12:00
Andrew Nicols
9a4a49f060 MDL-71343 core_h5p: Add unit test for helper::parse_js_array
Signed-off-by: Rajneel Totaram <rjnlfj@yahoo.com>
2021-04-30 23:51:56 +12:00
Andrew Nicols
5319d41af0 Merge branch 'MDL-70903-311' of git://github.com/roland04/moodle into MOODLE_311_STABLE 2021-04-23 11:56:59 +08:00
Mikel Martín
b98bcd1e38 MDL-70903 mod_h5p: Fix PHP8.0 warning 2021-04-20 15:17:39 +02:00
Andrew Nicols
28d07f3373 Merge branch 'MDL-69415-311' of git://github.com/sarjona/moodle into MOODLE_311_STABLE 2021-04-16 08:06:22 +01:00
Sara Arjona
8a81d74244 MDL-69331 core_contentbank: Hide disabled H5P content-types
If a H5P content-type is disabled:
- The content bank won't display existing contents having it as a
main library.
- The content bank won't allow to create new contents using it.
2021-04-15 09:32:58 +02:00
Sara Arjona
73a7133ef8 MDL-69331 core_h5p: Only upgrade enabled libraries
The core\task\h5p_get_content_types_task task will only download
content-type for enabled libraries.
2021-04-15 09:31:36 +02:00
Sara Arjona
be7143381f MDL-69331 core_h5p: Display error when main library is disabled
H5P contents with the main library disabled won't be deployed; a
message error will be displayed instead of.
2021-04-15 09:31:36 +02:00
Sara Arjona
dc77f13dab MDL-69331 core_h5p: Add enabled field to libraries
The "enabled" field has been added to the H5P libraries to let
admins decide whether a library should be used or not in the site.
2021-04-15 09:31:36 +02:00
Sara Arjona
eb813c0b95 MDL-69415 core_h5p: prepend H5P libraries in autoloader
Core and mod_hvp are using the same namespace for some H5P
libraries. This is causing some random errors.
In order to get the expected behaviour in Moodle core, this patch
prepends H5P libraries in order to guarantee they are loaded first.
Plugins using same libraries will need to use a different namespace
if they overlap and a different version of these libraries should
be used.
2021-03-22 12:40:56 +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
Ferran Recio
c7cbd92f8c MDL-70806 h5p: fix resize glitch 2021-02-11 13:12:12 +01:00
Ferran Recio
68e1dd3c0b MDL-70634 h5p: minimizing height glitch 2021-01-25 13:54:40 +01:00
Ilya Tregubov
dc4f973e62 MDL-70009 h5pactivity: Split get_pluginfile_hash in two methods. 2021-01-12 09:10:50 +02:00
cescobedo
38914ee3cd MDL-70327 core_h5p: Add preventredirect to the player 2020-11-25 16:30:43 +01:00
Eloy Lafuente (stronk7)
b0a1b4ce8b MDL-70089 versions: bump all versions and requires near release
version = 2020110900 release version
requires= 2020110300 current beta+ (week6roll1) version

Note that, because we are under parallel development period,
this is being done in the branch that is going to be released
(MOODLE_310_STABLE already existing) for Moodle 3.10.0 and
not in master, that is the one getting the bump under normal
(non-parallel) periods.
2020-11-03 19:34:52 +01:00
Eloy Lafuente (stronk7)
35bc26b516 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:05 +02:00
Eloy Lafuente (stronk7)
d81a94807b 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:46:04 +02:00
Sara Arjona
cb4418bc5b Merge branch 'MDL-69736-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-10-19 09:03:51 +02:00
Jun Pataleta
30eccfabaa Merge branch 'MDL-69520-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-10-15 13:53:36 +08:00
Eloy Lafuente (stronk7)
12fce2a4bd Merge branch 'MDL-69813-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-14 22:47:12 +02:00
Sara Arjona
dde0818f6c MDL-69520 core_h5p: unit tests for covering example and tutorial 2020-10-14 18:35:52 +02:00
Sara Arjona
ad28920d0b MDL-69520 core_h5p: add example and tutorial links 2020-10-14 18:35:50 +02:00
Jun Pataleta
05a3e35677 Merge branch 'MDL-69257-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-10-09 11:12:16 +08:00
Mihail Geshoski
03058394f2 MDL-69257 core_h5p: Move $maxsize outside the foreach loop
There is no reason to repeatedly obtain the maximum size for uploading
files as a part of foreach loop.
2020-10-09 10:36:01 +08:00
Martin Gauk
1a80427018 MDL-69257 H5P: Check size of uploaded files and virus scan 2020-10-09 10:36:01 +08:00
Ferran Recio
a0999ab66f MDL-69736 core_h5p: enable player reporting 2020-10-06 13:05:33 +02:00