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

@requires function swallows digits at the end of function name #3459

Closed
MaxSem opened this issue Jan 2, 2019 · 3 comments · Fixed by elecena/nano#2
Closed

@requires function swallows digits at the end of function name #3459

MaxSem opened this issue Jan 2, 2019 · 3 comments · Fixed by elecena/nano#2

Comments

@MaxSem
Copy link

MaxSem commented Jan 2, 2019

Q A
PHPUnit version 7.5.1
PHP version 7.2.13
Installation Method PHAR

If a required function name ends with a digit, PHPUnit misses the digit(s).

Example:

<?php
/**
 * @requires function hash_pbkdf2
 */
class DummyTest extends PHPUnit\Framework\TestCase {
}

Current behavior:

$ php phpunit-7.5.1.phar --verbose test.php
PHPUnit 7.5.1 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.13

S                                                                   1 / 1 (100%)

Time: 84 ms, Memory: 10.00MB

There was 1 skipped test:

1) Warning
Function hash_pbkdf is required.

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.

Expected behavior: test is not skipped because hash_pbkdf2() is present.

@epdenouden
Copy link
Contributor

epdenouden commented Jan 2, 2019

@MaxSem Thanks for taking the time to submit the issue! I have reproduced it in the self-test collection and... fireworks! A solid start to 2019, I say. Will submit a pull request with a fix.

I will also check whether the other @requires parameters like setting and extension suffer from the same bug:

image

@epdenouden
Copy link
Contributor

Aha, seems the regex eats the trailing digit as a part of a version requirement. I'll have to do some exploring to make sure a fix for this doesn't break a bunch of other use cases.

wmfgerrit pushed a commit to wikimedia/mediawiki that referenced this issue Jan 2, 2019
Due to sebastianbergmann/phpunit#3459 it was
looking for a wrong function name and was skipping the test even when PHP
support was present.

Change-Id: I2508f192a76275286e95bd6a06e4628d98b11737
@epdenouden
Copy link
Contributor

epdenouden commented Feb 1, 2019

@MaxSem PHPUnit 6.5.14 has just been released and I noticed the Mediawiki composer.json picking it up as expected:

image

Again thanks for reporting the bug, it has been fixed in v7 and v8 too :)

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 a pull request may close this issue.

3 participants