LinkTest.php 50 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 3/31/16
 * Time: 10:06 PM
 */

namespace qfq;

require_once(__DIR__ . '/../../qfq/report/Link.php');
Carsten  Rose's avatar
Carsten Rose committed
12
13
require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/store/Sip.php');
14
require_once(__DIR__ . '/../../qfq/store/Session.php');
15
16
17
18


class LinkTest extends \PHPUnit_Framework_TestCase {

Carsten  Rose's avatar
Carsten Rose committed
19
20
21
22
23
24
25
26
27
    /**
     * @var Sip
     */
    private $sip = null;

    /**
     * @var Store
     */
    private $store = null;
28

29
30
31
32
    /**
     * @expectedException \qfq\UserReportException
     */
    public function testUnknownTokenException1() {
33
        $link = new Link($this->sip, true);
34
35
36
37
38
39
40
41

        $link->renderLink('b:hello world');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testUnknownTokenException2() {
42
        $link = new Link($this->sip, true);
43
44
45
46

        $link->renderLink('abc:hello world');
    }

47
48
49
50
    /**
     * @throws SyntaxReportException
     */
    public function testLinkUrlBasic() {
51
        $link = new Link($this->sip, true);
52

53
        Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
54

55
        $result = $link->renderLink('');
56
57
58
59
60
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

61
62
63
64
65
66
        $result = $link->renderLink('u:http://example.com?id=100&t=2&param=hello');
        $this->assertEquals('<a href="http://example.com?id=100&t=2&param=hello" class="external" >http://example.com?id=100&t=2&param=hello</a>', $result);

        $result = $link->renderLink('u:example.com');
        $this->assertEquals('<a href="example.com" class="external" >example.com</a>', $result);

67
68
        $result = $link->renderLink('u:http://example.com|t:Hello world');
        $this->assertEquals('<a href="http://example.com" class="external" >Hello world</a>', $result);
69
70
71

        $result = $link->renderLink('u:http://example.com?id=100&t=2&param=hello|t:Hello world');
        $this->assertEquals('<a href="http://example.com?id=100&t=2&param=hello" class="external" >Hello world</a>', $result);
72
73
74
75
76
77
78
    }

    /**
     * @expectedException \qfq\UserReportException
     *
     */
    public function testLinkUrlBasicExceptionDouble() {
79
        $link = new Link($this->sip, true);
80

81
82
83
84
85
86
87
88
        $link->renderLink('u:http://example.com|u:http://new.org');
    }

    /**
     * @expectedException \qfq\UserReportException
     *
     */
    public function testLinkUrlBasicExceptionEmpty1() {
89
        $link = new Link($this->sip, true);
90
91

        $link->renderLink('u');
92
93
    }

94
95
96
97
98
    /**
     * @expectedException \qfq\UserReportException
     *
     */
    public function testLinkUrlBasicExceptionEmpty2() {
99
        $link = new Link($this->sip, true);
100
101
102

        $link->renderLink('u:');
    }
103

104
    /**
105
     * @throws SyntaxReportException
106
     */
107
    public function testLinkPageBasic() {
108
        $link = new Link($this->sip, true);
109
110
111
112
113
114
115
116
117
118
        Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);

        $result = $link->renderLink('p');
        $this->assertEquals('<a href="?id=firstPage" class="internal" >?id=firstPage</a>', $result);

        $result = $link->renderLink('p:');
        $this->assertEquals('<a href="?id=firstPage" class="internal" >?id=firstPage</a>', $result);

        $result = $link->renderLink('p:secondPage');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >?id=secondPage</a>', $result);
119

120
121
122
        $result = $link->renderLink('p:id=secondPage');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >?id=secondPage</a>', $result);

123
124
125
        $result = $link->renderLink('p:id=secondPage&id=100&t=2&param=hello');
        $this->assertEquals('<a href="?id=secondPage&id=100&t=2&param=hello" class="internal" >?id=secondPage&id=100&t=2&param=hello</a>', $result);

126
127
        $result = $link->renderLink('p:secondPage|t:Hello world');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >Hello world</a>', $result);
128
129
130
131
132
    }

    /**
     * @throws SyntaxReportException
     */
133
    public function testLinkMailBasic() {
134
        $link = new Link($this->sip, true);
135
136

        $result = $link->renderLink('m:john@doe.com');
137
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
138
139

        $result = $link->renderLink('m:john@doe.com|t:John Doe');
140
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >John Doe</a>', $result);
141
142
143
144
145
146
147
    }

    /**
     * @expectedException \qfq\UserReportException
     *
     */
    public function testLinkMailBasicExceptionMissing1() {
148
        $link = new Link($this->sip, true);
149

150
        $link->renderLink('m');
151
152
153
154
155
156
157
    }

    /**
     * @expectedException \qfq\UserReportException
     *
     */
    public function testLinkMailBasicExceptionMissing2() {
158
        $link = new Link($this->sip, true);
159

160
        $link->renderLink('m:');
161
162
    }

Carsten  Rose's avatar
Carsten Rose committed
163
164
165
166
    /**
     * @throws SyntaxReportException
     */
    public function testMailEncryption() {
167
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
168

169
170
171
172
173
174
        //TODO: aktivieren sobald encrypted Mails implemented.
//        $result = $link->renderLink('m:john@doe.com|e');
//        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
//
//        $result = $link->renderLink('m:john@doe.com|e:');
//        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
175
176

        $result = $link->renderLink('m:john@doe.com|e:0');
177
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
178
179
180
181
182
183
184
185

//        $result = $link->renderLink('m:john@doe.com|e:1');
//        $this->assertEquals('<a href="mailto:john@doe.com" >mailto:john@doe.com</a>', $result);
    }

    /**
     * @throws UserReportException
     */
186
    public function testRenderModeUrl() {
187
        $link = new Link($this->sip, true);
188

189
        Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
190

191
192
193
194
        $result = $link->renderLink('u:http://example.com');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('t:Example');
195
        $this->assertEquals('', $result);
196

197
198
199
200
        $result = $link->renderLink('u:http://example.com|t:Example');
        $this->assertEquals('<a href="http://example.com" class="external" >Example</a>', $result);

        $result = $link->renderLink('u:http://example.com|r:0');
201
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);
202

203
204
205
206
207
208
209
210
211
212
213
        $result = $link->renderLink('t:Example|r:0');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:0');
        $this->assertEquals('<a href="http://example.com" class="external" >Example</a>', $result);

        // r: 1
        $result = $link->renderLink('u:http://example.com|r:1');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('t:Example|r:1');
214
215
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

        $result = $link->renderLink('u:http://example.com|t:Example|r:1');
        $this->assertEquals('<a href="http://example.com" class="external" >Example</a>', $result);

        // r: 2
        $result = $link->renderLink('u:http://example.com|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:2');
        $this->assertEquals('<a href="http://example.com" class="external" >Example</a>', $result);

        // r: 3
        $result = $link->renderLink('u:http://example.com|r:3');
232
233
//        $this->assertEquals('<span >http://example.com</span>', $result);
        $this->assertEquals('http://example.com', $result);
234
235

        $result = $link->renderLink('t:Example|r:3');
236
237
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
238
239

        $result = $link->renderLink('u:http://example.com|t:Example|r:3');
240
241
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
242
243
244

        // r: 4
        $result = $link->renderLink('u:http://example.com|r:4');
245
246
//        $this->assertEquals('<span >http://example.com</span>', $result);
        $this->assertEquals('http://example.com', $result);
247
248

        $result = $link->renderLink('t:Example|r:4');
249
250
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
251
252

        $result = $link->renderLink('u:http://example.com|t:Example|r:4');
253
254
//        $this->assertEquals('<span >http://example.com</span>', $result);
        $this->assertEquals('http://example.com', $result);
255
256
257
258
259
260
261
262
263
264
265
266

        // r: 5
        $result = $link->renderLink('u:http://example.com|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:5');
        $this->assertEquals('', $result);
    }

Carsten  Rose's avatar
Carsten Rose committed
267
268
269
270
271
    /**
     * @throws CodeException
     * @throws UserFormException
     * @throws UserReportException
     */
