Issues (42)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

test/src/TextFilter/CTextFilterTest.php (11 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Mos\TextFilter;
4
5
/**
6
 * A testclass
7
 *
8
 */
9
class CTextFilterTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * Supported filters.
13
     */
14
    private $standardFilters = [
15
         'yamlfrontmatter',
16
         'bbcode',
17
         'clickable',
18
         'markdown',
19
//         'geshi',
20
         'nl2br',
21
         'shortcode',
22
         'purify',
23
         'titlefromh1',
24
     ];
25
26
27
28
     /**
29
      * Test.
30
      *
31
      * @return void
32
      */
33
    public function testMore()
34
    {
35
        $filter = new CTextFilter();
36
37
        $text = "";
38
        $exp  = "";
39
        $res = $filter->parse($text, []);
40
        $filter->addExcerpt($res);
41
        $this->assertEquals($exp, $res->excerpt, "More did not match");
42
43
        $text = "A<!--more-->B";
44
        $exp  = "A";
45
        $res = $filter->parse($text, []);
46
        $filter->addExcerpt($res);
47
        $this->assertEquals($exp, $res->excerpt, "More did not match");
48
49
        $text = "A<!--stop-->B<!--more-->C";
50
        $exp  = "A";
51
        $res = $filter->parse($text, []);
52
        $filter->addExcerpt($res);
53
        $this->assertEquals($exp, $res->excerpt, "More did not match");
54
    }
55
56
57
58
    /**
59
     * Test.
60
     *
61
     * @return void
62
     */
63
    public function testStop()
64
    {
65
        $filter = new CTextFilter();
66
67
        $text = "";
68
        $exp  = "";
69
        $res = $filter->parse($text, []);
70
        $filter->addExcerpt($res);
71
        $this->assertEquals($exp, $res->excerpt, "Stop did not match");
72
73
        $text = "A<!--stop-->B";
74
        $exp  = "A";
75
        $res = $filter->parse($text, []);
76
        $filter->addExcerpt($res);
77
        $this->assertEquals($exp, $res->excerpt, "Stop did not match");
78
    }
79
80
81
82
     /**
83
      * Test.
84
      *
85
      * @return void
86
      */
87
/*
88
    public function testSyntaxHighlightGeshiMethod()
89
    {
90
        $filter = new CTextFilter();
91
92
        $text = "";
93
        $exp  = '<pre class="text geshi"></pre>';
94
        $res = $filter->parse($text, ["geshi"]);
95
        $this->assertEquals($exp, $res->text, "Geshi did not match");
96
97
        $text = <<<'EOD'
98
$php = "hi";
99
EOD;
100
        $exp  = '<pre class="text geshi">$php = &quot;hi&quot;;</pre>';
101
        $res = $filter->parse($text, ["geshi"]);
102
        $this->assertEquals($exp, $res->text, "Geshi did not match");
103
104
        $text = <<<'EOD'
105
$php = "hi";
106
EOD;
107
108
        // @codingStandardsIgnoreStart
109
        $exp = <<<'EOD'
110
<pre class="php geshi"><span class="re0">$php</span> <span class="sy0">=</span> <span class="st0">&quot;hi&quot;</span><span class="sy0">;</span></pre>
111
EOD;
112
        // @codingStandardsIgnoreEnd
113
        $res = $filter->syntaxHighlightGeSHi($text, "php");
114
        $this->assertEquals($exp, $res, "Geshi did not match");
115
    }
116
*/
117
118
119
    /**
120
     * Test.
121
     *
122
     * @return void
123
     */
124
/*
125
    public function testSyntaxHighlightGeshiShortCode()
126
    {
127
        $filter = new CTextFilter();
128
129
        $text = <<<'EOD'
130
```text
131
```
132
133
EOD;
134
        $exp = <<<'EOD'
135
<pre class="text geshi"></pre>
136
EOD;
137
        $res = $filter->parse($text, ["shortcode"]);
138
        $this->assertEquals($exp, $res->text, "Geshi did not match");
139
140
        $text = <<<'EOD'
141
```
142
```
143
144
EOD;
145
        $exp = <<<'EOD'
146
<pre class="text geshi"></pre>
147
EOD;
148
        $res = $filter->parse($text, ["shortcode"]);
149
        $this->assertEquals($exp, $res->text, "Geshi did not match");
150
151
        $text = <<<'EOD'
152
```text
153
$php = "hi";
154
```
155
156
EOD;
157
        $exp = <<<'EOD'
158
<pre class="text geshi">$php = &quot;hi&quot;;
159
</pre>
160
EOD;
161
        $res = $filter->parse($text, ["shortcode"]);
162
        $this->assertEquals($exp, $res->text, "Geshi did not match");
163
164
        $text = <<<'EOD'
165
```php
166
$php = "hi";
167
```
168
169
EOD;
170
        // @codingStandardsIgnoreStart
171
        $exp = <<<'EOD'
172
<pre class="php geshi"><span class="re0">$php</span> <span class="sy0">=</span> <span class="st0">&quot;hi&quot;</span><span class="sy0">;</span>
173
</pre>
174
EOD;
175
        // @codingStandardsIgnoreEnd
176
        $res = $filter->parse($text, ["shortcode"]);
177
        $this->assertEquals($exp, $res->text, "Geshi did not match");
178
    }
179
*/
180
181
182
183
/**
184
 * Test.
185
 *
186
 * @return void
187
 */
188
/*
189
    public function testSyntaxHighlightHlJsiShortCode()
190
    {
191
        $filter = new CTextFilter();
192
193
        $text = <<<'EOD'
194
```text
195
```
196
197
EOD;
198
        $exp = <<<'EOD'
199
<pre></pre>
200
EOD;
201
        $res = $filter->parse($text, ["shortcode"]);
202
        $this->assertEquals($exp, $res->text, "Geshi did not match");
203
204
        $text = <<<'EOD'
205
```
206
```
207
208
EOD;
209
        $exp = <<<'EOD'
210
<pre></pre>
211
EOD;
212
        $res = $filter->parse($text, ["shortcode"]);
213
        $this->assertEquals($exp, $res->text, "Geshi did not match");
214
215
        $text = <<<'EOD'
216
```text
217
$php = "hi";
218
```
219
220
EOD;
221
        $exp = <<<'EOD'
222
<pre>$php = "hi";
223
</pre>
224
EOD;
225
        $res = $filter->parse($text, ["shortcode"]);
226
        $this->assertEquals($exp, $res->text, "Geshi did not match");
227
228
        $text = <<<'EOD'
229
```php
230
$php = "hi";
231
```
232
233
EOD;
234
        // @codingStandardsIgnoreStart
235
        $exp = <<<'EOD'
236
<pre class="hljs">$php = <span class="hljs-string">"hi"</span>;
237
</pre>
238
EOD;
239
        // @codingStandardsIgnoreEnd
240
        $res = $filter->parse($text, ["shortcode"]);
241
        $this->assertEquals($exp, $res->text, "Geshi did not match");
242
    }
243
*/
244
245
246
     /**
247
      * Test.
248
      *
249
      * @return void
250
      */
251
    public function testTitleFromFirstH1()
252
    {
253
        $filter = new CTextFilter();
254
255
        $text = "";
256
        $res = $filter->parse($text, ["titlefromh1"]);
257
        $title = $res->frontmatter["title"];
258
        $this->assertNull($title, "Title should be null");
259
260
        $text = "<h1>My title</h1>";
261
        $exp = "My title";
262
        $res = $filter->parse($text, ["titlefromh1"]);
263
        $title = $res->frontmatter["title"];
264
        $this->assertEquals($exp, $title, "Title missmatch");
265
266
        $text = "<h1><a href=''>My title</a></h1>";
267
        $exp = "My title";
268
        $res = $filter->parse($text, ["titlefromh1"]);
269
        $title = $res->frontmatter["title"];
270
        $this->assertEquals($exp, $title, "Title missmatch");
271
272
        $text = "<h1 class=''>My title</h1>";
273
        $exp = "My title";
274
        $res = $filter->parse($text, ["titlefromh1"]);
275
        $title = $res->frontmatter["title"];
276
        $this->assertEquals($exp, $title, "Title missmatch");
277
278
        $text = <<<EOD
279
{{{
280
{
281
    "title": "JSON title"
282
}
283
}}}
284
<h1 class=''>My title</h1>
285
EOD;
286
        $exp = "JSON title";
287
        $res = $filter->parse($text, ["titlefromh1", "jsonfrontmatter"]);
288
        $title = $res->frontmatter["title"];
289
        $this->assertEquals($exp, $title, "Title missmatch");
290
291
        $exp = "JSON title";
292
        $res = $filter->parse($text, ["jsonfrontmatter", "titlefromh1"]);
293
        $title = $res->frontmatter["title"];
294
        $this->assertEquals($exp, $title, "Title missmatch");
295
296
        $text = <<<EOD
297
{{{
298
{
299
    "title": "JSON title"
300
}
301
}}}
302
My title
303
=================================
304
305
This is the index page.
306
EOD;
307
        $exp = "JSON title";
308
        $res = $filter->parse($text, ["jsonfrontmatter", "markdown", "titlefromh1"]);
309
        $title = $res->frontmatter["title"];
310
        $this->assertEquals($exp, $title, "Title missmatch");
311
312
        $text = <<<EOD
313
{{{
314
{
315
    "title-no": "JSON title"
316
}
317
}}}
318
My title
319
=================================
320
321
This is the index page.
322
EOD;
323
        $exp = "My title";
324
        $res = $filter->parse($text, ["jsonfrontmatter", "markdown", "titlefromh1"]);
325
        $title = $res->frontmatter["title"];
326
        $this->assertEquals($exp, $title, "Title missmatch");
327
328
    }
329
330
331
332
     /**
333
      * Test.
334
      *
335
      * @expectedException /Mos/TextFilter/Exception
336
      *
337
      * @return void
338
      */
339
    public function testJsonFrontMatterException()
340
    {
341
        $filter = new CTextFilter();
342
343
        $text = <<<EOD
344
{{{
345
346
}}}
347
EOD;
348
        $filter->parse($text, ["jsonfrontmatter"]);
349
    }
350
351
352
353
     /**
354
      * Test.
355
      *
356
      * @return void
357
      */
358
    public function testJsonFrontMatter()
359
    {
360
        $filter = new CTextFilter();
361
362
        $text = "";
363
        $res = $filter->parse($text, ["jsonfrontmatter"]);
364
        $this->assertEmpty($res->frontmatter, "Frontmatter should be empty");
365
        $this->assertEmpty($res->text, "Text should be empty");
366
367
        $text = <<<EOD
368
{{{
369
}}}
370
371
EOD;
372
        $res = $filter->parse($text, ["jsonfrontmatter"]);
373
        $this->assertEmpty($res->frontmatter, "Frontmatter should be empty");
374
        $this->assertEmpty($res->text, "Text should be empty");
375
376
        $txt = "TEXT";
377
        $text = <<<EOD
378
{{{
379
{
380
    "key": "value"
381
}
382
}}}
383
$txt
384
EOD;
385
        $res = $filter->parse($text, ["jsonfrontmatter"]);
386
        $this->assertEquals(
387
            $res->frontmatter,
388
            [
389
                "key" => "value"
390
            ],
391
            "Frontmatter should be empty"
392
        );
393
        $this->assertEquals($txt, $res->text, "Text missmatch");
394
    }
395
396
397
398
    /**
399
     * Test.
400
     *
401
     * @expectedException /Mos/TextFilter/Exception
402
     *
403
     * @return void
404
     */
405
    public function testYamlFrontMatterException()
406
    {
407
        if (!function_exists("yaml_parse")) {
408
            return;
409
        }
410
411
        $filter = new CTextFilter();
412
413
        $text = <<<EOD
414
---
415
416
---
417
EOD;
418
        $filter->parse($text, ["yamlfrontmatter"]);
419
    }
420
421
422
423
    /**
424
     * Test.
425
     *
426
     * @return void
427
     */
428
    public function testYamlFrontMatter()
429
    {
430
        if (!function_exists("yaml_parse")) {
431
            return;
432
        }
433
434
        $filter = new CTextFilter();
435
436
        $text = "";
437
        $res = $filter->parse($text, ["yamlfrontmatter"]);
438
        $this->assertEmpty($res->frontmatter, "Frontmatter should be empty");
439
        $this->assertEmpty($res->text, "Text should be empty");
440
441
        $text = <<<EOD
442
---
443
...
444
445
EOD;
446
        $res = $filter->parse($text, ["yamlfrontmatter"]);
447
        $this->assertEmpty($res->frontmatter, "Frontmatter should be empty");
448
        $this->assertEmpty($res->text, "Text should be empty");
449
450
        $txt = "TEXT";
451
        $text = <<<EOD
452
---
453
key: value
454
...
455
$txt
456
EOD;
457
        $res = $filter->parse($text, ["yamlfrontmatter"]);
458
        $this->assertEquals(
459
            $res->frontmatter,
460
            [
461
                "key" => "value"
462
            ],
463
            "Frontmatter not matching"
464
        );
465
        $this->assertEquals($txt, $res->text, "Text missmatch");
466
467
        $text = <<<EOD
468
---
469
key1: value1
470
key2: This is a long sentence.
471
...
472
My Article
473
=================================
474
475
This is an example on writing text and adding a YAML frontmatter.
476
477
Subheading
478
---------------------------------
479
480
More text.
481
482
EOD;
483
        $res = $filter->parse($text, ["yamlfrontmatter", "markdown"]);
484
        $this->assertEquals(
485
            $res->frontmatter,
486
            [
487
                "key1" => "value1",
488
                "key2" => "This is a long sentence."
489
            ],
490
            "Frontmatter not matching"
491
        );
492
493
        $text = <<<EOD
494
My Article
495
=================================
496
497
This is an example on writing text and adding a YAML frontmatter.
498
499
Subheading
500
---------------------------------
501
502
More text.
503
504
EOD;
505
        $res = $filter->parse($text, ["yamlfrontmatter", "markdown"]);
506
        $this->assertEmpty($res->frontmatter, "Frontmatter should be empty");
507
    }
508
509
510
511
    /**
512
     * Test.
513
     *
514
     * @return void
515
     */
516
    public function testGetFilters()
517
    {
518
        $filter = new CTextFilter();
519
520
        $filters = $filter->getFilters();
521
        $res = array_diff($this->standardFilters, $filters);
522
        $this->assertTrue(empty($res), "Missmatch standard filters.");
523
    }
524
525
526
527
528
    /**
529
     * Test.
530
     *
531
     * @return void
532
     */
533
    public function testHasFilter()
534
    {
535
        $filter = new CTextFilter();
536
537
        $res = $filter->hasFilter("markdown");
538
        $this->assertTrue($res, "Missmatch has filters.");
539
    }
540
541
542
543
544
    /**
545
     * Test.
546
     *
547
     * @expectedException /Mos/TextFilter/Exception
548
     *
549
     * @return void
550
     */
551
    public function testHasFilterException()
552
    {
553
        $filter = new CTextFilter();
554
555
        $filter->hasFilter("NOT EXISTING");
556
    }
557
558
559
560
561
    /**
562
     * Test.
563
     *
564
     * @return void
565
     */
566
    public function testPurifier()
567
    {
568
        $filter = new CTextFilter();
569
570
        $text = "Header\n=========";
571
        $exp  = "<h1>Header</h1>\n";
572
        $res = $filter->parse($text, ["markdown", "purify"]);
573
        $this->assertEquals($exp, $res->text, "Purify failed");
574
    }
575
576
577
578
    /**
579
     * Test.
580
     *
581
     * @return void
582
     */
583 View Code Duplication
    public function testMarkdown()
584
    {
585
        $filter = new CTextFilter();
586
587
        $html = "Header\n=========";
588
        $exp  = "<h1>Header</h1>\n";
589
        $res = $filter->doFilter($html, "markdown");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
590
        $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'");
591
    }
592
593
594
595
    /**
596
     * Test.
597
     *
598
     * @return void
599
     */
600 View Code Duplication
    public function testSmartyPants()
601
    {
602
        $filter = new CTextFilter();
603
604
        $html = "...";
605
        $exp  = "<p>&#8230;</p>\n";
606
        $res = $filter->doFilter($html, "markdown");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
607
        $this->assertEquals($exp, $res, "SmartyPants elippsis failed: '$res'");
608
    }
609
610
611
612
    /**
613
     * Test.
614
     *
615
     * @return void
616
     */
617 View Code Duplication
    public function testMarkdownAndBBCode()
618
    {
619
        $filter = new CTextFilter();
620
621
        $html = "Header[b]text[/b]\n=========";
622
        $exp  = "<h1>Header<strong>text</strong></h1>\n";
623
        $res = $filter->doFilter($html, "markdown, bbcode");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
624
        $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'");
625
    }
626
627
628
629
    /**
630
     * Test.
631
     *
632
     * @return void
633
     */
634 View Code Duplication
    public function testMarkdownAndBBCodeAsArray()
635
    {
636
        $filter = new CTextFilter();
637
638
        $html = "Header[b]text[/b]\n=========";
639
        $exp  = "<h1>Header<strong>text</strong></h1>\n";
640
        $res = $filter->doFilter($html, ["markdown", "bbcode"]);
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
641
        $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'");
642
    }
643
644
645
646
    /**
647
     * Test.
648
     *
649
     * @return void
650
     */
651 View Code Duplication
    public function testMarkdownArray()
652
    {
653
        $filter = new CTextFilter();
654
655
        $html = "Header\n=========";
656
        $exp  = "<h1>Header</h1>\n";
657
        $res = $filter->doFilter($html, ["markdown"]);
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
658
        $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'");
659
    }
660
661
662
663
    /**
664
     * Test.
665
     *
666
     * @return void
667
     */
668 View Code Duplication
    public function testUppercase()
669
    {
670
        $filter = new CTextFilter();
671
672
        $html = "Header\n=========";
673
        $exp  = "<h1>Header</h1>\n";
674
        $res = $filter->doFilter($html, "MARKDOWN");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
675
        $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'");
676
    }
677
678
679
680
    /**
681
     * Test.
682
     *
683
     * @return void
684
     */
685 View Code Duplication
    public function testBBCode()
686
    {
687
        $filter = new CTextFilter();
688
689
        $html = "[b]text[/b]";
690
        $exp  = "<strong>text</strong>";
691
        $res = $filter->doFilter($html, "bbcode");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
692
        $this->assertEquals($exp, $res, "BBCode [b] failed: '$res'");
693
    }
694
695
696
697
    /**
698
     * Test.
699
     *
700
     * @return void
701
     */
702 View Code Duplication
    public function testClickable()
703
    {
704
        $filter = new CTextFilter();
705
706
        $html = "http://example.com/humans.txt";
707
        $exp  = "<a href='$html'>$html</a>";
708
        $res = $filter->doFilter($html, "clickable");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
709
        $this->assertEquals($exp, $res, "clickable failed: '$res'");
710
    }
711
712
713
714
    /**
715
     * Test.
716
     *
717
     * @return void
718
     */
719 View Code Duplication
    public function testNl2Br()
720
    {
721
        $filter = new CTextFilter();
722
723
        $html = "hej\nhej";
724
        $exp  = "hej<br />\nhej";
725
        $res = $filter->doFilter($html, "nl2br");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
726
        $this->assertEquals($exp, $res, "nl2br failed: '$res'");
727
    }
728
729
730
731
    /**
732
     * Test.
733
     *
734
     * @return void
735
     */
736
    public function testShortCodeFigure()
737
    {
738
        $filter = new CTextFilter();
739
740
        $src = "/img/me.png";
741
        $caption = "This is me.";
742
        
743
        $html = <<<EOD
744
[FIGURE src=$src caption="$caption"]
745
EOD;
746
747
        $exp  = <<<EOD
748
<figure class="figure">
749
<a href="$src"><img src="$src" alt="$caption"/></a>
750
<figcaption markdown=1>$caption</figcaption>
751
</figure>
752
EOD;
753
        $res = $filter->doFilter($html, "shortcode");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
754
        $this->assertEquals($exp, $res, "shortcode failed: '$res'");
755
    }
756
757
758
759
    /**
760
     * Test.
761
     *
762
     * @expectedException Exception
763
     *
764
     * @return void
765
     */
766
    public function testDoItException()
767
    {
768
        $filter = new CTextFilter();
769
        $filter->doFilter("void", "no-such-filter");
0 ignored issues
show
Deprecated Code introduced by
The method Mos\TextFilter\CTextFilter::doFilter() has been deprecated with message: deprecated since version 1.2 in favour of parse().

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
770
    }
771
}
772