Passed
Push — master ( af658c...3b1324 )
by Laurens
06:34 queued 04:39
created

testConvertClassNameToServiceName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace Werkspot\Enum\Util;
3
4
use PHPUnit_Framework_TestCase;
5
6
class ClassNameConverterTest extends PHPUnit_Framework_TestCase
7
{
8
    /** @dataProvider getConversionData */
9
    public function testConvertClassNameToServiceName($class, $service)
10
    {
11
        $this->assertSame($service, ClassNameConverter::convertClassNameToServiceName($class));
12
    }
13
14
    /** @dataProvider getConversionData */
15
    public function testConvertServiceNameToClassName($class, $service)
16
    {
17
        $this->assertSame($class, ClassNameConverter::convertServiceNameToClassName($service));
18
    }
19
20
    public function getConversionData()
21
    {
22
        return array(
23
            array('ServicePro', 'service_pro'),
24
            array('ServicePro\\FooClass', 'service_pro.foo_class'),
25
        );
26
    }
27
28
    /** @dataProvider getNamespaceData */
29
    public function testStripNamespace($class, $fullClass)
30
    {
31
        $this->assertSame($class, ClassNameConverter::stripNameSpace($fullClass));
32
    }
33
34
    public function getNamespaceData()
35
    {
36
        return array(
37
            array('ServicePro', 'ServicePro'),
38
            array('FooClass', 'ServicePro\\FooClass'),
39
            array('FooClass', 'Some\\ServicePro\\FooClass'),
40
        );
41
    }
42
}
43