Completed
Branch master (0fa812)
by Julius
15:22 queued 12:36
created

ConfigServiceTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace OCA\AppOrder\Tests\Unit\Service;
4
5
use OCA\AppOrder\Service\ConfigService;
6
use OCP\IConfig;
7
8
class ConfigServiceTest extends \Test\TestCase {
9
10
  private $config;
11
  private $service;
12
13
  public function setUp() {
14
    $this->config = $this->getMockBuilder('\OCP\IConfig')
15
      ->disableOriginalConstructor()->getMock();
16
    $this->service = new ConfigService($this->config, 'apporder');
17
  }
18
19
  public function testAppValue() {
20
    $this->config->expects($this->any())
21
      ->method('getAppValue')
22
      ->with('apporder', 'foo')
23
      ->willReturn('bar');
24
//    $this->service->setAppValue("foo","bar");
25
    $result = $this->service->getAppValue("foo");
26
    $this->assertEquals('bar', $result);
27
  }
28
29
  public function testUserValue() {
30
    $this->config->expects($this->any())
31
      ->method('getUserValue')
32
      ->with('user', 'apporder', 'foo')
33
      ->willReturn('bar');
34
    $this->service->setUserValue("foo", "user", "bar");
35
    $result = $this->service->getUserValue("foo", "user");
36
    $this->assertEquals('bar', $result);
37
  }
38
39
  }
40