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

UtilTest::testSafeSubstr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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