Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept any _testcase as valid #322

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

andrewnicols
Copy link
Contributor

Historically we had a blur between _test and _testcase, but in recent versions we have largely solved this. We now expect:

  • every test class name to be suffixed with _test
  • every test class to be final
  • every test class to extend a testcase with class name suffixed _testcase
  • every testcase class to be abstract

Given these parameters, which have been in place for some time and are checked with phpcs, we can move away from a hardcoded list of accepted testcases, and move towards a regular expression based on the name.

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.12%. Comparing base (87c1bf8) to head (03e3425).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
+ Coverage   31.07%   33.12%   +2.05%     
==========================================
  Files          71       71              
  Lines        3215     3215              
==========================================
+ Hits          999     1065      +66     
+ Misses       2216     2150      -66     
Flag Coverage Δ
check_upgrade_savepoints 0.46% <ø> (ø)
checkstyle_manipulations 0.00% <ø> (ø)
compare_databases 2.39% <ø> (ø)
continuous_manage_queues_validation 0.71% <ø> (ø)
define_excluded 1.11% <ø> (ø)
detect_conflicts 1.49% <ø> (ø)
diff_extract_changes 0.00% <ø> (ø)
git_sync_two_branches 2.05% <ø> (?)
grunt_process 3.01% <ø> (ø)
illegal_whitespace 2.64% <ø> (ø)
list_valid_components 0.00% <ø> (ø)
mustache_lint 2.83% <ø> (ø)
mustache_lint_plugins 1.30% <ø> (ø)
php_lint 1.21% <ø> (ø)
prepare_npm_stuff 1.52% <ø> (ø)
remote_branch_checker 17.48% <ø> (ø)
remote_branch_reporter 0.00% <ø> (ø)
setup 0.00% <ø> (ø)
thirdparty_check 1.46% <ø> (ø)
travis-branch-checker 0.00% <ø> (ø)
upgrade_external_backup 1.61% <ø> (ø)
verifications 0.00% <ø> (ø)
verify_commit_messages 2.64% <ø> (ø)
verify_phpunit_xml 1.24% <ø> (ø)
versions_check_set 5.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@andrewnicols andrewnicols force-pushed the acceptAnyTestcase branch 7 times, most recently from 834649d to c0a72e4 Compare November 19, 2024 13:41
Historically we had a blur between `_test` and `_testcase`, but in
recent versions we have largely solved this. We now expect:
- every test class name to be suffixed with `_test`
- every test class to be final
- every test class to extend a testcase with class name suffixed `_testcase`
- every testcase class to be abstract

Given these parameters, which have been in place for some time and are
checked with phpcs, we can move away from a hardcoded list of accepted
testcases, and move towards a regular expression based on the name.

There are still some uses of the legacy names, but we can reduce them
and support any _testcase class.
@andrewnicols andrewnicols force-pushed the acceptAnyTestcase branch 2 times, most recently from d7ba15e to 03e3425 Compare November 19, 2024 13:54
@andrewnicols andrewnicols requested review from stronk7 and junpataleta and removed request for stronk7 November 19, 2024 14:46
externallib_advanced_testcase
googledocs_content_testcase
grade_base_testcase
lti_advantage_testcase
manage_category_test_base
messagelib_test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can remove the following, and the test will still pass:

  • messagelib_test
  • mod_quiz\\\\attempt_walkthrough_from_csv_test

Is there a reason they were not removed here?

Copy link
Member

@stronk7 stronk7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I imagine that all remaining base classes are because we still aren’t completely free from them, specially in old branches. Cannot wait to have all them under the _testcase unique umbrella.

@andrewnicols andrewnicols merged commit bbab45c into moodlehq:main Nov 20, 2024
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants