-
Task
-
Resolution: Fixed
-
Minor
-
3.7.1, 3.8, 3.9
-
MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
While doing various attempts to get travis able to pass under windows... I needed to split tests to workaround travis execution time restrictions.
That revealed (just because of the way I split), some problems with "customfield" unit tests. Have been able to reproduce them locally without too much problem, just performing the same split (filtering).
$ vendor/bin/phpunit --verbose "core_customfield_field_controller_testcase" customfield/tests/field_controller_test.php --filter '/::test_[d-e]/'
|
Moodle 3.9dev (Build: 20191122), c234086cb957c2810affbabbe3e2839fd3807c53
|
Php: 7.3.11, pgsql: 9.6.15, OS: Darwin 18.7.0 x86_64
|
PHPUnit 7.5.17 by Sebastian Bergmann and contributors.
|
|
Runtime: PHP 7.3.11 with Xdebug 2.7.2
|
Configuration: /Users/stronk7/git_moodle/moodle/phpunit.xml
|
|
. 1 / 1 (100%)F
|
|
Time: 1.35 seconds, Memory: 62.50 MB
|
|
There was 1 failure:
|
|
1) core_customfield_field_controller_testcase::tearDownAfterClass
|
Exception in core_customfield_field_controller_testcase::tearDownAfterClass
|
Coding error detected, it must be fixed by a programmer: id is required to delete
|
|
lib/classes/persistent.php:600
|
customfield/classes/field_controller.php:173
|
customfield/classes/api.php:237
|
customfield/classes/api.php:326
|
customfield/classes/handler.php:309
|
customfield/tests/field_controller_test.php:46
|
So this issue is about:
- Fix those issues in order to guarantee that the singleton involved is always reset properly. Maybe being part of the reset_all_data(), maybe being part of tearDown(). In any case, surely a public (restricted to phpunit usage) method will be needed within customfield API.
- Clarify the rules for using tearDownAfterClass(), forbid the use of resetAfterTest() within setup() ... because it's a recurring problem that we face here and there.
Ciao
- duplicates
-
MDL-67619 core_customfield unit tests cause unexpected database modification
- Closed
- has a non-specific relationship to
-
MDLSITE-5960 Ban use of resetAfterTest in shared setup
- Open