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

exchangeArrayIgnoresAnyNonProvidedKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 24
rs 9.536
c 0
b 0
f 0
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