Completed
Pull Request — master (#23)
by Gorka
06:01
created

FieldsSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015-present 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
use LIN3S\WPFoundation\PostTypes\Fields\Components\FieldComponentInterface;
16
use LIN3S\WPFoundation\PostTypes\Fields\PostTypeAndTemplateFieldConnector;
17
18
/**
19
 * Spec of Fields class.
20
 *
21
 * @author Beñat Espiña <[email protected]>
22
 */
23
class FieldsSpec extends ObjectBehavior
24
{
25
    function it_extends_fields()
26
    {
27
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\Fields');
28
    }
29
30
    function it_implements_fields_interface()
31
    {
32
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\FieldsInterface');
33
    }
34
35
    function it_should_be_components()
36
    {
37
        $this->components()->shouldBeArray();
38
    }
39
40 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...
41
    {
42
        $this->beAnInstanceOf('fixtures\LIN3S\WPFoundation\Fields');
43
        $this->connector()->shouldReturn([
44
            [
45
                [
46
                    'param'    => 'post_type',
47
                    'operator' => '==',
48
                    'value'    => 'post',
49
                ],
50
            ],
51
        ]);
52
    }
53
54
    function it_should_be_add_screen_attributes()
55
    {
56
        $this->addScreenAttributes();
57
    }
58
59
    function it_should_be_remove_screen_attributes()
60
    {
61
        $this->removeScreenAttributes();
62
    }
63
64
    function it_should_initialize_fields_with_name_from_connector(
65
        FieldComponentInterface $component,
66
        PostTypeAndTemplateFieldConnector $connector
67
    ) {
68
        $connector->connector()->shouldBeCalled()->willReturn([]);
69
        $connector->name()->shouldBeCalled()->willReturn('name');
70
        $component->init('name', [])->shouldBeCalled();
71
72
        $this->beConstructedWith([
73
            $component
74
        ], $connector);
75
76
        $this->shouldHaveType('LIN3S\WPFoundation\PostTypes\Fields\Fields');
77
78
    }
79
}
80