【发布时间】:2015-12-25 16:09:04
【问题描述】:
我的 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,则模块根本不会运行。似乎全局配置的 modules 部分被完全忽略了。如果全局配置中的Db 有错字,它甚至不会影响任何事情。但我只需要为每个套件和每个应用程序配置一个 Db 配置。我究竟做错了什么?文档说应该可以全局声明模块。
【问题讨论】:
-
从 codeception.yml 中删除启用部分
-
@Naktibalda,在执行
codecept build时会出现同样的Db module is not configured!错误。我之前省略了中间的一个配置。也许它有助于注意一些事情。我真的不明白这些名称空间以及类和演员名称选项的作用。文档根本不包括任何这些。 -
放回配置部分。
-
@Naktibalda,你的意思是
codeception/unit.suite.yml?我应该在那里写什么?
标签: php unit-testing codeception