CaseFunctionsTest   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 129
rs 10
c 0
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A testUncaseWithSentence() 0 3 1
A testUncase() 0 3 1
A testKababcase() 0 3 1
A testKababcaseWithSentence() 0 3 1
A testSnakecaseWithSentence() 0 3 1
A testStudlycaseWithSentence() 0 3 1
A sentenceProvider() 0 4 1
A testCamelcase() 0 3 1
A testSnakecase() 0 3 1
A testCamelcaseWithSentence() 0 3 1
A testStudlycase() 0 3 1
A fooBarProvider() 0 8 1
1
<?php
2
3
namespace Jasny\Tests;
4
5
use PHPStan\Testing\TestCase;
6
7
use function Jasny\camelcase;
8
use function Jasny\studlycase;
9
use function Jasny\snakecase;
10
use function Jasny\kababcase;
11
use function Jasny\uncase;
12
13
14
/**
15
 * Test case functions
16
 * @coversNothing
17
 */
18
class CaseFunctionsTest extends TestCase
19
{
20
    public function fooBarProvider()
21
    {
22
        return [
23
            ['foo bar'],
24
            ['fooBar'],
25
            ['FooBar'],
26
            ['foo-bar'],
27
            ['foo_bar']
28
        ];
29
    }
30
    
31
    /**
32
     * @covers Jasny\camelcase
33
     * @dataProvider fooBarProvider
34
     * 
35
     * @param string $fooBar
36
     */
37
    public function testCamelcase($fooBar)
38
    {
39
        $this->assertEquals('fooBar', camelcase($fooBar));
40
    }
41
    
42
    /**
43
     * @covers Jasny\studlycase
44
     * @dataProvider fooBarProvider
45
     * 
46
     * @param string $fooBar
47
     */
48
    public function testStudlycase($fooBar)
49
    {
50
        $this->assertEquals('FooBar', studlycase($fooBar));
51
    }
52
    
53
    /**
54
     * @covers Jasny\snakecase
55
     * @dataProvider fooBarProvider
56
     * 
57
     * @param string $fooBar
58
     */
59
    public function testSnakecase($fooBar)
60
    {
61
        $this->assertEquals('foo_bar', snakecase($fooBar));
62
    }
63
    
64
    /**
65
     * @covers Jasny\kababcase
66
     * @dataProvider fooBarProvider
67
     * 
68
     * @param string $fooBar
69
     */
70
    public function testKababcase($fooBar)
71
    {
72
        $this->assertEquals('foo-bar', kababcase($fooBar));
73
    }
74
    
75
    /**
76
     * @covers Jasny\uncase
77
     * @dataProvider fooBarProvider
78
     * 
79
     * @param string $fooBar
80
     */
81
    public function testUncase($fooBar)
82
    {
83
        $this->assertEquals('foo bar', uncase($fooBar));
84
    }
85
    
86
    
87
    public function sentenceProvider()
88
    {
89
        return [
90
            ['fooBar, .Baz--QUX']
91
        ];
92
    }
93
    
94
    /**
95
     * @covers Jasny\camelcase
96
     * @dataProvider sentenceProvider
97
     * 
98
     * @param string $sentence
99
     */
100
    public function testCamelcaseWithSentence($sentence)
101
    {
102
        $this->assertEquals('fooBarBazQUX', camelcase($sentence));
103
    }
104
    
105
    /**
106
     * @covers Jasny\studlycase
107
     * @dataProvider sentenceProvider
108
     * 
109
     * @param string $sentence
110
     */
111
    public function testStudlycaseWithSentence($sentence)
112
    {
113
        $this->assertEquals('FooBarBazQUX', studlycase($sentence));
114
    }
115
    
116
    /**
117
     * @covers Jasny\snakecase
118
     * @dataProvider sentenceProvider
119
     * 
120
     * @param string $sentence
121
     */
122
    public function testSnakecaseWithSentence($sentence)
123
    {
124
        $this->assertEquals('foo_bar_baz_qux', snakecase($sentence));
125
    }
126
    
127
    /**
128
     * @covers Jasny\kababcase
129
     * @dataProvider sentenceProvider
130
     * 
131
     * @param string $sentence
132
     */
133
    public function testKababcaseWithSentence($sentence)
134
    {
135
        $this->assertEquals('foo-bar-baz-qux', kababcase($sentence));
136
    }
137
    
138
    /**
139
     * @covers Jasny\uncase
140
     * @dataProvider sentenceProvider
141
     * 
142
     * @param string $sentence
143
     */
144
    public function testUncaseWithSentence($sentence)
145
    {
146
        $this->assertEquals('foo bar, .baz qux', uncase($sentence));
147
    }
148
}
149