Skip to content

Commit

Permalink
Add renderContainerTag method to HasContainerTest. (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 5, 2024
1 parent 015d029 commit 57a5472
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/Attribute/Custom/HasContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use InvalidArgumentException;
use PHPForge\Html\Attribute\Custom\HasContainer;
use PHPForge\Html\Input\Base\AbstractButton;
use PHPForge\Support\Assert;
use PHPUnit\Framework\TestCase;

final class HasContainerTest extends TestCase
Expand Down Expand Up @@ -65,8 +67,6 @@ public function testImmutability(): void
{
$instance = new class () {
use HasContainer;

protected string $containerTag = 'div';
};

$this->assertNotSame($instance, $instance->container(true));
Expand All @@ -75,4 +75,23 @@ public function testImmutability(): void
$this->assertNotSame($instance, $instance->containerTag('span'));
$this->assertNotSame($instance, $instance->containerTemplate(''));
}

public function testRenderContainterTag(): void
{
$instance = new class () extends AbstractButton {
public function run(): string
{
return $this->renderContainerTag(null, 'content');
}
};

Assert::equalsWithoutLE(
<<<HTML
<div>
content
</div>
HTML,
$instance->container(true)->run()
);
}
}

0 comments on commit 57a5472

Please sign in to comment.