Passed
Push — master ( abee1f...edc958 )
by Kirill
03:08
created

GroupTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 11
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPatch() 0 15 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Config;
13
14
use Spiral\Config\Patch\Append;
15
use Spiral\Config\Patch\Delete;
16
use Spiral\Config\Patch\Group;
17
use Spiral\Config\Patch\Prepend;
18
19
class GroupTest extends BaseTest
20
{
21
    public function testPatch(): void
22
    {
23
        $cf = $this->getFactory();
24
        $this->assertEquals(['value' => 'value!'], $cf->getConfig('scope'));
25
26
        $cf->modify('scope', new Group(
27
            new Prepend('.', 'other', ['a' => 'b']),
28
            new Delete('other', 'a'),
29
            new Append('other', 'c', 'd')
30
        ));
31
32
        $this->assertEquals([
33
            'other' => ['c' => 'd'],
34
            'value' => 'value!'
35
        ], $cf->getConfig('scope'));
36
    }
37
}
38