Commit Graph

69 Commits

Author SHA1 Message Date
Mathew May
e5ca7766e7 MDL-52805 core: Remove legacy log calls 2023-03-07 13:08:46 +08:00
Jun Pataleta
1a6bf2e5ff MDL-74321 mod_forum: Add forum_check_throttling unit tests 2022-03-28 14:39:21 +08:00
Eloy Lafuente (stronk7)
511801cb46 MDL-73352 phpunit: lib_test and locallib_test testcase names
All lib_test and locallib_test classes:

- Namespaced with component (and API whenever makes sense).
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed or add new uses.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under login/tests:

1) The core_login component doesn't exist.
2) But login/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 login_xxxx as prefix.
2021-12-30 16:21:42 +01:00
Jun Pataleta
58bd7256ec MDL-67610 mod_forum: Do not include private replies in unread count
Fetching the counts of unread posts should only include unread regular
posts or unread private reply posts directed to the user unless the user
has the capability to read private replies.
In order to retrieve the correct counts, we also need to loop through
each forum instance in the course to check the capability of the user to
read private replies in each forum.
2021-09-07 23:19:26 +08:00
Eloy Lafuente (stronk7)
ba5b6089d5 MDL-71036 phpunit: Renamed various regexp-related assertions
In PHPUnit 9.1, the following regexp-related assertions
have been deprecated and there are new alternatives for
all them:
    - assertRegExp()     -> assertMatchesRegularExpression()
    - assertNotRegExp()  -> assertDoesNotMatchRegularExpression()

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 'assertRegExp|assertNotRegExp' -li
2021-03-11 19:22:24 +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
Ryan Wyllie
667e5fd93f MDL-66770 mod_forum: put nested v2 display mode behind user preference 2019-11-01 13:17:24 +08:00
Sara Arjona
b18015c687 MDL-57487 mod_forum: final deprecation xxx_print_overview
Apart from deprecating forum_print_overview, the following method
has been also deprecated because it's not used anymore:
- forum_filter_user_groups_discussions
2019-06-14 17:42:59 +02:00
Shamim Rezaie
7a6b701a90 MDL-31355 mod_forum: Add drag and drop support to forum duedate events 2019-04-11 18:47:35 +10:00
Shamim Rezaie
82482e3d3e MDL-31355 mod_forum: different message when duedate has passed 2019-04-11 18:47:35 +10:00
Shamim Rezaie
cbf63d8efc MDL-31355 mod_forum: Prevent users from posting after cut-off date 2019-04-11 18:47:35 +10:00
Andrew Nicols
bc4c7337e1 MDL-22077 forum: Add forum private replies
This patch adds new capabilities:
'mod/forum:postprivatereply'   - whether a user is able to post private replies; and
'mod/forum:readprivatereplies' - whether a user is able to read private replies.

Private replies are only visible to the intended recipient (the author of
the parent post), the author of the private reply, and those with the
ability to read private replies.

If a post is private then it cannot be replied to further.
2019-04-04 11:25:29 +08:00
Ryan Wyllie
47d38303cf MDL-64820 forum: add new classes for rendering to local namespace 2019-03-22 09:24:05 +08:00
Ryan Wyllie
4dc671a920 MDL-64820 forum: add caching to forum_tp_is_tracked 2019-03-22 09:24:05 +08:00
Andrew Nicols
fc9694d1e5 Merge branch 'MDL-63892-master-rework' of git://github.com/mickhawkins/moodle 2019-02-13 10:18:25 +08:00
Andrew Nicols
b231aabb2d MDL-46881 mod_forum: Remove unused functions
Note: I have not applied the deprecation policy to these functions as
they are extremely core to the cron functionality and were never
intended to be used outside of cron.
2019-01-30 07:48:38 +08:00
Michael Hawkins
c41d36fa6b MDL-63892 mod_forum: Updating lib unit test 2019-01-22 13:50:47 +08:00
Shamim Rezaie
46b29219e3 MDL-63139 mod_forum: Check if the module is visible to the user 2018-09-07 16:55:19 +10:00
Shamim Rezaie
d46da4aadc MDL-63139 mod_forum: Add userid param to mod_forum calendar callbacks 2018-09-07 16:47:56 +10:00
Andrew Nicols
08ac68de3e MDL-61068 mod_forum: Fix neighbour test dates 2018-01-09 09:08:40 +08:00
Ankit Agarwal
bb40a28d9b MDL-58497 forum: Show correct itemcount on action events 2017-05-01 13:48:30 +05:30
Jake Dallimore
8db355c58f MDL-58138 tests: unit and behat tests covering bulk and default tabs
Part of MDL-58138 epic
2017-04-19 08:56:11 +08:00
Andrew Hancox
d2ba493cfe MDL-46929 mod_forum: Implement tagging 2017-04-11 08:30:09 +01:00
Mark Nelson
e1cd93ce20 MDL-58423 core_calendar: moved \core_calendar\event class
Part of MDL-55611 epic.
2017-04-04 11:01:49 +01:00
Damyon Wiese
739de5fefe MDL-58087 mod_forum: Fix fragile test
This test was dependant on the randomly generated group names coming back in a
specific order.

