I try to use PHPUnit (with codeception, but codeception isn't at fault here) to get a Mock of an Exception and an error is thrown with getMock()
with no error message (I only gave a stackTrace).
I launch the command via PHPStorm, here si to command as it appeared in console C:\php-7.3.1\php.exe C:/Users/Etshy/AppData/Local/Temp/ide-codeception.php run --report -o "reporters: report: PhpStorm_Codeception_ReportPrinter" --no-ansi --no-interaction tests\unit\Http\ClientTest.php:testRequest404
And here is the results:
Codeception PHP Testing Framework v3.0.1
Powered by PHPUnit 8.2-g24fc15955 by Sebastian Bergmann and contributors.
Running with seed:
D:\PhpStormProjects\imgur-php-wrapper\vendor\doctrine\instantiator\src\Doctrine\Instantiator\Instantiator.php:70
D:\PhpStormProjects\imgur-php-wrapper\vendor\doctrine\instantiator\src\Doctrine\Instantiator\Instantiator.php:59
D:\PhpStormProjects\imgur-php-wrapper\tests\unit\Http\ClientTest.php:101
C:\Users\Etshy\AppData\Local\Temp\ide-codeception.php:40
Time: 390 ms, Memory: 12.00 MB
There was 1 error:
---------
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Process finished with exit code 1
Here is the getMock
call that cause this
$exception = $this->getMockBuilder(ClientException::class)
->disableOriginalConstructor()
->getMock();
I also tried with the CodeCeption method make()
and makeEmpty()
with exact same error (that's why I tried doing it directly with PHPUnit methods later, wihtout success).
ClientException is the GuzzleHttp\Exception\ClientException
.
There is only Mock object creation before that.
Anyone have an idea what's the cause of the error ? I can't figure it.