EncryptionMnemonicTest::testConsistency()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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