45 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
40de097e65 MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
d95c378771 MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:00 +02: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
Dani Palou
25bc7a3d6b MDL-68098 ws: Add unit tests to test mathjax in WS 2020-09-23 11:18:41 +02:00
Eloy Lafuente (stronk7)
5afac432f5 MDL-67598 unit tests: Pass day of month without leading zero
Note this fixes the unit tests. Still the calendar API itself
should be able to manage this cases, both casting (int) or
being stricter about what's allowed there (param hinting).

But that falls out from this issue and the code that introduced
the failures, so the pure unit-test fix has been applied.
2020-01-02 00:06:40 +01:00
Shamim Rezaie
f046b70355 MDL-67152 calendar: The day view should start from the current day 2019-12-09 22:37:21 +11:00
Michael Hawkins
23affd76c2 MDL-66373 calendar: Added datetimes to timestamps conversion web service 2019-11-04 10:04:57 +08:00
Juan Leyva
2aad6b8261 MDL-64641 calendar: New WS core_calendar_get_allowed_event_types 2019-04-05 09:56:39 +02:00
Juan Leyva
a46980fa79 MDL-64641 calendar: New WS core_calendar_get_access_information 2019-04-05 09:56:39 +02:00
David Monllaó
7af6528e30 MDL-60340 calendar: New param to specify a user 2019-03-15 11:35:29 +01:00
Adrian Greeve
c84ee67864 MDL-64063 core_calendar: Unit test for suspended users. 2018-11-21 09:51:52 +08:00
Simey Lameze
dfc609e55d MDL-60826 calendar: lazy load groups on event form 2018-07-24 07:58:34 +08:00
Michael Hawkins
ef4e04ee26 MDL-37624 calendar: Added location support 2018-06-29 10:46:54 +08:00
Juan Leyva
e3c04bd98a MDL-60836 core_calendar: Return categoryid in get_calendar_events 2018-01-30 13:47:19 +01:00
David Monllao
641e7d41a6 MDL-60967 calendar: Add argument for missing mini param 2018-01-16 13:30:14 +01:00
Juan Leyva
44ae08383b MDL-60813 calendar: Fix core_calendar_get_calendar_events for categories
Users couldn’t see category events when filtering by categories in the
core_calendar_get_calendar_events WS.
2017-11-16 19:16:01 +01:00
Jun Pataleta
0cf288757d MDL-60779 calendar: Pass correct parameters for get_calendar_X_view() 2017-11-11 22:28:38 +13:00
Simey Lameze
754016ab33 MDL-60628 calendar: amend web service unit test 2017-11-09 11:43:49 +08:00
Jun Pataleta
8001199766 MDL-60611 calendar: Remove usage of deprecated setExpectedException() 2017-11-07 11:21:29 +13:00
Damyon Wiese
9e0884d410 MDL-60626 calendar: Unit tests for capabilities
Check various calendar external functions for capabilities.
2017-11-06 11:11:28 +08:00
Andrew Nicols
303d649aca MDL-59890 calendar: Correct context checks for edit test 2017-10-04 11:16:06 +08:00
Ryan Wyllie
ea5f7707e7 MDL-59919 calendar: add file support to event form 2017-09-07 01:38:43 +00:00
Eloy Lafuente (stronk7)
f0e6ff9a8e Merge branch 'MDL-59669-master-3' of git://github.com/ryanwyllie/moodle 2017-08-29 02:15:18 +02:00
Ryan Wyllie
69b160ed12 MDL-59669 calendar: add unit tests for submit_create_update_form 2017-08-24 05:40:01 +00:00
Ryan Wyllie
96283892fe MDL-59393 calendar: fix CiBoT complaints 2017-08-23 02:09:43 +00:00
Ryan Wyllie
909d08588d MDL-59393 calendar: stop user editing module events 2017-08-23 00:57:22 +00:00
Ryan Wyllie
c6fb931088 MDL-59393 calendar: add update_event_start_day external function 2017-08-23 00:56:27 +00:00
Simey Lameze
5d942f5a53 MDL-59810 core_calendar: test action events cannot be deleted 2017-08-15 12:05:10 +08:00
Marina Glancy
63e9e38202 MDL-58911 calendar: use the same callbacks in unittests and prod
Remove unittest-specific callbacks for checking access and displaying
the calendar events on the dashboard.

This will allow plugin developers unittest the full behavior
of how their plugins add events to the dashboard.

Reset all static caches between unittests.
2017-06-20 16:13:35 +08:00
Marina Glancy
5900513f75
MDL-58688 calendar: use modinfo to check module availability 2017-05-03 15:07:43 +08: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
Ryan Wyllie
1aeb58faad MDL-57503 calendat: test external function get action events by courses
Part of MDL-55611 epic.
2017-04-03 11:36:34 +08:00
Ryan Wyllie
5e026bb05f MDL-57503 calendar: test external function get action events by course
Part of MDL-55611 epic.
2017-04-03 11:36:34 +08:00
Ryan Wyllie
4139f1311f MDL-57502 core_calendar: get calendar action events tests
Part of MDL-55611 epic.
2017-04-03 11:36:08 +08:00
Mark Nelson
e057f279e4 MDL-57497 core_calendar: added new calendar event class
Moved calendar_event class to new location using replaceclasses.php

Part of MDL-55611 epic.
2017-04-03 11:33:55 +08:00
Jun Pataleta
f52459bbbe MDL-55956 calendar: Show only one of duplicate events relevant to user
If there are multiple, non-repeating events with the same module name,
instance and event type. The most specific event or the event with the
highest priority will be shown.
The ordering of event priorities:
  User override events > Group override events > Course events.
If there are no user override events and there are multiple group
overrides for an event, then the one with the highest priority will be
shown.
2017-03-07 11:33:17 +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
Juan Leyva
871988b0b4 MDL-54049 core_message: Add missing external format text 2016-05-04 12:52:45 +02:00
Juan Leyva
39b8513763 MDL-52808 calendar: Do not return events for hidden activities 2016-03-07 22:36:31 +01:00
Neill Magill
11dc7c1c3d MDL-51495 calendar: Unit test to get an individual course event
If is user requests a single event on a course via the web service they should be able to retrieve it.
2015-11-11 15:18:37 +00:00
Juan Leyva
e2c851575f MDL-45131 calendar: Add validation for returned parameters in WS tests 2015-04-13 16:37:18 +02:00
David Monllao
ef5b65dae4 MDL-48285 calendar: Adapting unit tests to the new behaviour
Testing also the default value including repeated events.
2014-12-04 12:14:31 +00:00
Ankit Agarwal
5ac3b20dc5 MDL-40915 events: Add unit tests for the newly created events 2014-03-21 16:33:19 +08:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Ankit Agarwal
9dadb59064 MDL-39020 phpunit: Rename incorrect filename
Rename externallib_tests.php to externallib_test.php
Fix failing unit tests
2013-07-01 10:32:28 +08:00