php - 如何在 laravel phpunit.xml 中添加 elasticsearch 测试数据库作为第二个测试数据库?
问题描述
我将 postgres 作为主数据库,将 elasticsearch 作为第二个(侧面)数据库
也用于测试目的我有第二个 postgres 测试数据库
我想在 phpunit.xml 中添加 elasticsearch_test db
我该怎么做?
是否需要做任何其他必要的配置?
这是我当前的 phpunit.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
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>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<server name="APP_ENV" value="testing"/>
<server name="APP_URL" value="/"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="MAIL_DRIVER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="DB_CONNECTION" value="pgsql_test"/>
<server name="SESSION_DRIVER" value="array"/>
</php>
解决方案
推荐阅读
- apache-flink - Apache Flink 是否支持具有相同时间戳的多个事件?
- jsonschema - JsonSchema:对二进制数据使用类型/格式
- ag-grid - 如何动态获取单元格的滚动容器?
- android - 前台服务会在打瞌睡模式的非唤醒时间工作吗
- jquery - 在haml中添加内联jquery时出现referenceerror
- c# - 下载后解压 zip 文件时,出现异常,提示该文件正在被另一个进程使用
- php - 在 PHP 中找不到类 ParseClient
- javascript - 如何在另一个对象数组中初始化一个对象数组?
- python - 通过视图提交表单时获取“NOT NULL 约束”。通过 /admin 添加时工作正常
- c# - 为什么这个功能和一个完全相同的格式不起作用是有原因的吗?