We do not return old style bool on error, we throw Exceptions: HtmlBuilderExcpetion Element has more classes to set tag, id, etc with basic checks for valid data String Replace to set strings is one array with key -> value entries Errors thrown on index for element/replace blocks
35 lines
740 B
PHP
35 lines
740 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use CoreLibs\Template\HtmlBuilder\Block;
|
|
|
|
/**
|
|
* Test class for Template\HtmlBuilder\Block
|
|
* @coversDefaultClass \CoreLibs\Template\HtmlBuilder\Block
|
|
* @testdox \CoreLibs\Template\HtmlBuilder\Block method tests
|
|
*/
|
|
final class CoreLibsTemplateHtmlBuilderBlockTest extends TestCase
|
|
{
|
|
public function testCreateBlock(): void
|
|
{
|
|
$el = Block::cel('div', 'id', 'content', ['css'], ['onclick' => 'foo();']);
|
|
$this->assertEquals(
|
|
'<div id="id" class="css" onclick="foo();">content</div>',
|
|
Block::buildHtml($el)
|
|
);
|
|
}
|
|
|
|
// ael
|
|
// aelx|addSub
|
|
// resetSub
|
|
// acssel/rcssel/scssel
|
|
// buildHtml
|
|
// buildHtmlFromList|printHtmlFromArray
|
|
}
|
|
|
|
// __END__
|