Completed
Push — master ( 247290...01d05f )
by Michael
08:30
created

UtilTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSafeStrlen() 0 3 1
A testSafeSubstr() 0 5 1
1
<?php
2
namespace SecurityLib;
3
4
/**
5
 * Highly recommended that his be run with and without setting
6
 * mbstring.func_overload = 7
7
 * in your php.ini file to verify its correctness.
8
 */
9
class UtilTest extends \PHPUnit_Framework_TestCase {
10
11
    public function testSafeStrlen() {
12
        $this->assertEquals(Util::safeStrlen("\x03\x3f"), 2);
13
    }
14
15
    public function testSafeSubstr() {
16
        $a = "abcdefg\x03\x3fhijk";
17
        $b = "\x03\x3f";
18
        $this->assertEquals(Util::safeSubstr($a, 7, 2), $b);
19
    }
20
}
21