BladeLangTest.php 772 B

12345678910111213141516171819
  1. <?php
  2. namespace Illuminate\Tests\View\Blade;
  3. class BladeLangTest extends AbstractBladeTestCase
  4. {
  5. public function testStatementThatContainsNonConsecutiveParenthesisAreCompiled()
  6. {
  7. $string = "Foo @lang(function_call('foo(blah)')) bar";
  8. $expected = "Foo <?php echo app('translator')->get(function_call('foo(blah)')); ?> bar";
  9. $this->assertEquals($expected, $this->compiler->compileString($string));
  10. }
  11. public function testLanguageAndChoicesAreCompiled()
  12. {
  13. $this->assertSame('<?php echo app(\'translator\')->get(\'foo\'); ?>', $this->compiler->compileString("@lang('foo')"));
  14. $this->assertSame('<?php echo app(\'translator\')->choice(\'foo\', 1); ?>', $this->compiler->compileString("@choice('foo', 1)"));
  15. }
  16. }