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

ViewInflectorSpec::its_a_view_inflector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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