ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\Xml\Element\CDataTest Class Reference
+ Inheritance diagram for Sabre\Xml\Element\CDataTest:
+ Collaboration diagram for Sabre\Xml\Element\CDataTest:

Public Member Functions

 testDeserialize ()
 
 testSerialize ()
 

Detailed Description

Definition at line 8 of file CDataTest.php.

Member Function Documentation

◆ testDeserialize()

Sabre\Xml\Element\CDataTest::testDeserialize ( )

Definition at line 13 of file CDataTest.php.

References $input, Sabre\VObject\$output, and $reader.

13  {
14 
15  $input = <<<BLA
16 <?xml version="1.0"?>
17 <root xmlns="http://sabredav.org/ns">
18  <blabla />
19 </root>
20 BLA;
21 
22  $reader = new Reader();
23  $reader->elementMap = [
24  '{http://sabredav.org/ns}blabla' => 'Sabre\\Xml\\Element\\Cdata',
25  ];
26  $reader->xml($input);
27 
28  $output = $reader->parse();
29 
30  }

◆ testSerialize()

Sabre\Xml\Element\CDataTest::testSerialize ( )

Definition at line 32 of file CDataTest.php.

References Sabre\VObject\$output.

32  {
33 
34  $writer = new Writer();
35  $writer->namespaceMap = [
36  'http://sabredav.org/ns' => null
37  ];
38  $writer->openMemory();
39  $writer->startDocument('1.0');
40  $writer->setIndent(true);
41  $writer->write([
42  '{http://sabredav.org/ns}root' => new Cdata('<foo&bar>'),
43  ]);
44 
45  $output = $writer->outputMemory();
46 
47  $expected = <<<XML
48 <?xml version="1.0"?>
49 <root xmlns="http://sabredav.org/ns"><![CDATA[<foo&bar>]]></root>
50 
51 XML;
52 
53  $this->assertEquals($expected, $output);
54 
55 
56  }

The documentation for this class was generated from the following file: