diff --git a/.htaccess b/.htaccess
index b964f57d5..1ceb6bfd7 100644
--- a/.htaccess
+++ b/.htaccess
@@ -16,7 +16,7 @@
## Uncomment following lines to force HTTPS.
##
# RewriteCond %{HTTPS} off
- # RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
+ # RewriteRule (.*) https://%{SERVER_NAME}/$1 [L,R=301]
##
## Black listed folders
diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php
index 20b55decc..25d6d3dc2 100644
--- a/modules/backend/behaviors/RelationController.php
+++ b/modules/backend/behaviors/RelationController.php
@@ -1477,39 +1477,79 @@ class RelationController extends ControllerBehavior
/**
* Determine the default buttons based on the model relationship type.
- * @return string
+ * @return array|null
*/
protected function evalToolbarButtons()
{
$buttons = $this->getConfig('view[toolbarButtons]');
- if ($buttons === false) {
- return null;
- }
- elseif (is_string($buttons)) {
- return array_map('trim', explode('|', $buttons));
- }
- elseif (is_array($buttons)) {
- return $buttons;
+ if (!is_array($buttons)) {
+ if ($buttons === false) {
+ return null;
+ } elseif (is_string($buttons)) {
+ $buttons = array_map('trim', explode('|', $buttons));
+ } elseif ($this->manageMode === 'pivot') {
+ $buttons = ['add', 'remove'];
+ } else {
+ switch ($this->relationType) {
+ case 'hasMany':
+ case 'morphMany':
+ case 'morphToMany':
+ case 'morphedByMany':
+ case 'belongsToMany':
+ return ['create', 'add', 'delete', 'remove'];
+
+ case 'hasOne':
+ case 'morphOne':
+ case 'belongsTo':
+ return ['create', 'update', 'link', 'delete', 'unlink'];
+ }
+ }
}
- if ($this->manageMode == 'pivot') {
- return ['add', 'remove'];
+ $buttonText = [];
+
+ foreach ($buttons as $type => $text) {
+ if (is_numeric($type) || !$text) {
+ if (is_numeric($type) && $text) {
+ $type = $text;
+ }
+
+ switch ($type) {
+ case 'create':
+ $text = 'backend::lang.relation.create_name';
+ break;
+
+ case 'update':
+ $text = 'backend::lang.relation.update_name';
+ break;
+
+ case 'delete':
+ $text = 'backend::lang.relation.delete';
+ break;
+
+ case 'add':
+ $text = 'backend::lang.relation.add_name';
+ break;
+
+ case 'remove':
+ $text = 'backend::lang.relation.remove';
+ break;
+
+ case 'link':
+ $text = 'backend::lang.relation.link_name';
+ break;
+
+ case 'unlink':
+ $text = 'backend::lang.relation.unlink';
+ break;
+ }
+ }
+
+ $buttonText[$type] = $text;
}
- switch ($this->relationType) {
- case 'hasMany':
- case 'morphMany':
- case 'morphToMany':
- case 'morphedByMany':
- case 'belongsToMany':
- return ['create', 'add', 'delete', 'remove'];
-
- case 'hasOne':
- case 'morphOne':
- case 'belongsTo':
- return ['create', 'update', 'link', 'delete', 'unlink'];
- }
+ return $buttonText;
}
/**
@@ -1543,28 +1583,41 @@ class RelationController extends ControllerBehavior
*/
protected function evalManageTitle()
{
- if ($customTitle = $this->getConfig('manage[title]')) {
+ $customTitle = $this->getConfig('manage[title]');
+
+ if (is_string($customTitle)) {
return $customTitle;
}
+ $customTitles = is_array($customTitle) ? $customTitle : [];
+
switch ($this->manageMode) {
case 'pivot':
+ if (array_key_exists('pivot', $customTitles)) {
+ return $customTitles['pivot'];
+ } elseif ($this->eventTarget === 'button-link') {
+ return 'backend::lang.relation.link_a_new';
+ }
+
+ return 'backend::lang.relation.add_a_new';
case 'list':
- if ($this->eventTarget == 'button-link') {
+ if (array_key_exists('list', $customTitles)) {
+ return $customTitles['list'];
+ } elseif ($this->eventTarget === 'button-link') {
return 'backend::lang.relation.link_a_new';
}
return 'backend::lang.relation.add_a_new';
case 'form':
- if ($this->readOnly) {
+ if (array_key_exists('form', $customTitles)) {
+ return $customTitles['form'];
+ } elseif ($this->readOnly) {
return 'backend::lang.relation.preview_name';
- }
- elseif ($this->manageId) {
+ } elseif ($this->manageId) {
return 'backend::lang.relation.update_name';
}
- else {
- return 'backend::lang.relation.create_name';
- }
+
+ return 'backend::lang.relation.create_name';
}
}
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_add.htm b/modules/backend/behaviors/relationcontroller/partials/_button_add.htm
index 68e80a401..6939b3bc3 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_add.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_add.htm
@@ -4,5 +4,5 @@
data-handler="onRelationButtonAdd"
href="javascript:;"
class="btn btn-sm btn-secondary oc-icon-plus">
- = e(trans('backend::lang.relation.add_name', ['name'=>trans($relationLabel)])) ?>
+ = e(trans($text, ['name' => trans($relationLabel)])) ?>
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_create.htm b/modules/backend/behaviors/relationcontroller/partials/_button_create.htm
index aa9b9ee19..d7d3569df 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_create.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_create.htm
@@ -4,5 +4,5 @@
data-handler="onRelationButtonCreate"
href="javascript:;"
class="btn btn-sm btn-secondary oc-icon-file">
- = e(trans('backend::lang.relation.create_name', ['name'=>trans($relationLabel)])) ?>
+ = e(trans($text, ['name' => trans($relationLabel)])) ?>
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm b/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm
index 5e1e76268..d8fd4ff6b 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm
@@ -5,7 +5,7 @@
data-request-confirm="= e(trans('backend::lang.relation.delete_confirm')) ?>"
data-request-success="$.oc.relationBehavior.changed('= e($this->vars['relationField']) ?>', 'deleted')"
data-stripe-load-indicator>
- = e(trans('backend::lang.relation.delete')) ?>
+ = e(trans($text)) ?>
-
\ No newline at end of file
+
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_link.htm b/modules/backend/behaviors/relationcontroller/partials/_button_link.htm
index ff765a7d6..b4ad47073 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_link.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_link.htm
@@ -4,5 +4,5 @@
data-handler="onRelationButtonLink"
href="javascript:;"
class="btn btn-sm btn-secondary oc-icon-link">
- = e(trans('backend::lang.relation.link_name', ['name'=>trans($relationLabel)])) ?>
+ = e(trans($text, ['name' => trans($relationLabel)])) ?>
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm b/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm
index b4f647641..c288bdec6 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm
@@ -4,7 +4,7 @@
data-request="onRelationButtonRemove"
data-request-success="$.oc.relationBehavior.changed('= e($this->vars['relationField']) ?>', 'removed')"
data-stripe-load-indicator>
- = e(trans('backend::lang.relation.remove')) ?>
+ = e(trans($text)) ?>
-
\ No newline at end of file
+
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm b/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm
index cfbec72fb..30851eea6 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm
@@ -5,5 +5,5 @@
data-request-success="$.oc.relationBehavior.changed('= e($this->vars['relationField']) ?>', 'removed')"
data-request-confirm="= e(trans('backend::lang.relation.unlink_confirm')) ?>"
data-stripe-load-indicator>
- = e(trans('backend::lang.relation.unlink')) ?>
+ = e(trans($text)) ?>
diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_update.htm b/modules/backend/behaviors/relationcontroller/partials/_button_update.htm
index f1cf08a48..3f267e4c9 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_button_update.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_button_update.htm
@@ -5,5 +5,5 @@
data-request-data="manage_id: '= $relationManageId ?>'"
href="javascript:;"
class="btn btn-sm btn-secondary oc-icon-pencil">
- = e(trans('backend::lang.relation.update_name', ['name'=>trans($relationLabel)])) ?>
+ = e(trans($text, ['name' => trans($relationLabel)])) ?>
diff --git a/modules/backend/behaviors/relationcontroller/partials/_toolbar.htm b/modules/backend/behaviors/relationcontroller/partials/_toolbar.htm
index 3b23bd498..d7f85f55e 100644
--- a/modules/backend/behaviors/relationcontroller/partials/_toolbar.htm
+++ b/modules/backend/behaviors/relationcontroller/partials/_toolbar.htm
@@ -1,13 +1,16 @@
-
+ $text): ?>
-
+
= $this->relationMakePartial('button_update', [
- 'relationManageId' => $relationViewModel->getKey()
+ 'relationManageId' => $relationViewModel->getKey(),
+ 'text' => $text
]) ?>
- = $this->relationMakePartial('button_'.$button) ?>
+ = $this->relationMakePartial('button_' . $type, [
+ 'text' => $text
+ ]) ?>
diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php
index 3010b5577..27e814100 100644
--- a/modules/backend/lang/en/lang.php
+++ b/modules/backend/lang/en/lang.php
@@ -268,7 +268,7 @@ return [
'confirm_delete_multiple' => 'Delete selected records?',
'deleting_name' => 'Deleting :name...',
'restore' => 'Restore',
- 'restoring' => 'Restoring',
+ 'restoring' => 'Restoring...',
'confirm_restore' => 'Are you sure you want to restore this record?',
'reset_default' => 'Reset to default',
'resetting' => 'Resetting',
diff --git a/modules/backend/lang/ru/lang.php b/modules/backend/lang/ru/lang.php
index 1d5e63f84..498c8baba 100644
--- a/modules/backend/lang/ru/lang.php
+++ b/modules/backend/lang/ru/lang.php
@@ -7,7 +7,6 @@ return [
],
'field' => [
'invalid_type' => 'Использован неверный тип поля: :type.',
- 'options_method_invalid_model' => "The attribute ':field' does not resolve to a valid model. Try specifying the options method for model class :model explicitly.",
'options_method_not_exists' => "Класс модели :model должен содержать метод :method(), возвращающий опции для поля формы ':field'.",
'colors_method_not_exists' => "Класс модели :model должен содержать метод :method(), возвращающий HTML цвет в HEX для поля формы ':field'."
],
@@ -17,6 +16,11 @@ return [
],
'page' => [
'untitled' => 'Без названия',
+ '404' => [
+ 'label' => 'Страница не найдена',
+ 'help' => 'Мы тщательно искали, но запрошенный URL так и не смогли найти. Может быть вы искали что то ещё?',
+ 'back_link' => 'Вернуться к предыдущей странице',
+ ],
'access_denied' => [
'label' => 'Доступ запрещен',
'help' => 'У вас нет необходимых прав для просмотра этой страницы.',
@@ -29,7 +33,12 @@ return [
],
],
'partial' => [
- 'not_found_name' => 'Не удалось найти шаблон (partial) с именем :name.'
+ 'not_found_name' => 'Не удалось найти фрагмент (partial) с именем :name.',
+ 'invalid_name' => 'Неправильное имя фрагмента: :name.',
+ ],
+ 'ajax_handler' => [
+ 'invalid_name' => 'Неправильное имя AJAX обработчика: :name.',
+ 'not_found' => "AJAX обработчик ':name' не найден.",
],
'account' => [
'signed_in_as' => 'Выполнен вход как :full_name',
@@ -138,6 +147,8 @@ return [
'last_login' => 'Последний вход',
'created_at' => 'Создан',
'updated_at' => 'Обновлен',
+ 'deleted_at' => 'Удален',
+ 'show_deleted' => 'Показать удаленных',
'group' => [
'name' => 'Группы',
'name_field' => 'Название',
@@ -171,6 +182,8 @@ return [
'preferences' => [
'not_authenticated' => 'Невозможно загрузить или сохранить настройки для неавторизованного пользователя.'
],
+ 'trashed_hint_title' => 'Этот аккаунт был удален',
+ 'trashed_hint_desc' => 'Этот аккаунт был удален и не может быть авторизован. Чтобы восстановить его, нажмите иконку восстановления пользователя в правом нижнем углу.',
],
'list' => [
'default_title' => 'Список',
@@ -216,6 +229,7 @@ return [
'remove_file' => 'Удалить файл'
],
'repeater' => [
+ 'add_new_item' => 'Добавить новый объект',
'min_items_failed' => ':name требует минимум :min объектов, было передано только :items',
'max_items_failed' => ':name позволяет передать максимум :max объектов, было передано :items',
],
@@ -226,6 +240,7 @@ return [
'create_success' => ':name был успешно создан',
'update_success' => ':name был успешно сохранен',
'delete_success' => ':name был успешно удален',
+ 'restore_success' => ':name восстановлен',
'reset_success' => 'Сброс завершен',
'missing_id' => 'Идентификатор формы записи не указан.',
'missing_model' => 'Для формы используемой в :class не определена модель.',
@@ -245,6 +260,9 @@ return [
'confirm_delete' => 'Вы действительно хотите удалить эту запись?',
'confirm_delete_multiple' => 'Вы действительно хотите удалить выбранные записи?',
'deleting_name' => 'Удаление :name...',
+ 'restore' => 'Восстановить',
+ 'restoring' => 'Восстановление...',
+ 'confirm_restore' => 'Вы уверены, что хотите восстановить эту запись?',
'reset_default' => 'Сбросить настройки',
'resetting' => 'Сброс',
'resetting_name' => 'Сброс :name',
@@ -335,7 +353,8 @@ return [
'tips_description' => 'Есть проблемы, на которые стоит обратить внимание, чтобы правильно настроить систему.',
'permissions' => 'Каталог :name или его подкаталоги недоступны для записи. Укажите соответствующие разрешения для веб-сервера.',
'extension' => 'Расширение PHP :name не установлено. Установите эту библиотеку и активируйте расширение.',
- 'plugin_missing' => 'Плагин :name имеет зависимость. Установите этот плагин.'
+ 'plugin_missing' => 'Плагин :name имеет зависимость. Установите этот плагин.',
+ 'debug' => 'Режим отладки включен. Это не рекомендуется для рабочих инсталяций.',
],
'editor' => [
'menu_label' => 'Настройки редактора',
@@ -405,6 +424,8 @@ return [
'brand' => 'Бренд',
'logo' => 'Логотип',
'logo_description' => 'Загрузите логотип для панели управления',
+ 'favicon' => 'Фавикон',
+ 'favicon_description' => 'Загрузите пользовательский фавикон для бекенда',
'app_name' => 'Название приложения',
'app_name_description' => 'Это имя отображается в заголовке панели управления',
'app_tagline' => 'Слоган приложения',
@@ -418,6 +439,7 @@ return [
'navigation' => 'Навигация',
'menu_mode' => 'Стиль меню',
'menu_mode_inline' => 'Строчный',
+ 'menu_mode_inline_no_icons' => 'Строчный (без иконок)',
'menu_mode_tile' => 'Плитка',
'menu_mode_collapsed' => 'Схлопнутый'
],
@@ -435,7 +457,9 @@ return [
'hint' => 'В этом журнале отображается список успешных попыток авторизаций администраторов. Записи хранятся :days дней.',
'menu_label' => 'Журнал доступа',
'menu_description' => 'Просмотр списка успешных авторизаций администраторов.',
+ 'id' => 'ID',
'created_at' => 'Дата & Время',
+ 'type' => 'Тип',
'login' => 'Логин',
'ip_address' => 'IP адрес',
'first_name' => 'Имя',
@@ -522,11 +546,12 @@ return [
]
],
'permissions' => [
- 'manage_media' => 'Управление медиафайлами'
+ 'manage_media' => 'Загрузка и управление медиаконтентом - изображениями, видео, звуками, документами',
],
'mediafinder' => [
'label' => 'Поиск медиа',
- 'default_prompt' => 'Кликните на кнопку %s, чтобы найти медиафайл'
+ 'default_prompt' => 'Кликните на кнопку %s, чтобы найти медиафайл',
+ 'no_image' => 'Не удалось найти изображение',
],
'media' => [
'menu_label' => 'Медиафайлы',
diff --git a/modules/system/console/OctoberEnv.php b/modules/system/console/OctoberEnv.php
index 50804627a..43f2079bf 100644
--- a/modules/system/console/OctoberEnv.php
+++ b/modules/system/console/OctoberEnv.php
@@ -63,7 +63,7 @@ class OctoberEnv extends Command
/**
* Overwrite config file
*/
- private function overwriteConfig()
+ protected function overwriteConfig()
{
foreach (array_keys($this->config()) as $config) {
$this->config = $config;
@@ -75,7 +75,7 @@ class OctoberEnv extends Command
/**
* Replace config values with env() syntax
*/
- private function configToEnv()
+ protected function configToEnv()
{
$content = $this->parseConfigFile();
@@ -87,7 +87,7 @@ class OctoberEnv extends Command
*
* @return string
*/
- private function parseConfigFile()
+ protected function parseConfigFile()
{
$lines = [];
@@ -107,7 +107,7 @@ class OctoberEnv extends Command
* @param $line
* @return mixed
*/
- private function parseLine($line, $keys)
+ protected function parseLine($line, $keys)
{
$line = $this->replaceConfigLine($line, $keys);
@@ -121,7 +121,7 @@ class OctoberEnv extends Command
* @param $keys
* @return mixed
*/
- private function replaceConfigLine($line, $keys)
+ protected function replaceConfigLine($line, $keys)
{
foreach ($keys as $envKey => $configKey) {
$pattern = $this->buildPattern($configKey);
@@ -140,7 +140,7 @@ class OctoberEnv extends Command
* @param $line
* @return mixed
*/
- private function replaceDbConfigLine($line)
+ protected function replaceDbConfigLine($line)
{
if ($this->config == 'database') {
foreach ($this->dbConfig() as $connection => $settings) {
@@ -159,7 +159,7 @@ class OctoberEnv extends Command
* @param $line
* @param $connection
*/
- private function setCurrentConnection($line, $connection)
+ protected function setCurrentConnection($line, $connection)
{
if (preg_match("/['\"]" . $connection . "['\"]" . "\s*=>/", $line)) {
$this->connection = $connection;
@@ -170,7 +170,7 @@ class OctoberEnv extends Command
* @param $configKey
* @return string
*/
- private function buildPattern($configKey)
+ protected function buildPattern($configKey)
{
return "/['\"]" . $configKey . "['\"]" . "\s*=>\s*[^,\[]+,/";
}
@@ -180,19 +180,19 @@ class OctoberEnv extends Command
* @param $configKey
* @return \Closure
*/
- private function buildCallback($envKey, $configKey)
+ protected function buildCallback($envKey, $configKey)
{
return function ($matches) use ($envKey, $configKey) {
$value = $this->envValue($configKey);
- $this->saveEnvSettings($envKey, $value);
+ $this->saveEnvSettings($envKey, $this->normalizeForEnv($value));
// Remove protected values from the config files
if (in_array($envKey, $this->protectedKeys) && !empty($value)) {
- $value = "''";
+ $value = '';
}
- return $this->isEnv($matches[0]) ? $matches[0] : "'$configKey' => env('$envKey', {$value}),";
+ return $this->isEnv($matches[0]) ? $matches[0] : "'$configKey' => env('$envKey', {$this->normalizeForConfig($value)}),";
};
}
@@ -200,7 +200,7 @@ class OctoberEnv extends Command
* @param $key
* @param $value
*/
- private function saveEnvSettings($key, $value)
+ protected function saveEnvSettings($key, $value)
{
if (! $this->envKeyExists($key)) {
$line = sprintf("%s=%s\n", $key, $value);
@@ -216,7 +216,7 @@ class OctoberEnv extends Command
/**
* @param $line
*/
- private function writeDbEnvSettings($line)
+ protected function writeDbEnvSettings($line)
{
if ($this->connection == config('database.default') || $this->connection == 'redis') {
$this->writeToEnv($line);
@@ -227,7 +227,7 @@ class OctoberEnv extends Command
* @param $configKey
* @return string
*/
- private function envValue($configKey)
+ protected function envValue($configKey)
{
$value = config("$this->config.$configKey");
@@ -235,14 +235,14 @@ class OctoberEnv extends Command
$value = $this->databaseConfigValue($configKey);
}
- return $this->normalize($value);
+ return $value;
}
/**
* @param $configKey
* @return string
*/
- private function databaseConfigValue($configKey)
+ protected function databaseConfigValue($configKey)
{
if ($configKey == 'default') {
return config('database.default');
@@ -260,10 +260,12 @@ class OctoberEnv extends Command
}
/**
+ * Normalizes a value to be inserted into the .env file
+ *
* @param $value
* @return string
*/
- private function normalize($value)
+ protected function normalizeForEnv($value)
{
if (is_string($value)) {
if (preg_match('/["\'#]/', $value)) {
@@ -280,11 +282,26 @@ class OctoberEnv extends Command
return $value;
}
+ /**
+ * Normalizes a value to be inserted into config files.
+ *
+ * @param $value
+ * @return string
+ */
+ protected function normalizeForConfig($value)
+ {
+ if (is_string($value)) {
+ return '\'' . addslashes($value) . '\'';
+ }
+
+ return $this->normalizeForEnv($value);
+ }
+
/**
* @param $matches
* @return bool
*/
- private function isEnv($matches)
+ protected function isEnv($matches)
{
return strpos($matches, 'env') !== false;
}
@@ -292,7 +309,7 @@ class OctoberEnv extends Command
/**
* @param $content
*/
- private function writeToEnv($content)
+ protected function writeToEnv($content)
{
file_put_contents('.env', $content, FILE_APPEND);
}
@@ -300,7 +317,7 @@ class OctoberEnv extends Command
/**
* @return string
*/
- private function readEnvFile()
+ protected function readEnvFile()
{
return file_exists('.env') ? file_get_contents('.env') : '';
}
@@ -308,7 +325,7 @@ class OctoberEnv extends Command
/**
* @param $content
*/
- private function writeToConfigFile($content)
+ protected function writeToConfigFile($content)
{
file_put_contents(config_path($this->config . '.php'), $content);
}
@@ -316,7 +333,7 @@ class OctoberEnv extends Command
/**
* @return array
*/
- private function lines()
+ protected function lines()
{
return file(config_path($this->config . '.php'));
}
@@ -325,7 +342,7 @@ class OctoberEnv extends Command
* @param $key
* @return bool
*/
- private function envKeyExists($key)
+ protected function envKeyExists($key)
{
return strpos($this->readEnvFile(), $key) !== false;
}
@@ -333,7 +350,7 @@ class OctoberEnv extends Command
/**
* @return array
*/
- private function config()
+ protected function config()
{
return [
'app' => [
@@ -375,7 +392,7 @@ class OctoberEnv extends Command
/**
* @return array
*/
- private function dbConfig()
+ protected function dbConfig()
{
return [
'sqlite' => [
diff --git a/tests/unit/system/console/OctoberEnvTest.php b/tests/unit/system/console/OctoberEnvTest.php
index 77530b002..c075fe857 100644
--- a/tests/unit/system/console/OctoberEnvTest.php
+++ b/tests/unit/system/console/OctoberEnvTest.php
@@ -50,6 +50,36 @@ class OctoberEnvTest extends TestCase
$this->assertContains('DB_PASSWORD="test\\"quotes\'test"', $envFile);
$this->assertContains('DB_PORT=3306', $envFile);
}
+
+ // Check app.php config file
+ $appConfigFile = file_get_contents(storage_path('temp/tests/config/app.php'));
+
+ if (method_exists($this, 'assertStringContainsString')) {
+ $this->assertStringContainsString('\'debug\' => env(\'APP_DEBUG\', true),', $appConfigFile);
+ $this->assertStringContainsString('\'url\' => env(\'APP_URL\', \'https://localhost\'),', $appConfigFile);
+ } else {
+ $this->assertContains('\'debug\' => env(\'APP_DEBUG\', true),', $appConfigFile);
+ $this->assertContains('\'url\' => env(\'APP_URL\', \'https://localhost\'),', $appConfigFile);
+ }
+
+ // Check database.php config file
+ $appConfigFile = file_get_contents(storage_path('temp/tests/config/database.php'));
+
+ if (method_exists($this, 'assertStringContainsString')) {
+ $this->assertStringContainsString('\'default\' => env(\'DB_CONNECTION\', \'mysql\')', $appConfigFile);
+ $this->assertStringContainsString('\'port\' => env(\'DB_PORT\', 3306),', $appConfigFile);
+ // Both the following configurations had values in the original config, they should be stripped out once
+ // the .env file is generated.
+ $this->assertStringContainsString('\'username\' => env(\'DB_USERNAME\', \'\'),', $appConfigFile);
+ $this->assertStringContainsString('\'password\' => env(\'DB_PASSWORD\', \'\'),', $appConfigFile);
+ } else {
+ $this->assertContains('\'default\' => env(\'DB_CONNECTION\', \'mysql\')', $appConfigFile);
+ $this->assertContains('\'port\' => env(\'DB_PORT\', 3306),', $appConfigFile);
+ // Both the following configurations had values in the original config, they should be stripped out once
+ // the .env file is generated.
+ $this->assertContains('\'username\' => env(\'DB_USERNAME\', \'\'),', $appConfigFile);
+ $this->assertContains('\'password\' => env(\'DB_PASSWORD\', \'\'),', $appConfigFile);
+ }
}
protected function tearDown(): void