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

CustomPostTypeFieldsSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

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 41
loc 41
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 4 4 1
A it_extends_fields() 5 5 1
A it_implements_fields_interface() 4 4 1
A it_should_be_components() 4 4 1
A it_should_connector() 12 12 1
A it_should_be_remove_screen_attributes() 4 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 custom post type fields class.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21 View Code Duplication
class CustomPostTypeFieldsSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class 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...
22
{
23
    function let()
24
    {
25
        $this->beAnInstanceOf('fixtures\LIN3S\WPFoundation\CustomPostTypeFields');
26
    }
27
28
    function it_extends_fields()
29
    {
30
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\CustomPostTypeFields');
31
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\Fields');
32
    }
33
34
    function it_implements_fields_interface()
35
    {
36
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\FieldsInterface');
37
    }
38
39
    function it_should_be_components()
40
    {
41
        $this->components()->shouldBeArray();
42
    }
43
44
    function it_should_connector()
45
    {
46
        $this->connector()->shouldReturn([
47
            [
48
                [
49
                    'param'    => 'post_type',
50
                    'operator' => '==',
51
                    'value'    => 'custom_post_type',
52
                ],
53
            ],
54
        ]);
55
    }
56
57
    function it_should_be_remove_screen_attributes()
58
    {
59
        $this->removeScreenAttributes();
60
    }
61
}
62