ILIAS  release_8 Revision v8.24
ilServicesXmlTest Class Reference
+ Inheritance diagram for ilServicesXmlTest:
+ Collaboration diagram for ilServicesXmlTest:

Public Member Functions

 testHeader ()
 
 testStartEndTag ()
 
 testElements ()
 

Protected Member Functions

 brutallyTrim (string $string)
 

Detailed Description

Definition at line 22 of file ilServicesXmlTest.php.

Member Function Documentation

◆ brutallyTrim()

ilServicesXmlTest::brutallyTrim ( string  $string)
protected

Definition at line 61 of file ilServicesXmlTest.php.

61 : string
62 {
63 $string = str_replace(["\n", "\r", "\t"], "", $string);
64 $string = preg_replace('# {2,}#', " ", $string);
65 $string = preg_replace("/>(\s+)</", "><", $string);
66 $string = str_replace(" >", ">", $string);
67 $string = str_replace(" <", "<", $string);
68 return trim($string);
69 }

Referenced by testElements(), testHeader(), and testStartEndTag().

+ Here is the caller graph for this function:

◆ testElements()

ilServicesXmlTest::testElements ( )

Definition at line 46 of file ilServicesXmlTest.php.

46 : void
47 {
48 $writer = new ilXmlWriter();
49 $writer->xmlStartTag('lorem');
50 $writer->xmlElement('ipsum', ['attr1' => 1], 'data1');
51 $writer->xmlElement('dolor', ['attr2' => 2, 'attr3' => 3], 'data2');
52 $writer->xmlEndTag('lorem');
53 $this->assertEquals(
54 $this->brutallyTrim(
55 "<lorem><ipsum attr1=\"1\"> data1</ipsum><dolor attr2=\"2\" attr3=\"3\"> data2</dolor></lorem>"
56 ),
57 $this->brutallyTrim($writer->xmlDumpMem())
58 );
59 }
brutallyTrim(string $string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References brutallyTrim().

+ Here is the call graph for this function:

◆ testHeader()

ilServicesXmlTest::testHeader ( )

Definition at line 24 of file ilServicesXmlTest.php.

24 : void
25 {
26 $writer = new ilXmlWriter();
27 $writer->xmlHeader();
28
29 $this->assertEquals(
30 $this->brutallyTrim("<?xml version=\"1.0\" encoding=\"utf-8\"?><!--Generated by ILIAS XmlWriter-->"),
31 $this->brutallyTrim($writer->xmlDumpMem())
32 );
33 }

References brutallyTrim().

+ Here is the call graph for this function:

◆ testStartEndTag()

ilServicesXmlTest::testStartEndTag ( )

Definition at line 35 of file ilServicesXmlTest.php.

35 : void
36 {
37 $writer = new ilXmlWriter();
38 $writer->xmlStartTag('lorem');
39 $writer->xmlEndTag('lorem');
40 $this->assertEquals(
41 $this->brutallyTrim("<lorem></lorem>"),
42 $this->brutallyTrim($writer->xmlDumpMem())
43 );
44 }

References brutallyTrim().

+ Here is the call graph for this function:

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