isAnXmlString() public static method

public static isAnXmlString ( $string )
Beispiel #1
0
            $expected = '//x:current/x:child';
            \assert($actual === $expected, __($actual, $expected));
        });
    });
});
describe('FluidHelper', function () {
    describe(':isAnXmlString()', function () {
        it('should understand if a string is an XML document', function () {
            $xml = new FluidXml();
            $actual = FluidHelper::isAnXmlString($xml->xml());
            $expected = true;
            \assert($actual === $expected, __($actual, $expected));
            $actual = FluidHelper::isAnXmlString(" \n \n \t" . $xml->xml());
            $expected = true;
            \assert($actual === $expected, __($actual, $expected));
            $actual = FluidHelper::isAnXmlString('item');
            $expected = false;
            \assert($actual === $expected, __($actual, $expected));
        });
    });
    describe(':domdocumentToHtml()', function () {
        it('should convert a DOMDocument instance to an HTML string without respecting void and not void tags.', function () {
            // This is only to analyze a condition (not used) for the code coverage reporter.
            FluidHelper::domdocumentToHtml((new FluidXml())->dom(), true);
        });
    });
    describe(':domdocumentToStringWithoutHeaders()', function () {
        it('should convert a DOMDocument instance to an XML string without the XML headers (declaration and stylesheets)', function () {
            $xml = new FluidXml();
            $actual = FluidHelper::domdocumentToStringWithoutHeaders($xml->dom());
            $expected = "<doc/>";