Comments (4)
Please note that bugs in PHPUnit 9 are no longer fixed. And while I agree that we should fix this for supported versions, please also note that annotations are deprecated and that you should use attributes instead sooner rather than later.
from phpunit.
will look into it
from phpunit.
@fredericgboutin-yapla I tried reproducing the issue but on my machine the code sample does not emit warnings. see #5802 (also doesnt reproduce on CI).
are you sure he warnings are emitted by a plain phpunit setup and not because of some other thing? do you have a backtrace of the warning?
from phpunit.
Hum, that's surprising.
I'm running PHP from the official Docker image using php.ini-development configuration.
> php vendor/bin/phpunit tests/ExampleTest.php
PHP Warning: Uninitialized string offset 0 in /var/www/html/vendor/phpunit/phpunit/src/Metadata/Api/DataProvider.php on line 259
Warning: Uninitialized string offset 0 in /var/www/html/vendor/phpunit/phpunit/src/Metadata/Api/DataProvider.php on line 259
PHPUnit 10.5.17 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.14
Configuration: /var/www/html/phpunit.xml
... 3 / 3 (100%)
Time: 00:00.017, Memory: 6.00 MB
Example
✔ This test should NOT make phpunit spit a PHP Warning anymore... with data set 0
✔ This test should NOT make phpunit spit a PHP Warning anymore... with data set 1
✔ This test should NOT make phpunit spit a PHP Warning anymore... with data set 2
OK (3 tests, 3 assertions)
<?php
class ExampleTest extends PHPUnit\Framework\TestCase
{
/**
* @testWith [1]
* [2]
* [3]
*
* @testdox This test should NOT make phpunit spit a PHP Warning anymore...
*/
public function testExample($arg): void
{
$this->assertIsInt($arg);
}
}
But sure, here is the backtrace JSON encoded for readability
[
{
"file": "\/var\/www\/html\/vendor\/bin\/phpunit",
"line": 122,
"args": [
"\/var\/www\/html\/vendor\/phpunit\/phpunit\/phpunit"
],
"function": "include"
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/phpunit",
"line": 104,
"function": "run",
"class": "PHPUnit\\TextUI\\Application",
"object": {},
"type": "->",
"args": [
[
"vendor\/bin\/phpunit",
"tests\/ExampleTest.php"
]
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/TextUI\/Application.php",
"line": 108,
"function": "buildTestSuite",
"class": "PHPUnit\\TextUI\\Application",
"object": {},
"type": "->",
"args": [
{}
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/TextUI\/Application.php",
"line": 349,
"function": "build",
"class": "PHPUnit\\TextUI\\Configuration\\TestSuiteBuilder",
"object": {},
"type": "->",
"args": [
{}
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/TextUI\/Configuration\/TestSuiteBuilder.php",
"line": 55,
"function": "testSuiteFromPath",
"class": "PHPUnit\\TextUI\\Configuration\\TestSuiteBuilder",
"object": {},
"type": "->",
"args": [
"\/var\/www\/html\/tests\/ExampleTest.php",
[
"Test.php",
".phpt"
]
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/TextUI\/Configuration\/TestSuiteBuilder.php",
"line": 119,
"function": "fromClassReflector",
"class": "PHPUnit\\Framework\\TestSuite",
"type": "::",
"args": [
{
"name": "ExampleTest"
}
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Framework\/TestSuite.php",
"line": 134,
"function": "addTestMethod",
"class": "PHPUnit\\Framework\\TestSuite",
"object": {},
"type": "->",
"args": [
{
"name": "ExampleTest"
},
{
"name": "testExample",
"class": "ExampleTest"
}
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Framework\/TestSuite.php",
"line": 486,
"function": "build",
"class": "PHPUnit\\Framework\\TestBuilder",
"object": {},
"type": "->",
"args": [
{
"name": "ExampleTest"
},
"testExample"
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Framework\/TestBuilder.php",
"line": 38,
"function": "providedData",
"class": "PHPUnit\\Metadata\\Api\\DataProvider",
"object": {},
"type": "->",
"args": [
"ExampleTest",
"testExample"
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Metadata\/Api\/DataProvider.php",
"line": 61,
"function": "dataProvidedByTestWithAnnotation",
"class": "PHPUnit\\Metadata\\Api\\DataProvider",
"object": {},
"type": "->",
"args": [
"ExampleTest",
"testExample"
]
},
{
"file": "\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Metadata\/Api\/DataProvider.php",
"line": 259,
"function": "throwError",
"args": [
2,
"Uninitialized string offset 0",
"\/var\/www\/html\/vendor\/phpunit\/phpunit\/src\/Metadata\/Api\/DataProvider.php",
259
]
}
]
from phpunit.
Related Issues (20)
- TypeError: PHPUnit\Framework\TestSuiteIterator::current(): Return value must be of type PHPUnit\Framework\Test, null returned HOT 12
- Add option to limit export of arrays
- Change default value for `shortenArraysForExportThreshold` from `0` to `10`
- PHPUnit's error handler is not registered if Symfony is booted in a "before class" hook
- Doubled methods cannot be called from destructor on test double created by the return value generator HOT 14
- missing the upport to method Enum::cases() HOT 1
- Allow different file name to class name mapping HOT 2
- Include hint in deprecation notice for `--group`, `--exclude-group`, `--covers`, `--uses`, and `--test-suffix CLI` options HOT 1
- Text coverage report no longer shows colours HOT 12
- No good upgrade path for `processUncoveredFiles` HOT 9
- Testdox no longer outputs in real-time HOT 8
- Testdox prints random warning icons HOT 4
- Increase PHPStan Rule Level to 9
- Add a priority for hooks HOT 1
- Weird behaviour when mocking spread operator as argument. HOT 1
- Errors during write of `phpunit.xml` are not handled correctly when `--generate-configuration` is used
- `durationSincePrevious()` does not yield time since previous event of same type HOT 2
- Mark a test as passed although its expectation fail HOT 1
- symlinks ignored in stack trace file paths HOT 1
- `Test\Passed` event is not emitted for PHPT tests HOT 4
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.