272
    public function testRenderModePage() {
273
        $link = new Link($this->sip, true);
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
        Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);

        // r: default (0)
        $result = $link->renderLink('p');
        $this->assertEquals('<a href="?id=firstPage" class="internal" >?id=firstPage</a>', $result);

        $result = $link->renderLink('p:secondPage');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >?id=secondPage</a>', $result);

        $result = $link->renderLink('t:Example');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|t:Example');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >Example</a>', $result);

        // r: 0
        $result = $link->renderLink('p|r:0');
        $this->assertEquals('<a href="?id=firstPage" class="internal" >?id=firstPage</a>', $result);

        $result = $link->renderLink('p:secondPage|r:0');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >?id=secondPage</a>', $result);

        $result = $link->renderLink('t:Example|r:0');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|t:Example|r:0');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >Example</a>', $result);

        // r: 1
        $result = $link->renderLink('p|r:1');
        $this->assertEquals('<a href="?id=firstPage" class="internal" >?id=firstPage</a>', $result);

        $result = $link->renderLink('p:secondPage|r:1');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >?id=secondPage</a>', $result);

        $result = $link->renderLink('t:Example|r:1');
310
311
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330

        $result = $link->renderLink('p:secondPage|t:Example|r:1');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >Example</a>', $result);

        // r: 2
        $result = $link->renderLink('p|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|t:Example|r:2');
        $this->assertEquals('<a href="?id=secondPage" class="internal" >Example</a>', $result);

        // r: 3
        $result = $link->renderLink('p|r:3');
331
332
//        $this->assertEquals('<span >?id=firstPage</span>', $result);
        $this->assertEquals('?id=firstPage', $result);
333
334

        $result = $link->renderLink('p:secondPage|r:3');
335
336
//        $this->assertEquals('<span >?id=secondPage</span>', $result);
        $this->assertEquals('?id=secondPage', $result);
337
338

        $result = $link->renderLink('t:Example|r:3');
339
340
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
341
342

        $result = $link->renderLink('p:secondPage|t:Example|r:3');
343
344
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
345
346
347

        // r: 4
        $result = $link->renderLink('p|r:4');
348
349
//        $this->assertEquals('<span >?id=firstPage</span>', $result);
        $this->assertEquals('?id=firstPage', $result);
350
351

        $result = $link->renderLink('p:secondPage|r:4');
352
353
//        $this->assertEquals('<span >?id=secondPage</span>', $result);
        $this->assertEquals('?id=secondPage', $result);
354
355

        $result = $link->renderLink('t:Example|r:4');
356
357
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
358
359

        $result = $link->renderLink('p:secondPage|t:Example|r:4');
360
361
//        $this->assertEquals('<span >?id=secondPage</span>', $result);
        $this->assertEquals('?id=secondPage', $result);
362

363
364
365
366
367
368
369
370
371
372
373
374
        // r: 5
        $result = $link->renderLink('p|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('p:secondPage|t:Example|r:5');
        $this->assertEquals('', $result);
375
376
    }

Carsten  Rose's avatar
Carsten Rose committed
377
378
379
    /**
     * @throws UserReportException
     */
380
    public function testRenderModeMail() {
381
        $link = new Link($this->sip, true);
382
383
384

        // r: default (0)
        $result = $link->renderLink('m:john@doe.com');
385
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
386
387
388
389
390

        $result = $link->renderLink('t:Example');
        $this->assertEquals('', $result);

        $result = $link->renderLink('m:john@doe.com|t:Example');
391
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >Example</a>', $result);
392
393
394

        // r: 0
        $result = $link->renderLink('m:john@doe.com|r:0');
395
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
396
397
398
399
400

        $result = $link->renderLink('t:Example|r:0');
        $this->assertEquals('', $result);

        $result = $link->renderLink('m:john@doe.com|t:Example|r:0');
401
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >Example</a>', $result);
402
403
404

        // r: 1
        $result = $link->renderLink('m:john@doe.com|r:1');
405
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >mailto:john@doe.com</a>', $result);
406
407

        $result = $link->renderLink('t:Example|r:1');
408
409
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
410
411

        $result = $link->renderLink('m:john@doe.com|t:Example|r:1');
412
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >Example</a>', $result);
413
414
415
416
417
418
419
420
421

        // r: 2
        $result = $link->renderLink('m:john@doe.com|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:2');
        $this->assertEquals('', $result);

        $result = $link->renderLink('m:john@doe.com|t:Example|r:2');
422
        $this->assertEquals('<a href="mailto:john@doe.com" class="external" >Example</a>', $result);
423
424
425

        // r: 3
        $result = $link->renderLink('m:john@doe.com|r:3');
426
427
//        $this->assertEquals('<span >mailto:john@doe.com</span>', $result);
        $this->assertEquals('mailto:john@doe.com', $result);
428
429

        $result = $link->renderLink('t:Example|r:3');
430
431
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
432
433

        $result = $link->renderLink('m:john@doe.com|t:Example|r:3');
434
435
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
436
437
438

        // r: 4
        $result = $link->renderLink('m:john@doe.com|r:4');
439
440
//        $this->assertEquals('<span >mailto:john@doe.com</span>', $result);
        $this->assertEquals('mailto:john@doe.com', $result);
441
442

        $result = $link->renderLink('t:Example|r:4');
443
444
//        $this->assertEquals('<span >Example</span>', $result);
        $this->assertEquals('Example', $result);
445
446

        $result = $link->renderLink('m:john@doe.com|t:Example|r:4');
447
448
//        $this->assertEquals('<span >mailto:john@doe.com</span>', $result);
        $this->assertEquals('mailto:john@doe.com', $result);
449
450
451
452
453
454
455
456
457
458
459
460

        // r: 5
        $result = $link->renderLink('m:john@doe.com|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:5');
        $this->assertEquals('', $result);

        $result = $link->renderLink('m:john@doe.com|t:Example|r:5');
        $this->assertEquals('', $result);
    }

