Change locale back to current_locale and add changie

This commit is contained in:
2025-10-07 10:21:22 +02:00
parent 49fc02a7da
commit 2cac6b78db
3 changed files with 30 additions and 10 deletions

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Create environment banner that can be activated and configured depending on the image deployed
time: 2025-10-07T10:19:49.784462956+02:00
custom:
Issue: "423"
SchemaChange: No schema change

View File

@@ -3,7 +3,7 @@
{% set current_locale = app.request.locale %}
{% if chill_main_config.top_banner.text[current_locale] is defined %}
{% set banner_text = chill_main_config.top_banner.text[nl] %}
{% set banner_text = chill_main_config.top_banner.text[current_locale] %}
{% else %}
{% set banner_text = chill_main_config.top_banner.text|first %}
{% endif %}

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Tests\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Configuration;
@@ -7,6 +16,11 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @internal
*
* @coversNothing
*/
class ConfigurationTest extends TestCase
{
public function testTopBannerConfiguration(): void
@@ -21,12 +35,12 @@ class ConfigurationTest extends TestCase
'top_banner' => [
'text' => [
'fr' => 'Vous travaillez actuellement avec la version de pré-production de Chill.',
'nl' => 'Je werkte momenteel in de pré-productie versie van Chill.'
'nl' => 'Je werkte momenteel in de pré-productie versie van Chill.',
],
'color' => 'white',
'background-color' => 'red'
]
]
'background-color' => 'red',
],
],
];
$processedConfig = $processor->processConfiguration($configuration, $config);
@@ -47,7 +61,7 @@ class ConfigurationTest extends TestCase
// Test without top_banner configuration
$config = [
'chill_main' => []
'chill_main' => [],
];
$processedConfig = $processor->processConfiguration($configuration, $config);
@@ -67,10 +81,10 @@ class ConfigurationTest extends TestCase
'chill_main' => [
'top_banner' => [
'text' => [
'fr' => 'Test message'
]
]
]
'fr' => 'Test message',
],
],
],
];
$processedConfig = $processor->processConfiguration($configuration, $config);