Completed
Push — master ( 6a7f6a...2d18f0 )
by Julius
04:59 queued 02:43
created

ConfigServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 32
ccs 22
cts 22
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testAppValue() 0 9 1
A testUserValue() 0 9 1
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 2
  public function setUp() {
14 2
    $this->config = $this->getMockBuilder('\OCP\IConfig')
15 2
      ->disableOriginalConstructor()->getMock();
16 2
    $this->service = new ConfigService($this->config, 'apporder');
17 2
  }
18
19 1
  public function testAppValue() {
20 1
    $this->config->expects($this->any())
21 1
      ->method('getAppValue')
22 1
      ->with('apporder', 'foo')
23 1
      ->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 1
    $result = $this->service->getAppValue("foo");
26 1
    $this->assertEquals('bar', $result);
27 1
  }
28
29 1
  public function testUserValue() {
30 1
    $this->config->expects($this->any())
31 1
      ->method('getUserValue')
32 1
      ->with('user', 'apporder', 'foo')
33 1
      ->willReturn('bar');
34 1
    $this->service->setUserValue("foo", "user", "bar");
35 1
    $result = $this->service->getUserValue("foo", "user");
36 1
    $this->assertEquals('bar', $result);
37 1
  }
38
39
  }
40