Esempio n. 1
0
/**
 * Constructs a new FluidXml instance.
 *
 * ```php
 * $xml = fluidxml();
 * // is the same of
 * $xml = new FluidXml();
 *
 * $xml = fluidxml([
 *
 *   'root'       => 'doc',
 *
 *   'version'    => '1.0',
 *
 *   'encoding'   => 'UTF-8',
 *
 *   'stylesheet' => null ]);
 * ```
 *
 * @param array $arguments Options that influence the construction of the XML document.
 *
 * @return FluidXml A new FluidXml instance.
 */
function fluidify(...$arguments)
{
    return FluidXml::load(...$arguments);
}
Esempio n. 2
0
         $expected = $doc;
         assert_equal_xml($xml, $expected);
     });
     it('should import a DOMDocument', function () {
         $xml = FluidXml::load($this->dom);
         $expected = $this->doc;
         assert_equal_xml($xml, $expected);
     });
     it('should import a SimpleXMLElement', function () {
         $xml = FluidXml::load(\simplexml_import_dom($this->dom));
         $expected = $this->doc;
         assert_equal_xml($xml, $expected);
     });
     it('should throw for not supported documents', function () {
         try {
             $xml = FluidXml::load('.impossible.xml');
         } catch (\Exception $e) {
             $actual = $e;
         }
         assert_is_a($actual, \Exception::class);
     });
 });
 if (version_compare(phpversion(), '7', '>=')) {
     describe(':new', function () {
         it('should behave like FluidXml::__construct', function () {
             $xml = new FluidXml();
             eval('$alias = FluidXml::new();');
             $actual = $alias->xml();
             $expected = $xml->xml();
             assert($actual === $expected, __($actual, $expected));
             $options = ['root' => 'root', 'version' => '1.2', 'encoding' => 'UTF-16', 'stylesheet' => 'stylesheet.xsl'];