Codeception / Codeception/module-db
[Db] Change to disconnect on initialise breaks tests where Db is used in _beforeSuite
- Ngôn ngữ chính
- PHP
- Star
- 23
- Fork
- 31
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
#### 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
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra phần khởi tạo kết nối của mô-đun Db và mã trợ giúp chạy SQL trong _beforeSuite, sử dụng cấu hình reconnect được示 để tái hiện lỗi. Hoàn thành khi phần thiết lập suite có thể thực thi SQL của control-row mà không bị kết nối kết thúc khi reconnect được bật.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100