[Db] Change to disconnect on initialise breaks tests where Db is used in _beforeSuite
还没有人认领这个 Issue。
评估
调研方向
首先检查 Db 模块的连接初始化,以及在 _beforeSuite 中运行 SQL 的辅助代码,使用所示的 reconnect 配置来重现故障。当启用 reconnect 时,套件设置能够在连接未终止的情况下执行其控制行 SQL,即表示完成。
由索引模型根据 Issue 内容生成。
描述
What are you trying to achieve?
A helper runs code to modify the database in _beforeSuite in order to add control rows before any tests are run.
What do you get instead?
The code crashes upon trying to run SQL as the connection has been terminated. This was new behaviour added by https://github.com/Codeception/Codeception/commit/5e2c999df9eae7ff4f802eb801940f87088f0fc7
Easiest fix would be to create a public method on Db to ensure that the connection is open before running code if config has reconnect. The quickest route would just be to make connect() public.
Details
- Codeception version: 2.2.11
- PHP Version: 7.0.19
- Operating System: Ubuntu 16.04 LTS
- Installation type: Composer
- List of installed packages (
composer show) not relevant - Suite configuration:
config:
Db:
dsn: 'mysql:host=localhost;dbname=XXXX;charset=utf8'
user: 'root'
password: ''
dump: 'tests/_data/schema.sql'
populate: true
cleanup: false
reconnect: true
- 主要语言
- PHP
- 星标
- 23
- 派生
- 31
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-db 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 42/100
Codeception/module-db#87 ·
-
难度 4/5 3-5 天 新手友好度 25/100
Codeception/module-db#85 ·
-
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#68 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#67 ·
-
难度 3/5 1-2 天 新手友好度 38/100
Codeception/module-db#58 ·
查看 Codeception/module-db 的全部 Issue
相似的 Issue
-
sync-en
难度 1/5 1-3 小时 新手友好度 88/100
-
sync-en
难度 1/5 1-3 小时 新手友好度 88/100
-
Перевод устарел
难度 1/5 1-3 小时 新手友好度 88/100
-
status/awaiting_triage
难度 2/5 1-3 小时 新手友好度 74/100
-
Issue: ready for confirmation Reported on 2.4.x
难度 2/5 1-3 小时 新手友好度 88/100