Carsten  Rose's avatar
Carsten Rose committed
461
462
463
    /**
     * @throws UserReportException
     */
464
    public function testRenderModeUrlPicture() {
465
        $link = new Link($this->sip, true);
466
467
468

        // r: default (0)
        $result = $link->renderLink('u:http://example.com|P:picture.gif');
469
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" ></a>', $result);
470
471
472
473
474

        $result = $link->renderLink('t:Example|P:picture.gif');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|P:picture.gif');
475
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</a>', $result);
476
477
478

        // r: 0
        $result = $link->renderLink('u:http://example.com|r:0|P:picture.gif');
479
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" ></a>', $result);
480
481
482
483
484

        $result = $link->renderLink('t:Example|r:0|P:picture.gif');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:0|P:picture.gif');
485
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</a>', $result);
486
487
488

        // r: 1
        $result = $link->renderLink('u:http://example.com|r:1|P:picture.gif');
489
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" ></a>', $result);
490
491

        $result = $link->renderLink('t:Example|r:1|P:picture.gif');
492
493
//        $this->assertEquals('<span ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</span>', $result);
        $this->assertEquals('<img alt="picture.gif" src="picture.gif" title="picture.gif" > Example', $result);
494
495

        $result = $link->renderLink('u:http://example.com|t:Example|r:1|P:picture.gif');
496
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</a>', $result);
497
498
499
500

        // r: 2
        //TODO: no link if text is empty - image is linked here: this is not what the user expects.
        $result = $link->renderLink('u:http://example.com|r:2|P:picture.gif');
501
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" ></a>', $result);
502
503
504
505
506

        $result = $link->renderLink('t:Example|r:2|P:picture.gif');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:2|P:picture.gif');
507
        $this->assertEquals('<a href="http://example.com" ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</a>', $result);
508
509
510

        // r: 3:
        $result = $link->renderLink('u:http://example.com|r:3|P:picture.gif');
511
512
//        $this->assertEquals('<span ><img alt="picture.gif" src="picture.gif" title="picture.gif" > </span>', $result);
        $this->assertEquals('<img alt="picture.gif" src="picture.gif" title="picture.gif" >', $result);
513
514

        $result = $link->renderLink('t:Example|r:3|P:picture.gif');
515
516
//        $this->assertEquals('<span ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</span>', $result);
        $this->assertEquals('<img alt="picture.gif" src="picture.gif" title="picture.gif" > Example', $result);
517
518

        $result = $link->renderLink('u:http://example.com|t:Example|r:3|P:picture.gif');
519
520
//        $this->assertEquals('<span ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</span>', $result);
        $this->assertEquals('<img alt="picture.gif" src="picture.gif" title="picture.gif" > Example', $result);
521
522
523

        // r: 4
        $result = $link->renderLink('u:http://example.com|r:4|P:picture.gif');
524
525
//        $this->assertEquals('<span >http://example.com</span>', $result);
        $this->assertEquals('http://example.com', $result);
526
527

        $result = $link->renderLink('t:Example|r:4|P:picture.gif');
528
529
//        $this->assertEquals('<span ><img alt="picture.gif" src="picture.gif" title="picture.gif" > Example</span>', $result);
        $this->assertEquals('<img alt="picture.gif" src="picture.gif" title="picture.gif" > Example', $result);
530
531

        $result = $link->renderLink('u:http://example.com|t:Example|r:4|P:picture.gif');
532
533
//        $this->assertEquals('<span >http://example.com</span>', $result);
        $this->assertEquals('http://example.com', $result);
534
535
536
537
538
539
540
541
542
543
544
545

        // r: 5
        $result = $link->renderLink('u:http://example.com|r:5|P:picture.gif');
        $this->assertEquals('', $result);

        $result = $link->renderLink('t:Example|r:5|P:picture.gif');
        $this->assertEquals('', $result);

        $result = $link->renderLink('u:http://example.com|t:Example|r:5|P:picture.gif');
        $this->assertEquals('', $result);
    }

