phpUnit无法通过phpStorm远程解释器执行

时间:2019-02-01 14:30:39

标签: symfony docker phpunit phpstorm

我遇到的问题是,仅在PhpStorm中单击“运行”(在Windows上为Shift + F10)时,PhpUnit不起作用(正确地,会发生)。


首先,遵循教程/设置指南:

因此,除了没有,它几乎可以正常工作了。

Testing started at 15:21 ...
[docker://IMAGE_NAME:latest/]:php bin/.phpunit/phpunit-6.5/phpunit --configuration /var/www/html/phpunit.xml.dist --teamcity
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing Project Test Suite

Fatal error: Uncaught PDOException: SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired in /var/www/html/src/Legacy/Connection/MssqlConnection.php on line 178

PDOException: SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired in /var/www/html/src/Legacy/Connection/MssqlConnection.php on line 178

Call Stack:
    0.0003     393408   1. {main}() /var/www/html/bin/.phpunit/phpunit-6.5/phpunit:0
    0.0571     923544   2. PHPUnit\TextUI\Command::main() /var/www/html/bin/.phpunit/phpunit-6.5/phpunit:17
    0.0571     923656   3. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run() /var/www/html/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:148
    0.2019    4269152   4. Symfony\Bridge\PhpUnit\Legacy\TestRunnerForV6->doRun() /var/www/html/bin/.phpunit/phpunit-6.5/src/TextUI/Command.php:195
    0.2158    4697272   5. PHPUnit\Framework\TestSuite->run() /var/www/html/bin/.phpunit/phpunit-6.5/src/TextUI/TestRunner.php:545
    0.2181    4702968   6. PHPUnit\Framework\TestResult->startTestSuite() /var/www/html/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php:689
    0.2233    4717824   7. App\Tests\Helper\DeleteDBOnceListener->startTestSuite() /var/www/html/bin/.phpunit/phpunit-6.5/src/Framework/TestResult.php:368
    0.2270    4739216   8. App\Legacy\Connection\MssqlConnection->databaseExists() /var/www/html/tests/Helper/DeleteDBOnceListener.php:55
    0.2270    4739216   9. App\Legacy\Connection\MssqlConnection->findDbFromDSN() /var/www/html/src/Legacy/Connection/MssqlConnection.php:38
    0.2271    4740104  10. PDO->__construct() /var/www/html/src/Legacy/Connection/MssqlConnection.php:178


Process finished with exit code 255

显然,它读作:无法连接到数据库。但是!

如果我登录Docker实例,然后运行该命令,它将起作用!命令:

php bin/.phpunit/phpunit-6.5/phpunit --configuration /var/www/html/phpunit.xml.dist

生成输出:

user@hash:/var/www/html# php bin/.phpunit/phpunit-6.5/phpunit --configuration /var/www/html/phpunit.xml.dist
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing Project Test Suite
Dropping current database...
.Creating database..
................................................................ 65 / 80 ( 81%)
...............                                                   80 / 80 (100%)

Time: 3.25 minutes, Memory: 56.12MB

OK (80 tests, 336 assertions)

那么,为什么在使用“运行”执行时,从PhpStorm执行此操作会失败?我错过了设置吗?

0 个答案:

没有答案