Completed
Push — master ( e6fe6f...a29d2d )
by Hannes
09:33
created

FileProcessorSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace spec\byrokrat\autogiro\Processor;
6
7
use byrokrat\autogiro\Processor\FileProcessor;
8
use byrokrat\autogiro\Tree\FileNode;
9
use byrokrat\autogiro\Tree\LayoutNode;
10
use byrokrat\autogiro\Tree\OpeningNode;
11
use byrokrat\autogiro\Tree\BankgiroNode;
12
use PhpSpec\ObjectBehavior;
13
use Prophecy\Argument;
14
15
class FileProcessorSpec extends ObjectBehavior
16
{
17
    function it_is_initializable()
18
    {
19
        $this->shouldHaveType(FileProcessor::CLASS);
20
    }
21
22
    function it_writes_attributes(
23
        FileNode $fileNode,
24
        LayoutNode $layoutNode,
25
        OpeningNode $openingNode,
26
        BankgiroNode $bankgiroNode
27
    ) {
28
        $bankgiroNode->getValue()->willReturn('111-111');
29
30
        $openingNode->getAttribute('customer_number')->willReturn('12345');
31
        $openingNode->getChild('bankgiro')->willReturn($bankgiroNode);
0 ignored issues
show
Bug introduced by
The method willReturn() does not seem to exist on object<byrokrat\autogiro\Tree\Node>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        $openingNode->getAttribute('layout_name')->willReturn('name');
33
34
        $layoutNode->getChild('opening')->willReturn($openingNode);
0 ignored issues
show
Bug introduced by
The method willReturn() does not seem to exist on object<byrokrat\autogiro\Tree\Node>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
36
        $fileNode->getChildren()->willReturn([$layoutNode]);
37
38
        $fileNode->setAttribute('customer_number', '12345')->shouldBeCalled();
39
        $fileNode->setAttribute('bankgiro', '111-111')->shouldBeCalled();
40
        $fileNode->setAttribute('layout_ids', ['name'])->shouldBeCalled();
41
42
        $this->visitFileNode($fileNode);
43
    }
44
}
45