Completed
Push — master ( 261499...3196a9 )
by Beñat
07:26
created

PageFieldsSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 36.17 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 6
c 1
b 1
f 0
lcom 0
cbo 1
dl 17
loc 47
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_extends_fields() 0 6 1
A it_implements_fields_interface() 0 4 1
A it_should_be_components() 0 4 1
A it_should_connector() 17 17 1
A it_should_be_remove_screen_attributes() 0 4 1

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
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\LIN3S\WPFoundation\PostTypes\Fields;
13
14
use LIN3S\WordPressPhpSpecBridge\ObjectBehavior;
15
16
/**
17
 * Spec of page fields class.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class PageFieldsSpec extends ObjectBehavior
22
{
23
    function let()
24
    {
25
        $this->beAnInstanceOf('fixtures\LIN3S\WPFoundation\PageFields');
26
    }
27
28
    function it_extends_fields()
29
    {
30
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\Templates\PageFields');
31
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\Fields');
32
33
    }
34
35
    function it_implements_fields_interface()
36
    {
37
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\FieldsInterface');
38
    }
39
40
    function it_should_be_components()
41
    {
42
        $this->components()->shouldBeArray();
43
    }
44
45 View Code Duplication
    function it_should_connector()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
46
    {
47
        $this->connector()->shouldReturn([
48
            [
49
                [
50
                    'param'    => 'post_type',
51
                    'operator' => '==',
52
                    'value'    => 'page',
53
                ],
54
                [
55
                    'param'    => 'page_template',
56
                    'operator' => '==',
57
                    'value'    => 'page',
58
                ],
59
            ],
60
        ]);
61
    }
62
63
    function it_should_be_remove_screen_attributes()
64
    {
65
        $this->removeScreenAttributes();
66
    }
67
}
68