Completed
Push — master ( 3d39f9...d9b5c0 )
by Anthony
07:02 queued 04:32
created

CAPICOMTest::testGenerate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 5
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 5
loc 5
rs 9.4285
nc 1
cc 1
eloc 4
nop 2
1
<?php
2
3
namespace RandomLib\Source;
4
5
use SecurityLib\Strength;
6
7
class CAPICOMTest extends \PHPUnit_Framework_TestCase {
8
9
    public static function provideGenerate() {
10
        $data = array();
11
        for ($i = 0; $i < 100; $i += 25) {
12
            $not = $i > 0 ? str_repeat(chr(0), $i) : chr(0);
13
            $data[] = array($i, $not);
14
        }
15
        return $data;
16
    }
17
18
    /**
19
     */
20
    public function testGetStrength() {
21
        $strength = new Strength(Strength::MEDIUM);
22
        $actual = CAPICOM::getStrength();
23
        $this->assertEquals($actual, $strength);
24
    }
25
26
    /**
27
     * @dataProvider provideGenerate
28
     * @group slow
29
     */
30
    public function testGenerate($length, $not) {
31
        $rand = new CAPICOM;
32
        $stub = $rand->generate($length);
33
        $this->assertEquals($length, strlen($stub));
34
    }
35
36
}
37