21 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
1093256560
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 12:18:04 +02:00
Daniel Ziegenberg
08027e408c
MDL-81281 phpunit: assertObjectHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectHasProperty() instead."

So we replace all instances of assertObjectHasAttribute with
assertObjectHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:45 +01:00
Daniel Ziegenberg
87267da39d
MDL-81281 phpunit: assertObjectNotHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectNotHasProperty() instead."

So we replace all instances of assertObjectNotHasAttribute with
assertObjectNotHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:07 +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
Laurent David
d5dc0a8eb1 MDL-77813 core_xapi: Add delete states webservice
* Add new core_xapi_delete_states Webservices in pair with the "Multiple
document DELETE" action from xAPI specification.
2023-06-19 06:23:53 +02:00
Andrew Nicols
6d706408f2
Merge branch 'MDL-78355' of https://github.com/paulholden/moodle 2023-06-12 10:26:34 +08:00
Paul Holden
e60c45b610
MDL-78355 xapi: correct coverage notation for delete state test. 2023-06-06 12:04:07 +01:00
Ferran Recio
268e82b005 MDL-77814 core_xapi: add itemid check to state store
The xAPI state standard allow any type of activity ID, not only
integers. However, the default state store uses itemid to identify the
component instance so the activity id is limited to numerics. The store
base calls should use string as activityid as this is how xAPI specs
describe it. However, if a plugin want to use non numeric activity ids
it must implement it's own state store.
2023-05-29 08:57:24 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Paul Holden
dcc32979ec Merge branch 'MDL-77802-master' of https://github.com/ferranrecio/moodle 2023-04-06 08:36:22 +02:00
Ferran Recio
625f9646a7 MDL-77802 core_xapi: create core_xapi_get_states webservice
The xAPI get states webservice is needed for mobile APPs to check if any
new state has been stored from another device.
2023-04-05 12:59:06 +02:00
Sara Arjona
c8628576e3 MDL-77254 h5p: Add support to restored states
The restored states should be treated differently, to avoid resetting
them by default the first time users access them.
In that case, the first time users access to content with restored
xAPI states, they should be displayed (instead of resetting them).
2023-04-04 17:23:43 +02:00
Ferran Recio
03a4abde0f MDL-67789 xapi: Add support to save content state 2023-03-15 09:42:18 +01:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Andrew Nicols
3a70983d53 MDL-72701 unit tests: Generate default coverage 2021-12-21 09:24:00 +08: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
Eloy Lafuente (stronk7)
9fd6ac7c9d MDL-71036 phpunit: xml config - switch coverage info to new includes
This applies the "whitelist" => "include" changes to all the core
phpunit_coverage_info occurrences, so core won't emit any deprecation
warning (see previous commit).

At the same time, modified a bunch of comments in coverage files
to be more readable/understandable.
2021-03-11 23:04:32 +01: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
Ferran Recio
72a2335151 MDL-68379 core_xapi: adding result, attachments and context to statement 2020-05-04 18:47:11 +02:00
Ferran Recio
d8c9c99001 MDL-67734 core_xapi: Fix MSSQL PHPUnit failure with duplicated id 2020-04-02 10:37:41 +02:00
Ferran Recio
1d4c6f5355 MDL-67734 core_xapi: add xAPI statement support webservice 2020-04-01 14:14:39 +02:00