-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentConfigTest.php
More file actions
56 lines (44 loc) · 1.55 KB
/
EnvironmentConfigTest.php
File metadata and controls
56 lines (44 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
declare(strict_types=1);
namespace LibreCodeCoop\NfsePHP\Tests\Unit\Config;
use LibreCodeCoop\NfsePHP\Config\EnvironmentConfig;
use LibreCodeCoop\NfsePHP\Tests\TestCase;
/**
* @covers \LibreCodeCoop\NfsePHP\Config\EnvironmentConfig
*/
class EnvironmentConfigTest extends TestCase
{
public function testDefaultsToProductionUrl(): void
{
$config = new EnvironmentConfig();
self::assertFalse($config->sandboxMode);
self::assertSame(
'https://sefin.nfse.gov.br/SefinNacional',
$config->baseUrl,
);
}
public function testSandboxModeSelectsSandboxUrl(): void
{
$config = new EnvironmentConfig(sandboxMode: true);
self::assertTrue($config->sandboxMode);
self::assertSame(
'https://sefin.producaorestrita.nfse.gov.br/SefinNacional',
$config->baseUrl,
);
}
public function testCustomBaseUrlOverridesMode(): void
{
$custom = 'http://localhost:8080/SefinNacional';
$config = new EnvironmentConfig(sandboxMode: false, baseUrl: $custom);
self::assertFalse($config->sandboxMode);
self::assertSame($custom, $config->baseUrl);
}
public function testCustomBaseUrlOverridesSandboxUrl(): void
{
$custom = 'http://mock-server/SefinNacional';
$config = new EnvironmentConfig(sandboxMode: true, baseUrl: $custom);
self::assertSame($custom, $config->baseUrl);
}
}