Commit graph

99469 commits

Author SHA1 Message Date
Sara Arjona
0459910b53 MDL-65959 core_badges: fix unique index in upgrade.php
There was an error when creating the unique index. Apart from that,
the code has been reorganised to copy data in the new structure only
if password field hasn't been removed.
2020-10-26 23:56:46 +01:00
Matt Clarkson
adeaafd59d MDL-68722 atto_equation: fix for form elements with special characters
Element id's containing characters such as ':' would break the tab
selector in bootstrap.

This specifically affects the essay question type.
2020-10-27 11:10:58 +13:00
Sara Arjona
0dd7bb8374 Merge branch 'MDL-65959-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE 2020-10-26 22:44:05 +01:00
Peter Dias
bcba1347f8 MDL-65959 badges: Allow cross domain/protocol functionality - obv2 2020-10-26 18:36:26 +08:00
Peter Dias
b0e1edd427 MDL-65959 badge: Enable OB2.1 *connection* with cross domain ability 2020-10-26 18:36:26 +08:00
Peter Dias
b0007a154c MDL-65959 badge: Reset external_identifiers if backpack details modified 2020-10-26 18:36:26 +08:00
Peter Dias
8c9d3695e3 MDL-65959 badge: Confirm assertion data is updated before awarding 2020-10-26 18:36:26 +08:00
Peter Dias
184944ce6a MDL-65959 badges: Unit and Behat tests 2020-10-26 18:36:26 +08:00
Peter Dias
ad9f9e54a3 MDL-65959 badges: Do not use badge user preference after verification 2020-10-26 18:36:26 +08:00
Peter Dias
943b261760 MDL-65959 badges: Update the implementation to use admin set backpack 2020-10-26 18:36:25 +08:00
Peter
8dbc7c6532 MDL-65959 core_badges: Allow ability to upload badges cross domain. 2020-10-26 18:35:36 +08:00
Peter
6f7fe5df9c MDL-65959 core_badges: Unrestricted user's badger account
* Restructure the email to be backpack specific
* Amended table defintion and functions
2020-10-26 18:35:35 +08:00
Eloy Lafuente (stronk7)
7e5f0e1fe6 MDL-70010 core: reconcile MOODLE_310_STABLE and master
There are some unexpected differences between 310 and master,
better reconcile them now. Note this is not 100% critical but,
as far as nothing exclusively for 4.0 has landed to master yet
only branch/version differences should exist.
2020-10-26 11:03:40 +01:00
Eloy Lafuente (stronk7)
11b6df58db Merge branch 'MDL-69993-310' of git://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-26 10:42:51 +01:00
Andrew Nicols
36beec930e Merge branch 'MDL-69995-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-26 16:00:38 +08:00
Adrian Greeve
750fe24949 MDL-69559 core_course: Fix to bad behat test formatting. 2020-10-26 13:28:10 +08:00
Adrian Greeve
cc718b59d0 Merge branch 'MDL-69559-310-7' of git://github.com/mickhawkins/moodle into MOODLE_310_STABLE 2020-10-26 13:05:33 +08:00
Jun Pataleta
4dcc2d37c6 Merge branch 'MDL-67301-dynreg-squashed-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-10-26 12:40:23 +08:00
Michael Hawkins
d358b91e2b MDL-69559 course: Add course setting and cap to control course downloads 2020-10-26 10:25:37 +08:00
Michael Hawkins
c053b93f0c MDL-69559 course: Add course content download UI and execution page 2020-10-26 10:19:39 +08:00
Michael Hawkins
cdf91cc236 MDL-69559 course: Add capability and access checks for course download 2020-10-26 10:19:33 +08:00
Michael Hawkins
fab34222ca MDL-69559 admin: Add course download admin settings and lang strings 2020-10-26 10:19:27 +08:00
Huong Nguyen
ef6f42a825 MDL-69930 qtype_ddimageortext: Duplication items in drag-onto-image question 2020-10-25 20:14:43 +07:00
Luca Bösch
a9f5f8094c MDL-69995 backup: padding before activity icons. 2020-10-25 02:07:26 +02:00
Claude Vervoort
10e16c69c8 MDL-67301 mod_lti: dynamic registration 2020-10-24 09:28:32 -04:00
Amaia Anabitarte
e66e3740a7 MDL-69716 mod_quiz: No timestamp for in progress attempts 2020-10-23 16:02:25 +02:00
Eloy Lafuente (stronk7)
6594c54b2e on-demand release 3.10dev+ 2020-10-23 14:41:20 +02:00
Paul Holden
6dc336a5d4 MDL-69993 output: correct navigation node type for user reports. 2020-10-23 08:25:40 +01:00
Adrian Greeve
39128991d7 Merge branch 'MDL-67650-forced-checkbox-textarea-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-23 09:01:59 +08:00
Víctor Déniz
e1990f2f33 Merge branch 'MDL-68664-310' of git://github.com/lameze/moodle into MOODLE_310_STABLE 2020-10-22 12:25:51 +01:00
Sara Arjona
1ce223c7e1 Merge branch 'MDL-69553-m310' of https://github.com/NeillM/moodle into MOODLE_310_STABLE 2020-10-22 08:56:05 +02:00
Brendan Heywood
6694715840 MDL-67650 admin: Consistently show forced config settings 2020-10-22 13:17:49 +11:00
Jake Dallimore
0a43a459ba Merge branch 'MDL-68438_310' of https://github.com/t-schroeder/moodle into MOODLE_310_STABLE 2020-10-22 09:30:48 +08:00
Adrian Greeve
7e0bcbfb19 Merge branch 'MDL-69788-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-22 09:07:54 +08:00
Eloy Lafuente (stronk7)
eaf89f7754 Merge branch 'MDL-66392-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-21 19:45:26 +02:00
Paul Holden
5bbfcc25c0 MDL-66392 analytics: make model output directory default to empty.
Falling back to path within $CFG->dataroot/models.
2020-10-21 18:04:20 +01:00
Sara Arjona
4a495d66b8 Merge branch 'm310_MDL-68536_Notice_Undefined_Property_CFG_branch' of https://github.com/scara/moodle into MOODLE_310_STABLE 2020-10-21 18:32:47 +02:00
Sara Arjona
b13ec3c353 Merge branch 'MDL-67673_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-10-21 17:38:16 +02:00
Víctor Déniz
5903054142 Merge branch 'MDL-69392-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-10-21 16:26:44 +01:00
Víctor Déniz
2dd9b53fd6 Merge branch 'MDL-69513-dkim-settings-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-21 11:56:54 +01:00
Eloy Lafuente (stronk7)
7f20e2071c MDL-67673 phpunit: Document all the changes in upgrade.txt
This includes:

