Completed
Push — master ( adedfa...b6430b )
by Julius
07:05
created

ConfigServiceTest::testUserValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

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 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 1
eloc 8
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");
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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