support installation specific translations (#1099)
This commit is contained in:
@@ -98,7 +98,6 @@ class AppExtensionTest extends TestCase
|
||||
'currency' => 'EUR',
|
||||
]
|
||||
],
|
||||
|
||||
'kimai.theme' => [
|
||||
'active_warning' => 3,
|
||||
'box_color' => 'green',
|
||||
@@ -115,18 +114,17 @@ class AppExtensionTest extends TestCase
|
||||
'mini' => null,
|
||||
'company' => null,
|
||||
'title' => null,
|
||||
'translation' => null,
|
||||
],
|
||||
'auto_reload_datatable' => false,
|
||||
'autocomplete_chars' => 3,
|
||||
],
|
||||
'kimai.theme.select_type' => null,
|
||||
'kimai.theme.show_about' => true,
|
||||
|
||||
'kimai.fosuser' => [
|
||||
'registration' => true,
|
||||
'password_reset' => true,
|
||||
],
|
||||
|
||||
'kimai.timesheet' => [
|
||||
'mode' => 'default',
|
||||
'markdown_content' => false,
|
||||
@@ -174,6 +172,7 @@ class AppExtensionTest extends TestCase
|
||||
'ROLE_ADMIN' => [],
|
||||
'ROLE_SUPER_ADMIN' => [],
|
||||
],
|
||||
'kimai.i18n_domains' => []
|
||||
];
|
||||
|
||||
// nasty parameter, should be removed!!!
|
||||
@@ -322,6 +321,34 @@ class AppExtensionTest extends TestCase
|
||||
$this->assertEquals('(&(objectClass=inetOrgPerson))', $ldapConfig['user']['filter']);
|
||||
}
|
||||
|
||||
public function testTranslationOverwritesEmpty()
|
||||
{
|
||||
$minConfig = $this->getMinConfig();
|
||||
$this->extension->load($minConfig, $container = $this->getContainer());
|
||||
|
||||
$config = $container->getParameter('kimai.i18n_domains');
|
||||
$this->assertEquals([], $config);
|
||||
}
|
||||
|
||||
public function testTranslationOverwrites()
|
||||
{
|
||||
$minConfig = $this->getMinConfig();
|
||||
$minConfig['kimai']['industry'] = [
|
||||
'translation' => 'xxxx',
|
||||
];
|
||||
$minConfig['kimai']['theme'] = [
|
||||
'branding' => [
|
||||
'translation' => 'yyyy',
|
||||
]
|
||||
];
|
||||
|
||||
$this->extension->load($minConfig, $container = $this->getContainer());
|
||||
|
||||
$config = $container->getParameter('kimai.i18n_domains');
|
||||
// oder is important, theme/installation specific translations win
|
||||
$this->assertEquals(['yyyy', 'xxxx'], $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \PHPUnit\Framework\Error\Notice
|
||||
* @expectedExceptionMessage Found invalid "kimai" configuration: The child node "data_dir" at path "kimai" must be configured.
|
||||
|
||||
@@ -219,4 +219,138 @@ class ConfigurationTest extends TestCase
|
||||
];
|
||||
self::assertEquals($expected, $finalizedConfig['ldap']);
|
||||
}
|
||||
|
||||
public function testFullDefaultConfig()
|
||||
{
|
||||
$fullDefaultConfig = [
|
||||
'data_dir' => '/tmp/',
|
||||
'plugin_dir' => '/tmp/',
|
||||
'timesheet' => [
|
||||
'default_begin' => 'now',
|
||||
'mode' => 'default',
|
||||
'markdown_content' => false,
|
||||
'rounding' => [],
|
||||
'rates' => [],
|
||||
'active_entries' => [
|
||||
'soft_limit' => 1,
|
||||
'hard_limit' => 1,
|
||||
],
|
||||
'rules' => [
|
||||
'allow_future_times' => true,
|
||||
],
|
||||
],
|
||||
'user' => [
|
||||
'registration' => true,
|
||||
'password_reset' => true,
|
||||
],
|
||||
'invoice' => [
|
||||
'documents' => [
|
||||
0 => 'var/invoices/',
|
||||
1 => 'templates/invoice/renderer/',
|
||||
],
|
||||
],
|
||||
'languages' => [],
|
||||
'calendar' => [
|
||||
'week_numbers' => true,
|
||||
'day_limit' => 4,
|
||||
'slot_duration' => '00:30:00',
|
||||
'businessHours' => [
|
||||
'days' => [
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
3 => 4,
|
||||
4 => 5,
|
||||
],
|
||||
'begin' => '08:00',
|
||||
'end' => '20:00',
|
||||
],
|
||||
'visibleHours' => [
|
||||
'begin' => '00:00',
|
||||
'end' => '23:59',
|
||||
],
|
||||
'google' => [
|
||||
'api_key' => null,
|
||||
'sources' => [
|
||||
],
|
||||
],
|
||||
'weekends' => true,
|
||||
],
|
||||
'theme' => [
|
||||
'active_warning' => 3,
|
||||
'box_color' => 'green',
|
||||
'select_type' => null,
|
||||
'auto_reload_datatable' => false,
|
||||
'show_about' => true,
|
||||
'chart' => [
|
||||
'background_color' => 'rgba(0,115,183,0.7)',
|
||||
'border_color' => '#3b8bba',
|
||||
'grid_color' => 'rgba(0,0,0,.05)',
|
||||
'height' => '200',
|
||||
],
|
||||
'branding' => [
|
||||
'logo' => null,
|
||||
'mini' => null,
|
||||
'company' => null,
|
||||
'title' => null,
|
||||
'translation' => null,
|
||||
],
|
||||
'autocomplete_chars' => 3,
|
||||
],
|
||||
'industry' => [
|
||||
'translation' => null,
|
||||
],
|
||||
'dashboard' => [],
|
||||
'widgets' => [],
|
||||
'defaults' => [
|
||||
'customer' => [
|
||||
'timezone' => null,
|
||||
'country' => 'DE',
|
||||
'currency' => 'EUR',
|
||||
],
|
||||
'user' => [
|
||||
'timezone' => null,
|
||||
'language' => 'en',
|
||||
'theme' => null,
|
||||
'currency' => 'EUR',
|
||||
],
|
||||
],
|
||||
'permissions' => [
|
||||
'sets' => [],
|
||||
'maps' => [],
|
||||
'roles' => [
|
||||
'ROLE_USER' => [],
|
||||
'ROLE_TEAMLEAD' => [],
|
||||
'ROLE_ADMIN' => [],
|
||||
'ROLE_SUPER_ADMIN' => [],
|
||||
],
|
||||
],
|
||||
'ldap' => [
|
||||
'connection' => [
|
||||
'host' => null,
|
||||
'port' => 389,
|
||||
'useStartTls' => false,
|
||||
'useSsl' => false,
|
||||
'bindRequiresDn' => true,
|
||||
'accountFilterFormat' => null,
|
||||
],
|
||||
'user' => [
|
||||
'baseDn' => null,
|
||||
'filter' => '',
|
||||
'attributesFilter' => '(objectClass=*)',
|
||||
'usernameAttribute' => 'uid',
|
||||
'attributes' => [],
|
||||
],
|
||||
'role' => [
|
||||
'baseDn' => null,
|
||||
'usernameAttribute' => 'dn',
|
||||
'nameAttribute' => 'cn',
|
||||
'userDnAttribute' => 'member',
|
||||
'groups' => [],
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
$this->assertConfig($this->getMinConfig(), $fullDefaultConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class UserTest extends TestCase
|
||||
$user = new User();
|
||||
$this->assertInstanceOf(ArrayCollection::class, $user->getPreferences());
|
||||
$this->assertNull($user->getTitle());
|
||||
$this->assertNull($user->getDisplayName());
|
||||
$this->assertNull($user->getAvatar());
|
||||
$this->assertNull($user->getAlias());
|
||||
$this->assertNull($user->getId());
|
||||
@@ -73,17 +74,20 @@ class UserTest extends TestCase
|
||||
$this->assertEquals('I like rain', $user->getPreferenceValue('test2'));
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
public function testDisplayName()
|
||||
{
|
||||
$user = new User();
|
||||
|
||||
$user->setUsername('bar');
|
||||
$this->assertEquals('bar', (string) $user);
|
||||
$this->assertEquals('bar', $user->getDisplayName());
|
||||
$this->assertEquals('bar', $user->getUsername());
|
||||
$this->assertEquals('bar', (string) $user);
|
||||
|
||||
$user->setAlias('foo');
|
||||
$this->assertEquals('foo', (string) $user);
|
||||
$this->assertEquals('foo', $user->getAlias());
|
||||
$this->assertEquals('bar', $user->getUsername());
|
||||
$this->assertEquals('foo', $user->getDisplayName());
|
||||
$this->assertEquals('foo', (string) $user);
|
||||
}
|
||||
|
||||
public function testGetLocale()
|
||||
|
||||
Reference in New Issue
Block a user