473 Commits

Author SHA1 Message Date
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
Leon Stringer
50960244d8 MDL-59911 fileconverter_unoconv: Fix: test PDF fails after upgrade
When generating the PDF of unoconv_test.docx this file's previous conversions
are removed from mdl_file_conversion.  But these may also be removed by
\core_files\task\conversion_cleanup_task in which case an error occurs as
delete() is invoked with a NULL id.  Added check for non-NULL id prior to
invoking delete().
2019-07-16 16:44:09 +01:00
Damyon Wiese
27b67f6b5a MDL-65409 files: Allow location header
Allow incorrect capitals in location header response.
2019-07-12 08:42:20 +08:00
Eloy Lafuente (stronk7)
c9a1a6341c MDL-65571 versions: bump all versions and requires near release
version = 2019052000 release version
requires= 2019051100 current beta (week6roll2) version
2019-05-12 23:46:34 +02:00
Ryan Wyllie
a307a47651 MDL-64820 external: add isimage to stored_file exporter 2019-03-22 09:24:04 +08:00
Jun Pataleta
ed90e4d378 MDL-64230 files: Display long file/folder names with ellipsis
* Instead of clipping long file/folder names by default, truncate them
with ellipsis to indicate to the user that the file/folder has a long
name.
2019-03-08 14:48:49 +08:00
Mathew May
f39111d0ea MDL-58428 renderer: Move renderer override from files 2019-02-26 16:24:49 +08:00
Helen Foster
65d70aa81b MDL-64509 lang: Import fixed English strings (en_fix)
Significant string change: enablerunnow_desc,tool_task - including
mention of pathtophp requirement
2019-01-07 14:40:34 +01:00
Eloy Lafuente (stronk7)
085353b315 MDL-64282 versions: bump all versions and requires near release
version = 2018120300 release version
requires= 2018112800 current rc2 (week7roll1) version
2018-11-29 18:24:08 +01:00
Andrew Nicols
c96cd71102 MDL-63924 privacy: Add shared user providers to subsytsems 2018-11-08 21:26:18 +08:00
Andrew Nicols
b272efb460 Merge branch 'MDL-63673-master' of git://github.com/mihailges/moodle 2018-10-26 11:40:46 +08:00
Mihail Geshoski
8171cd7f3c MDL-63673 fileconverter_googledrive: Support removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-24 07:02:16 +08:00
Andrew Nicols
4b3ca0ebf2 MDL-63657 core_files: Coding style fix 2018-10-23 11:26:02 +08:00
Andrew Nicols
2612cf5673 Merge branch 'MDL-63640-master' of git://github.com/mihailges/moodle 2018-10-23 11:25:21 +08:00
Mihail Geshoski
16ec426a4f MDL-63640 core_files: Add method that returns users in context
This issue is part of the MDL-62560 Epic.
2018-10-23 10:48:12 +08:00
Mihail Geshoski
1ba1fcf838 MDL-63639 core_fileconverter: Add support for removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-22 12:50:11 +02: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
Andrew Nicols
4a74ab0200 MDL-36754 core_files: Add a token version of pluginfile 2018-08-14 06:57:32 +08:00