Commit Graph

61 Commits

Author SHA1 Message Date
Andrew Nicols 846892ab07 MDL-79697 core: Coding style updates 2023-11-15 21:24:31 +08:00
Andrew Nicols db556a4ce8 MDL-79697 core: PSR-4 NS can be spread across multiple dirs
The PSR-4 specification does not preclude a single namespaces from
having multiple sources. This is the case for several PSR standards
including standard packagist packages distributed by PSR:

- PSR-7 - HTTP Message Interfaces: \Psr\Http\Message
- PSR-17 - HTTP Factories: \Psr\Http\Message
- PSR-15 - http-server-handler: \Psr\Http\Server
- PSR-15 - http-server-middleware: \Psr\Http\Server
2023-11-15 21:23:27 +08:00
Huong Nguyen 36677cd883 Merge branch 'MDL-79739-master' of https://github.com/andrewnicols/moodle 2023-11-08 09:23:37 +07:00
Andrew Nicols 06965b823e MDL-79739 core: Only run some tests in separate processes 2023-10-17 12:18:37 +08:00
Andrew Nicols 9942c14856 MDL-79698 core: Correct duplicate array key in test provider 2023-10-13 15:43:47 +08:00
Meirza b7008d33ea MDL-78167 lib: Added missing class properties in tests
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.

Adding @runTestsInSeparateProcesses and removing setUp() and tearDown() at the
component_test.php, so the test will run in a separate process making sure that
whatever changes happen to the in-memory version of the component class in its thread,
therefore does not impact other tests and makes it more safe.
2023-05-27 09:24:59 +07:00
Huong Nguyen 163b4134df MDL-77576 core: Register new communication sub-system
Create a new subsystem for communication and create
associated experimental settings to safely use the
new subsystem.

Originally implemented as MDL-76699.

Co-Authored-By: Huong Nguyen <huongnv13@gmail.com>
2023-05-05 14:41:28 +10:00
Peter Burnett 027c770eab MDL-65471 upgrade: framework to reduce maintenance mode 2023-04-06 11:38:26 +10:00
Jun Pataleta cd0afd5c76 MDL-77105 core: Method to determine whether a plugin has monolog icons 2023-03-27 13:32:09 +08:00
Eloy Lafuente (stronk7) ef936717ee MDL-77607 core_component: Fix wrong component for the grade api
The correct component (subsystem) for the "grade" API is
"core_grades" not "core_grade".

Let's fix that and cover it with tests.
2023-03-17 19:27:14 +01:00
Meirza e2cd808b34 MDL-76415 core: Fixed ${var} string interpolation deprecations.
Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when
the expression inside the braces resolves to a variable or an expression.
2023-02-13 19:51:46 +07:00
Andrew Nicols 93ab932211 MDL-76362 core: plugin names must be strings to be valid 2023-01-23 09:15:55 +08:00
Andrew Nicols e068f2284f MDL-76362 core: Update core_component plugin name tests 2023-01-23 09:15:55 +08:00
Andrew Nicols 4a2793002c MDL-76583 core_external: Add new core_external subsystem 2023-01-17 10:59:15 +08:00
Eloy Lafuente (stronk7) 28937d4243 MDL-71096 core: Add meta information about APIs to core
Right now we have the information only in docs:
  - https://docs.moodle.org/dev/Core_APIs
  - https://moodledev.io/docs/apis

And, in fact, we are crawling those pages to get the information
from various tools (moodlecheck, CiBoT...). Obviously, that's far
from ideal, the source only has the current list of APIs, and
there isn't much information there but the names.

So we are moving the source of information to be in core, so it
can be modified between branches, and contains richer information:
 - The component the API belongs to, usually a subsystem or core.
 - If the API can be used as level 2 namespace.
 - If the API can be used as level 2 namespace out from its component.

Note that all that information has NO USES right now in core (and maybe
never will), but tools/checkers will benefit enormously by having that
information at hand, so we can check for namespaces, categories and
other bits way better.

Also, once we have this, the APIs dev documents linked above, surely
can be improved by being automatically generated and include all the
meta-information available.

It also includes a very basic json schema validating the basis. It can
be tried online @ https://www.jsonschemavalidator.net , or any other
tool. PHP requires extra libraries to be able to perform the validation.

Covered with unit tests, both api-related functions and structure validation.
2022-12-09 10:49:12 +01:00
Sara Arjona 727f0d4daf MDL-73397 adminpresets: Create new core_adminpresets component
The core_adminpresets component has been added and some data and
methods from the tool_admin_presets have been moved here.
2022-01-03 11:51:33 +01:00
Paul Holden 542f2927f7 MDL-70794 reportbuilder: register new core sub-system.
In addition to housekeeping for the new sub-system, define our
table schema to be used in later persistents.
2021-07-28 16:40:50 +01:00
Ferran Recio 21d93554d4 MDL-71863 courseformat: create courseformat subsystem 2021-06-28 13:50:18 +02:00
Eloy Lafuente (stronk7) 309a65a6f7 MDL-71036 phpunit: Renamed various file-related assertions
In PHPUnit 9.1, the following file-related assertions
have been deprecated and there are new alternatives for
all them:
- assertNotIsReadable()         -> assertIsNotReadable()
- assertNotIsWritable()         -> assertIsNotWritable()
- assertDirectoryNotExists()    -> assertDirectoryDoesNotExist()
- assertDirectoryNotIsReadable()-> assertDirectoryIsNotReadable()
- assertDirectoryNotIsWritable()-> assertDirectoryIsNotWritable()
- assertFileNotExists()         -> assertFileDoesNotExist()
- assertFileNotIsReadable()     -> assertFileIsNotReadable()
- assertFileNotIsWritable()     -> assertFileIsNotWritable()

