243 Commits

Author SHA1 Message Date
Andrew Nicols
13bf6748f7
Merge branch 'MDL-82309' of https://github.com/paulholden/moodle 2024-07-18 11:58:06 +08:00
Paul Holden
a3c386af93
MDL-82463 reportbuilder: change non-numeric entity column types.
Where columns were previously of type `TYPE_INTEGER` or `TYPE_FLOAT`
but did not provide numeric data on output, we should change their
type to `TYPE_TEXT` (i.e. the default) to ensure that future work on
numeric aggregation doesn't affect them.
2024-07-15 10:42:01 +01:00
Paul Holden
c8d32c279d
MDL-82309 comment: preserve link text property during AJAX requests.
We really only need to update the count value that follows the link
text content, so do that rather than overwriting the entire thing.
2024-07-09 09:17:10 +01:00
Huong Nguyen
ccd8089de9
Merge branch 'MDL-80907' of https://github.com/marinaglancy/moodle 2024-07-04 11:12:50 +07: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
Andrew Nicols
0964cd5b69
MDL-81125 core: Update upgrade.txt files to document new upgrade notes 2024-05-20 22:26:45 +08:00
Marina Glancy
49ab83c1a4 MDL-80907 various: fixes to incorrect column selectors in behat 2024-05-07 19:27:14 +01:00
Marina Glancy
ef1759da74 MDL-80820 various: fix incorrect phpdocs 2024-04-08 10:13:10 +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
David Carrillo
10d2b5864b
MDL-80325 reportbuilder: Update 'Delete' links to red color
- Update all 'Delete' links on RB system report actions to red color
2024-01-12 15:38:19 +01:00
Paul Holden
7143cf4cbc
MDL-79397 reportbuilder: update existing entity table definitions. 2023-12-07 17:19:01 +00:00
Jake Dallimore
832e394322
MDL-76694 core_comment: exit the js init if the element cannot be found
In pages which result in the theme_boost/embedded template being used,
blocks may be rendered and the resulting HTML ignored, leaving any JS
they may have added to run without a corresponding DOM element to act
on. This fixes that case for comments, making sure we exit gracefully
during the init if the element can't be found.
2023-11-03 10:04:32 +08:00
Andrew Nicols
1ce54ee87e
Merge branch 'MDL-72321_master-squashed' of https://github.com/marxjohnson/moodle 2023-08-31 23:02:35 +08:00
Nathan Nguyen
43866217da MDL-72321 qbank_comment: Only initialise javascript if plugin is enabled 2023-08-31 15:00:38 +01:00
Andrew Nicols
af7719682d
MDL-79064 core: Update all get_strings as uses 2023-08-29 10:57:54 +08:00
Paul Holden
33a63ca639
MDL-76295 reportbuilder: implement default datasource sorting.
Update all existing report sources to use the new default sorting
API from 064eccd4, updating existing tests to assert behaviour.
2023-08-23 15:32:50 +01:00
Paul Holden
ca6731dff7
MDL-78117 comment: use new context entity in system report. 2023-08-02 08:05:50 +01:00
Paul Holden
d8df4ad675
MDL-78117 reportbuilder: use context entity in report sources.
Deprecate existing columns, to be replaced by corresponding elements
from the new entity.
2023-08-02 08:05:50 +01:00
Simey Lameze
9382d66b4a MDL-76635 comment: render the delete icon in the right place
Special thanks to Andrew Lyons.
2023-06-21 11:27:41 +08:00
Meirza
0d3a840154 MDL-77350 comment: 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-05-16 00:33:19 +07:00
Andrew Nicols
511401f4f6 MDL-77559 js: Rebuild all JS with Node 16 2023-03-09 09:53:19 +08:00
Andrew Nicols
33b1e41f13 MDL-75012 js: Full build of all grunt things 2023-03-02 11:55:32 +08:00
Paul Holden
76327f04ac MDL-76591 comment: create test generators and Behat scenarios.
The added scenarios cover the management of comments: viewing,
filtering and deletion.
2023-01-30 16:00:25 +00:00
Paul Holden
35f3847064 MDL-76591 comment: implement new management interface elements.
Convert existing JS modules, call existing external service for
comment deletion.
2023-01-30 15:54:00 +00:00
Paul Holden
648b80c201 MDL-76591 comment: convert existing overview page to system report.
Re-use the entity definitions previously created in fdf2f8f3 for
custom reporting, to create a new system report class.
2023-01-30 15:53:59 +00:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Paul Holden
fdf2f8f31b MDL-75352 comment: implement comments datasource for custom reporting.
Create entity definition for a comment, join with user entity in new
report source to provide data for reportbuilder editor.
2022-10-20 13:37:56 +01:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Paul Holden
53d6b18237 MDL-74344 comment: consistent capability check for accessing report.
Co-authored-by: David Wipperfurth <dwipperfurth@webcourseworks.com>
2022-05-13 10:31:16 +01:00
Eloy Lafuente (stronk7)
9f53b0e965 MDL-73971 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:

