Completed
Push — master ( 8d9cf8...669f46 )
by Vítězslav
04:09
created

NastaveniTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 20.93 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 9
loc 43
rs 10
wmc 4
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A testGetFlexiData() 9 14 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Test\FlexiPeeHP;
4
5
use FlexiPeeHP\Nastaveni;
6
7
/**
8
 * Generated by PHPUnit_SkeletonGenerator on 2016-04-27 at 17:32:11.
9
 */
10
class NastaveniTest extends FlexiBeeTest
11
{
12
    /**
13
     * @var Nastaveni
14
     */
15
    protected $object;
16
17
    /**
18
     * Sets up the fixture, for example, opens a network connection.
19
     * This method is called before a test is executed.
20
     */
21
    protected function setUp()
22
    {
23
        $this->object = new Nastaveni();
24
    }
25
26
    /**
27
     * Tears down the fixture, for example, closes a network connection.
28
     * This method is called after a test is executed.
29
     */
30
    protected function tearDown()
31
    {
32
33
    }
34
35
    /**
36
     * @covers FlexiPeeHP\Nastaveni::getFlexiData
37
     */
38
    public function testGetFlexiData()
39
    {
40
        if ($this->object->url == 'https://demo.flexibee.eu') {
41
            $this->markTestSkipped('Public demo site does not allow read here');
42 View Code Duplication
        } else {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
            $flexidata = $this->object->getFlexiData();
44
            $this->assertArrayHasKey(0, $flexidata);
45
            $this->assertArrayHasKey('id', $flexidata[0]);
46
            $filtrered = $this->object->getFlexiData(null,
47
                key($flexidata[0])." = ".current($flexidata[0]));
48
            $this->assertArrayHasKey(0, $filtrered);
49
            $this->assertArrayHasKey('id', $filtrered[0]);
50
        }
51
    }
52
}