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

Public Member Functions

 testDeserialize ()
 
 testSerialize ()
 

Detailed Description

Definition at line 8 of file UriTest.php.

Member Function Documentation

◆ testDeserialize()

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

Definition at line 10 of file UriTest.php.

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

10  {
11 
12  $input = <<<BLA
13 <?xml version="1.0"?>
14 <root xmlns="http://sabredav.org/ns">
15  <uri>/foo/bar</uri>
16 </root>
17 BLA;
18 
19  $reader = new Reader();
20  $reader->contextUri = 'http://example.org/';
21  $reader->elementMap = [
22  '{http://sabredav.org/ns}uri' => 'Sabre\\Xml\\Element\\Uri',
23  ];
24  $reader->xml($input);
25 
26  $output = $reader->parse();
27 
28  $this->assertEquals(
29  [
30  'name' => '{http://sabredav.org/ns}root',
31  'value' => [
32  [
33  'name' => '{http://sabredav.org/ns}uri',
34  'value' => new Uri('http://example.org/foo/bar'),
35  'attributes' => [],
36  ]
37  ],
38  'attributes' => [],
39  ],
40  $output
41  );
42 
43  }

◆ testSerialize()

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

Definition at line 45 of file UriTest.php.

References Sabre\VObject\$output, and ILIAS\FileDelivery\http().

45  {
46 
47  $writer = new Writer();
48  $writer->namespaceMap = [
49  'http://sabredav.org/ns' => null
50  ];
51  $writer->openMemory();
52  $writer->startDocument('1.0');
53  $writer->setIndent(true);
54  $writer->contextUri = 'http://example.org/';
55  $writer->write([
56  '{http://sabredav.org/ns}root' => [
57  '{http://sabredav.org/ns}uri' => new Uri('/foo/bar'),
58  ]
59  ]);
60 
61  $output = $writer->outputMemory();
62 
63  $expected = <<<XML
64 <?xml version="1.0"?>
65 <root xmlns="http://sabredav.org/ns">
66  <uri>http://example.org/foo/bar</uri>
67 </root>
68 
69 XML;
70 
71  $this->assertEquals($expected, $output);
72 
73 
74  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

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