Passed
Pull Request — master (#16)
by Dmitry
14:13
created

ParamsConfigTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultConfigName() 0 3 1
A configProvider() 0 34 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Tests\Integration\Tests\Config;
6
7
use stdClass;
8
use Yiisoft\Composer\Config\Tests\Integration\Tests\Helper\LiterallyCallback;
9
10
final class ParamsConfigTest extends ConfigTest
11
{
12
    public function configProvider(): array
13
    {
14
        return [
15
            ['boolean parameter', true],
16
            ['string parameter', 'value of param 1'],
17
            ['NAN parameter', 'NAN'],
18
            ['float parameter', 1.0000001],
19
            ['int parameter', 123],
20
            ['long int parameter', 123_000],
0 ignored issues
show
Bug introduced by
The constant Yiisoft\Composer\Config\...on\Tests\Config\123_000 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
21
            ['array parameter', [[[[[[]]]]]]],
22
            [
23
                'callable parameter',
24
                new LiterallyCallback(function () {
25
                    return 'I am callable';
26
                }),
27
            ],
28
            [
29
                'static callable parameter',
30
                new LiterallyCallback(static function () {
31
                    return 'I am callable';
32
                }),
33
            ],
34
            ['object parameter', new stdClass()],
35
            /**
36
             * Test for subpackages parameters
37
             */
38
            ['first-vendor/first-package', true],
39
            ['first-vendor/second-package', true],
40
            ['first-dev-vendor/first-package', true],
41
            ['first-dev-vendor/second-package', true],
42
            ['second-vendor/first-package', true],
43
            ['second-vendor/second-package', true],
44
            ['second-dev-vendor/first-package', true],
45
            ['second-dev-vendor/second-package', true],
46
        ];
47
    }
48
49
    protected function getDefaultConfigName(): string
50
    {
51
        return 'params';
52
    }
53
}
54