1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Test\Skautis; |
4
|
|
|
|
5
|
|
|
use Skautis\Config; |
6
|
|
|
|
7
|
|
|
class ConfigTest extends \PHPUnit_Framework_TestCase |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
public function testDefaultConfiguration() |
11
|
|
|
{ |
12
|
|
|
$config = new Config("asd123"); |
13
|
|
|
|
14
|
|
|
$this->assertEquals("asd123", $config->getAppId()); |
15
|
|
|
$this->assertSame(Config::TESTMODE_DISABLED, $config->isTestMode()); |
16
|
|
|
$this->assertSame(Config::CACHE_ENABLED, $config->getCache()); |
17
|
|
|
$this->assertSame(Config::COMPRESSION_ENABLED, $config->getCompression()); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function testConstructor() |
21
|
|
|
{ |
22
|
|
|
$config = new Config('sad', true, false, false); |
23
|
|
|
|
24
|
|
|
$this->assertSame('sad', $config->getAppId()); |
25
|
|
|
$this->assertSame(Config::TESTMODE_ENABLED, $config->isTestMode()); |
26
|
|
|
$this->assertSame(Config::CACHE_DISABLED, $config->getCache()); |
27
|
|
|
$this->assertSame(Config::COMPRESSION_DISABLED, $config->getCompression()); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function testTestMode() |
31
|
|
|
{ |
32
|
|
|
$config = new Config("asd123"); |
33
|
|
|
|
34
|
|
|
$config->setTestMode(Config::TESTMODE_ENABLED); |
35
|
|
|
$this->assertSame(Config::TESTMODE_ENABLED, $config->isTestMode()); |
36
|
|
|
|
37
|
|
|
$config->setTestMode(Config::TESTMODE_DISABLED); |
38
|
|
|
$this->assertSame(Config::TESTMODE_DISABLED, $config->isTestMode()); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function testCache() |
42
|
|
|
{ |
43
|
|
|
$config = new Config("asd123"); |
44
|
|
|
|
45
|
|
|
$config->setCache(Config::CACHE_DISABLED); |
46
|
|
|
$this->assertSame(Config::CACHE_DISABLED, $config->getCache()); |
47
|
|
|
|
48
|
|
|
$config->setCache(Config::CACHE_ENABLED); |
49
|
|
|
$this->assertSame(Config::CACHE_ENABLED, $config->getCache()); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function testCompression() |
53
|
|
|
{ |
54
|
|
|
$config = new Config("asd123"); |
55
|
|
|
|
56
|
|
|
$config->setCompression(Config::COMPRESSION_DISABLED); |
57
|
|
|
$this->assertSame(Config::COMPRESSION_DISABLED, $config->getCompression()); |
58
|
|
|
|
59
|
|
|
$config->setCompression(Config::COMPRESSION_ENABLED); |
60
|
|
|
$this->assertSame(Config::COMPRESSION_ENABLED, $config->getCompression()); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function testBaseUrl() |
64
|
|
|
{ |
65
|
|
|
$config = new Config('sad'); |
66
|
|
|
|
67
|
|
|
$config->setTestMode(Config::TESTMODE_ENABLED); |
68
|
|
|
$this->assertContains('test', $config->getBaseUrl()); |
69
|
|
|
|
70
|
|
|
$config->setTestMode(Config::TESTMODE_DISABLED); |
71
|
|
|
$this->assertNotContains('test', $config->getBaseUrl()); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|