30 Commits

Author SHA1 Message Date
Dani Palou
3923ef9408 MDL-75788 testing: Handle new lines in menu profile field generator 2022-12-02 14:54:46 +08: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
Noel De Martin
3ce936fe6d MDL-72846 testing: Add default block generators 2021-12-02 14:58:24 +01:00
Peter
90acd8d381 MDL-52206 core: Add completion criteria to course_modules 2021-10-04 19:44:02 +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
sam marshall
9ddb51b07e MDL-45242 Testing: Generators for user profile fields 2021-03-08 09:20:17 +00: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
Marina Glancy
5b529aca15 MDL-68333 testing: trigger user_created event in user generator 2020-05-19 19:11:54 +02:00
Andrew Nicols
aac98ca7df MDL-62514 behat: Remove potentially conflicting names from description 2019-01-30 08:24:32 +08:00
Adrian Greeve
190646bd75 MDL-59287 core_completion: Update to unit tests. 2017-07-10 09:40:02 +08:00
Marina Glancy
89b909f6de MDL-57769 course: prepare to remove numsections option 2017-03-30 08:26:12 +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
Simey Lameze
ac9768fc1b MDL-52781 core_user: replace direct PARAM_ usages.
This commit replace as much as possible of clean_param and PARAM_ usages related to user object.
Also few unit tests has been changed to match the new validation
2016-04-21 15:24:36 +08:00
Nadav Kavalerchik
dffcf46f43 MDL-52252 Tags: Add tags to modules (Resources and Activities) 2016-03-09 14:19:47 +08:00
Marina Glancy
c026a28d59 MDL-50851 core_tag: introduce tag collections 2016-01-10 15:25:43 +08:00
sam marshall
92cce140ed MDL-52558 Data generator: enrol_user should allow shortname 2015-12-18 11:01:15 +00:00
Marina Glancy
810805da9e MDL-51636 core_tag: allow setting tags in generators 2015-10-04 22:25:37 +08:00
Petr Skoda
e5035ecb3f MDL-48420 test: fix lasttnamephonetic typo 2014-12-01 09:25:55 +13:00
Marina Glancy
f4f2045a7f MDL-47398 core_grades: fix grade category generator 2014-09-26 09:57:56 +08:00
Damyon Wiese
15ace20460 MDL-46997 Grades: Improve the behat tests for grade aggregation
The tests now cover hidden grades in sub categories for all aggregation types. This change
includes a data generator for grade categories, with unit tests and behat tests for
the generator.
2014-09-09 17:11:59 +08:00
sam marshall
9c85baa8c5 MDL-44725 Availability: Replace groupmembersonly - FEATURE_xx (6)
Remove old FEATURE_GROUPMEMBERSONLY as no longer required.
2014-09-02 13:03:17 +01:00
sam marshall
061e6b2864 MDL-44725 Availability: Replace groupmembersonly - upgrade, core (1)
* Upgrades existing data so that the groupmembersonly option is
  replaced with equivalent data for the new availability API.
* Removes the database field and admin setting used for
  groupmembersonly.
* Changes core modinfo library to remove/deprecate groupmembersonly
  data and functions.
* Changes other core library files to remove groupmembersonly
  references.

Includes deprecation of several functions, listed in lib/upgrade.txt.
2014-09-02 13:03:07 +01:00
sam marshall
8d1f33e122 MDL-44070 Conditional availability enhancements (6): core changes
Changes core code to use new API instead of the old one when
checking user access to activities and sections.

Includes changes to other libraries that are necessary after
adding the availability system and removing old conditional tables
etc.
2014-04-07 20:11:48 +01:00
Marina Glancy
c24b3f66f1 MDL-42400 generator: unittest for module generator 2013-10-26 14:00:27 +11:00
Petr Škoda
401c82d7a7 MDL-41022 cleanup core_test_generator_testcase 2013-08-24 16:18:19 +02:00
Eloy Lafuente (stronk7)
cf20e809aa Merge branch 'MDL-38582' of git://github.com/timhunt/moodle 2013-03-26 16:03:37 +01:00
Petr Škoda
c3f31a3ded MDL-38581 move forum discussion and post generators to proper place 2013-03-22 13:21:35 +01:00
Tim Hunt
ba203de1d3 MDL-38582 testing: Let any component have a data generator.
Plus a simple core_question generator to test the concept.
2013-03-22 10:28:24 +00:00
Mark Nelson
a9a0cb691c MDL-30102 mod_forum: adding webservice function to allow for the retrieval of forum discussions 2013-02-04 19:28:29 +08:00
David Monllao
5c3c2c81be MDL-37457 testing Refactoring references 2013-01-15 11:07:43 +08:00