- Some fixtures, initially defined in the test files have been
  moved to new files in fixtures subdirectory, leaving the unit
  test files clearer:
  - moodle2_course_format_test.php
- Rename wrong named test:
  - baseoptiogroup_test = baseoptigroup_test
2022-05-06 18:29:11 +02:00
Bas Brands
6f3a7998af MDL-73632 core_comment: useravatar styles new comments 2022-02-01 12:21:55 +01: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
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00: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
Neill Magill
2987182e16 MDL-64525 comments: Should not be able to delete frozen comments
Before this change in a frozen context a user would be able to delete
their own comments.

After this change a user will only be able to delete their own comments
if they still have the capability to post new comments or the capability
to delete comments from any user.
2020-08-24 07:59:27 +01:00
Neill Magill
7603ca3080 MDL-64525 comments: Tests for deleting frozen comments 2020-08-24 07:59:27 +01:00
Jake Dallimore
0c3eaf9ee6 MDL-64588 core_comment: fix unnecessary type check in add_comments
We should rely on the return type, else an exception with be thrown.
2019-10-02 09:23:43 +08:00
Jake Dallimore
93ea6612bd MDL-64588 core_comment: make external test code use helper method
Instead of using setUp to create testing objects, use a helper.
2019-10-02 09:23:43 +08:00
Jake Dallimore
ae94d477a6 MDL-64588 core_comment: fix get_comment ordering when timestamps match
Include id in the sorting, to be sure that we always get the correct
record in cases where the comment timestamps are the same.
2019-10-02 09:23:43 +08:00
Jake Dallimore
6cd3d398a9 MDL-64588 core_comment: use comment structure in external get_comments
Other minor changes include:
- added the since tag to newly added external functions
- Changed 'web service' to 'external function' in comment/upgrade.txt
2019-10-02 09:23:33 +08:00
Juan Leyva
09899abc55 MDL-64588 comment: New WebService core_comment_delete_comment 2019-10-01 09:26:01 +08:00
Juan Leyva
8e4a9ed854 MDL-64588 comment: New WebService core_comment_add_comment 2019-10-01 09:26:01 +08:00
Juan Leyva
2234b6c9dc MDL-64588 comment: Return whether the user can post in a comments area 2019-10-01 09:25:36 +08:00
Juan Leyva
48f5ca7bee MDL-66061 comments: Support pagination and sorting in get_comments WS 2019-08-19 10:42:25 +01:00
Mathew May
5cac5fa428 MDL-64506 templates: BS2 m-x-x to BS4 mx-x 2019-04-03 19:47:11 +08:00
Damyon Wiese
5d87464bc6 MDL-64651 comments: Do not send referrer
Use blanktarget option on all comments to prevent malicious links.
2019-03-05 04:24:53 +01:00