Completed
Branch master (1820a0)
by Oss
02:45
created

ConfigTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 53
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Test\Brownie\BpmOnline;
4
5
use Brownie\BpmOnline\Config;
6
use PHPUnit\Framework\TestCase;
7
8
class ConfigTest extends TestCase
9
{
10
11
    /**
12
     * @var Config
13
     */
14
    private $config;
15
16
    protected function setUp()
17
    {
18
        $this->config = new Config([
19
            'apiUrlScheme' => 'xxews',
20
            'apiDomain' => 'test.com',
21
            'apiConnectTimeOut' => 120,
22
            'userDomain' => 'devDomain',
23
            'userName' => 'devLogin',
24
            'userPassword' => 'devPassword',
25
        ]);
26
    }
27
28
    protected function tearDown()
29
    {
30
        $this->config = null;
31
    }
32
33
    public function testInitConfigParams()
34
    {
35
        $this->assertEquals('xxews', $this->config->getApiUrlScheme());
36
        $this->assertEquals('test.com', $this->config->getApiDomain());
37
        $this->assertEquals(120, $this->config->getApiConnectTimeOut());
38
        $this->assertEquals('devDomain', $this->config->getUserDomain());
39
        $this->assertEquals('devLogin', $this->config->getUserName());
40
        $this->assertEquals('devPassword', $this->config->getUserPassword());
41
    }
42
43
    public function testSetGetConfigParams()
44
    {
45
        $this
46
            ->config
47
            ->setApiUrlScheme('https')
48
            ->setApiDomain('bpmonline.com')
49
            ->setApiConnectTimeOut(60)
50
            ->setUserDomain('test')
51
            ->setUserName('tester')
52
            ->setUserPassword('dev');
53
        $this->assertEquals('https', $this->config->getApiUrlScheme());
54
        $this->assertEquals('bpmonline.com', $this->config->getApiDomain());
55
        $this->assertEquals(60, $this->config->getApiConnectTimeOut());
56
        $this->assertEquals('test', $this->config->getUserDomain());
57
        $this->assertEquals('tester', $this->config->getUserName());
58
        $this->assertEquals('dev', $this->config->getUserPassword());
59
    }
60
}
61