- Breaking changes (return void + PHP 7.1 min requirement).
- Deprecations and removals.
- Specifically DbUnit and its replacement.
- Printer showing how to rerun tests removed.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
0ab106f41c 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:05 +02:00
Eloy Lafuente (stronk7)
9f82c9aece MDL-67673 phpunit: deprecate old phpunit/dbunit stuff
Apply the standard deprecation procedure to the old APIs, to
be removed in Moodle 4.2 (MDL-69882). Existing unit tests
cover the deprecation debugging.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
1f13dff1a7 MDL-67673 phpunit: Move tests to use new phpunit_dataset
- Make advanced_testcase old methods to use new ones internally.
- Fix advanced_testcase, statslib, mod/quiz and mod/data tests.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
be396eddf0 MDL-67673 phpunit: Introduce a new, lightweight phpunit_dataset
In charge of taking over the, now removed/archived, phpunit/dbunit
package. It supports loading of CSV/XML files and strings and
PHP arrays, allowing to send the loaded information to database.

Perform some basic controls about the consistency of information,
surely not super-exhaustive but fair enough.

100% covered with unit test.

Planned like an "interim" replacement for phpunit/dbunit uses in
core that, ideally, should be moved to generators stuff at some
point.

Note, expect a few tests in core to fail with this commit, I've
changed some fixtures around. Next commit will fix existing uses.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
4af4d709a4 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:05 +02:00
Eloy Lafuente (stronk7)
46606b3ddd MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
35bc26b516 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:05 +02:00
Eloy Lafuente (stronk7)
106c64ac24 MDL-67673 phpunit: Remove deprecated non-public attribute assertions
With PHPUnit 8 a good number of assertions, all them related with
operations on non-public attributes have been deprecated. And will
be removed with PHPUnit 9.

The main point is that unit tests shouldn't be testing non-public
APIs (good practice) and those assertions were an error originally.

See https://github.com/sebastianbergmann/phpunit/issues/3338 for
the complete list and other details.

When possible (the attributes being checked are public), the change
is simple, just switching to normal assertions.

When the attributes are not public we need to find a workaround
to be able to test the same using public APIs, or use Reflection,
or remove the tests.

For the records, this is the regexp used to find all the cases:

ag '>(assertAttribute|attribute\(|readAttributte|getStaticAttribute| \
    getObjectAttribute)' -G "test.php"
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7)
ddf72dd60d 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:05 +02:00