-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Strange error in tests after update to phpunit 6 #2460
Comments
Thank you for your report. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting. Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue. |
<?php
use PHPUnit\Framework\TestCase;
class Simple
{
public function a($a1)
{
}
}
class SimpleTest extends TestCase
{
public function testSimple()
{
$mock = $this->createMock(Simple::class);
$mock->expects($this->once())
->method('a')
->with($this->callback(
function ($a) { return $a === 'b'; }
));
$mock->a('b');
}
} |
I cannot reproduce this:
|
I used composer autoload |
As am I. I just don't use it to load the class under test. |
I am running tests in PhpStorm with run configuration and settings of PHPUnit: "use composer autoload" with path to \vendor. This settings are working good in 5.7. command in console:
My phpunit.xml:
|
Are you absolutely sure that you are not mixing different versions of PHPUnit? |
I changed only my composer.json deps from "phpunit/phpunit": "5." to "phpunit/phpunit": "6."
|
SimpleTestCase is failed only when is in suite with other tests in my project, I tested it alone in other suite and it passed. After selective check I found what can give fatal error you need second TestCase:
And run it in same suite with processIsolation="false". |
I have just the same problem:
Following is enough to get this error:
|
Same problem here:
If I rename PHPUnit\Framework\Exception to PHPUnit\Framework\PHPUnitException everything works fine. |
I cannot reproduce this:
|
@sebastianbergmann I'm facing the same problems and I tested with PHP 7.0.5. After updating to PHP 7.0.15 the problem is gone. Update: It's also not working with PHP 7.0.11 Update #2: PHP 7.0.12 also quits with an error, but it works with PHP 7.0.13 Update #3: Confirmed with https://travis-ci.org/Trainmaster/Vision/builds/198133136 |
Can you please check whether d109afe solves the problem? |
d109afe seems to have fixed the issue with PHP 7.0.12 |
With PHP 7.0.15 the problem is gone for me, too. |
I can confirm this issue with PHP 7.0.15 on Ubuntu 16.04 though mine is not exactly the same.
If I remove local PHPUnit 5.1.3 it works fine. |
I had this problem after installing phpunit 6.2.3 globally and using laravel framework 5.4 |
To get rid of sebastianbergmann/phpunit#2460 which hits this project on Travis CI.
For phpunit 6.5.5 version the problem exists. $ phpunit PHP Warning: is_dir() expects parameter 1 to be a valid path, object given in /usr/share/php/PHPUnit/Runner/BaseTestRunner.php on line 56 $ phpunit --version |
One of my tests was green in 5.7 now is red :( . In that test I used $this->callback() and error is
Its strange :). When I removed line:
from that file all tests passed.
The text was updated successfully, but these errors were encountered: