Commit 869d7b7c by Carsten Brandt

Improved test config

You can now customize test config without having uncommitted changes in git. issue #4687
parent 47b42ca8
......@@ -38,4 +38,14 @@ PHPUnit configuration is in `phpunit.xml.dist` in repository root folder.
You can create your own phpunit.xml to override dist config.
Database and other backend system configuration can be found in `unit/data/config.php`
adjust them to your needs to allow testing databases and caching in your environment.
\ No newline at end of file
adjust them to your needs to allow testing databases and caching in your environment.
You can override configuration values by creating a `config.local.php` file
and manipulate the `$config` variable.
For example to change MySQL username and password your `config.local.php` should
contain the following:
```php
<?php
$config['databases']['mysql']['username'] = 'yiitest';
$config['databases']['mysql']['password'] = 'changeme';
```
runtime/cache/*
\ No newline at end of file
/runtime/cache/*
/data/config.local.php
\ No newline at end of file
<?php
return [
/**
* This is the configuration file for the Yii2 unit tests.
* You can override configuration values by creating a `config.local.php` file
* and manipulate the `$config` variable.
* For example to change MySQL username and password your `config.local.php` should
* contain the following:
*
<?php
$config['databases']['mysql']['username'] = 'yiitest';
$config['databases']['mysql']['password'] = 'changeme';
*/
$config = [
'databases' => [
'cubrid' => [
'dsn' => 'cubrid:dbname=demodb;host=localhost;port=33000',
......@@ -58,3 +72,9 @@ return [
'options' => [],
]
];
if (is_file(__DIR__ . '/config.local.php')) {
include(__DIR__ . '/config.local.php');
}
return $config;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment