Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/View/Antlers/Language/Nodes/AntlersNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ public function copyBasicDetailsTo($instance)
$instance->rawEnd = $this->rawEnd;
$instance->startPosition = $this->startPosition;
$instance->endPosition = $this->endPosition;
$instance->interpolationRegions = $this->interpolationRegions;
$instance->processedInterpolationRegions = $this->processedInterpolationRegions;

return $instance;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/Antlers/Runtime/UnlessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Antlers\Runtime;

use Illuminate\Support\Str;
use Tests\Antlers\ParserTestCase;

class UnlessTest extends ParserTestCase
Expand All @@ -17,4 +18,19 @@ public function test_elseunless_conditions_does_not_cause_error()
'last' => false,
]));
}

public function test_unless_with_vars()
{
$template = <<<'EOT'
{{ the_var = 1 }}

{{ unless {the_var} }}true{{ else }}false{{ /unless }}
{{ if ! {the_var} }}true{{ else }}false{{ /if }}
EOT;

$this->assertSame(
'false false',
Str::squish($this->renderString($template))
);
}
}
Loading