775 Commits

Author SHA1 Message Date
Adrian Greeve
7d435fb5f2 MDL-70196 navigation: Update to feature files.
- Part of: MDL-69588
A lot of tests rely on the last element of the breadcrumb being
active. This updates feature files to not rely on this anymore.
2021-08-23 17:46:38 +08:00
Mikhail Golenkov
8355a9a018 MDL-72239 phpunit: Assert the number of db queries to be less or equal
The course unit test assumes the number of db call. This assumption
is correct in vanilla moodle only. Once some plugins installed their
observers may do extra db calls. Due to caching the number of actual
db calls in the unit test may be fewer.
2021-08-18 11:01:29 +10:00
Andrew Nicols
776f4bd80c MDL-72179 behat: Make use of page resolvers 2021-07-26 15:14:28 +08:00
Andrew Nicols
9f428f68c7 MDL-72179 behat: Add activity editing page resolution 2021-07-23 20:43:48 +08:00
Andrew Nicols
730d6cb94e MDL-72179 behat: Improve core page resolvers
This commit makes the following improvements to core page resolverss:
* allows for mixed case naming (course, Course, etc.)
* allows fields other than the idnumber to be specified:
** course: idnumber, shortname, fullname
** course category: idnumber, name

Whilst some of these fields are not unique, they will typically be
unique in most test scenarios. Where they are not then the idnumber
should be used in preference.
2021-07-23 20:28:10 +08:00
Eloy Lafuente (stronk7)
0139d213ac Merge branch 'MDL-71874-master' of git://github.com/andrewnicols/moodle 2021-07-13 20:38:01 +02:00
Ilya Tregubov
4819625349 MDL-32103 completion: Allow instant completion updates.
For activity based course completion criteria allow instant
course completion updates if the activity completion state was changed
for a single user.
2021-07-13 12:07:53 +02:00
Sujith Haridasan
b2527be7d3 MDL-71241 course: Validate and sanitize sort arguments
Signed-off-by: Sujith Haridasan <sujith@moodle.com>
2021-07-08 23:30:27 +02:00
Mihail Geshoski
084ff0c8da MDL-71242 core_course: Test the validation of the sort value
Adds new unit test, test_course_get_recent_courses_sort_validation(),
which is reponsible for testing the validation of the sort value in
course_get_recent_courses().
2021-07-08 23:30:26 +02:00
Mihail Geshoski
069cc7164c MDL-71242 core_course: Update test_course_get_recent_courses() unit test
Adds additional assertions in test_course_get_recent_courses() test to
ensure that the sort funcionality works as expected.
2021-07-08 23:30:26 +02:00
Andrew Nicols
e506742102 Merge branch 'MDL-71314' of https://github.com/paulholden/moodle 2021-07-01 10:23:47 +08:00
Ferran Recio
21d93554d4 MDL-71863 courseformat: create courseformat subsystem 2021-06-28 13:50:18 +02:00
Paul Holden
c8f0fee909 MDL-71314 course: add category record snapshot to deletion event. 2021-06-25 14:50:17 +01:00
Víctor Déniz
754d164391 Merge branch 'MDL-71052' of git://github.com/paulholden/moodle 2021-06-17 02:37:46 +01:00
Sara Arjona
6347b916bc MDL-71165 course: core_course_update_course external method 2021-06-14 14:36:20 +08:00
Andrew Nicols
a9b0f4dafe Merge branch 'MDL-71134-master-v03' of git://github.com/ferranrecio/moodle 2021-06-14 11:52:35 +08:00
Ferran Recio
ee3547306e MDL-71134 course: fix format get_output_classname
The get_output_classname method is used to invoke overridden output
components from course_formats. Now the method does not accept null
output names anymore, and it controls the format class is extending
the core one.
2021-06-10 16:08:39 +02:00
Andrew Nicols
412c7a4afa MDL-71382 couurse: Remove unnecessary js tag for test 2021-06-10 09:58:12 +08:00
Andrew Nicols
6bc1346333 Merge branch 'MDL-71382-master' of git://github.com/ilyatregubov/moodle 2021-06-10 09:48:55 +08:00
Andrew Nicols
64e7326649 MDL-71874 behat: Show warning when using add to section without js 2021-06-09 16:26:43 +08:00
abgreeve
1a9e810e06 Merge branch 'MDL-71207_master' of https://github.com/TomoTsuyuki/moodle 2021-06-08 10:44:04 +08:00
Tomo Tsuyuki
14d11b8f0e MDL-71207 course: Add info for task error 2021-06-08 09:44:59 +10:00
Sara Arjona
5f91cbb611 MDL-71135 course: core_course_get_state external method 2021-06-04 16:43:28 +02:00
Paul Holden
7f6364971e MDL-71052 course: use filetypes setting for course overview files. 2021-06-04 09:35:15 +01:00
Ilya Tregubov
b071a7b838 MDL-71382 course: Don't allow empty name for section 0. 2021-06-02 08:42:12 +02:00
Ilya Tregubov
cf1cf222e7 MDL-66431 core: Fix behat tests.
Move activity creation to data generators. Only fixing those
tests failing due to removing usemodchooser preference.
2021-05-01 16:22:03 +02:00
Adrian Greeve
e17333c342 Merge branch 'MDL-71141-master' of git://github.com/ferranrecio/moodle 2021-04-29 15:40:51 +08:00
Dongsheng Cai
36bc7b07db MDL-71235 webservices: add activity completion data to web services 2021-04-29 13:52:32 +10:00
Huong Nguyen
5e7ff4b80c MDL-71252 completion: PHPUnit failure 2021-04-27 08:42:37 +07:00
Ferran Recio
6ae566c55d MDL-71141 course: fix frontpage section warning 2021-04-12 12:41:10 +02:00
Jun Pataleta
15a9b2c51c MDL-70821 course: Check activity dates on course homepage
* Check the activity dates on the course homepage depending on
  the value of the showactivitydates course setting
