getUsers() as $user) breeze @empty empty @endforelse'; $expected = 'getUsers(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> breeze popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> empty '; $this->assertEquals($expected, $this->compiler->compileString($string)); } public function testForelseStatementsAreCompiledWithUppercaseSyntax() { $string = '@forelse ($this->getUsers() AS $user) breeze @empty empty @endforelse'; $expected = 'getUsers(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> breeze popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> empty '; $this->assertEquals($expected, $this->compiler->compileString($string)); } public function testForelseStatementsAreCompiledWithMultipleLine() { $string = '@forelse ([ foo, bar, ] as $label) breeze @empty empty @endforelse'; $expected = 'addLoop($__currentLoopData); foreach($__currentLoopData as $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> breeze popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> empty '; $this->assertEquals($expected, $this->compiler->compileString($string)); } public function testNestedForelseStatementsAreCompiled() { $string = '@forelse ($this->getUsers() as $user) @forelse ($user->tags as $tag) breeze @empty tag empty @endforelse @empty empty @endforelse'; $expected = 'getUsers(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> tags; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tag): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_2 = false; ?> breeze popLoop(); $loop = $__env->getLastLoop(); if ($__empty_2): ?> tag empty popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> empty '; $this->assertEquals($expected, $this->compiler->compileString($string)); } }