Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bscheshirwork/codeception-db-yii2-config
Connection 'Db' codeception module to 'Yii2' codeception module database settings
https://github.com/bscheshirwork/codeception-db-yii2-config
Last synced: about 14 hours ago
JSON representation
Connection 'Db' codeception module to 'Yii2' codeception module database settings
- Host: GitHub
- URL: https://github.com/bscheshirwork/codeception-db-yii2-config
- Owner: bscheshirwork
- Created: 2017-01-20T15:43:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T15:20:19.000Z (over 6 years ago)
- Last Synced: 2024-11-12T10:15:37.656Z (2 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DbYii2Config
Connection 'Db' codeception module to 'Yii2' codeception module database settings## NO MORE db settings in `codeception.yml`!
Delete duplicate settings `dsn`, `username`, `password`, look at this:
Example `backend/codeception.yml`
```yml
namespace: backend\tests
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Yii2:
configFile: 'config/test-local.php'
```Example `common/config/main-local.php` (included in `backend/config/test-local.php`)
```php
[
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=db;dbname=yii2advanced',
'username' => 'yii2advanced',
'password' => 'yii2advanced',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
],
];
```Example `backend/tests/acceptance.suite.yml`
```yml
class_name: AcceptanceTester
modules:
enabled:
# See docker-codeception-run/docker-compose.yml: "ports" of service "nginx" is null; the selenium service named "firefox"
# See nginx-conf/nginx.conf: listen 80 for frontend; listen 8080 for backend
- WebDriver:
url: http://nginx:8080/
host: firefox
port: 4444
browser: firefox
- \bscheshirwork\Codeception\Module\DbYii2Config:
dump: ../common/tests/_data/dump.sql #relative path from "codeception.yml"
- Yii2:
part:
- ORM
- Fixtures
```
> Note: the `Db` module is first (restore dump), the `Yii2` module is second (load fixtures)# Installation
Add to you test environment`composer.json`
```json
"require": {
"bscheshirwork/codeception-db-yii2-config": "^2.0"
}
```