29 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
ad5fe71868
MDL-82207 phpunit: fix various @covers annotations (take#1)
This fixes various (not all) wrong @covers annotations that
are reported as warnings by PHPUnit when it's run with
code-coverage enabled.

When possible, the preferred solution is to change to
@covers at class level, that is the recommended way.

If multiple classes are involved, then a mix of @coversDefaultClass
and @covers at method level are used (always trying to use the
minimum needed patch).

This is the first of a series of issues created as sub-tasks
of MDL-82142.
2024-06-24 12:07:39 +02:00
Eloy Lafuente (stronk7)
674497a12c
MDL-81523 phpunit: Add all missing setUp/tearDown parent calls
All setUp(), tearDown(), setUpBeforeClass() and tearDownAfterClass()
must, always, call to parent, to ensure that everything is properly
set and cleaned.

While in a lot of situations this is not needed (parents may not
have anything to run), with PHPUnit >= 10 this can become more
important because we are going to move the reset code from current
placement @ runBare() to setUp()/tearDown().

Note that all the changes performed in this commit have been detected
and fixed by moodle-cs (ParentSetUpTearDownSniffTest).
2024-06-14 16:04:57 +02:00
Eloy Lafuente (stronk7)
01148a0816
MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.

All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
2024-06-11 11:55:07 +02:00
Eloy Lafuente (stronk7)
018e6e1fc8
MDL-81698 phpunit: Apply various fixes towards 1by1 execution
The changes here are heterogeneous:
- Include stuff that is not available (other test has included it).
  Sometimes local to a unit test, others in setupBeforeClass() or
  globally, ... depends on every case.
- Rename some tests (namespaces, test name, ...) towards getting it
  running.
- Amend small bits here and there.

Important note: I've left any "cosmetic" warning out from the
changes, only a few errors (like long array syntax) have been fixed.
2024-05-25 17:19:44 +02:00
Eloy Lafuente (stronk7)
361dfe8145
MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces:
- https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
- https://www.php.net/manual/en/reflectionproperty.setaccessible.php
- https://www.php.net/manual/en/reflectionmethod.setaccessible.php

As of PHP 8.1.0, calling this method has no effect; all methods are
invokable by default. So, let's remove all uses from core, they are
no-op.
2024-03-10 21:15:00 +01:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Sara Arjona
b2e5f3e746
MDL-80866 phpunit: Fix failures after disabling Chat and Survey 2024-03-01 11:41:50 +01:00
Sara Arjona
e422045d92
MDL-80866 mod: Disable Chat and Survey for new installations 2024-03-01 11:41:50 +01:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Paul Holden
87091e7b7c
MDL-80124 admin: prevent deletion of pre-installed preset definitions. 2024-01-25 21:51:41 +00:00
Sara Arjona
a52f94b754
Merge branch 'MDL-78980' of https://github.com/paulholden/moodle 2023-08-28 16:56:22 +02:00
Meirza
4cfa361e0a MDL-78468 admin: Removed devicedetectregex theme setting 2023-08-22 09:47:36 +07:00
Paul Holden
a06ec5dd06
MDL-78980 admin: ensure all values for multiselect presets are used.
Previously, just the first value was selected. Instead defer to the
implementation in the base class for `set_value`.
2023-08-11 10:43:29 +01:00
Meirza
97ff68fd6b MDL-78159 lib: Added missing properties for core libraries
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-06-21 15:39:53 +07:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Ilya Tregubov
58fb00eb18 Merge branch 'MDL-77308-master' of https://github.com/andrewnicols/moodle 2023-03-09 17:02:07 +08:00
Andrew Nicols
f58a71baab MDL-77308 core: Remove editor_tiny from core 2023-03-09 15:28:35 +08:00
Andrew Nicols
830c9fd7dd Merge branch 'MDL-77336-master' of https://github.com/meirzamoodle/moodle 2023-03-07 12:01:30 +08:00
Meirza
e2d5d50276 MDL-77336 admin: Added class properties that are not declared.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-03-06 16:44:06 +07:00
Sara Arjona
5c20b537b4 MDL-70226 course: Add more options to the activitychoosertabmode setting
Some extra options have been added to the activitychoosertabmode setting, to let
admins decide when to display the Recommended tab.
Apart from that, one of these values have be set as default value for this setting,
as suggested by the UX/PX teams. So the Starter and Full presets have been updated
too with the new values.
2023-03-03 13:45:15 +01:00
Tim Hunt
9efec07f77 MDL-74923 quiz: move admin setting classes to mod_quiz\admin namespace 2022-12-13 16:24:58 +00:00
Paul Holden
23df60893a MDL-76226 admin: account for preset config checkboxes other than bool.
The assumption that the settings checkbox always stores boolean values
(e.g. 0/1) isn't correct. The `perfdebug` configuration instead uses
the values 7/15.
2022-11-28 16:04:08 +00:00
Eloy Lafuente (stronk7)
facf5cbcd0 Merge branch 'MDL-73953-master' of https://github.com/aanabit/moodle 2022-03-02 12:54:12 +01:00
Amaia Anabitarte
c0196fb096 MDL-73953 core_adminpresets: Marking core presets on DB 2022-03-02 12:49:01 +01:00
Andrew Nicols
b3e7bb58b8 Merge branch 'MDL-73833-master' of https://github.com/sarjona/moodle 2022-02-28 14:21:28 +08:00
Sara Arjona
00699beeed MDL-73833 adminpresets: Use displayname from pluginmanager
In order to guarantee all the plugin type names are displayed properly,
the 'pluginname' string call has been replaced to the proper
$plugininfo->displayname setting. That way, the plugin names will
be always displayed using the proper string translation.
2022-02-22 13:06:45 +01:00
Sara Arjona
49aef9f9bc MDL-73831 adminpresets: Display current/new value for settings
Before applying a preset, the settings are displayed and, in some cases,
the Current/New value columns were empty.
This patch fixes it and guarantees this information is updated properly
every time the set_value() method is called.
2022-02-22 12:58:02 +01:00
Sara Arjona
256232ad46 MDL-73248 adminpresets: Improvements to the Starter preset
This is the list of changes applied to the Starter preset, following
the community suggestions and the latest features included in 4.0:

- Hide Online users, Recently accessed courses and Starred courses.
- Re-enable Description and Essay question types.
- Disable guest enrolment and hide guest login button.
- Reduce the information displayed in the activity chooser.

Apart from that, the User menu items has been removed because it had
the same value in both presets (so it makes no sense having there).
2022-02-11 16:41:06 +01:00
Andrew Nicols
fc082d349c MDL-73728 admin: Move adminpresets to admin/presets
This commit moves the presets subsystem to a location within the admin
folder, which is more appropriate given its purpose and reduces
developer frustration with tab completion of the admin directory.
2022-02-03 19:14:28 +08:00