Comments (4)
As of #5812 and since PHPUnit 10.5.18, PHPUnit 10.5 warns about tests that "only work by happenstance". These tests, that may already work incorrectly when run with PHPUnit 10.5, no longer work with PHPUnit 11 due to #4964.
PHPUnit 10.5.20 did not introduce any new deprecations, but I guess you are referring to #5819. This, too, is a warning about tests that, if at all, "only work by happenstance".
is there an option that would allow PHPUnit to report a zero status code when there's no failure/errors but only deprecations
What you ask for is the default behaviour. You need to explictly configure that deprecations lead to a non-zero exit code, for instance using the failOnDeprecation
attribute in the XML configuration file.
from phpunit.
failOnDeprecation
fixes the status code indeed. Is there a way to not report the thousands of deprecations at the end of each run too ?
Your answer and closing the issue right afterwards doesn't give me a feeling that you really care about the effort fixing these deprecations will require of the developers using your library. Maybe I misunderstand "happenstance", but if it means "by a happy coincidence", I beg to disagree : it worked because there never was any constraint on how data providers keys were to be named, and suddenly you've added such a constraint to fit the plans for the future version.
I'd be curious to hear of other developers if they had such impacts on their test suites, but closing the issue means no one will ever see it...
from phpunit.
@gnutix We've seen this too. While it's annoying, as it happened between minor versions, we're not really that worried.
Either:
- stick with
10.5.18
, as PHPUnit 11 is already available - remove all array keys from data providers
- update array keys to match the argument name
We've decided on half/half: removing array keys from data providers that weren't providing additional information, and for those with more complex structures (true/false/true/true
), we've updated the array keys to match the argument names.
As for the 'happenstance', I wouldn't much call it that if it weren't for PHPUnit introducing support for named arguments somewhere along the way. PHPUnit doing->{$method}(...array_values($dataProviderData))
worked perfectly fine for many years
from phpunit.
Related Issues (20)
- `#[CoversTrait]` and `#[UsesTrait]` attributes
- Deprecate support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes
- Remove support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes
- `#[CoversMethod]` attribute is not considered for risky test check
- Newrelic causes error handlers loop to get stuck, tests run out of memory HOT 3
- Infinite recursion with test doubles in combination with a destructor HOT 6
- Reduce output of Constraint failure descriptions, when asserting against trivial data types
- `assertObjectNotEquals()` HOT 3
- Duplicate CI pipeline jobs HOT 2
- TestCase::createStubForIntersectionOfInterfaces returns a Stub without an expects() method, triggering an exception when calling ->method() HOT 3
- Calling `method()` on a test stub created using `createStubForIntersectionOfInterfaces()` throws an unexpected exception HOT 3
- Run code coverage without a phpunit.xml HOT 6
- [Question] returnCallback + willReturnOnConsecutiveCalls HOT 2
- Avoid abstract test warning HOT 3
- Too few arguments to function PHPUnit\Framework\TestCase::__construct(), 0 passed HOT 5
- Depends attribute and annotation only skip tests, but don't execute them on success HOT 2
- Test with dependencies and data provider fails HOT 3
- Testing a method in a Custom Extension class HOT 5
- Is it possible to remove final declaration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpunit.