ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
WikiUtilTest Class Reference

Wiki util test. More...

+ Inheritance diagram for WikiUtilTest:
+ Collaboration diagram for WikiUtilTest:

Public Member Functions

 testMakeUrlTitle ()
 
 testMakeDbTitle ()
 
 testProcessInternalLinksExtCollect ()
 
 testProcessInternalLinksExtCollectOneSimple ()
 
 testProcessInternalLinksExtCollectMultipleSimple ()
 
 testProcessInternalLinksExtCollectMultipleSame ()
 
 testProcessInternalLinksExtCollectOneText ()
 
 testProcessInternalLinksExtCollectMultiText ()
 
 testProcessInternalLinksCollectOneSimple ()
 
 testProcessInternalLinksCollectMultipleSame ()
 
 testProcessInternalLinksCollectMultiText ()
 
 testProcessInternalLinksReplaceWithoutLink ()
 

Protected Member Functions

 tearDown ()
 
 processInternalLinksExtCollect (string $xml)
 
 processInternalLinksCollect (string $xml)
 
 processInternalLinksReplace (string $xml)
 

Detailed Description

Wiki util test.

Tests mostly mediawiki code.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 10 of file WikiUtilTest.php.

Member Function Documentation

◆ processInternalLinksCollect()

WikiUtilTest::processInternalLinksCollect ( string  $xml)
protected

Definition at line 197 of file WikiUtilTest.php.

References IL_WIKI_MODE_COLLECT, and ilWikiUtil\processInternalLinks().

Referenced by testProcessInternalLinksCollectMultipleSame(), testProcessInternalLinksCollectMultiText(), and testProcessInternalLinksCollectOneSimple().

197  :array
198  {
200  $xml,
201  0,
203  true
204  );
205  }
static processInternalLinks( $s, $a_wiki_id, $a_mode=IL_WIKI_MODE_REPLACE, $a_collect_non_ex=false, $a_offline=false)
Process internal links.
const IL_WIKI_MODE_COLLECT
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processInternalLinksExtCollect()

WikiUtilTest::processInternalLinksExtCollect ( string  $xml)
protected

Definition at line 86 of file WikiUtilTest.php.

References IL_WIKI_MODE_EXT_COLLECT, and ilWikiUtil\processInternalLinks().

Referenced by testProcessInternalLinksExtCollect(), testProcessInternalLinksExtCollectMultipleSame(), testProcessInternalLinksExtCollectMultipleSimple(), testProcessInternalLinksExtCollectMultiText(), testProcessInternalLinksExtCollectOneSimple(), and testProcessInternalLinksExtCollectOneText().

86  :array
87  {
89  $xml,
90  0,
92  );
93  }
static processInternalLinks( $s, $a_wiki_id, $a_mode=IL_WIKI_MODE_REPLACE, $a_collect_non_ex=false, $a_offline=false)
Process internal links.
$xml
Definition: metadata.php:332
const IL_WIKI_MODE_EXT_COLLECT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processInternalLinksReplace()

WikiUtilTest::processInternalLinksReplace ( string  $xml)
protected

Definition at line 237 of file WikiUtilTest.php.

References IL_WIKI_MODE_REPLACE, and ilWikiUtil\processInternalLinks().

Referenced by testProcessInternalLinksReplaceWithoutLink().

237  :string
238  {
240  $xml,
241  0,
243  );
244  }
static processInternalLinks( $s, $a_wiki_id, $a_mode=IL_WIKI_MODE_REPLACE, $a_collect_non_ex=false, $a_offline=false)
Process internal links.
const IL_WIKI_MODE_REPLACE
Wiki link / page title handling:
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tearDown()

WikiUtilTest::tearDown ( )
protected

Definition at line 12 of file WikiUtilTest.php.

12  : void
13  {
14  }

◆ testMakeDbTitle()

WikiUtilTest::testMakeDbTitle ( )

Definition at line 51 of file WikiUtilTest.php.

References $result, and ilWikiUtil\makeDbTitle().

