Completed
Push — master ( c4d705...5571d6 )
by Filipe
03:31
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
1
<?php
2
3
/**
4
 * This file is part of slick/web_stack package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace spec\Slick\WebStack\Renderer;
11
12
use Aura\Router\Route;
13
use Slick\WebStack\Renderer\ViewInflector;
14
use PhpSpec\ObjectBehavior;
15
use Slick\WebStack\Renderer\ViewInflectorInterface;
16
17
/**
18
 * ViewInflectorSpec specs
19
 *
20
 * @package spec\Slick\WebStack\Renderer
21
 */
22
class ViewInflectorSpec extends ObjectBehavior
23
{
24
    function let()
25
    {
26
        $this->beConstructedWith('tpl');
27
    }
28
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType(ViewInflector::class);
33
    }
34
35
    function its_a_view_inflector()
36
    {
37
        $this->shouldBeAnInstanceOf(ViewInflectorInterface::class);
38
    }
39
40
    function it_inflates_camel_cased_names_to_dashed_names()
41
    {
42
        $route = new Route();
43
        $route->attributes([
44
            'controller' => 'staticPages',
45
            'action' => 'aboutUs'
46
        ]);
47
        $this->inflect($route)->shouldBe('static-pages/about-us.tpl');
48
    }
49
50
    function it_inflates_underscored_names_to_dashed_names()
51
    {
52
        $this->beConstructedWith('html');
53
        $route = new Route();
54
        $route->attributes([
55
            'controller' => 'otherPages',
56
            'action' => 'testPage'
57
        ]);
58
        $this->inflect($route)->shouldBe('other-pages/test-page.html');
59
    }
60
}