|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
|
4
|
|
|
|
|
5
|
|
|
namespace spec\byrokrat\autogiro\Tree; |
|
6
|
|
|
|
|
7
|
|
|
use byrokrat\autogiro\Tree\RequestMandateCreationNode; |
|
8
|
|
|
use byrokrat\autogiro\Tree\Node; |
|
9
|
|
|
use byrokrat\autogiro\Tree\AccountNode; |
|
10
|
|
|
use byrokrat\autogiro\Tree\BankgiroNode; |
|
11
|
|
|
use byrokrat\autogiro\Tree\IdNode; |
|
12
|
|
|
use byrokrat\autogiro\Tree\PayerNumberNode; |
|
13
|
|
|
use PhpSpec\ObjectBehavior; |
|
14
|
|
|
|
|
15
|
|
View Code Duplication |
class RequestMandateCreationNodeSpec extends ObjectBehavior |
|
|
|
|
|
|
16
|
|
|
{ |
|
17
|
|
|
function let(BankgiroNode $bankgiro, PayerNumberNode $payerNr, AccountNode $account, IdNode $id) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->beConstructedWith($bankgiro, $payerNr, $account, $id); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
function it_is_initializable() |
|
23
|
|
|
{ |
|
24
|
|
|
$this->shouldHaveType(RequestMandateCreationNode::CLASS); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
function it_implements_node_interface() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->shouldHaveType(Node::CLASS); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
function it_contains_a_type() |
|
33
|
|
|
{ |
|
34
|
|
|
$this->getType()->shouldEqual('RequestMandateCreationNode'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
function it_contains_a_bankgiro($bankgiro) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->getChild('bankgiro')->shouldEqual($bankgiro); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
function it_contains_a_payer_nr($payerNr) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->getChild('payer_number')->shouldEqual($payerNr); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
function it_contains_an_accont($account) |
|
48
|
|
|
{ |
|
49
|
|
|
$this->getChild('account')->shouldEqual($account); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
function it_containt_an_id($id) |
|
53
|
|
|
{ |
|
54
|
|
|
$this->getChild('id')->shouldEqual($id); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
function it_contains_a_line_number($bankgiro, $payerNr, $account, $id) |
|
58
|
|
|
{ |
|
59
|
|
|
$this->beConstructedWith($bankgiro, $payerNr, $account, $id, 123); |
|
60
|
|
|
$this->getLineNr()->shouldEqual(123); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
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.