41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
<?php
|
|
namespace nur\sery\php\content;
|
|
|
|
use nur\sery\php\content\impl\html;
|
|
use nur\sery\wip\web\content\v;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class cTest extends TestCase {
|
|
function testTo_string() {
|
|
self::assertSame("", c::to_string(null));
|
|
self::assertSame("", c::to_string(false));
|
|
self::assertSame("pouet<q/>", c::to_string("pouet<q/>"));
|
|
self::assertSame("pouet<q/>", c::to_string(["pouet<q/>"]));
|
|
self::assertSame("hello world", c::to_string(["hello", "world"]));
|
|
self::assertSame("hello1 world", c::to_string(["hello1", "world"]));
|
|
self::assertSame("hello<world>", c::to_string(["hello", "<world>"]));
|
|
self::assertSame("<hello>world", c::to_string(["<hello>", "world"]));
|
|
self::assertSame("hello,world", c::to_string(["hello,", "world"]));
|
|
self::assertSame("hello world", c::to_string(["hello ", "world"]));
|
|
self::assertSame("hello. world", c::to_string(["hello.", "world"]));
|
|
self::assertSame("hello.<world>", c::to_string(["hello.", "<world>"]));
|
|
|
|
self::assertSame(
|
|
"<h1>title<q/></h1><p>hello<nq/><span>brave<q/></span><span>world<nq/></span></p>",
|
|
c::to_string([
|
|
[html::H1, "title<q/>"],
|
|
[html::P, [
|
|
"hello<nq/>",
|
|
[html::SPAN, "brave<q/>"],
|
|
[html::SPAN, ["world<nq/>"]],
|
|
]],
|
|
]));
|
|
}
|
|
|
|
function testXxx() {
|
|
$content = [[v::h1, "hello"]];
|
|
self::assertSame("<h1>hello</h1>", c::to_string($content));
|
|
}
|
|
}
|
|
|