I'm having an issue that seems to be related to the --coverage-html
functionality in PHPUnit (I'm using version 4.8.0, though I've encountered it with other versions, too). When I leave it enabled, all tests fail with Array to string conversion
in the console.
I've been debugging a bit and it seems to be related to this piece of code:
// vendor/phpunit/php-token-stream/src/Token/Stream.php:437-441
$this->addFunctionToMap(
$class . '::' . $name,
$tmp['startLine'],
$tmp['endLine']
);
The $class
variable is a one-item array
with the name of one of my classes, though obviously, a string is expected.
Does anyone have any idea why this is happening, and what I can do to fix it?
Edit: I noticed people are getting this message when making a mistake with mocking, this also happens for me with mock-less tests
As it turns out, this is a regression that was introduced in a new version of php-token-stream.
A pull request has been submitted.
https://github.com/sebastianbergmann/php-token-stream/pull/55