| 1 | <?php |
||
| 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 | } |