php-Codeception无法构建在全局配置中配置的模块
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php-Codeception无法构建在全局配置中配置的模块,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2839字,纯文字阅读大概需要5分钟。
内容图文
![php-Codeception无法构建在全局配置中配置的模块](/upload/InfoBanner/zyjiaocheng/663/f294eca53a134e4c9345d38ce1c5f5c1.jpg)
我在我的codeception.yml中的测试根文件夹配置中有这个:
include:
- codeception/backend
- codeception/common
- codeception/console
paths:
log: codeception/_output
settings:
colors: true
modules:
enabled:
- Db
config:
Db:
dsn: 'mysql:host=localhost;dbname=db1_test'
user: 'root'
password: 'qwerty'
cleanup: true
然后在mu codeception / codeception.yml中:
namespace: tests\codeception\backend
actor: Tester
paths:
tests: .
log: _output
data: _data
helpers: _support
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
config:
# the entry script URL (without host info) for functional and acceptance tests
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
test_entry_url: http://ds3/index-test.php
然后在我的codeception / unit.suite.yml中:
class_name: UnitTester
modules:
enabled:
- Db
但是当我从测试根目录运行codecept build时,出现以下错误:
[Codeception\Exception\ModuleConfigException]
Db module is not configured!
Options: dsn, user, password are required
Please, update the configuration and set all the required fields
如果我从codeception / unit.suite.yml中删除了-Db,则该模块根本不会运行.似乎全局配置的模块部分被完全忽略了.如果全局配置中Db中有错字,它甚至不会影响任何东西.但是对于每个套件和每个应用程序,我只需要为Db配置一个配置.我究竟做错了什么?文档说应该可以全局声明模块.
解决方法:
好的,澄清一下:这是我的codecetion.yml文件(与上面的项目不同,但已针对您的情况进行了测试):
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
modules:
config:
DataHelper:
db:
host: 02corm.za.ds.xxxxxxx.com
user: xxxxxxx
password: yyyyyyy
port: 3306
env:
stubDelay: 2
otdWebhook: http://xxxxxx.com:9080/api/webhook/
otdStubUrl: http://xxxxxx.com:9080/api/
和我的api.suite.yml:
class_name: ApiTester
modules:
enabled:
- PhpBrowser
- REST
- ApiHelper
- DataHelper
- CurlHelper
- OtdHelper
- Asserts
- WooCommerceHelper
- ResponseHelper
config:
PhpBrowser:
url: http://dev.xxxx.co.za
curl:
CURLOPT_TIMEOUT: 50000 # timeout in seconds
REST:
url: http://dev.xxxx.co.za
timeout: 90
env:
mini:
modules:
config:
PhpBrowser:
url: http://xxxxxx.com:9080/api/
curl:
CURLOPT_TIMEOUT: 50000 # timeout in seconds
REST:
url: http://xxxxxx.com:9080/api/
dcr-static:
modules:
config:
PhpBrowser:
url: http://x.x.x.x:10080/api
curl:
CURLOPT_TIMEOUT: 50000 # timeout in seconds
REST:
url: http://x.x.x.x:10080/api
DataHelper:
db:
host: x.x.x.x
user: xxxxx
password: yyyy
port: 3307
env:
stubDelay: 2
otdWebhook: http://x.x.x.x:10080/api/webhook/otd
otdStubUrl: http://x.x.x.x:10080/otd-stub/service
在以上设置中,我有两个环境:mini和dcr-static.
>在“迷你”中,没有提供DataHelper配置,因此它使用的是codecetion.yml文件中的配置.
>在“ dcr-static”中,我为此环境提供了另一种配置,该配置被使用,而不是codecetion.yml文件中给定的配置.
内容总结
以上是互联网集市为您收集整理的php-Codeception无法构建在全局配置中配置的模块全部内容,希望文章能够帮你解决php-Codeception无法构建在全局配置中配置的模块所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。