Skip to content

Tests: Switch to PHPUnit#227

Merged
drupol merged 21 commits intomasterfrom
tests/switch-to-phpunit
Dec 29, 2021
Merged

Tests: Switch to PHPUnit#227
drupol merged 21 commits intomasterfrom
tests/switch-to-phpunit

Conversation

@drupol
Copy link
Copy Markdown
Collaborator

@drupol drupol commented Dec 12, 2021

This PR:

This is a huge work - I'm testing the best way to implement tests. So far I tested:

  • One file per test - One dataprovider per file
  • One big file containing all the dataproviders and one single test

I really like having one single basic tests and multiple dataproviders... if you have a better idea, let me know.

Follows #173

@drupol drupol force-pushed the tests/switch-to-phpunit branch 5 times, most recently from 1d09e53 to d3c6342 Compare December 12, 2021 21:48
Comment thread tests/unit/Operation/AllCollectionTest.php Outdated
Comment thread .github/workflows/mutation-tests.yml Outdated
Comment thread tests/unit/Operation/GenericCollectionTest.php Outdated
@sanmai
Copy link
Copy Markdown

sanmai commented Dec 14, 2021

THB I don't understand what's going on here. That GrumPHP thing might be at fault. If I run Infection like so:

vendor/bin/infection -j4

I have no issues whatsoever. I get:

879 mutations were generated:
     534 mutants were killed
     268 mutants were not covered by tests
      70 covered mutants were not detected
       6 errors were encountered
       0 syntax errors were encountered
       1 time outs were encountered
       0 mutants required more time than configured

Metrics:
         Mutation Score Indicator (MSI): 61%
         Mutation Code Coverage: 69%
         Covered Code MSI: 88%

@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 14, 2021

THB I don't understand what's going on here. That GrumPHP thing might be at fault. If I run Infection like so:

Try: ./vendor/bin/grumphp --tasks=infection -vvv to get the command it runs:

Command: '/home/pol/dev/git/collection/vendor/bin/infection' '--no-interaction' '--ignore-msi-with-no-mutations' '--threads=4' '--test-framework=phpunit' '--configuration=infection.json' '--min-msi=90' '--min-covered-msi=90'

@sanmai
Copy link
Copy Markdown

sanmai commented Dec 14, 2021

Ah, looks like you need to raise the timeout:

611 mutants required more time than configured

It is set to 10 seconds now. You can try bumping it to 20 or all 30 seconds.

Comment thread grumphp.yml Outdated
@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 14, 2021

Thanks for helping @sanmai ! Going to close the issue I opened with the solution.

Comment thread grumphp.yml
Comment thread grumphp.yml
@drupol drupol force-pushed the tests/switch-to-phpunit branch 4 times, most recently from 9344e58 to a8c2cc5 Compare December 14, 2021 11:12
@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 27, 2021

Ok ! I have the confirmation of what I thought ! Thanks !!!

@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 27, 2021

Got another feedback from @maks-rafalko on Slack

image

@sanmai
Copy link
Copy Markdown

sanmai commented Dec 27, 2021

I can second this. It also runs quite a bit faster on PHP 8 👍

@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 27, 2021

Ok, this PR is done. Ready for review.

Comment thread .gitattributes Outdated
Comment thread docs/pages/principles.rst Outdated
Comment thread tests/unit/CollectionConstructorsTest.php Outdated
Comment thread tests/unit/CollectionGenericOperationTest.php Outdated
Comment thread tests/unit/Iterator/PsrCacheIteratorTest.php Outdated
drupol and others added 6 commits December 28, 2021 22:10
Co-authored-by: Alex Gidei <34811569+AlexandruGG@users.noreply.github.com>
Co-authored-by: Alex Gidei <34811569+AlexandruGG@users.noreply.github.com>
Co-authored-by: Alex Gidei <34811569+AlexandruGG@users.noreply.github.com>
Comment thread tests/unit/Utils/CallbacksArrayReducerTest.php Outdated
AlexandruGG
AlexandruGG previously approved these changes Dec 29, 2021
Copy link
Copy Markdown
Collaborator

@AlexandruGG AlexandruGG left a comment

Choose a reason for hiding this comment

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

Great work on this @drupol! 🚀

@drupol
Copy link
Copy Markdown
Collaborator Author

drupol commented Dec 29, 2021

Pheew ! It's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants