EncryptionMnemonicTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConsistencyCheckVectors() 0 6 1
A testConsistency() 0 5 1
1
<?php
2
3
namespace Btccom\JustEncrypt\Test;
4
5
use BitWasp\Buffertools\Buffer;
6
use BitWasp\Buffertools\BufferInterface;
7
use Btccom\JustEncrypt\EncryptionMnemonic;
8
9
class EncryptionMnemonicTest extends AbstractTestCase
10
{
11
    /**
12
     * @return array
13
     */
14
    public function getConsistencyCheckVectors()
15
    {
16
        return array_map(function (array $row) {
17
            return [Buffer::hex($row['data']), $row['mnemonic']];
18
        }, $this->getTestVectors()['mnemonic']);
19
    }
20
21
    /**
22
     * @dataProvider getConsistencyCheckVectors
23
     * @param BufferInterface $data
24
     * @param $mnemonic
25
     */
26
    public function testConsistency(BufferInterface $data, $mnemonic)
27
    {
28
        $this->assertEquals($mnemonic, EncryptionMnemonic::encode($data));
29
        $this->assertTrue($data->equals(EncryptionMnemonic::decode($mnemonic)));
30
    }
31
}
32