refactor configurations (#2626)
* composition instead of inheritance * refactored some twig extensions to runtime extensions
This commit is contained in:
@@ -98,7 +98,15 @@ class SystemConfigurationTest extends TestCase
|
||||
],
|
||||
'theme' => [
|
||||
'color_choices' => 'Maroon|#800000,Brown|#a52a2a,Red|#ff0000,Orange|#ffa500,#ffffff,,|#000000',
|
||||
'colors_limited' => true
|
||||
'colors_limited' => true,
|
||||
'tags_create' => true,
|
||||
'branding' => [
|
||||
'logo' => null,
|
||||
'mini' => null,
|
||||
'company' => 'Acme Corp.',
|
||||
'title' => 'Fantastic Time-Tracking',
|
||||
'translation' => null,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -137,6 +145,9 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertTrue($sut->find('theme.colors_limited'));
|
||||
$this->assertTrue($sut->isThemeColorsLimited());
|
||||
$this->assertEquals('Maroon|#800000,Brown|#a52a2a,Red|#ff0000,Orange|#ffa500,#ffffff,,|#000000', $sut->getThemeColorChoices());
|
||||
$this->assertEquals('Acme Corp.', $sut->getBrandingCompany());
|
||||
$this->assertEquals('Fantastic Time-Tracking', $sut->getBrandingTitle());
|
||||
$this->assertTrue($sut->isAllowTagCreation());
|
||||
}
|
||||
|
||||
public function testDefaultWithLoader()
|
||||
|
||||
@@ -9,20 +9,22 @@
|
||||
|
||||
namespace App\Tests\Configuration;
|
||||
|
||||
use App\Configuration\SystemConfiguration;
|
||||
use App\Configuration\ThemeConfiguration;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Configuration\ThemeConfiguration
|
||||
* @covers \App\Configuration\StringAccessibleConfigTrait
|
||||
* @covers \App\Configuration\SystemConfiguration
|
||||
*/
|
||||
class ThemeConfigurationTest extends TestCase
|
||||
{
|
||||
protected function getSut(array $settings, array $loaderSettings = []): ThemeConfiguration
|
||||
{
|
||||
$loader = new TestConfigLoader($loaderSettings);
|
||||
$config = new SystemConfiguration($loader, ['theme' => $settings]);
|
||||
|
||||
return new ThemeConfiguration($loader, $settings);
|
||||
return new ThemeConfiguration($config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,26 +53,13 @@ class ThemeConfigurationTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testPrefix()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals('theme', $sut->getPrefix());
|
||||
}
|
||||
|
||||
public function testConfigs()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertTrue($sut->isAllowTagCreation());
|
||||
$this->assertNull($sut->getTitle());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDeprecations()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals('', $sut->getSelectPicker());
|
||||
$this->assertFalse($sut->isAutoReloadDatatable());
|
||||
$this->assertTrue($sut->isAllowTagCreation());
|
||||
$this->assertNull($sut->getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user