94 Commits

Author SHA1 Message Date
Andrew Nicols
4a2793002c MDL-76583 core_external: Add new core_external subsystem 2023-01-17 10:59:15 +08:00
Sara Arjona
e2421df68e MDL-75191 phpunit: add core_admin to phpunit.xml.dist 2022-08-30 10:16:16 +02:00
Simey Lameze
e2cd526456 MDL-74925 phpunit: add missing course/format test suite 2022-07-18 15:00:15 +08:00
Andrew Nicols
fc082d349c MDL-73728 admin: Move adminpresets to admin/presets
This commit moves the presets subsystem to a location within the admin
folder, which is more appropriate given its purpose and reduces
developer frustration with tab completion of the admin directory.
2022-02-03 19:14:28 +08:00
Sara Arjona
727f0d4daf MDL-73397 adminpresets: Create new core_adminpresets component
The core_adminpresets component has been added and some data and
methods from the tool_admin_presets have been moved here.
2022-01-03 11:51:33 +01:00
Eloy Lafuente (stronk7)
5df6768443 MDL-73278 phpunit: Add missing payment subsystem and fix dataprovider
While testing the changed unit tests one by one, the
payment/tests/helper_test.php was failing because of a mismatch
between the dataProvider data and the param type.

That made me think why that error was not popping in complete runs
and the answer is that the new (3.10) subsystem is not in the
phpunit.xml.dist file.

Hence, adding it and fixing the dataProvider mismatch.

Finally, it has been detected that some old ICU versions (< 62)
have an incorrect behaviour, not adding the required non-breaking
white-space between the currency abbreviation and the value. So
we are skipping some payment tests if that's found.
2021-12-09 10:31:33 +01:00
Paul Holden
542f2927f7 MDL-70794 reportbuilder: register new core sub-system.
In addition to housekeeping for the new sub-system, define our
table schema to be used in later persistents.
2021-07-28 16:40:50 +01:00
Eloy Lafuente (stronk7)
83a35142f6 MDL-71036 phpunit: xml config - change dist file to spread them to final
Basically switch to 2-space indenting and small tweaks to comments,
so both the main phpunit.xml file and also the individual components
ones, all them based in the dist one will be consistent.
2021-03-11 23:04:31 +01:00
Eloy Lafuente (stronk7)
be30af0e23 MDL-71036 phpunit: Remove custom autoloader
Custom autoloaders are deprecated with PHPUnit 9 and will be removed
with PHPUnit 10.

Since PHPUnit 8.5 custom autoloaders don't do much because that
version removed the ability to launch unit tests by class name
and that's exactly the reason we had a custom autoloader (to map
class names to files within our tests). See MDL-67673 about
when direct use of classes was deprecated (8.5), now removed (9.5).

So, as far as it's unused, removing it now, test still can be
selectively using any of:

- a relative path to file (although there are some restrictions comming
  with PHPUnit 9, see https://github.com/sebastianbergmann/phpunit/issues/4105
- using --filter, to point to any classname[::method]
- using --testsuite to run a complete suite
- using --config to point to custom components.

Also, commented out the lib/ajax/tests directory because it doesn't
exist / is empty and PHPUnit 9 emits error when a configured test
directory does not exist. See
https://github.com/sebastianbergmann/phpunit/issues/4493.

Alternative was to completely remove the configuration line, but
decided to keep it around in case some day we want to add some
test there.
2021-03-11 19:22:24 +01:00
Eloy Lafuente (stronk7)
cc1c4de8dc MDL-67673 phpunit: Remove the rerun hint on failed test cases
That custom printer was using some hacks to be able to intercept
configuration switches, reflection and other tricks to be able to
print the:

To re-run:
 vendor/bin/phpunit --verbose "core_setuplib_testcase" lib/tests/setuplib_test.php

line on every failed/exceptional/skipped test. After some internal
discussion it was agreed that the normal phpunit output:

1) core_setuplib_testcase::test_localcachedir
Time is lower that allowed start value
Failed asserting that 1601976686 is equal to 1601976687 or is greater than 1601976687.