Part of MDL-55611 epic.
2017-04-04 11:01:42 +01:00
Mark Nelson
6c83e65928 MDL-57878 mod_*: added unit tests for event decoration
Part of MDL-55611 epic.
2017-04-03 11:37:09 +08:00
Mark Nelson
e9dfeec94e MDL-57434 core: deprecated xxx_print_overview() and related functions
Part of MDL-55611 epic.
2017-04-03 11:33:55 +08:00
David Monllao
1535cd5bad MDL-58450 mod_forum: Force groups to be returned as they are created
Long history resumed: The test relies on the first group
being the first that is created, the first group is
actually the first one ordering by name. If  is
group-999 and  is group-1000  is returned
as the first group.
2017-03-31 01:44:21 +02:00
David Mudrák
106f23730a MDL-57677 mod_forum: Fix wrong user displayed as the last post's author
In the recent issue MDL-56225, we started to record the current user as
the usermodified in the forum_discussions table when updating a forum
post. It made sense but it was a mistake.

Even if the current user really modifies the discussion by updating the
post, the field usermodified has actually been always interpreted and
displayed as the last post' author. Not as the last user who touched the
discussion.

This patch reverts that particular change to the previous behaviour and
adds explicit unit test for it.
2017-01-17 19:45:17 +01:00
Andrew Nicols
0f3bbfd4f8 MDL-55982 mod_forum: Add time-based discussion locking
This patch adds support for time-based locking of discussions.
Discussions are automatically locked after a user-definable period of
inactivity. After this time, only those with the the relevant capability
are able to add replies.

This has been designed to add support for other types of discussion locking
at a later date with relative ease.
2016-09-21 09:03:42 +08:00
Rajesh Taneja
52f3e060e4 MDL-55091 phpunit: Following has been deprecated.
1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
2016-07-26 10:11:30 +08:00
Jun Pataleta
af0fc6a254 MDL-18599 mod_forum: Hide single discussion owner's name and picture
* On the discussion's page.
* On the recent activity block.
* On the recent activity page.
2016-07-11 21:40:19 +08:00
Andrew Nicols
c0e3c8ae0d MDL-52942 forum: Allow posting to multiple groups in eachuser forums 2016-04-11 12:23:47 +08:00
Andrew Nicols
985dca606f MDL-52930 forum: Fix random test failure caused by passing of time 2016-02-10 12:24:09 +08:00
Andrew Nicols
d6ffb0277a MDL-52930 mod_forum: Add get_unmailed_posts tests 2016-02-05 14:33:17 +08:00
Ryan Wyllie
f9621c56c4 MDL-372 forum: tests for pinned discussions 2016-01-13 02:01:27 +00:00
Ben Kelada
5f219cf181 MDL-372 forum: Improve pinning and update for Moodle 3.0 2016-01-13 02:01:26 +00:00
Dan Poltawski
7931245f95 Merge branch 'wip-mdl-52656' of https://github.com/rajeshtaneja/moodle 2016-01-12 10:39:46 +00:00
Rajesh Taneja
faea241337 MDL-52656 unittest: Reset original session while setting user 2016-01-08 09:41:28 +10:00
Andrew Nicols
6667ebb98e MDL-52000 mod_forum: Respect timed posts in course overview block 2016-01-07 16:57:27 +08:00
Andrew Nicols
4aaa38e8fa MDL-52000 mod_forum: Respect timed posts in course overview block 2016-01-06 16:20:48 +08:00
Andrew Nicols
23079c2941 Merge branch 'MDL-49566_master' of git://github.com/markn86/moodle 2016-01-04 13:53:40 +08:00
Mark Nelson
be5e0110ff MDL-49566 core: used reflection in unit tests
Also split the tests into multiple functions for each scenario.
2015-12-29 17:42:43 +08:00
Ankit Agarwal
bef0d6b052 MDL-49566 core: Write unittests for MDL-45898 2015-12-29 11:22:42 +08:00
Andrew Nicols
6ec766069c MDL-52597 mod_forum: Remove sleep from tests 2015-12-23 14:24:35 +08:00
Juan Leyva
04cd8ae3c0 MDL-52165 mod_forum: New Web Service mod_forum_can_add_discussion 2015-12-04 15:30:16 +01:00
Adam Olley
1e36665719 MDL-50993 forum: Display timed posts/discussions in a logical order
Users that don't have permission to view timed posts outside of the release
time frame will have discussions that have entered the visible frame appear
in an odd order from their point of view on the discussion list.

Example:
Discussion 1, modified 2015-01-01, hidden till 2015-01-03
Discussion 2, modified 2015-01-02, not hidden

The standard 'modified descending' order means that D2 is listed at the top
even after D1 becomes visible. When scanning the list of discussions for new
posts, the user could be tricked into thinking they'd already read it.

This fix instead takes into account the release time of the discussion when
timed forum posts are enabled.

I opted to use CASE statements to handle this instead of GREATEST as the
latter is not supported by MSSQL.
2015-10-19 04:04:58 +00:00
Juan Leyva
4f3a2d2103 MDL-51637 forum: Make forum_get_discussions_paginated return group post 2015-10-12 10:08:17 +02:00
Dan Poltawski
158cc03737 Merge branch 'MDL-50109-master-blogsort' of https://github.com/mudrd8mz/moodle 2015-09-28 10:44:47 +01:00
Ankit Agarwal
731c2712e7 MDL-50173 ratings: Use proper checks to ensure ratings are viewable.
Mainly to verify groups visibility this new callback has been created.

Note this was originally 3 commits but for amending purposes they have
been squashed.
2015-09-09 04:07:21 +02:00