490 Commits

Author SHA1 Message Date
Angelia Dela Cruz
09dd28488a MDL-76499 behat: Resource Behat tests optimised
Replace steps that manually add resource instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.

Co-authored-by: David Woloszyn <david.woloszyn@moodle.com>
2023-02-03 11:02:26 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Paul Holden
8176a6c690 Merge branch 'MDL-76011-master' of https://github.com/abgreeve/moodle 2022-11-10 11:49:30 +00:00
Eloy Lafuente (stronk7)
d590b08dfa MDL-75880 phpunit: fix all @coversDefaultClass missing @covers
Because @coversDefaultClass doesn't indicate any coverage (it's
just an alias to avoid having to write the class name in @covers),
this commit fixes all the files that were using that annotation
and missing any @covers.

Basically, replacing one by the other and done.
2022-11-04 16:51:20 +01:00
Sara Arjona
b8ae747056 Merge branch 'MDL-75535' of https://github.com/paulholden/moodle 2022-11-04 11:01:41 +08:00
Adrian Greeve
2b2b4e63a2 MDL-76011 lib: Updated the zip writer to retain the modified date. 2022-10-27 14:46:31 +08:00
Jun Pataleta
a0e33d87ac Merge branch 'MDL-74910-master' of https://github.com/cameron1729/moodle 2022-10-20 13:57:40 +08:00
Cameron Ball
38c89c5343 MDL-74910 core_files: Remove unused query param 2022-10-20 13:57:39 +08:00
Kateryna Degtyariova
70bd5a2161 MDL-74910 core_files: Additional unit tests for get_conversions_for_file 2022-10-20 13:57:39 +08:00
Cameron Ball
c9da36d731 MDL-74910 core_files: Return SQL to initial state
MDL-73727 aimed to improve the performance of the
get_conversions_for_file SQL. Unfortunately it also
changed the behvaiour of the SQL.

On further investigation, there is nothing wrong with
the SQL. This patch returns it back to its initial state.
2022-10-20 13:57:39 +08:00
Paul Holden
5d385d4bcb MDL-75535 files: implement files datasource for custom reporting.
Create file entity, joining to existing user entity to provide data
for the reportbuilder editor.
2022-10-19 15:04:09 +01:00
Kevin Pham
027b6f73d6 MDL-49795 file: Add missing metadata providers for file_conversion 2022-08-03 15:17:05 +10:00
Paul Holden
52992d993c MDL-73568 admin: show accepted types for stored file config settings.
Re-factor existing code to make use of file manager class that renders
these details for us by default.

Co-authored-by: Simey Lameze <simey@moodle.com>
2022-06-24 10:13:09 +01:00
Kevin Pham
f984566b15 MDL-73727 core_files: Add subquery to avoid a seq scan on larger sites
- Formatted the query to meet SQL coding styles
- Add index on {files} to prevent performance regression
- Fork the SQL query based on DB family based on support
2022-05-30 13:38:45 +10: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
Mathew May
b0532aedd8 MDL-72092 behat: Add private files block where needed 2022-03-01 19:13:20 +08:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_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 tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 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:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 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:02 +01:00
Eloy Lafuente (stronk7)
deb0e76eee 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:29 +01:00
Mathew May
b983003e2e MDL-70197 navigation: Remove old navigation elements and migrate behat 2021-11-29 15:47:42 +08:00
sam marshall
e332d1849d MDL-72643 core: Improve display_size
Allows display_size to use a fixed unit for easy comparison of
multiple results, and fixed decimal places for the same reason.

Improves behaviour by using consistent decimal places and a
consistent space before the unit (the previous one only has a space
before 'bytes', not before 'KB').

Of existing uses, all the ones that displayed a 'maxbytes' type
configuration setting (which are likely to have an 'exact' size
and would be better shown as 512 KB rather than 512.0 KB) have been
changed to use 0 decimal places, to preserve previous behaviour.
All the uses which were showing an actual file or memory size have
been left as default (1 decimal place).
2021-09-27 16:52:33 +01:00
Sara Arjona
3f2f2e85bb MDL-72115 course: Rename Miscellaneous category
The "Miscellaneous" course category has been renamed to Category 1.
Besides, the description field has been set from FORMAT_MOODLE to
FORMAT_HTML.
2021-09-13 08:36:17 +02:00
Eloy Lafuente (stronk7)
9d6aa39985 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:11:07 +02:00
Eloy Lafuente (stronk7)
870a8de3fb MDL-37655 phpunit: Avoid having multiple testcase classes in 1 file
Note that there wasn't any case of multiple testcase classes in
1 file. All the cases reported in the issue were false positives
caused but other "mock/fixture" files being named _test.

So all this issue does is:

1) rename any _test suffixed class in test files, because we are
   going to start renaming a lot of test classes to _test.

2) ensure that the 2 test case classes modified in this issue,
   are already observing the filename = classname rule that will
   be implemented soon (and verigy it works).