51  : void
52  {
53  $input_expected = [
54  ["a", "a"]
55  ,["z", "z"]
56  ,["0", "0"]
57  ,[" ", " "]
58  ,["_", " "]
59  ,["!", "!"]
60  ,["§", "§"]
61  ,["$", "$"]
62  ,["%", "%"]
63  ,["&", "&"]
64  ,["/", "/"]
65  ,["(", "("]
66  ,["+", "+"]
67  ,[";", ";"]
68  ,[":", ":"]
69  ,["-", "-"]
70  ,["#", "#"]
71  ,["?", "?"]
72  ,["\x00", ""]
73  ,["\n", ""]
74  ,["\r", ""]
75  ];
76  foreach ($input_expected as $ie) {
78 
79  $this->assertEquals(
80  $ie[1],
81  $result
82  );
83  }
84  }
$result
static makeDbTitle($a_par)
Handle page GET parameter.
+ Here is the call graph for this function:

◆ testMakeUrlTitle()

WikiUtilTest::testMakeUrlTitle ( )

Definition at line 16 of file WikiUtilTest.php.

References $result, and ilWikiUtil\makeUrlTitle().

16  : void
17  {
18  $input_expected = [
19  ["a", "a"]
20  ,["z", "z"]
21  ,["0", "0"]
22  ,[" ", "_"]
23  ,["_", "_"]
24  ,["!", "%21"]
25  ,["§", "%C2%A7"]
26  ,["$", "%24"]
27  ,["%", "%25"]
28  ,["&", "%26"]
29  ,["/", "%2F"]
30  ,["(", "%28"]
31  ,["+", "%2B"]
32  ,[";", "%3B"]
33  ,[":", "%3A"]
34  ,["-", "-"]
35  ,["#", "%23"]
36  ,["?", "%3F"]
37  ,["\x00", ""]
38  ,["\n", ""]
39  ,["\r", ""]
40  ];
41  foreach ($input_expected as $ie) {
43 
44  $this->assertEquals(
45  $ie[1],
46  $result
47  );
48  }
49  }
$result
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
+ Here is the call graph for this function:

◆ testProcessInternalLinksCollectMultipleSame()

WikiUtilTest::testProcessInternalLinksCollectMultipleSame ( )

Definition at line 217 of file WikiUtilTest.php.

References $xml, and processInternalLinksCollect().

217  : void
218  {
219  $xml = "<Foo>[[bar]]</Foo><Par>[[bar1]] some text [[bar]]</Par>";
220  $r = $this->processInternalLinksCollect($xml);
221  $this->assertEquals(
222  ["bar", "bar1"],
223  $r
224  );
225  }
processInternalLinksCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksCollectMultiText()

WikiUtilTest::testProcessInternalLinksCollectMultiText ( )

Definition at line 227 of file WikiUtilTest.php.

References $xml, and processInternalLinksCollect().

227  : void
228  {
229  $xml = "<Foo>lore [[bar|some text]] ipsum</Foo><Par>More [[second link|some text for second]]</Par>";
230  $r = $this->processInternalLinksCollect($xml);
231  $this->assertEquals(
232  ["bar", "second link"],
233  $r
234  );
235  }
processInternalLinksCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksCollectOneSimple()

WikiUtilTest::testProcessInternalLinksCollectOneSimple ( )

Definition at line 207 of file WikiUtilTest.php.

References $xml, and processInternalLinksCollect().

207  : void
208  {
209  $xml = "<Foo>[[bar]]</Foo>";
210  $r = $this->processInternalLinksCollect($xml);
211  $this->assertEquals(
212  ["bar"],
213  $r
214  );
215  }
processInternalLinksCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollect()

WikiUtilTest::testProcessInternalLinksExtCollect ( )

Definition at line 95 of file WikiUtilTest.php.

References $result, and processInternalLinksExtCollect().

