Completed
Push — master ( bd4c23...b341c0 )
by Filipe
10:29
created

ViewInflectorSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A its_a_view_inflector() 0 4 1
A it_inflates_camel_cased_names_to_dashed_names() 0 9 1
A it_inflates_underscored_names_to_dashed_names() 0 10 1
1
<?php
2
3
namespace spec\Slick\Mvc\Http\Renderer;
4
5
use Aura\Router\Route;
6
use Slick\Mvc\Http\Renderer\ViewInflector;
7
use PhpSpec\ObjectBehavior;
8
use Prophecy\Argument;
9
use Slick\Mvc\Http\Renderer\ViewInflectorInterface;
10
11
/**
12
 * ViewInflectorSpec
13
 *
14
 * @package spec\Slick\Mvc\Http\Renderer
15
 * @author  Filipe Silva <[email protected]>
16
 */
17
class ViewInflectorSpec extends ObjectBehavior
18
{
19
20
    function let()
21
    {
22
        $this->beConstructedWith('tpl');
23
    }
24
25
    function it_is_initializable()
26
    {
27
        $this->shouldHaveType(ViewInflector::class);
28
    }
29
30
    function its_a_view_inflector()
31
    {
32
        $this->shouldBeAnInstanceOf(ViewInflectorInterface::class);
33
    }
34
35
    function it_inflates_camel_cased_names_to_dashed_names()
36
    {
37
        $route = new Route();
38
        $route->attributes([
39
            'controller' => 'staticPages',
40
            'action' => 'aboutUs'
41
        ]);
42
        $this->inflect($route)->shouldBe('static-pages/about-us.tpl');
43
    }
44
45
    function it_inflates_underscored_names_to_dashed_names()
46
    {
47
        $this->beConstructedWith('html');
48
        $route = new Route();
49
        $route->attributes([
50
            'controller' => 'otherPages',
51
            'action' => 'testPage'
52
        ]);
53
        $this->inflect($route)->shouldBe('other-pages/test-page.html');
54
    }
55
}
56