|
@@ 350-360 (lines=11) @@
|
| 347 |
|
$this->assertEquals($twigTemplate->render([]), $value); |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
public function testSessionFunction() |
| 351 |
|
{ |
| 352 |
|
$twig = $this->getTwig(); |
| 353 |
|
|
| 354 |
|
session(['my.session.key' => 'test value']); |
| 355 |
|
|
| 356 |
|
$template = "{{ session('my.session.key') }}"; |
| 357 |
|
|
| 358 |
|
$twigTemplate = $twig->createTemplate($template); |
| 359 |
|
$this->assertEquals($twigTemplate->render([]), 'test value'); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
public function testTransFunction() |
| 363 |
|
{ |
|
@@ 362-371 (lines=10) @@
|
| 359 |
|
$this->assertEquals($twigTemplate->render([]), 'test value'); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
public function testTransFunction() |
| 363 |
|
{ |
| 364 |
|
$twig = $this->getTwig(); |
| 365 |
|
Config::set('app.locale', 'en'); |
| 366 |
|
|
| 367 |
|
$template = "{{ trans('validation.accepted') }}"; |
| 368 |
|
|
| 369 |
|
$twigTemplate = $twig->createTemplate($template); |
| 370 |
|
$this->assertEquals($twigTemplate->render([]), 'The :attribute must be accepted.'); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
public function testTransFunctionWithParam() |
| 374 |
|
{ |
|
@@ 373-382 (lines=10) @@
|
| 370 |
|
$this->assertEquals($twigTemplate->render([]), 'The :attribute must be accepted.'); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
public function testTransFunctionWithParam() |
| 374 |
|
{ |
| 375 |
|
$twig = $this->getTwig(); |
| 376 |
|
Config::set('app.locale', 'en'); |
| 377 |
|
|
| 378 |
|
$template = "{{ trans('backend::lang.access_log.hint', {'days': 60}) }}"; |
| 379 |
|
|
| 380 |
|
$twigTemplate = $twig->createTemplate($template); |
| 381 |
|
$this->assertContains('60 days', $twigTemplate->render([])); |
| 382 |
|
} |
| 383 |
|
} |
| 384 |
|
|