FinTsTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A escapeStringProvider() 0 15 1
A testEscapeString() 0 11 1
1
<?php
2
3
namespace Tests\Fhp;
4
5
use Fhp\FinTs;
6
7
class FinTsTest extends \PHPUnit_Framework_TestCase
8
{
9
10
    public function escapeStringProvider()
11
    {
12
        return array(
13
            array('[email protected]', '[email protected]'),
14
            array('??pseudo?:pass?\'special?@', '?pseudo:pass\'special@'),
15
            array('nothingtodo', 'nothingtodo'),
16
            array('??', '?'),
17
            array('?:', ':'),
18
            array('?@', '@'),
19
            array('?\'', '\''),
20
            array('????', '??'),
21
            array('', ''),
22
            array('', null),
23
        );
24
    }
25
26
    /**
27
     * @dataProvider escapeStringProvider
28
     * @param string $expected
29
     * @param string $value
30
     */
31
    public function testEscapeString($expected, $value)
32
    {
33
        $fints = $this->getMockBuilder('\Fhp\FinTs')
34
            ->disableOriginalConstructor()
35
            ->getMock();
36
37
        $reflMethod = new \ReflectionMethod('\Fhp\FinTs', 'escapeString');
38
        $reflMethod->setAccessible(true);
39
40
        $this->assertSame($expected, $reflMethod->invoke($fints, $value));
41
    }
42
}
43