Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

テスト用configファイルがある時は切り替える EC-CUBE#1013 #1014

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion data/class/SC_Initial.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@
*/
public function requireInitialConfig()
{
define('CONFIG_REALFILE', realpath(dirname(__FILE__)) . '/../config/config.php');
$testConfig = realpath(dirname(__FILE__)) . '/../config/config4test.php';
$configPath = realpath(dirname(__FILE__)) . '/../config/config.php';

Check warning on line 72 in data/class/SC_Initial.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Initial.php#L71-L72

Added lines #L71 - L72 were not covered by tests
// テスト実行にはテスト用configファイルに
if (defined('TEST_FUNCTION') && TEST_FUNCTION && file_exists($testConfig)) {
$configPath = $testConfig;

Check warning on line 75 in data/class/SC_Initial.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Initial.php#L74-L75

Added lines #L74 - L75 were not covered by tests
}
define('CONFIG_REALFILE', $configPath);

Check warning on line 77 in data/class/SC_Initial.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Initial.php#L77

Added line #L77 was not covered by tests

if (file_exists(CONFIG_REALFILE)) {
require_once CONFIG_REALFILE;

Expand Down
27 changes: 27 additions & 0 deletions data/config/config4test.php.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// テスト実行時に使用する設定ファイル
// config4test.phpにリネームして配置するとテスト実行時に使用されます。
define('ECCUBE_INSTALL', 'ON');
define('HTTP_URL', 'http://example.com/eccube/html/');
define('HTTPS_URL', 'https://example.com/eccube/html/');
define('ROOT_URLPATH', '/eccube/html/path/');
define('DOMAIN_NAME', '');
define('DB_TYPE', 'pgsql_or_mysql');
define('DB_USER', 'your_db_user');
define('DB_PASSWORD', 'your_password');
define('DB_SERVER', 'db_server');
define('DB_NAME', 'eccube_db_name');
define('DB_PORT', '');
define('ADMIN_DIR', 'admin/');
define('ADMIN_FORCE_SSL', TRUE);
define('ADMIN_ALLOW_HOSTS', 'a:0:{}');
define('AUTH_MAGIC', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
define('PASSWORD_HASH_ALGOS', 'sha256');
define('MAIL_BACKEND', 'smtp');
define('SMTP_HOST', 'mailcatcher');
define('SMTP_PORT', '25');
define('SMTP_USER', '');
define('SMTP_PASSWORD', '');

define('TEST_MAILCATCHER_URL', 'http://127.0.0.1:1080');
Loading