/var/www/html/lib/phpunit/classes/advanced_testcase.php:446
/var/www/html/lib/tests/setuplib_test.php:170
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80

has already all the information at hand about how to rerun a test:

- vendor/bin/phpunit lib/tests/setuplib_test.php
- vendor/bin/phpunit --filter core_setuplib_testcase::test_localcachedir
- vendor/bin/phpunit --filter ::test_localcachedir
- vendor/bin/phpunit --testsuite componentname_testsuite
- vendor/bin/phpunit --config <<compoenent directory>>
- use --cache-result to get failed tests rerun with ease.
- ...

So better, let's use standard phpunit output and done. Also, note that,
with the upgrade to phpunit 8.5, the printer was not working correctly
any more, causing some switches, like --verbose ... to be ignored. Sure
it could have been fixed but, as commented above, no real need for all
that "parapheranlia" to print the rerun information.
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
61ff13f0f3 MDL-67673 phpunit: Disable phpunit results cache by default
It can be enabled if desired from CLI using the --cache-result
option (or modifying the phpunit.xml cacheResult to true).

That will create the .phpunit.result.cache files that,
later, can be used to easily repeat failed (defects) tests or
run the slow ones first and more. See the --order-by option
to know more about all the available criteria. For example:

./vendor/bin/phpunit --order-by=defects --stop-on-defect

(will run all the failed ones first, stopping on problem, useful
for TDD and other scenarios, not so much for complete runs or CI).

Also, added to .gitignore so they won't be committed ever.
2020-10-21 12:46:00 +02:00
Amaia Anabitarte
bd4e0a7664 MDL-67786 core_contentbank: Unit and behat tests 2020-04-15 23:45:08 +02:00
Ferran Recio
0a832fa1f0 MDL-67734 core_xapi: add xAPI testsuite 2020-03-27 12:08:45 +01:00
Andrew Nicols
1142e1bc83 MDL-67913 core: Add new core_table component path 2020-03-16 11:44:31 +08:00
Sara Arjona
60bd7a8021 MDL-66609 core_h5p: Update phpunit.xml.dist 2019-10-29 10:22:43 +08:00
Eloy Lafuente (stronk7)
1eb34211f7 Merge branch 'MDL-66779-master' of git://github.com/andrewnicols/moodle 2019-10-13 02:11:38 +02:00
Andrew Nicols
bfdeae2afd MDL-66779 phpunit: Correct component name for core_grades 2019-10-09 09:34:47 +08:00
Andrew Nicols
8847ec4791 MDL-66011 tests: Stop forcing coverage annoation 2019-10-04 09:39:50 +08:00
Andrew Nicols
abbabc5a91 MDL-65130 phpunit: Only generate coverage where it is deliberate 2019-03-21 08:16:56 +08:00
Andrew Nicols
0970aa10af MDL-63366 core_phpunit: Add ability to specify coverage filters 2019-03-01 10:30:31 +08:00
Marina Glancy
0e367a119c MDL-57898 core_customfield: Custom fields API
This commit is part of work on Custom fields API,
to minimize commit history in moodle core the work of a team of developers was split
into several commits with different authors but the authorship of individual
lines of code may be different from the commit author.
2019-01-18 14:28:18 +01:00
Jake Dallimore
4fca5dabb2 MDL-63658 core_favourites: introduce the favourites subsystem to core 2018-10-17 10:16:18 +08:00
Mark Nelson
0f41e8a2a1 MDL-62308 core_backup: implement privacy provider
The provider was added to 'backup/util/ui/' due to
Moodle's implementation of autoclass loading. See
fetch_subsystems() in lib/classes/component.php.
2018-05-09 22:48:07 +08:00
David Monllao
74d0a7f975 Merge branch 'MDL-62047-master' of git://github.com/andrewnicols/moodle 2018-04-23 11:58:28 +02:00
Andrew Nicols
81626948c7 MDL-62047 core_userkey: Define component path 2018-04-19 12:46:52 +08:00
David Monllao
37543ce51e MDL-61958 rss: Add rss test suite 2018-04-18 18:23:59 +02:00
Andrew Nicols
ceb2167df1 MDL-61663 phpunit: Add portfolio to the testsuite list 2018-04-17 14:39:56 +08:00
Eloy Lafuente (stronk7)
06dbe955d0 MDL-61819 editor: add testsuite to phpunit.xml 2018-04-16 16:36:42 +02:00
Eloy Lafuente (stronk7)
1c2d8c7fb3 MDL-61751 core_plagiarism: add testsuite to phpunit.xml 2018-04-04 01:04:54 +02:00
Andrew Nicols
33dca94573 MDL-61689 phpunit: Be stricter about output during unit tests
This change also add fail-on-risky to travis to help pick these up, and
verbosity too.

We only fail on risky during Travis and not during normal output because
developers may want to debug tests.
2018-03-20 08:30:42 +08:00
Andrew Nicols
dcc16e155d MDL-61307 core: Define a new privacy component 2018-03-09 09:59:36 +08:00
Eloy Lafuente (stronk7)
6be1923d81 MDL-60611 phpunit: ignore risky (empty) unit tests
At some point we should review them, removing or moving stuff.
2017-11-02 23:45:35 +01:00
Jun Pataleta
52f6f4879a MDL-58713 phpunit: Add core_filter test suite 2017-10-17 09:20:31 +08:00
Jun Pataleta
68b998906e MDL-35668 phpunit: Add filebrowser test folder to phpunit.xml 2017-09-11 11:24:51 +08:00
David Monllao
3834630813 MDL-57791 testing: Add analytics test suite 2017-07-24 08:36:18 +02:00
Jun Pataleta
64755ee800 MDL-58716 core: Define core_login_testsuite in phpunit.xml.dist 2017-07-05 12:39:18 +08:00
Juan Leyva
8446ba3641 MDL-50970 core_block: New Web Service core_block_get_course_blocks 2017-04-03 09:27:53 +02:00
Rajesh Taneja
a4c970ff0e
MDL-56092 phpunit: Add auth/tests to phpunit.xml.dist 2016-10-05 10:03:46 +08:00
David Monllao
286a391b86 MDL-45753 test: Adding core_my testsuite 2016-07-26 04:35:02 +08:00
Andrew Nicols
21e8b48d13 MDL-51758 libraries: Remove password_compat library from core 2016-07-18 10:06:57 +08:00
Frederic Massart
922634d3e5 MDL-53700 competency: Migrating data generator to core 2016-04-18 11:05:59 +08:00
David Monllao
db48207e1a MDL-31989 search: Search API and search engine API
Introducing both APIs in moodle along with:
- search_box widget to add a tiny search box
- admin settings with setup steps helper
- cache for search results
- template for a search result
- php unit stuff

Many thanks to Tomasz Muras, Prateek Sachan and Daniel Neis for their contributions, for starting this development
and for pushing for it to be completed. Also thanks to other contributors: Jonathan Harker and eugeneventer.
2016-02-23 10:47:58 +00:00
Tony Levi
b80b35d0fc MDL-50926 phpunit: Upgrade to phpunit 4.x 2015-08-11 02:35:11 +02:00
Juan Leyva
ffe1579b0a MDL-49203 webservices: Add missing component testsuite declaration 2015-03-26 15:59:15 +01:00
Dan Poltawski
37ccb211fa MDL-49444 phpunit: add missing suite definition 2015-03-24 11:00:27 +00:00
Dan Poltawski
da88accb5f Merge branch 'wip-MDL-46547-master' of git://github.com/abgreeve/moodle 2014-10-08 15:33:46 +01:00
Petr Skoda
ddffa9d6d3 MDL-47538 phpunit: fix invalid PHPUNIT_SEQUENCE_START constant 2014-10-06 17:31:15 +13:00
Adrian Greeve
c3ba8429e1 MDL-46547 gradebook: Unit tests for new class importing csv files. 2014-10-06 09:14:04 +08:00
Russell Smith
529495f7ce MDL-46193 phpunit: Use random starting value on initialization. 2014-07-04 16:33:13 +10:00
Rajesh Taneja
3c4b599d9b MDL-45565 phpunit: Changed testsuite_name, so as to avoid class collision 2014-05-27 09:43:52 +08:00