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

Check validity of unit test dataProviders #59

Merged
merged 1 commit into from
Sep 17, 2023

Conversation

andrewnicols
Copy link
Contributor

@andrewnicols andrewnicols commented Sep 15, 2023

This change includes:

  • detection of private providers (error)
  • detection of providers which do not exist (error)
  • detection of incorrect casing of the dataProvider declaration (fixable error)
  • detection of providers which do not have a correct return type (fixable error)
  • detection of providers which are not static (partially fixable warning)
  • detection of providers whose names start with test_ (error)

@codecov
Copy link

codecov bot commented Sep 16, 2023

Codecov Report

Merging #59 (ae762af) into main (8e1fc14) will increase coverage by 0.61%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main      #59      +/-   ##
============================================
+ Coverage     95.62%   96.24%   +0.61%     
- Complexity      445      492      +47     
============================================
  Files            20       21       +1     
  Lines          1188     1384     +196     
============================================
+ Hits           1136     1332     +196     
  Misses           52       52              
Files Changed Coverage Δ
moodle/Sniffs/PHPUnit/TestCaseCoversSniff.php 100.00% <100.00%> (ø)
moodle/Sniffs/PHPUnit/TestCaseNamesSniff.php 100.00% <100.00%> (ø)
moodle/Sniffs/PHPUnit/TestCaseProviderSniff.php 100.00% <100.00%> (ø)
moodle/Util/MoodleUtil.php 97.24% <100.00%> (+0.52%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@andrewnicols andrewnicols marked this pull request as ready for review September 16, 2023 15:59
@andrewnicols andrewnicols changed the title Unit tests Check validity of unit test dataProviders Sep 16, 2023
@andrewnicols andrewnicols linked an issue Sep 16, 2023 that may be closed by this pull request
This change includes:
- detection of private providers
- detection of providers which do not exist
- detection of incorrect casing of the dataProvider declaration
- detection of providers which do not have a correct return type
- detection of providers which are not static
- detection of providers whose names start with test_

Fixes moodlehq#42
@stronk7 stronk7 merged commit 76ce969 into moodlehq:main Sep 17, 2023
7 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.

Add a check for dataProviders whose name starts with test_
2 participants