【发布时间】:2019-07-07 04:11:17
【问题描述】:
我有一个 Laravel 项目。
我想用 SQLite 在我的开发机器 + Travis/Scrutinizer 上测试它,另外我想用 MySQL 在另一台机器上测试。
这是我的 PHPUnit 文件,工作起来就像一个魅力
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<logging>
<!-- and this is where your report will be written -->
<log type="coverage-clover" target="./logs/clover.xml"/>
</logging>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
</php>
</phpunit>
我在问:是否有可能在 linux shell 命令上启动类似的命令(当然是伪代码):
./vendor/bin/phpunit --db_connection=mysql
?
【问题讨论】: