313 Commits

Author SHA1 Message Date
Andrew Nicols
7bb9f136d2
MDL-81520 core: Fix test finality 2024-12-11 12:30:21 +08:00
Huong Nguyen
1113c4c5b1
Merge branch 'MDL-83529-m405' of https://github.com/sammarshallou/moodle into MOODLE_405_STABLE 2024-11-21 11:21:45 +07:00
sam marshall
f7931a5580 MDL-83529 Analytics: Upgrade can break if core module is deleted 2024-11-15 09:34:05 +00:00
Andrew Nicols
c370c0cc5e
MDL-81521 core: Update all possibly data providers to be static
Note: Some data providers could not be automatically be converted to
being static. These will be handled in a separate issue.
2024-11-15 12:50:44 +08:00
meirzamoodle
a3b84f77c7 MDL-82988 general: Apply helper to get path to fixture 2024-10-27 15:38:50 +07:00
Paul Holden
f5aa88ec02
MDL-83472 phpunit: add void return type to test methods.
See also 01148a0816 from MDL-81522.
2024-10-16 13:03:50 +01:00
Simey Lameze
3ac7a2f6c5 MDL-63399 behat: update existing tests to use the better download steps
Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-09-06 12:14:07 +08:00
Jun Pataleta
a84fb7c075
Merge branch 'MDL-82651-main' of https://github.com/lameze/moodle 2024-08-29 11:59:31 +08:00
Andrew Nicols
e6146bca1b
Merge branch 'MDL-82359-main' of https://github.com/sammarshallou/moodle 2024-08-28 22:46:56 +08:00
Simey Lameze
b66d4e12bf MDL-82651 behat: wait for button to exist before clicking 2024-08-28 13:54:09 +08:00
Huong Nguyen
dca18ebca3
Merge branch 'MDL-81634-main' of https://github.com/andrewnicols/moodle 2024-08-20 09:30:44 +07:00
sam marshall
9e9d3b5b81 MDL-82359 Install: Allow removal of modules from core analytics models 2024-08-19 16:00:13 +01:00
Mikel Martín
0a03018116 MDL-75671 theme_boost: Refactor spacing classes for BS5
- Add SCSS code for spacing utility classes to the Boostrap 5 bridge SCSS file
- Replace all occurrences in the codebase (pr-1 > pe-1, ml-auto > ms-auto, ml-sm-3 > ms-sm-3, ...)
2024-08-09 07:40:17 +02:00
Andrew Nicols
024e36be17
MDL-81634 core: Fix all implicitly defined nullables
Note: This does not impact third-party libraries.
2024-08-02 14:11:12 +08:00
Paul Holden
8413f61260
MDL-82431 phpunit: correct unit test filename and classname.
Standardise the same test cases, e.g. make final, covers notation,
static data providers, namespaces, etc.

Once the tests run, a couple of them failed. They required changes
to assertions to make them pass.
2024-07-10 19:06:14 +01: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
Paul Holden
faee1cd58e
MDL-82047 analytics: remove 32-bit integer checks for maximum time. 2024-05-30 18:17:44 +01:00
Paul Holden
c9d2e72943
MDL-81282 dml: replace occurrences of large integers with new constant.
Where calling code was previously using either the 32-bit limit, or a
value equal to SQL_INT_MAX inside a database read/write, instead use
our new constant.
2024-05-24 22:19:54 +01:00
Andrew Nicols
0964cd5b69
MDL-81125 core: Update upgrade.txt files to document new upgrade notes 2024-05-20 22:26:45 +08:00
Huong Nguyen
f64fda43d5
MDL-4188 behat: Turn off course welcome message
Turn off the course welcome message,
so we can easily test other messages.
2024-04-04 20:13:47 +07: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
Eloy Lafuente (stronk7)
29a541724f
MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +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
Huong Nguyen
a2866d6833
MDL-72359 core_analytics: Better handling of MAX_TIME
We are limited by both PHP's max int value and DB (cross-db) max int allowed.
We need to use the smallest one
2023-08-29 20:36:58 +07:00
Daniel Poggenpohl
079a5fa104
MDL-72359 core: Changed MAX_TIME from 9999999999 to PHP_INT_MAX
This prevents automatic casting from int to double on 32 bit systems
(which have a maximum for integers of 2147483647)

Whilst Moodle will not support 32-bit systems for much longer, this is
still worth doing to prevent future issues.
2023-08-23 14:34:32 +08:00
Paul Holden
a06b8d978b
MDL-78140 analytics: improve context restrictions manager test.
This test apparently fails sporadically on Oracle, without obvious
causes. The failure however was hard to interpret, and the test
itself made a lot of assumptions about the system re. naming of
categories/courses. This could be prone to errors, so improve that.
2023-05-11 09:39:39 +01:00
Meirza
a6894fc65e MDL-77337 analytics: 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-16 09:46:07 +07:00
Sara Arjona
ae53d04144 Merge branch 'MDL-75337-master' of https://github.com/laurentdavid/moodle 2023-01-24 16:07:35 +01:00
Laurent David
fc72a1d7b1 MDL-75337 core: Single button - core changes
* Change all core calls toward single_button to use single_button::BUTTON_PRIMARY
    when needed
