Passed
Pull Request — main (#3)
by Chema
02:25
created

GetCallbackUrlFeatureTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_default_values() 0 14 1
A setUp() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightningTest\Feature;
6
7
use Gacela\Framework\Bootstrap\GacelaConfig;
8
use Gacela\Framework\Gacela;
9
use PhpLightning\Invoice\Infrastructure\Command\CallbackUrlCommand;
10
use PHPUnit\Framework\TestCase;
11
use Symfony\Component\Console\Tester\CommandTester;
12
13
final class GetCallbackUrlFeatureTest extends TestCase
14
{
15
    protected function setUp(): void
16
    {
17
        Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
18
            $config->resetInMemoryCache();
19
            $config->addAppConfigKeyValues([
20
                'domain' => 'custom-domain',
21
                'receiver' => 'custom-receiver',
22
            ]);
23
        });
24
    }
25
26
    public function test_default_values(): void
27
    {
28
        $tester = new CommandTester(new CallbackUrlCommand());
29
        $tester->execute([]);
30
        $outputAsJson = json_decode($tester->getDisplay(), true);
31
32
        self::assertEquals([
33
            'callback' => 'https://custom-domain/custom-receiver',
34
            'maxSendable' => 10_000_000_000,
0 ignored issues
show
Bug introduced by
The constant PhpLightningTest\Feature\10_000_000_000 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
35
            'minSendable' => 100_000,
0 ignored issues
show
Bug introduced by
The constant PhpLightningTest\Feature\100_000 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
36
            'metadata' => '[["text/plain","Pay to custom-receiver@custom-domain"],["text/identifier","custom-receiver@custom-domain"]]',
37
            'tag' => 'payRequest',
38
            'commentAllowed' => false,
39
        ], $outputAsJson);
40
    }
41
}
42