This is about to, simply, move all cases to the new alternatives.

Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md

Regexp to find all them:

ag 'assertNotIsReadable|assertNotIsWritable|assertDirectoryNotExists|\
assertDirectoryNotIsReadable|assertDirectoryNotIsWritable|\
assertFileNotExists|assertFileNotIsReadable|assertFileNotIsWritable'
2021-03-11 19:22:23 +01:00
Shamim Rezaie 9d77bf7c9b MDL-69166 core: define payment as a subsystem and pg as a plugin type 2020-10-27 08:37:08 +11:00
Eloy Lafuente (stronk7) f6711bb394 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:45:59 +02:00
Juan Leyva 8f2a40f2da MDL-68294 core_component: Fix test that depends on tool_mobile 2020-05-15 20:49:35 +02:00
Amaia Anabitarte 33b8ca26f9 MDL-67786 core_contentbank: New content bank contenttype plugin type
Co-authored by: Ferran Recio <ferran@moodle.com>
2020-04-15 23:45:08 +02:00
Ferran Recio 1d4c6f5355 MDL-67734 core_xapi: add xAPI statement support webservice 2020-04-01 14:14:39 +02:00
Amaia Anabitarte 45899564b3 MDL-66609 core_h5p: New core_h5p subsystem
New H5P libraries have been added to Moodle core_h5p in /lib/h5p.
2019-10-29 10:22:43 +08:00
Andrew Nicols 7fdefd3184 MDL-66022 core: subplugins.php moved to json 2019-07-02 15:55:12 +10:00
Tom Dickman 0d6a45d2fe MDL-64284 core: improved performance of component class searching
Added static caching of classes to reduce load times and reduce calls to `get_component_classes`
by altering to accept a null component value to search classmap only once.
2019-03-29 11:44:43 +11:00
Ruslan Kabalin 493e7526f9 MDL-57898 core_customfield: Custom fields API
This commit is part of work on Custom fields API,
to minimize commit history in moodle core the work of a team of developers was split
into several commits with different authors but the authorship of individual
lines of code may be different from the commit author.
2019-01-18 14:28:18 +01:00
Jake Dallimore 3a1ece149f MDL-63658 core: new method get_component_names() added to core 2018-10-18 08:22:07 +08:00
Jake Dallimore 4fca5dabb2 MDL-63658 core_favourites: introduce the favourites subsystem to core 2018-10-17 10:16:18 +08:00
Andrew Nicols 39b17e9933 Merge branch 'wip-MDL-62138-master' of git://github.com/marinaglancy/moodle 2018-05-01 11:46:27 +08:00
cescobedo 30e44bfcc4 MDL-61944 tool_mobile: Implement Privacy API 2018-04-25 15:33:50 +02:00
Marina Glancy dde3d58eb1 MDL-62138 core: remove core_register and core_publish
These components have no classes and no strings and have no purspose. Component core_hub is responsible
for storing data, defining classes and strings for site registration and course publishing

This also reverts MDL-61945
2018-04-23 13:17:12 +08:00
Zig Tan de33cd0cab MDL-61892 admin/tools: Implement null privacy providers 2018-04-20 11:41:20 +08:00
Eloy Lafuente (stronk7) a706fd79a5 MDL-61875 tests: Use existing component & support $CFG->admin 2018-04-10 13:14:34 +02:00
Jake Dallimore 5749f8a4f7 MDL-61875 core_component: new method to get full components list 2018-04-10 08:44:40 +08:00
Andrew Nicols dcc16e155d MDL-61307 core: Define a new privacy component 2018-03-09 09:59:36 +08:00
David Monllao 413f19bc49 MDL-59211 analytics: Make cibot happy
Part of MDL-57791 epic.
2017-07-24 08:36:49 +02:00
David Monllao ff656baeab MDL-58859 analytics: Add tests to core
Part of MDL-57791 epic.
2017-07-24 07:53:10 +02:00
Andrew Nicols 34df779a95 MDL-55528 core_files: Create new fileconverter plugintype 2017-03-10 09:31:14 +08:00
David Monllao 8bee2d8df6 MDL-55237 core_component: Fix last namespace level matching
Thanks to Andreas Grabs for proposing a fix.
2016-08-30 11:15:27 +08:00
John Okely 64f631c128 MDL-53016 classloader: Load PSR-0 and PSR-4 separately, add unit tests 2016-08-05 10:11:52 +08:00
Frederic Massart 67bc0eaf38 MDL-53700 competency: Migrate main classes to core 2016-04-18 11:05:59 +08:00
Ruslan Kabalin 324a45833a MDL-50887 tests: Increment number of plugins in core_component_testcase.
We have got one more core plugin now.
2016-02-29 09:31:30 +00:00
David Monllao f900b2b6c9 MDL-31989 component: Allow classes to be retrieved by namespace 2016-02-23 10:47:58 +00:00
Eloy Lafuente (stronk7) bdd48b459e MDL-49203 webservices: Increment subsystems count in unit tests. 2015-03-31 00:42:27 +02:00
Andrew Nicols 96671c8c38 MDL-47225 core: Tidy up component normalisation tests 2014-09-16 15:07:11 +08:00
Andrew Nicols 7ace328737 MDL-47225 core: Add ability to normalize component names 2014-09-16 15:06:46 +08:00
Petr Škoda b5486ce89b MDL-41953 add more tests for invalid plugin names 2013-10-11 00:09:04 +02:00
Petr Škoda a41d1ca0ce MDL-41953 allow plugin names to end with multiple digits 2013-10-11 00:04:39 +02:00