Skip to content

Commit bbab45c

Browse files
authored
Merge pull request #322 from andrewnicols/acceptAnyTestcase
Accept any _testcase as valid
2 parents 87c1bf8 + 03e3425 commit bbab45c

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

tests/verify_phpunit_xml.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ teardown () {
2020
assert_output --partial "OK: competency/tests will be executed"
2121
assert_output --partial "INFO: backup/util/ui/tests will be executed because the backup/util definition"
2222
assert_output --partial "INFO: Ignoring admin/tests, it does not contain any test unit file."
23-
assert_output --partial "WARNING: message/tests/api_test.php has incorrect (0) number of unit test classes."
23+
refute_output --partial "WARNING"
2424
refute_output --partial "ERROR"
2525
}
2626

@@ -46,7 +46,7 @@ teardown () {
4646
assert_output --partial "OK: competency/tests will be executed"
4747
assert_output --partial "INFO: backup/util/ui/tests will be executed because the backup/util definition"
4848
assert_output --partial "ERROR: admin/tests is not matched/covered by any definition in phpunit.xml !"
49-
assert_output --partial "WARNING: message/tests/api_test.php has incorrect (0) number of unit test classes."
49+
refute_output --partial "WARNING"
5050
assert_output --partial "ERROR"
5151
}
5252

verify_phpunit_xml/verify_phpunit_xml.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,18 @@ existingtests=$(cd ${gitdir} && find . -name tests | sed 's/^\.\/\(.*\)$/\1/g')
4444
ignoretests=""
4545

4646
# Unit test classes to look for with each file (must be 1 and only 1). MDLSITE-2096
47-
# TODO: Some day replace this with the list of abstract classes, using some classmap going up to phpunit top class.
47+
# TODO: When we stop supporting these class names, we can remove them.
4848
unittestclasses="
49-
advanced_testcase
5049
area_test_base
5150
badgeslib_test
52-
base_testcase
53-
basic_testcase
5451
cachestore_tests
55-
core_backup_backup_restore_base_testcase
56-
core_reportbuilder_testcase
5752
data_loading_method_test_base
58-
data_privacy_testcase
59-
database_driver_testcase
60-
externallib_advanced_testcase
61-
googledocs_content_testcase
62-
grade_base_testcase
63-
lti_advantage_testcase
6453
manage_category_test_base
6554
messagelib_test
66-
mod_assign\\\\externallib_advanced_testcase
67-
mod_lti_testcase
68-
mod_quiz_attempt_walkthrough_from_csv_testcase
6955
mod_quiz\\\\attempt_walkthrough_from_csv_test
70-
provider_testcase
7156
qbehaviour_walkthrough_test_base
7257
question_attempt_upgrader_test_base
73-
question_testcase
74-
repository_googledocs_testcase
75-
restore_date_testcase
76-
route_testcase
58+
[\\a-z0-9_]*_testcase
7759
"
7860

7961
# Verify that each existing test is covered by some defined test
@@ -105,8 +87,10 @@ do
10587
echo "ERROR: ${existing} is not matched/covered by any definition in phpunit.xml !"
10688
exitstatus=1
10789
fi
90+
10891
# Look inside all the test files, counting occurrences of $unittestclasses
10992
unittestclassesregex=$(echo ${unittestclasses} | sed 's/ /|/g')
93+
11094
for testfile in $(ls ${existing} | grep "_test.php$")
11195
do
11296
# This is not the best (more accurate) regexp, but should be ok 99.99% of times.

0 commit comments

Comments
 (0)