Completed
Push — feature/EVO-7277-schema-title ( 0eb4b8 )
by
unknown
66:17
created

FieldTitleMapperTest::testMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 13
loc 13
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
/**
3
 * validate mapping of names to singular
4
 */
5
6
namespace Graviton\GeneratorBundle\Tests\Generator\ResourceGenerator;
7
8
use \Graviton\GeneratorBundle\Generator\ResourceGenerator\FieldTitleMapper;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15 View Code Duplication
class FieldTitleMapperTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /**
18
     * @dataProvider mapData
19
     *
20
     * @param string $field    field form of string
21
     * @param string $expected expected form of string
22
     *
23
     * @return void
24
     */
25
    public function testMap($field, $expected)
26
    {
27
        $sut = new FieldTitleMapper;
28
29
        $field = [
30
            'fieldName' => $field
31
        ];
32
        $expected = [
33
            'fieldName' => $field,
34
            'title' => $expected
35
        ];
36
        $this->assertEquals($expected, $sut->map($field));
37
    }
38
39
    /**
40
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string[][].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
41
     */
42
    public function mapData()
43
    {
44
        return [
45
            ['names', 'Names'],
46
            [' buses', 'Buses'],
47
            ['buses.are.cool', 'Buses Are Cool'],
48
            ['bus.0.name', 'Bus Array Name'],
49
        ];
50
    }
51
}
52