Carsten  Rose's avatar
Carsten Rose committed
546
547
548
549
    /**
     * @throws UserReportException
     */
    public function testIcons() {
550
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
551
552

        $result = $link->renderLink('u:http://example.com|E');
553
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Edit" ><span class="glyphicon glyphicon-pencil" ></span></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
554
555

        $result = $link->renderLink('u:http://example.com|N');
556
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="New" ><span class="glyphicon glyphicon-plus" ></span></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
557

558
559
560
        $result = $link->renderLink('u:http://example.com|D');
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Delete" ><span class="glyphicon glyphicon-trash" ></span></a>', $result);

Carsten  Rose's avatar
Carsten Rose committed
561
        $result = $link->renderLink('u:http://example.com|H');
562
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
563
564

        $result = $link->renderLink('u:http://example.com|I');
565
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
566
567

        $result = $link->renderLink('u:http://example.com|S');
568
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span></a>', $result);
569
570
571

        $result = $link->renderLink('u:http://example.com|E|o:specific');
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="specific" ><span class="glyphicon glyphicon-pencil" ></span></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
572
573
574
575
576
577
    }

    /**
     * @throws UserReportException
     */
    public function testBullet() {
578
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
579
580

        $result = $link->renderLink('u:http://example.com|B');
581
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet green" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
582
583

        $result = $link->renderLink('u:http://example.com|B:green');
584
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet green" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
585
586

        $result = $link->renderLink('u:http://example.com|B:blue');
587
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet blue" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-blue.gif" title="blue" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
588
589

        $result = $link->renderLink('u:http://example.com|B:gray');
590
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet gray" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-gray.gif" title="gray" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
591
592

        $result = $link->renderLink('u:http://example.com|B:pink');
593
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet pink" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-pink.gif" title="pink" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
594
595

        $result = $link->renderLink('u:http://example.com|B:red');
596
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet red" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-red.gif" title="red" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
597
598

        $result = $link->renderLink('u:http://example.com|B:yellow');
599
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet yellow" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-yellow.gif" title="yellow" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
600

601
602
        $result = $link->renderLink('u:http://example.com|B|o:specific');
        $this->assertEquals('<a href="http://example.com" title="specific" ><img alt="Bullet green" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="specific" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
603
604
605
606
607
608
    }

    /**
     * @throws UserReportException
     */
    public function testChecked() {
609
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
610
611

        $result = $link->renderLink('u:http://example.com|C');
612
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked green" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
613
614

        $result = $link->renderLink('u:http://example.com|C:green');
615
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked green" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
616
617

        $result = $link->renderLink('u:http://example.com|C:blue');
618
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked blue" src="typo3conf/ext/qfq/Resources/Public/icons/checked-blue.gif" title="blue" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
619
620

        $result = $link->renderLink('u:http://example.com|C:gray');
621
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked gray" src="typo3conf/ext/qfq/Resources/Public/icons/checked-gray.gif" title="gray" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
622
623

        $result = $link->renderLink('u:http://example.com|C:pink');
624
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked pink" src="typo3conf/ext/qfq/Resources/Public/icons/checked-pink.gif" title="pink" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
625
626

        $result = $link->renderLink('u:http://example.com|C:red');
627
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked red" src="typo3conf/ext/qfq/Resources/Public/icons/checked-red.gif" title="red" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
628
629

        $result = $link->renderLink('u:http://example.com|C:yellow');
630
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked yellow" src="typo3conf/ext/qfq/Resources/Public/icons/checked-yellow.gif" title="yellow" ></a>', $result);
631
632
633

        $result = $link->renderLink('u:http://example.com|C|o:specific');
        $this->assertEquals('<a href="http://example.com" title="specific" ><img alt="Checked green" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="specific" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
634
635
    }

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
    /**
     * @throws UserReportException
     */
    public function testGlyph() {
        $link = new Link($this->sip, true);

        $result = $link->renderLink('u:http://example.com|G:glyphicon-envelope');
        $this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-envelope" ></span></a>', $result);
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphException() {
        $link = new Link($this->sip, true);

        // Missing 'glyph'-name
        $result = $link->renderLink('u:http://example.com|G');
    }

656
657
658
659
    /**
     * @expectedException \qfq\UserReportException
     */
    public function testPictureException1() {
660
        $link = new Link($this->sip, true);
661
662

        // r: default (0)
663
        $link->renderLink('u:http://www.example.com|P:picture.gif|B');
664
665
666
667
668
669
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testPictureException2() {
670
        $link = new Link($this->sip, true);
671
672

        // r: default (0)
673
        $link->renderLink('u:http://www.example.com|C|B');
674
675
    }

676
677
678
679
    /**
     * @expectedException \qfq\UserReportException
     */
    public function testPictureException3() {
680
        $link = new Link($this->sip, true);
681
682

        // r: default (0)
683
        $link->renderLink('u:http://www.example.com|B:green|B:red');
684
685
686
687
688
689
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testPictureException4() {
690
        $link = new Link($this->sip, true);
691
692

        // r: default (0)
693
        $link->renderLink('u:http://www.example.com|C:green|C:red');
694
    }
695

696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble1() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|N');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble2() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|D');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble3() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|H');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble4() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|I');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble5() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|S');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
    public function testGlyphExceptionDouble6() {
        $link = new Link($this->sip, true);

        // r: default (0)
        $link->renderLink('u:http://www.example.com|E|G');
    }

Carsten  Rose's avatar
Carsten Rose committed
756
757
758
759
    /**
     * @throws SyntaxReportException
     */
    public function testLinkUrlParam() {
760
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
761

762
763
764
765
766
767
        $result = $link->renderLink('u:http://example.com|U:');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('u:http://example.com|U:');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

Carsten  Rose's avatar
Carsten Rose committed
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
        $result = $link->renderLink('u:http://example.com|U:a=1234');
        $this->assertEquals('<a href="http://example.com?a=1234" class="external" >http://example.com?a=1234</a>', $result);

        $result = $link->renderLink('u:http://example.com|U:a=1234&b=abcd');
        $this->assertEquals('<a href="http://example.com?a=1234&b=abcd" class="external" >http://example.com?a=1234&b=abcd</a>', $result);

        $result = $link->renderLink('u:http://example.com|U:a');
        $this->assertEquals('<a href="http://example.com?a" class="external" >http://example.com?a</a>', $result);

        $result = $link->renderLink('u:http://example.com|U:a=');
        $this->assertEquals('<a href="http://example.com?a=" class="external" >http://example.com?a=</a>', $result);

        $result = $link->renderLink('u:http://example.com?A=hello|U:a=world');
        $this->assertEquals('<a href="http://example.com?A=hello&a=world" class="external" >http://example.com?A=hello&a=world</a>', $result);

        $result = $link->renderLink('u:http://example.com?A=hello&B=nice|U:a=world');
        $this->assertEquals('<a href="http://example.com?A=hello&B=nice&a=world" class="external" >http://example.com?A=hello&B=nice&a=world</a>', $result);

        $result = $link->renderLink('p:form|U:a=1234');
        $this->assertEquals('<a href="?id=form&a=1234" class="internal" >?id=form&a=1234</a>', $result);

        $result = $link->renderLink('p:form|U:a=1234&b=abcd');
        $this->assertEquals('<a href="?id=form&a=1234&b=abcd" class="internal" >?id=form&a=1234&b=abcd</a>', $result);

        $result = $link->renderLink('p:form|U:a');
        $this->assertEquals('<a href="?id=form&a" class="internal" >?id=form&a</a>', $result);

        $result = $link->renderLink('p:form|U:a=');
        $this->assertEquals('<a href="?id=form&a=" class="internal" >?id=form&a=</a>', $result);
    }

    /**
     * @throws SyntaxReportException
     */
    public function testTooltip() {
803
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841

        // standard case
        $result = $link->renderLink('u:http://example.com|o:hello world');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world" >http://example.com</a>', $result);

        // standard case, swapped parameter
        $result = $link->renderLink('o:hello world|u:http://example.com');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world" >http://example.com</a>', $result);

        // no text: this is ok
        $result = $link->renderLink('u:http://example.com|o');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        // no text: this is ok
        $result = $link->renderLink('u:http://example.com|o:');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        // some text, with double ticks inside
        $result = $link->renderLink('u:http://example.com|o:hello world "some more text" end');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world \\"some more text\\" end" >http://example.com</a>', $result);

        // some text, with already escaped  double ticks inside
        $result = $link->renderLink('u:http://example.com|o:hello world \\"some more text\\" end');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world \\"some more text\\" end" >http://example.com</a>', $result);

        // some text with single ticks
        $result = $link->renderLink('u:http://example.com|o:hello world \'some more text\' end');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world \'some more text\' end" >http://example.com</a>', $result);

        // some text with already escaped single ticks
        $result = $link->renderLink('u:http://example.com|o:hello world \\\'some more text\\\' end');
        $this->assertEquals('<a href="http://example.com" class="external" title="hello world \\\'some more text\\\' end" >http://example.com</a>', $result);
    }

    /**
     * @throws SyntaxReportException
     */
    public function testAltText() {
842
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
843
844
845

        // standard case
        $result = $link->renderLink('u:http://example.com|a:hello world|P:image.gif');
846
        $this->assertEquals('<a href="http://example.com" ><img alt="hello world" src="image.gif" title="image.gif" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
847

Carsten  Rose's avatar
Carsten Rose committed
848
849
850
851
852
        // standard: swapped parameter
        //TODO: fixme
//        $result = $link->renderLink('P:image.gif|a:hello world|u:http://example.com');
//        $this->assertEquals('<a href="http://example.com" ><img alt="hello world" src="image.gif" title="image.gif" ></a>', $result);

Carsten  Rose's avatar
Carsten Rose committed
853
854
        // alt text empty
        $result = $link->renderLink('u:http://example.com|a:|P:image.gif');
855
        $this->assertEquals('<a href="http://example.com" ><img alt="image.gif" src="image.gif" title="image.gif" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
856
857
858
859
860
861
862

    }

    /**
     * @throws SyntaxReportException
     */
    public function testClass() {
863
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879

        // no class
        $result = $link->renderLink('u:http://example.com|c:n');
        $this->assertEquals('<a href="http://example.com" >http://example.com</a>', $result);

        // internal class
        $result = $link->renderLink('u:http://example.com|c:i');
        $this->assertEquals('<a href="http://example.com" class="internal" >http://example.com</a>', $result);

        // internal class
        $result = $link->renderLink('u:http://example.com|c:e');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        // specific class
        $result = $link->renderLink('u:http://example.com|c:myClass');
        $this->assertEquals('<a href="http://example.com" class="myClass" >http://example.com</a>', $result);
880
881
882
883
884
885
886
887
888
889
890
891

        $result = $link->renderLink('u:http://example.com');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('u:http://example.com|c');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('u:http://example.com|c:');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        $result = $link->renderLink('p:form');
        $this->assertEquals('<a href="?id=form" class="internal" >?id=form</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
892
893
894
895
896
897
    }

    /**
     * @throws SyntaxReportException
     */
    public function testTarget() {
898
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924

        // no target
        $result = $link->renderLink('u:http://example.com|g');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        // no target
        $result = $link->renderLink('u:http://example.com|g:');
        $this->assertEquals('<a href="http://example.com" class="external" >http://example.com</a>', $result);

        // target _blank
        $result = $link->renderLink('u:http://example.com|g:_blank');
        $this->assertEquals('<a href="http://example.com" class="external" target="_blank" >http://example.com</a>', $result);

        // target someName
        $result = $link->renderLink('u:http://example.com|g:someName');
        $this->assertEquals('<a href="http://example.com" class="external" target="someName" >http://example.com</a>', $result);

        // target someName, swapped parameter
        $result = $link->renderLink('g:someName|u:http://example.com');
        $this->assertEquals('<a href="http://example.com" class="external" target="someName" >http://example.com</a>', $result);
    }

    /**
     * @throws SyntaxReportException
     */
    public function testRight() {
925
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
926
927
928

        // Bullet, LEFT (Standard)
        $result = $link->renderLink('u:http://example.com|t:Hello World|B');
929
        $this->assertEquals('<a href="http://example.com" ><img alt="Bullet green" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" > Hello World</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
930
931
932

        // Bullet, RIGHT
        $result = $link->renderLink('u:http://example.com|t:Hello World|B|R');
933
        $this->assertEquals('<a href="http://example.com" >Hello World <img alt="Bullet green" src="typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
934
935
936

        // Checked, LEFT (Standard)
        $result = $link->renderLink('u:http://example.com|t:Hello World|C');
937
        $this->assertEquals('<a href="http://example.com" ><img alt="Checked green" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" > Hello World</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
938
939
940

        // Checked, RIGHT
        $result = $link->renderLink('u:http://example.com|t:Hello World|C|R');
941
        $this->assertEquals('<a href="http://example.com" >Hello World <img alt="Checked green" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
942
943
944

        // Picture, LEFT (Standard)
        $result = $link->renderLink('u:http://example.com|t:Hello World|P:image.gif');
945
        $this->assertEquals('<a href="http://example.com" ><img alt="image.gif" src="image.gif" title="image.gif" > Hello World</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
946
947
948

        // Picture, RIGHT
        $result = $link->renderLink('u:http://example.com|t:Hello World|P:image.gif|R');
949
        $this->assertEquals('<a href="http://example.com" >Hello World <img alt="image.gif" src="image.gif" title="image.gif" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
950
951
952

        // swapped param
        $result = $link->renderLink('R|P:image.gif|t:Hello World|u:http://example.com');
953
        $this->assertEquals('<a href="http://example.com" class="external" >Hello World <img alt="image.gif" src="image.gif" title="image.gif" ></a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
954
955
956
957
958
959
960
    }


    /**
     * @throws SyntaxReportException
     */
    public function testSip() {
961
        $link = new Link($this->sip, true);
Carsten  Rose's avatar
Carsten Rose committed
962

963
        // Sip: URL, s
964
965
        $result = $link->renderLink('u:?form&r=12&xId=2345&L=1&type=99&gId=55|s');
        $this->assertEquals('<a href="index.php?id=form&L=1&type=99&s=badcaffee1234" class="external" >index.php?id=form&L=1&type=99&s=badcaffee1234</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
966

967
968
969
970
971
972
973
974
975
        // Sip: URL, s:0
        $result = $link->renderLink('u:?form&r=12&xId=2345&L=1&type=99&gId=55|s:0');
        $this->assertEquals('<a href="index.php?form&r=12&xId=2345&L=1&type=99&gId=55" class="external" >index.php?form&r=12&xId=2345&L=1&type=99&gId=55</a>', $result);

        // Sip: URL, s:1
        $result = $link->renderLink('u:?form&r=12&xId=2345&L=1&type=99&gId=55|s:1');
        $this->assertEquals('<a href="index.php?id=form&L=1&type=99&s=badcaffee1234" class="external" >index.php?id=form&L=1&type=99&s=badcaffee1234</a>', $result);

        // Sip: Page, s
976
977
        $result = $link->renderLink('p:form&r=12&xId=2345&L=1&type=99&gId=55|s');
        $this->assertEquals('<a href="index.php?id=form&L=1&type=99&s=badcaffee1234" class="internal" >index.php?id=form&L=1&type=99&s=badcaffee1234</a>', $result);
978
979
980
981
982
983
984
985

        // Sip: Page, s:0
        $result = $link->renderLink('p:form&r=12&xId=2345&L=1&type=99&gId=55|s:0');
        $this->assertEquals('<a href="?id=form&r=12&xId=2345&L=1&type=99&gId=55" class="internal" >?id=form&r=12&xId=2345&L=1&type=99&gId=55</a>', $result);

        // Sip: Page, s:1
        $result = $link->renderLink('p:form&r=12&xId=2345&L=1&type=99&gId=55|s:1');
        $this->assertEquals('<a href="index.php?id=form&L=1&type=99&s=badcaffee1234" class="internal" >index.php?id=form&L=1&type=99&s=badcaffee1234</a>', $result);
Carsten  Rose's avatar
Carsten Rose committed
986
987
    }

988
989
990
991
    /**
     * @expectedException \qfq\UserReportException
     */
    public function testSipException1() {
992
        $link = new Link($this->sip, true);
993
994
995
996
997
998
999
1000

        // r: default (0)
        $link->renderLink('u:http://www.example.com|s:s');
    }

    /**
     * @expectedException \qfq\UserReportException
     */
For faster browsing, not all history is shown. View entire blame