Phalcon\Test\Unit\Tag\TagTagHtmlTest::testTagHtmlWithArray PHP Method

testTagHtmlWithArray() public method

Tests tagHtml with array parameter
Since: 2014-09-05
Author: Nikolaos Dimopoulos ([email protected])
    public function testTagHtmlWithArray()
    {
        $this->specify("tagHtml with array parameter returns invalid HTML Strict", function () {
            Tag::resetInput();
            $name = 'canvas';
            $options = ['id' => 'canvas1', 'width' => 300, 'height' => 300];
            $expected = '<canvas id="canvas1" width="300" height="300">';
            Tag::setDocType(Tag::XHTML10_STRICT);
            $actual = Tag::tagHtml($name, $options);
            expect($actual)->equals($expected);
        });
        $this->specify("tagHtml with array parameter returns invalid HTML XHTML", function () {
            Tag::resetInput();
            $name = 'canvas';
            $options = ['id' => 'canvas1', 'width' => 300, 'height' => 300];
            $expected = '<canvas id="canvas1" width="300" height="300">' . '</canvas>';
            Tag::setDocType(Tag::HTML5);
            $actual = Tag::tagHtml($name, $options);
            expect($actual)->equals($expected);
        });
    }