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

Fix % escaping (all cases) for StringMatchesFormat #3267

Merged
merged 5 commits into from
Aug 31, 2018
Merged

Fix % escaping (all cases) for StringMatchesFormat #3267

merged 5 commits into from
Aug 31, 2018

Conversation

guilliamxavier
Copy link
Contributor

PHPUnit version 7.3.2
PHP version 7.1.20

$this->assertStringMatchesFormat('%d', '1'); // passes
$this->assertStringMatchesFormat('%%d', '%d'); // passes (thanks to #2914)
$this->assertStringMatchesFormat('%%%d', '%1'); // still FAILS (currently expects '%%d')

It seems appropriate to use strtr rather than str_replace/preg_replace.

Fixes the fix of #2914 for #2907

@codecov-io
Copy link

codecov-io commented Aug 31, 2018

Codecov Report

Merging #3267 into 7.3 will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                7.3    #3267      +/-   ##
============================================
- Coverage     82.28%   82.25%   -0.03%     
  Complexity     3485     3485              
============================================
  Files           140      140              
  Lines          9210     9198      -12     
============================================
- Hits           7578     7566      -12     
  Misses         1632     1632
Impacted Files Coverage Δ Complexity Δ
...work/Constraint/StringMatchesFormatDescription.php 100% <100%> (ø) 10 <0> (ø) ⬇️

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 a6a8147...ac0805a. Read the comment docs.

@sebastianbergmann sebastianbergmann merged commit bbfc617 into sebastianbergmann:7.3 Aug 31, 2018
@guilliamxavier guilliamxavier deleted the fix-2907-2914 branch September 3, 2018 05:59
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.

3 participants