2023-01-24 06:01:35 +01:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Jun Pataleta
fad05d7929 Merge branch 'MDL-76583-master-withoutrename' of https://github.com/andrewnicols/moodle 2023-01-19 09:44:48 +08:00
Andrew Nicols
853f07d4c0 Merge branch 'MDL-69127' of https://github.com/paulholden/moodle 2023-01-19 09:01:39 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Marina Glancy
594a8c5ab7 MDL-76356 various: avoid implicit conversion to arrays
PHP before version 8.1 automatically converted stdClass or 'false' to arrays if
function parameter expects array (for example, "reset").
PHP 8.1 shows notices in these situations
2023-01-10 12:16:52 +01:00
Paul Holden
d843168c14 MDL-69127 analytics: final removal of renamed target class mapping. 2023-01-05 17:28:59 +00:00
Eloy Lafuente (stronk7)
83b490a594 MDL-75111 phpunit: Move tests to use correct names and ns (take#4)
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:

- The following task tests have been moved within the level2 directory:
  - \core\adhoc_task_test => \core\task\adhoc_task_test
  - \core\scheduled_task_test => \core\task\scheduled_task_test
  - \core\calendar_cron_task_test => \core\task\calendar_cron_task_test
  - \core\h5p_get_content_types_task_test => \core\task\h5p_get_content_types_task_test
  - \core\task_database_logger_test => \core\task\database_logger_test
  - \core\task_logging_test => \core\task\logging_test

- The following event tests have been moved within level2 directory:
  - \core\event_context_locked_test => \core\event\context_locked_test
  - \core\event_deprecated_test => \core\event\deprecated_test
  - \core\event_grade_deleted_test => \core\event\grade_deleted_test
  - \core\event_profile_field_test => \core\event\profile_field_test
  - \core\event_unknown_logged_test => \core\event\unknown_logged_test
  - \core\event_user_graded_test => \core\event\user_graded_test
  - \core\event_user_password_updated_test => \core\event\user_password_updated_test

- The following output tests have been moved within level2 directory:
  - \core\mustache_template_finder_test => \core\output\mustache_template_finder_test
  - \core\mustache_template_source_loader_test => \core\output\mustache_template_source_loader_test
  - \core\output_mustache_helper_collection_test => \core\output\mustache_helper_collection_test

- The following tests have been moved to their correct tests directories:
  - lib/tests/time_splittings_test.php => analytics/tests/time_splittings_test.php

- All the classes and tests under lib/filebrowser and lib/filestorage
  belong to core, not to core_files. Some day we should move
  them to their correct subsystem.
- All the classes and tests under lib/grade belong to core, not
  to core_grades. Some day we should move them to their correct
  subsystem.
- The core_grades_external class and its \core\grades_external_test
  unit test should belong to the grades subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The core_grading_external class and its \core\grading_external_test
  unit test should belong to the grading subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The \core\message\message and \core\message\inbound (may be others)
  classes, and their associated tests should go to the core_message
  subsystem.
- The core_user class, and its associated tests should go to the
  core_user subsystem.
- The \core\update namespace is plain wrong (update is not valid API)
  and needs action 1) create it or 2) move elsewhere.
2022-08-26 16:34:20 +02:00
Kevin Pham
1495c10c26 MDL-49795 analytics: Add missing metadata providers for analytics tables
Affected tables:
- analytics_models
- analytics_models_log
2022-08-03 15:17:05 +10:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
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
Eloy Lafuente (stronk7)
7a0d024e60 MDL-73659 phpunit: restore_date, api, rule, plugin, manager & helper
All restore_date_test, api_test, rule_test, plugin_test,
manager_test, helper_test 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:

- All restore_date_test cases have been put under xxx\backup
  level 2 (valid API) namespace.
2022-02-05 00:03:32 +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
Andrew Nicols
0888efd258 Merge branch 'mdl-68199-fix-master' of https://github.com/jaypha/moodle 2021-12-02 11:54:59 +08:00
Jason den Dulk
e7f51a3857 MDL-68199 setup: Fix invalid parameters to make_request_directory()
Added parameter type hint to make_request_directory()
Removed invalid parameters from calls to make_request_directory()

Removing these parameters should have no effect on behaviour.
2021-12-02 07:49:28 +11:00
Ferran Recio
26d0e51d91 MDL-72456 mod_assign: fix behats 2021-11-25 15:29:54 +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
Jun Pataleta
4e75e73cb5 Merge branch 'primary_secondary_nav' of https://github.com/Chocolate-lightning/moodle 2021-08-25 10:42:57 +08:00
Adrian Greeve
7d435fb5f2 MDL-70196 navigation: Update to feature files.
- Part of: MDL-69588
A lot of tests rely on the last element of the breadcrumb being
active. This updates feature files to not rely on this anymore.
2021-08-23 17:46:38 +08:00
Dan Marsden
34bdef0b62 MDL-70006 analytics: Don't send notifications to suspended enrolments. 2021-08-03 10:52:53 +12:00