Passed
Push — main ( febc1c...c8b151 )
by Chema
02:27
created

LightningConfigTest::test_ln_bits_backend()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 10
c 2
b 0
f 1
nc 1
nop 0
dl 0
loc 16
rs 9.9332
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightningTest\Unit\Config;
6
7
use PhpLightning\Config\LightningConfig;
8
use PhpLightning\Shared\Value\SendableRange;
9
use PHPUnit\Framework\TestCase;
10
11
final class LightningConfigTest extends TestCase
12
{
13
    public function test_default_values(): void
14
    {
15
        $config = new LightningConfig();
16
17
        self::assertSame([], $config->jsonSerialize());
18
    }
19
20
    public function test_domain_with_scheme(): void
21
    {
22
        $config = (new LightningConfig())
23
            ->setDomain('https://your-domain.com');
24
25
        self::assertSame([
26
            'domain' => 'your-domain.com',
27
        ], $config->jsonSerialize());
28
    }
29
30
    public function test_domain_without_scheme(): void
31
    {
32
        $config = (new LightningConfig())
33
            ->setDomain('your-domain.com');
34
35
        self::assertSame([
36
            'domain' => 'your-domain.com',
37
        ], $config->jsonSerialize());
38
    }
39
40
    public function test_receiver(): void
41
    {
42
        $config = (new LightningConfig())
43
            ->setReceiver('custom-receiver');
44
45
        self::assertSame([
46
            'receiver' => 'custom-receiver',
47
        ], $config->jsonSerialize());
48
    }
49
50
    public function test_sendable_range(): void
51
    {
52
        $config = (new LightningConfig())
53
            ->setSendableRange(1_000, 5_000);
0 ignored issues
show
Bug introduced by
The constant PhpLightningTest\Unit\Config\1_000 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant PhpLightningTest\Unit\Config\5_000 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
54
55
        self::assertEquals([
56
            'sendable-range' => SendableRange::withMinMax(1_000, 5_000),
57
        ], $config->jsonSerialize());
58
    }
59
}
60