|
@@ 53-61 (lines=9) @@
|
| 50 |
|
$this->assertEquals($twigTemplate->render([]), 'Hello John'); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
public function testTruncateFilterForFive() |
| 54 |
|
{ |
| 55 |
|
$twig = $this->getTwig(); |
| 56 |
|
|
| 57 |
|
$template = "{{ 'Gordon Freeman' | truncate(5) }}"; |
| 58 |
|
|
| 59 |
|
$twigTemplate = $twig->createTemplate($template); |
| 60 |
|
$this->assertEquals($twigTemplate->render([]), 'Gordo...'); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public function testTruncateFilterForDefault() |
| 64 |
|
{ |
|
@@ 73-81 (lines=9) @@
|
| 70 |
|
$this->assertEquals($twigTemplate->render([]), 'Lorem ipsum dolor sit amet, co...'); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
public function testTruncateFilterWithSeparator() |
| 74 |
|
{ |
| 75 |
|
$twig = $this->getTwig(); |
| 76 |
|
|
| 77 |
|
$template = "{{ 'Gordon Freeman' | truncate(5, false, '-') }}"; |
| 78 |
|
|
| 79 |
|
$twigTemplate = $twig->createTemplate($template); |
| 80 |
|
$this->assertEquals($twigTemplate->render([]), 'Gordo-'); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
public function testWordWrapFilter() |
| 84 |
|
{ |
|
@@ 104-112 (lines=9) @@
|
| 101 |
|
$twigTemplate->render([]); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public function testShuffleFilterForeach() |
| 105 |
|
{ |
| 106 |
|
$twig = $this->getTwig(); |
| 107 |
|
|
| 108 |
|
$template = "{% for i in [1, 2, 3] | shuffle %}{{ i }}{% endfor %}"; |
| 109 |
|
|
| 110 |
|
$twigTemplate = $twig->createTemplate($template); |
| 111 |
|
$this->assertEquals(strlen($twigTemplate->render([])), 3); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
public function testTimeDiffFunction() |
| 115 |
|
{ |
|
@@ 206-214 (lines=9) @@
|
| 203 |
|
$this->assertEquals($twigTemplate->render([]), ' best best best'); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
public function testPluralFunction() |
| 207 |
|
{ |
| 208 |
|
$twig = $this->getTwig(); |
| 209 |
|
|
| 210 |
|
$template = "{{ 'mail' | plural(count) }}"; |
| 211 |
|
|
| 212 |
|
$twigTemplate = $twig->createTemplate($template); |
| 213 |
|
$this->assertEquals($twigTemplate->render([]), 'mails'); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
public function testStrpadFunction() |
| 217 |
|
{ |
|
@@ 236-244 (lines=9) @@
|
| 233 |
|
$this->assertEquals($twigTemplate->render([]), ' test'); |
| 234 |
|
} |
| 235 |
|
|
| 236 |
|
public function testRightpadFunction() |
| 237 |
|
{ |
| 238 |
|
$twig = $this->getTwig(); |
| 239 |
|
|
| 240 |
|
$template = "{{ 'test' | rightpad(7, 'o') }}"; |
| 241 |
|
|
| 242 |
|
$twigTemplate = $twig->createTemplate($template); |
| 243 |
|
$this->assertEquals($twigTemplate->render([]), 'testooo'); |
| 244 |
|
} |
| 245 |
|
|
| 246 |
|
public function testRtlFunction() |
| 247 |
|
{ |
|
@@ 342-352 (lines=11) @@
|
| 339 |
|
$this->assertEquals($twigTemplate->render([]), $value); |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
public function testSessionFunction() |
| 343 |
|
{ |
| 344 |
|
$twig = $this->getTwig(); |
| 345 |
|
|
| 346 |
|
session(['my.session.key' => 'test value']); |
| 347 |
|
|
| 348 |
|
$template = "{{ session('my.session.key') }}"; |
| 349 |
|
|
| 350 |
|
$twigTemplate = $twig->createTemplate($template); |
| 351 |
|
$this->assertEquals($twigTemplate->render([]), 'test value'); |
| 352 |
|
} |
| 353 |
|
|
| 354 |
|
public function testTransFunction() |
| 355 |
|
{ |