2021-03-30 19:17:54 +02:00
Eloy Lafuente (stronk7)
81407f18ec 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:04:31 +01:00
Eloy Lafuente (stronk7)
8a14a7bd22 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:04:31 +01:00
Andrew Nicols
a84a55bd45 MDL-64554 user: Fix use of Private files page on classic
The "Private files" link does not exist in the site navigation when
using the classic theme, so it is not possible to test the dedicated
page via Behat at this time.
2021-02-19 09:33:06 +08:00
Marina Glancy
440073ff20 MDL-64554 user: make private files editor modal/ajax form 2021-02-17 18:06:57 +01:00
Juan Leyva
7f02879ce7 MDL-70387 files: New WS core_files_get_unused_draft_itemid 2021-01-13 13:01:40 +01:00
Mark Nelson
38cd9a6bd7 MDL-68533 core_files: add archive_writer API 2020-12-12 12:44:55 +08: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
Juan Leyva
94a0ee41e7 MDL-69776 files: New WS core_files_delete_draft_files 2020-09-25 10:37:16 +02:00
Eloy Lafuente (stronk7)
fbb0767536 MDL-69475 versions: bump all versions and requires in master
version = 2021052500 release version
requires= 2021052500 same than version

Why 20210525? (25th May 2021) ?

Because master is going to be Moodle 4.0, to be released
on November 2021. And, until then, we are going to have
a couple of "intermediate" releases:

- Moodle 3.10 to be released 9th November 2020. (2020110900)

  This version will be using versions from today to 2020110900
  (once it's released the YYYYMMDD part stops advancing).

- Moodle 3.11 to be released 10th May 2021. (2021051000)

  This version will be using versions from 3.10 release to 2021051000
  (once it's released the YYYYMMDD part stops advancing).

That means that all versions from today to 2021051000 are going
to be used by those 2 "intermediate" releases (3.10 and 3.11).

And we cannot use them in master, because it's forbidden to have
any overlapping of versions between branches (or different upgrade
paths will fail).

So, get that 2021051000, let's add it a couple of weeks to cover
the on-sync period (or a 2 weeks delay max!) and, the first version
that master can "own" in exclusive (without any overlap) is, exactly,
25th May 2021, hence our 20210525.
2020-08-18 00:47:15 +02:00
Eloy Lafuente (stronk7)
115cc0214f MDL-68973 versions: bump all versions and requires near release
version = 2020061500 release version
requires= 2020060900 current rc1 (week7roll1) version
2020-06-09 16:23:09 +02:00
David Mudrák
6918ca6a4e MDL-68888 lang: Use the fixed spelling in the Behat tests, too 2020-06-05 09:33:29 +02:00
Jun Pataleta
1389465c29 MDL-66911 files: Use proper function for fetching enabled licenses 2020-05-28 15:23:38 +08:00
Adrian Greeve
4231b83668 Merge branch 'MDL-66911-38_core_file_add_license_help_to_fileselect' of https://github.com/tomdickman/moodle 2020-05-28 09:09:27 +08:00
Tom Dickman
2228ca31a2 MDL-66911 core files: Add license help to file selector
This improvement adds a help icon to the 'Choose license' option
providing links to further information on each license.
Utilise templates for license links to avoid code reuse.
2020-05-27 08:36:48 +10:00
Bas Brands
91de0ed823 MDL-67874 theme_boost: make focus outline accessible 2020-05-26 09:54:12 +02:00
Mihail Geshoski
17ddce9676 MDL-60817 core_repository: Show a warning if file extension is modified 2020-03-13 13:17:44 +08:00
Peter Dias
06dc3a6c27 MDL-33671 core: Remove custom behat selectors
Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2020-03-04 13:38:49 +08:00
Peter
a216d86c6c MDL-33671 core: Add ability to download selected items
Utilise the new checkbox-toggleall functionality
2020-03-03 07:20:35 +08:00
Peter
2f03923602 MDL-33671 core: Allow for bulk delete of files
* Enable bulk delete in a details view
* Behat tests for new functionality
* Unit test for new function
2020-03-03 07:20:35 +08:00
Zig Tan
1395442474 MDL-54554 files: Improve unoconv error logging & sanity checks 2019-12-16 09:52:51 +08:00
Eloy Lafuente (stronk7)
d5be859063 MDL-67199 versions: bump all versions and requires near release
version = 2019111800 release version
requires= 2019111200 current beta (week7roll1) version
2019-11-12 17:57:08 +01:00
Ryan Wyllie
e81be9a8b1 MDL-64821 files: increase icon image size for stored file exporter
The default size for the stored file icon was only 16px by 16px which
wasn't suitable for display in the new forum layout. I've increased
the default size to 128px by 128px so that it looks better scaled up.
2019-09-25 10:42:19 +08:00
Andrew Nicols
201c689b20 Merge branch 'MDL-59911-conv_cleanup_check' of git://github.com/leonstr/moodle 2019-07-18 08:25:07 +08:00