generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agregar metodos
div()
, span()
a Tag::class
.
- Loading branch information
1 parent
e37febb
commit bf3225a
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Forge\Html\Tests\Tag; | ||
|
||
use Forge\Html\Tag\Tag; | ||
use Forge\TestUtils\Assert; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class DivTest extends TestCase | ||
{ | ||
public function createProvider(): array | ||
{ | ||
return [ | ||
[[], '', '<div>' . PHP_EOL . '</div>'], | ||
[['class' => 'class'], '', '<div class="class">' . PHP_EOL . '</div>'], | ||
[[], 'Content', '<div>' . PHP_EOL . 'Content' . PHP_EOL . '</div>'], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider createProvider | ||
* | ||
* @param array $attributes Tag attributes. | ||
* @param string $content Tag content. | ||
* @param string $expected Expected result. | ||
*/ | ||
public function testCreate(array $attributes, string $content, string $expected): void | ||
{ | ||
$assert = new Assert(); | ||
|
||
$assert->equalsWithoutLE($expected, Tag::div($attributes, $content)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Forge\Html\Tests\Tag; | ||
|
||
use Forge\Html\Tag\Tag; | ||
use Forge\TestUtils\Assert; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SpanTest extends TestCase | ||
{ | ||
public function createProvider(): array | ||
{ | ||
return [ | ||
[[], '', '<span></span>'], | ||
[['class' => 'class'], '', '<span class="class"></span>'], | ||
[[], 'Content', '<span>Content</span>'], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider createProvider | ||
* | ||
* @param array $attributes Tag attributes. | ||
* @param string $content Tag content. | ||
* @param string $expected Expected result. | ||
*/ | ||
public function testCreate(array $attributes, string $content, string $expected): void | ||
{ | ||
$assert = new Assert(); | ||
|
||
$assert->equalsWithoutLE($expected, Tag::span($attributes, $content)); | ||
} | ||
} |