1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Skaut\Skautis\Test\Unit; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Framework\TestCase; |
6
|
|
|
use Skaut\Skautis\Config; |
7
|
|
|
|
8
|
|
|
class ConfigTest extends TestCase |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
public function testDefaultConfiguration(): void |
12
|
|
|
{ |
13
|
|
|
$config = new Config('asd123'); |
14
|
|
|
|
15
|
|
|
$this->assertEquals('asd123', $config->getAppId()); |
16
|
|
|
$this->assertTrue($config->isTestMode()); |
17
|
|
|
$this->assertTrue($config->isCacheEnabled()); |
18
|
|
|
$this->assertTrue($config->isCompressionEnabled()); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function testTestModeEnabled(): void |
22
|
|
|
{ |
23
|
|
|
$config = new Config('asd123', Config::TEST_MODE_ENABLED); |
24
|
|
|
$this->assertTrue($config->isTestMode()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testTestModeDisabled(): void |
28
|
|
|
{ |
29
|
|
|
$config = new Config('asd123', Config::TEST_MODE_DISABLED); |
30
|
|
|
$this->assertFalse($config->isTestMode()); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testCacheEnabled(): void |
34
|
|
|
{ |
35
|
|
|
$config = new Config('asd123', Config::TEST_MODE_ENABLED, Config::CACHE_ENABLED); |
36
|
|
|
$this->assertTrue($config->isCacheEnabled()); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function testCacheDisabled(): void |
40
|
|
|
{ |
41
|
|
|
$config = new Config('asd123', Config::TEST_MODE_ENABLED, Config::CACHE_DISABLED); |
42
|
|
|
$this->assertFalse($config->isCacheEnabled()); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function testCompressionEnabled(): void |
46
|
|
|
{ |
47
|
|
|
$config = new Config('asd123', Config::TEST_MODE_ENABLED, Config::CACHE_DISABLED, Config::COMPRESSION_ENABLED); |
48
|
|
|
$this->assertTrue( $config->isCompressionEnabled()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function testCompressionDisabled(): void |
52
|
|
|
{ |
53
|
|
|
$config = new Config('asd123', Config::TEST_MODE_ENABLED, Config::CACHE_DISABLED, Config::COMPRESSION_DISABLED); |
54
|
|
|
$this->assertFalse( $config->isCompressionEnabled()); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function testBaseUrlTestModeEnabled(): void |
58
|
|
|
{ |
59
|
|
|
$config = new Config('sad', Config::TEST_MODE_ENABLED); |
60
|
|
|
$this->assertStringStartsWith('https://test', $config->getBaseUrl()); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function testBaseUrlTestModeDisabled(): void |
64
|
|
|
{ |
65
|
|
|
$config = new Config('sad', Config::TEST_MODE_DISABLED); |
66
|
|
|
$this->assertStringStartsWith('https://is.', $config->getBaseUrl()); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|