Skip to content

Replace assertRegExp with assertMatchesRegularExpression in unit test #505

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

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jun 21, 2020

Fixes #507

To avoid:

There was 1 warning:

1) Sabre\VObject\CliTest::testRepair

assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

e.g. https://travis-ci.org/github/sabre-io/dav/jobs/700622019 where the unit test fails in sabre-io/dav sabre-io/dav#1275

@phil-davis
Copy link
Contributor Author

phil-davis commented Jun 21, 2020

It's a PITA - the new assertMatchesRegularExpression does not seem to exist in phpunit 7 or 8. It is new in phpunit 9, and already there is a warning about it being removed in phpunit 10.

Looks like it needs some "if method exists" code.

I have done that and forced-pushed it.

@phil-davis phil-davis force-pushed the deprecated-assertRegExp branch from 63ed94d to e11255b Compare June 21, 2020 17:59
@codecov
Copy link

codecov bot commented Jun 21, 2020

Codecov Report

Merging #505 into master will increase coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #505      +/-   ##
============================================
+ Coverage     98.33%   98.69%   +0.35%     
  Complexity     1757     1757              
============================================
  Files            67       66       -1     
  Lines          4328     4279      -49     
============================================
- Hits           4256     4223      -33     
+ Misses           72       56      -16     
Impacted Files Coverage Δ Complexity Δ
lib/PHPUnitAssertions.php 91.66% <0.00%> (-0.34%) 7.00% <0.00%> (ø%)
lib/Component/VCalendar.php 94.59% <0.00%> (-0.15%) 64.00% <0.00%> (ø%)
lib/Parser/Json.php 96.77% <0.00%> (-0.11%) 18.00% <0.00%> (ø%)
lib/Property/Time.php 97.29% <0.00%> (-0.08%) 13.00% <0.00%> (ø%)
lib/Component.php 98.67% <0.00%> (-0.02%) 92.00% <0.00%> (ø%)
lib/FreeBusyGenerator.php 98.10% <0.00%> (-0.01%) 90.00% <0.00%> (ø%)
lib/Property/Text.php 99.12% <0.00%> (-0.01%) 40.00% <0.00%> (ø%)
lib/Parameter.php 99.20% <0.00%> (-0.01%) 81.00% <0.00%> (ø%)
lib/Property/UtcOffset.php 100.00% <0.00%> (ø) 3.00% <0.00%> (ø%)
lib/Recur/EventIterator.php 100.00% <0.00%> (ø) 46.00% <0.00%> (ø%)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d529dda...d29010a. Read the comment docs.

@phil-davis phil-davis self-assigned this Jun 21, 2020
@phil-davis
Copy link
Contributor Author

All Travis CI phpunit results now have no warnings/errors.

@phil-davis phil-davis requested a review from staabm June 21, 2020 18:08
@phil-davis
Copy link
Contributor Author

These tests seem to get reused in sabre-io/dav. I guess this will need a vobject release so that the unit test change gets seen in the downstream repo?

@phil-davis phil-davis force-pushed the deprecated-assertRegExp branch from e11255b to d29010a Compare June 22, 2020 03:18
@phil-davis phil-davis requested a review from staabm June 22, 2020 03:19
Copy link
Member

@staabm staabm left a comment

Choose a reason for hiding this comment

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

LGTM - Thank you

@phil-davis phil-davis merged commit e3823bd into sabre-io:master Jun 23, 2020
@phil-davis phil-davis deleted the deprecated-assertRegExp branch June 23, 2020 11:10
@phil-davis phil-davis mentioned this pull request Jun 23, 2020
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.

phpunit CI fails on PHP 7.4
2 participants