|
@@ 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 |
|
{ |
|
@@ 179-187 (lines=9) @@
|
| 176 |
|
$this->assertEquals($twigTemplate->render([]), ' best best best'); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
public function testPluralFunction() |
| 180 |
|
{ |
| 181 |
|
$twig = $this->getTwig(); |
| 182 |
|
|
| 183 |
|
$template = "{{ 'mail' | plural(count) }}"; |
| 184 |
|
|
| 185 |
|
$twigTemplate = $twig->createTemplate($template); |
| 186 |
|
$this->assertEquals($twigTemplate->render([]), 'mails'); |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
public function testStrpadFunction() |
| 190 |
|
{ |
|
@@ 209-217 (lines=9) @@
|
| 206 |
|
$this->assertEquals($twigTemplate->render([]), ' test'); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
public function testRightpadFunction() |
| 210 |
|
{ |
| 211 |
|
$twig = $this->getTwig(); |
| 212 |
|
|
| 213 |
|
$template = "{{ 'test' | rightpad(7, 'o') }}"; |
| 214 |
|
|
| 215 |
|
$twigTemplate = $twig->createTemplate($template); |
| 216 |
|
$this->assertEquals($twigTemplate->render([]), 'testooo'); |
| 217 |
|
} |
| 218 |
|
|
| 219 |
|
public function testConfigFunction() |
| 220 |
|
{ |
|
@@ 219-228 (lines=10) @@
|
| 216 |
|
$this->assertEquals($twigTemplate->render([]), 'testooo'); |
| 217 |
|
} |
| 218 |
|
|
| 219 |
|
public function testConfigFunction() |
| 220 |
|
{ |
| 221 |
|
$twig = $this->getTwig(); |
| 222 |
|
|
| 223 |
|
Config::set('app.custom.key', 'test value'); |
| 224 |
|
$template = "{{ config('app.custom.key') }}"; |
| 225 |
|
|
| 226 |
|
$twigTemplate = $twig->createTemplate($template); |
| 227 |
|
$this->assertEquals($twigTemplate->render([]), 'test value'); |
| 228 |
|
} |
| 229 |
|
} |
| 230 |
|
|