* Plus use the new Behat steps for checking activity dates
2021-04-12 11:41:37 +08:00
Jun Pataleta
5dee6f45d8 MDL-70821 course: New Behat steps for activity dates
* activity_date_in_activity_should_contain_text()
  - Checks the presence of the given text in the activity's date info.
* activity_dates_information_in_activity_should_exist()
  - Checks the presence of activity dates information in the activity
    information output component.
* activity_dates_information_in_activity_should_not_exist()
  - Checks the absence of activity dates information in the activity
    information output component.
2021-04-12 11:41:37 +08:00
Simey Lameze
c0d0679c8a MDL-70782 course: behat coverage for new setting
Part of MDL-70817
2021-04-02 21:53:20 +08:00
Eloy Lafuente (stronk7)
6b95768f5f NOBUG: Fixed file access permissions 2021-03-19 14:06:19 +01:00
Jun Pataleta
ebf078458d Merge branch 'MDL-71036' of https://github.com/stronk7/moodle 2021-03-17 20:05:25 +08:00
Jun Pataleta
839abe254c Merge branch 'MDL-66667-cache-course-image-master' of https://github.com/dmitriim/moodle 2021-03-15 17:19:06 +08:00
Adrian Greeve
00cb88c352 Merge branch 'MDL-65974-master-iteration03' of git://github.com/ferranrecio/moodle 2021-03-15 15:16:44 +08:00
Dmitrii Metelkin
2affc87d2b MDL-66667 course: add course image cache 2021-03-15 12:50:35 +11:00
Eloy Lafuente (stronk7)
81407f18ec MDL-71036 phpunit: Mock->setMethods() silently deprecated
The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.

Basically the now deprecated method has been split into:

- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
  artifact.

In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.

Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.

Link: https://github.com/sebastianbergmann/phpunit/issues/3770
2021-03-11 23:04:31 +01:00
Eloy Lafuente (stronk7)
8a14a7bd22 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:04:31 +01: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
Ferran Recio
8e7dc42440 MDL-65974 course: move format renderers to outputs 2021-03-11 17:36:34 +01:00
Ferran Recio
1c839f9072 MDL-65974 course: move format_base to core_course\course_format 2021-03-11 17:36:34 +01:00
Eloy Lafuente (stronk7)
90db228323 Merge branch 'MDL-70726-master' of https://github.com/NashTechOpenUniversity/moodle 2021-03-11 00:11:15 +01:00
Amaia Anabitarte
d0bea8aa5e MDL-70726 behat: Fixing existing fail tests
Some of the current behat tests were wrong but not failing because of the bug in 'should not exist' step.
Once the bug is fixed, we must fix also wrong behats.
2021-03-05 14:19:55 +07:00
David Mudrák
0c9eaeff59 MDL-70964 lang: Use the fixed strings in tests 2021-02-25 16:20:58 +01:00
Marina Glancy
aa33a22733 MDL-64554 core_customfield: use modal forms for fields 2021-02-17 18:06:53 +01:00
Amaia Anabitarte
248d4ff200 MDL-70732 behat: Adding second parameter to ExpectationException() 2021-02-05 11:01:22 +01:00
sam marshall
b5568aad80 MDL-70102 PHPunit: Core test fails with weird added modules
Specifically it fails if the modules have unusual default capabilities
so that editingteacher doesn't have addinstance.
2021-01-07 16:09:57 +00:00
Andrew Nicols
31402aa406 MDL-69107 user: Fix autocomplete usages 2020-12-16 07:50:56 +08:00