Completed
Pull Request — master (#224)
by Alejandro
03:14
created

CustomizableAppConfigTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A exchangeArrayIgnoresAnyNonProvidedKey() 0 24 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Installer;
5
6
use PHPUnit\Framework\TestCase;
7
use Shlinkio\Shlink\Installer\Config\Plugin\ApplicationConfigCustomizer;
8
use Shlinkio\Shlink\Installer\Config\Plugin\LanguageConfigCustomizer;
9
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
10
11
class CustomizableAppConfigTest extends TestCase
12
{
13
    /**
14
     * @test
15
     */
16
    public function exchangeArrayIgnoresAnyNonProvidedKey()
17
    {
18
        $config = new CustomizableAppConfig();
19
20
        $config->exchangeArray([
21
            'app_options' => [
22
                'disable_track_param' => null,
23
            ],
24
            'translator' => [
25
                'locale' => 'es',
26
            ],
27
        ]);
28
29
        $this->assertFalse($config->hasDatabase());
30
        $this->assertFalse($config->hasUrlShortener());
31
        $this->assertTrue($config->hasApp());
32
        $this->assertTrue($config->hasLanguage());
33
        $this->assertEquals([
34
            ApplicationConfigCustomizer::DISABLE_TRACK_PARAM => null,
35
        ], $config->getApp());
36
        $this->assertEquals([
37
            LanguageConfigCustomizer::DEFAULT_LANG => 'es',
38
        ], $config->getLanguage());
39
    }
40
}
41