|
@@ 36-44 (lines=9) @@
|
| 33 |
|
$this->assertEquals($twigTemplate->render([]), 'Hello John'); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
public function testTruncateFilterForFive() |
| 37 |
|
{ |
| 38 |
|
$twig = $this->getTwig(); |
| 39 |
|
|
| 40 |
|
$template = "{{ 'Gordon Freeman' | truncate(5) }}"; |
| 41 |
|
|
| 42 |
|
$twigTemplate = $twig->createTemplate($template); |
| 43 |
|
$this->assertEquals($twigTemplate->render([]), 'Gordo...'); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
public function testTruncateFilterForDefault() |
| 47 |
|
{ |
|
@@ 56-64 (lines=9) @@
|
| 53 |
|
$this->assertEquals($twigTemplate->render([]), 'Lorem ipsum dolor sit amet, co...'); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public function testTruncateFilterWithSeparator() |
| 57 |
|
{ |
| 58 |
|
$twig = $this->getTwig(); |
| 59 |
|
|
| 60 |
|
$template = "{{ 'Gordon Freeman' | truncate(5, false, '-') }}"; |
| 61 |
|
|
| 62 |
|
$twigTemplate = $twig->createTemplate($template); |
| 63 |
|
$this->assertEquals($twigTemplate->render([]), 'Gordo-'); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testWordWrapFilter() |
| 67 |
|
{ |
|
@@ 87-95 (lines=9) @@
|
| 84 |
|
$twigTemplate->render([]); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
public function testShuffleFilterForeach() |
| 88 |
|
{ |
| 89 |
|
$twig = $this->getTwig(); |
| 90 |
|
|
| 91 |
|
$template = "{% for i in [1, 2, 3] | shuffle %}{{ i }}{% endfor %}"; |
| 92 |
|
|
| 93 |
|
$twigTemplate = $twig->createTemplate($template); |
| 94 |
|
$this->assertEquals(strlen($twigTemplate->render([])), 3); |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
public function testTimeDiffFunction() |
| 98 |
|
{ |
|
@@ 188-196 (lines=9) @@
|
| 185 |
|
$this->assertEquals($twigTemplate->render([]), ' best best best'); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
public function testPluralFunction() |
| 189 |
|
{ |
| 190 |
|
$twig = $this->getTwig(); |
| 191 |
|
|
| 192 |
|
$template = "{{ 'mail' | plural(count) }}"; |
| 193 |
|
|
| 194 |
|
$twigTemplate = $twig->createTemplate($template); |
| 195 |
|
$this->assertEquals($twigTemplate->render([]), 'mails'); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
public function testStrpadFunction() |
| 199 |
|
{ |
|
@@ 218-226 (lines=9) @@
|
| 215 |
|
$this->assertEquals($twigTemplate->render([]), ' test'); |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
public function testRightpadFunction() |
| 219 |
|
{ |
| 220 |
|
$twig = $this->getTwig(); |
| 221 |
|
|
| 222 |
|
$template = "{{ 'test' | rightpad(7, 'o') }}"; |
| 223 |
|
|
| 224 |
|
$twigTemplate = $twig->createTemplate($template); |
| 225 |
|
$this->assertEquals($twigTemplate->render([]), 'testooo'); |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
public function testRtlFunction() |
| 229 |
|
{ |
|
@@ 307-317 (lines=11) @@
|
| 304 |
|
$this->assertEquals($twigTemplate->render([]), $value); |
| 305 |
|
} |
| 306 |
|
|
| 307 |
|
public function testSessionFunction() |
| 308 |
|
{ |
| 309 |
|
$twig = $this->getTwig(); |
| 310 |
|
|
| 311 |
|
session(['my.session.key' => 'test value']); |
| 312 |
|
|
| 313 |
|
$template = "{{ session('my.session.key') }}"; |
| 314 |
|
|
| 315 |
|
$twigTemplate = $twig->createTemplate($template); |
| 316 |
|
$this->assertEquals($twigTemplate->render([]), 'test value'); |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
public function testTransFunction() |
| 320 |
|
{ |