echo "————————————————————————————————————————————————————————————————————————————————\n"; /************************* * Importing XML strings.* **************************/ /* * Raw XML/XHTML strings che be injected at any point of the document too. */ $book->appendChild('cover', true)->appendXml(<<<XML <h1>The Theory Of Everything</h1> <img src="http://goo.gl/kO3Iov"/> XML ); /* * The document can be filled with a raw XML string. */ $html = fluidxml(['root' => null]); $html->appendXml(<<<XML <html> <head> <meta/> </head> <body> <p/> </body> </html> XML ); /* * Sometimes XML/XHTML comes from legacy templating systems or external sources. */ /* Remember, fluidify() is an alias for FluidXml::load(). */
<?php require_once __DIR__ . DIRECTORY_SEPARATOR . ".common.php"; require_once 'FluidXml.php'; describe('fluidxml', function () { it('should behave like FluidXml::__construct', function () { $xml = new FluidXml(); $alias = fluidxml(); $actual = $alias->xml(); $expected = $xml->xml(); assert($actual === $expected, __($actual, $expected)); $options = ['root' => 'root', 'version' => '1.2', 'encoding' => 'UTF-16', 'stylesheet' => 'stylesheet.xsl']; $xml = new FluidXml($options); $alias = fluidxml($options); $actual = $alias->xml(); $expected = $xml->xml(); assert($actual === $expected, __($actual, $expected)); }); }); describe('fluidify', function () { it('should behave like FluidXml::load', function () { $doc = '<tag>content</tag>'; $xml = FluidXml::load($doc); $alias = fluidify($doc); $actual = $alias->xml(); $expected = $xml->xml(); assert($actual === $expected, __($actual, $expected)); }); }); describe('fluidns', function () { it('should behave like FluidNamespace::__construct', function () {