Failed Conditions
Push — master ( 65cf51...40aca8 )
by Adrien
03:16
created

EntryIteratorTest::testMultipleStatements()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 49
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 33
nc 5
nop 0
dl 0
loc 49
rs 9.392
c 0
b 0
f 0
1
<?php
2
3
namespace Genkgo\TestCamt\Unit;
4
5
use Genkgo\TestCamt\AbstractTestCase;
6
use Genkgo\Camt\Camt053\MessageFormat;
7
use Genkgo\Camt\DTO;
8
9
class EntryIteratorTest extends AbstractTestCase
10
{
11
    protected function getDefaultMessage()
12
    {
13
        $dom = new \DOMDocument('1.0', 'UTF-8');
14
        $dom->load(__DIR__.'/Camt053/Stubs/camt053.v2.multi.statement.xml');
15
        return (new MessageFormat\V02)->getDecoder()->decode($dom);
16
    }
17
18
    public function testMultipleStatements()
19
    {
20
        $message = $this->getDefaultMessage();
21
        $entries = $message->getEntries();
22
23
        $item = 0;
24
        foreach ($entries as $entry) {
25
            /* @var DTO\Entry $entry */
26
            if ($item === 0) {
27
                $this->assertEquals(885, $entry->getAmount()->getAmount());
28
                $this->assertEquals(
29
                    'Transaction Description 1',
30
                    $entry->getTransactionDetail()->getRemittanceInformation()->getMessage()
0 ignored issues
show
Deprecated Code introduced by
The function Genkgo\Camt\DTO\Remittan...formation::getMessage() has been deprecated: Use getStructuredBlocks method instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

30
                    /** @scrutinizer ignore-deprecated */ $entry->getTransactionDetail()->getRemittanceInformation()->getMessage()

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
31
                );
32
                $this->assertEquals(
33
                    'Company Name 1',
34
                    $entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getName()
35
                );
36
                $this->assertEquals(
37
                    'NL',
38
                    $entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getAddress()->getCountry()
39
                );
40
                $this->assertEquals(
41
                    '000000001',
42
                    $entry->getTransactionDetail()->getReference()->getEndToEndId()
43
                );
44
            }
45
46
            if ($item === 1) {
47
                $this->assertEquals(-700, $entry->getAmount()->getAmount());
48
                $this->assertEquals(
49
                    'Transaction Description 2',
50
                    $entry->getTransactionDetail()->getRemittanceInformation()->getMessage()
0 ignored issues
show
Deprecated Code introduced by
The function Genkgo\Camt\DTO\Remittan...formation::getMessage() has been deprecated: Use getStructuredBlocks method instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

50
                    /** @scrutinizer ignore-deprecated */ $entry->getTransactionDetail()->getRemittanceInformation()->getMessage()

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
51
                );
52
                $this->assertEquals(
53
                    'Company Name 2',
54
                    $entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getName()
55
                );
56
                $this->assertEquals(
57
                    'FR',
58
                    $entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getAddress()->getCountry()
59
                );
60
                $this->assertEquals(
61
                    '000000002',
62
                    $entry->getTransactionDetail()->getReference()->getEndToEndId()
63
                );
64
            }
65
66
            $item++;
67
        }
68
    }
69
}
70