-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Enhancement: Build phpunit-slow-test-detector.phar
#273
Conversation
Codecov Report
@@ Coverage Diff @@
## main #273 +/- ##
=========================================
Coverage 94.64% 94.64%
Complexity 61 61
=========================================
Files 15 15
Lines 299 299
=========================================
Hits 283 283
Misses 16 16 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
2244571
to
0b8bf19
Compare
manifest.xml
Outdated
<?xml version="1.0" encoding="utf-8" ?> | ||
<phar xmlns="https://phar.io/xml/manifest/1.0"> | ||
<contains name="ergebnis/phpunit-slow-test-detector" version="2.2.0" type="extension"> | ||
<extension for="phpunit/phpunit" compatible="^10.0.0"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, when I apply the following patch
<extension for="phpunit/phpunit" compatible="^10.0.0"/> | |
<extension for="phpunit/phpunit" compatible="^10.0.1"/> |
and run
make phar
fails with
.phive/phpunit --configuration=test/Phar/phpunit.xml
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.
Error while bootstrapping extension: Class "Ergebnis\PHPUnit\SlowTestDetector\Extension" does not exist
make: *** [phar] Error 2
f060740
to
d59456d
Compare
I build this locally and copied that to our project. When I try to run the tests, the following error is shown:
The same happens when I download the phar via phive:
|
Which version of PHPUnit does the PHAR have? |
<extension for="phpunit/phpunit" compatible="^10.1"/> | ||
</contains> | ||
|
||
<copyright> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this works, but when I change
-<extension for="phpunit/phpunit" compatible="^10.1"/>
+<extension for="phpunit/phpunit" compatible="^10.1.3"/>
I end up with the error that @alfredbez describes.
In other words, somewhere in https://github.com/sebastianbergmann/phpunit/blob/46739478930289fa955fe4697688bae921a2674a/src/Runner/Extension/PharLoader.php#L56-L76, the PharLoader
just continue
s instead of requiring the file containing the PHAR.
Looks like the compatible
attribute has issues when using major.minor.patch
versions.
Do you have an idea how to fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it has indeed issues, that would be a bug in the manifest
component. But what confuses me most is that it doesn't report that as a problem. It should report the fact it's not loading that extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an internal issue within PHPUnit: Currently, only the Version::series()
is passed on the version match, meaning you cannot currently require a patch level version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a separate issue in PHPUnit that also affects PHPUnit 8.5 and PHPUnit 9.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can have a look on side effects later today or tomorrow. If anyone opens that ticket, feel free to assign me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sebastianbergmann/phpunit@284eedd should fix this.
Sidenote: just this morning I added tests for unhappy code paths in extension bootstrapping for PHPUnit 10. The next thing I wanted to write tests for was loading of extensions from PHP archives ...
I've tested this with these versions and all of them produce the same issue:
I have installed PHPUnit first via phive:
Then I've installed this extension as mentioned in the previous comment. I try to run the tests via My <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="phpunit-bootstrap.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
colors="true"
testdox="false"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="false">
<extensions>
<bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension">
<parameter name="maximum-duration" value="250"/>
</bootstrap>
</extensions>
<coverage/>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests/PyzUnitTest</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory suffix=".php">src/Orm</directory>
<directory suffix=".php">src/Generated</directory>
</exclude>
</source>
</phpunit> |
Are you using the |
I just stumbled upon that and tried to set this, but had no luck so far. My
What should be the value for |
That won't work: PHPUnit does not recognize extensions without the |
Please open an issue for PHPUnit then (if that is the case). |
I can't get the extension to work: When I clone this repository and run
That crash probably qualifies as its own bug in PHPUnit ;-) but I'm at a loss. It tried to load the extension though, despite the |
FYI: https://github.com/sebastianbergmann/phpunit/tree/10.1/build/test-extension is used to generate https://github.com/sebastianbergmann/phpunit/tree/10.1/tests/end-to-end/_files/phar-extension/tools/phpunit.d which is used in PHPUnit's own test suite for testing the loading of PHAR extensions. |
For the record:
|
This pull request
ergebnis/phpunit-slow-test-detector
as a PHAR