95  : void
96  {
97  $input_expected = [
98  ["", []]
99  ,["<Foo></Foo>", []]
100  ];
101  foreach ($input_expected as $ie) {
102  $result = $this->processInternalLinksExtCollect($ie[0]);
103 
104  $this->assertEquals(
105  $ie[1],
106  $result
107  );
108  }
109  }
$result
processInternalLinksExtCollect(string $xml)
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollectMultipleSame()

WikiUtilTest::testProcessInternalLinksExtCollectMultipleSame ( )

Definition at line 143 of file WikiUtilTest.php.

References $xml, and processInternalLinksExtCollect().

143  : void
144  {
145  $xml = "<Foo>[[bar]]</Foo><Par>[[bar1]] some text [[bar]]</Par>";
147  $this->assertEquals(
148  "bar",
149  $r[0]["nt"]->mTextform
150  );
151  $this->assertEquals(
152  "bar1",
153  $r[1]["nt"]->mTextform
154  );
155  $this->assertEquals(
156  "bar",
157  $r[2]["nt"]->mTextform
158  );
159  }
processInternalLinksExtCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollectMultipleSimple()

WikiUtilTest::testProcessInternalLinksExtCollectMultipleSimple ( )

Definition at line 125 of file WikiUtilTest.php.

References $xml, and processInternalLinksExtCollect().

125  : void
126  {
127  $xml = "<Foo>[[bar]]</Foo><Par>[[bar1]] some text [[bar2]]</Par>";
129  $this->assertEquals(
130  "bar",
131  $r[0]["nt"]->mTextform
132  );
133  $this->assertEquals(
134  "bar1",
135  $r[1]["nt"]->mTextform
136  );
137  $this->assertEquals(
138  "bar2",
139  $r[2]["nt"]->mTextform
140  );
141  }
processInternalLinksExtCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollectMultiText()

WikiUtilTest::testProcessInternalLinksExtCollectMultiText ( )

Definition at line 175 of file WikiUtilTest.php.

References $xml, and processInternalLinksExtCollect().

175  : void
176  {
177  $xml = "<Foo>lore [[bar|some text]] ipsum</Foo><Par>More [[second link|some text for second]]</Par>";
179  $this->assertEquals(
180  "bar",
181  $r[0]["nt"]->mTextform
182  );
183  $this->assertEquals(
184  "some text",
185  $r[0]["text"]
186  );
187  $this->assertEquals(
188  "second link",
189  $r[1]["nt"]->mTextform
190  );
191  $this->assertEquals(
192  "some text for second",
193  $r[1]["text"]
194  );
195  }
processInternalLinksExtCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollectOneSimple()

WikiUtilTest::testProcessInternalLinksExtCollectOneSimple ( )

Definition at line 111 of file WikiUtilTest.php.

References $xml, and processInternalLinksExtCollect().

111  : void
112  {
113  $xml = "<Foo>[[bar]]</Foo>";
115  $this->assertEquals(
116  "bar",
117  $r[0]["nt"]->mTextform
118  );
119  $this->assertEquals(
120  "bar",
121  $r[0]["text"]
122  );
123  }
processInternalLinksExtCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksExtCollectOneText()

WikiUtilTest::testProcessInternalLinksExtCollectOneText ( )

Definition at line 161 of file WikiUtilTest.php.

References $xml, and processInternalLinksExtCollect().

161  : void
162  {
163  $xml = "<Foo>[[bar|some text]]</Foo>";
165  $this->assertEquals(
166  "bar",
167  $r[0]["nt"]->mTextform
168  );
169  $this->assertEquals(
170  "some text",
171  $r[0]["text"]
172  );
173  }
processInternalLinksExtCollect(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

◆ testProcessInternalLinksReplaceWithoutLink()

WikiUtilTest::testProcessInternalLinksReplaceWithoutLink ( )

Definition at line 246 of file WikiUtilTest.php.

References $xml, and processInternalLinksReplace().

246  : void
247  {
248  $xml = "<Foo>Some text without a link</Par>";
249  $r = $this->processInternalLinksReplace($xml);
250  $this->assertEquals(
251  $xml,
252  $r
253  );
254  }
processInternalLinksReplace(string $xml)
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:

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