Codeception / Codeception/module-db
[Db] Change to disconnect on initialise breaks tests where Db is used in _beforeSuite
- 主要語言
- PHP
- 星號
- 23
- 分支
- 31
- PR 合併指標
- 30 天內沒有已合併 PR
描述
#### 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:
```yml
config:
Db:
dsn: 'mysql:host=localhost;dbname=XXXX;charset=utf8'
user: 'root'
password: ''
dump: 'tests/_data/schema.sql'
populate: true
cleanup: false
reconnect: true
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
先檢查 Db 模組的連線初始化,以及在 _beforeSuite 中執行 SQL 的輔助程式碼,使用所示的 reconnect 設定來重現失敗。當啟用 reconnect 時,套件設定能夠在連線未終止的情況下執行其控制列 SQL,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- php
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100