Skip to content

Commit

Permalink
[10.x] Add test for pushIf directive (#47163)
Browse files Browse the repository at this point in the history
* add test for `pushIf` directive

* add enter
  • Loading branch information
milwad-dev authored May 22, 2023
1 parent 1ad5d9b commit d90054e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/View/Blade/BladePushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public function testPushOnceIsCompiledWhenIdIsMissing()
$expected = '<?php if (! $__env->hasRenderedOnce(\'e60e8f77-9ac3-4f71-9f8e-a044ef481d7f\')): $__env->markAsRenderedOnce(\'e60e8f77-9ac3-4f71-9f8e-a044ef481d7f\');
$__env->startPush(\'foo\'); ?>
test
<?php $__env->stopPush(); endif; ?>';

$this->assertEquals($expected, $this->compiler->compileString($string));
}

public function testPushIfIsCompiled()
{
$string = '@pushIf(true, \'foo\')
test
@endPushIf';
$expected = '<?php if(true): $__env->startPush( \'foo\'); ?>
test
<?php $__env->stopPush(); endif; ?>';

$this->assertEquals($expected, $this->compiler->compileString($string));
Expand Down

0 comments on commit d90054e

Please sign in to comment.