Example #1
0
<?php

/**
 * This is the configuration for the Yii app during functional tests
 */
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL;
return \DockerEnv::webConfig(['/var/www/html/tests/codeception/config/config.php'], ['components' => ['request' => ['enableCsrfValidation' => false, 'cookieValidationKey' => 'TESTING---TESTING'], 'urlManager' => ['showScriptName' => true]]]);
Example #2
0
<?php

$config = ['id' => 'basic', 'basePath' => '/var/www/html', 'vendorPath' => '/var/www/vendor', 'components' => ['cache' => ['class' => 'yii\\caching\\ApcCache'], 'db' => ['class' => 'yii\\db\\Connection', 'dsn' => \DockerEnv::dbDsn(), 'username' => \DockerEnv::dbUser(), 'password' => \DockerEnv::dbPassword(), 'charset' => 'utf8', 'tablePrefix' => ''], 'errorHandler' => ['errorAction' => 'site/error'], 'mail' => ['class' => 'yii\\swiftmailer\\Mailer', 'transport' => ['class' => 'Swift_SmtpTransport', 'host' => \DockerEnv::get('SMTP_HOST'), 'username' => \DockerEnv::get('SMTP_USER'), 'password' => \DockerEnv::get('SMTP_PASSWORD')]], 'log' => ['traceLevel' => \DockerEnv::get('YII_TRACELEVEL', 0), 'targets' => [['class' => 'codemix\\streamlog\\Target', 'url' => 'php://stdout', 'levels' => ['info', 'trace'], 'logVars' => []], ['class' => 'codemix\\streamlog\\Target', 'url' => 'php://stderr', 'levels' => ['error', 'warning'], 'logVars' => []]]], 'request' => ['cookieValidationKey' => \DockerEnv::get('COOKIE_VALIDATION_KEY', null, !YII_ENV_TEST), 'parsers' => ['application/json' => 'yii\\web\\JsonParser']], 'urlManager' => ['enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => array(['class' => 'yii\\rest\\UrlRule', 'controller' => 'api/ingredient', 'extraPatterns' => ['GET <id>/relationships/pizza' => 'view-link-pizza', 'POST <id>/relationships/pizza' => 'create-link-pizza', 'PATCH <id>/relationships/pizza' => 'update-link-pizza', 'DELETE <id>/relationships/pizza' => 'delete-link-pizza']], ['class' => 'yii\\rest\\UrlRule', 'controller' => 'api/pizza', 'extraPatterns' => ['GET <id>/relationships/ingredient' => 'view-link-ingredient', 'POST <id>/relationships/ingredient' => 'create-link-ingredient', 'PATCH <id>/relationships/ingredient' => 'update-link-ingredient', 'DELETE <id>/relationships/ingredient' => 'delete-link-ingredient']])], 'user' => ['identityClass' => 'app\\models\\User', 'enableAutoLogin' => true]], 'params' => require '/var/www/html/config/params.php'];
if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = ['class' => 'yii\\debug\\Module', 'allowedIPs' => ['*']];
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\\gii\\Module';
}
return $config;
Example #3
0
<?php

$config = ['id' => 'basic', 'basePath' => '/var/www/html', 'vendorPath' => '/var/www/vendor', 'components' => ['cache' => ['class' => 'yii\\caching\\ApcCache'], 'db' => ['class' => 'yii\\db\\Connection', 'dsn' => \DockerEnv::dbDsn(), 'username' => \DockerEnv::dbUser(), 'password' => \DockerEnv::dbPassword(), 'charset' => 'utf8', 'tablePrefix' => ''], 'errorHandler' => ['errorAction' => 'site/error'], 'mail' => ['class' => 'yii\\swiftmailer\\Mailer', 'transport' => ['class' => 'Swift_SmtpTransport', 'host' => \DockerEnv::get('SMTP_HOST'), 'username' => \DockerEnv::get('SMTP_USER'), 'password' => \DockerEnv::get('SMTP_PASSWORD')]], 'log' => ['traceLevel' => \DockerEnv::get('YII_TRACELEVEL', 0), 'targets' => [['class' => 'codemix\\streamlog\\Target', 'url' => 'php://stdout', 'levels' => ['info', 'trace'], 'logVars' => []], ['class' => 'codemix\\streamlog\\Target', 'url' => 'php://stderr', 'levels' => ['error', 'warning'], 'logVars' => []]]], 'request' => ['cookieValidationKey' => \DockerEnv::get('COOKIE_VALIDATION_KEY', null, !YII_ENV_TEST)], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false], 'user' => ['identityClass' => 'app\\models\\User', 'enableAutoLogin' => true]], 'params' => require '/var/www/html/config/params.php'];
if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = ['class' => 'yii\\debug\\Module', 'allowedIPs' => ['*']];
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\\gii\\Module';
}
return $config;
Example #4
0
<?php

require '/var/www/html/helpers/DockerEnv.php';
\DockerEnv::init();
$config = \DockerEnv::webConfig();
(new yii\web\Application($config))->run();
Example #5
0
<?php

/**
 * This is the configuration for the Yii app during unit tests
 */
return \DockerEnv::webConfig(['/var/www/html/tests/codeception/config/config.php']);
Example #6
0
<?php

/**
 * This file is run before all codeception tests
 */
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', '/var/www/html/web/index.php');
require '/var/www/html/helpers/DockerEnv.php';
\DockerEnv::init();
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL;
$_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST);
$_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80';
Yii::setAlias('@tests', '/var/www/html/tests');