@@ 583-591 (lines=9) @@ | ||
580 | * |
|
581 | * @return void |
|
582 | */ |
|
583 | 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"); |
|
590 | $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'"); |
|
591 | } |
|
592 | ||
593 | ||
594 | ||
@@ 600-608 (lines=9) @@ | ||
597 | * |
|
598 | * @return void |
|
599 | */ |
|
600 | public function testSmartyPants() |
|
601 | { |
|
602 | $filter = new CTextFilter(); |
|
603 | ||
604 | $html = "..."; |
|
605 | $exp = "<p>…</p>\n"; |
|
606 | $res = $filter->doFilter($html, "markdown"); |
|
607 | $this->assertEquals($exp, $res, "SmartyPants elippsis failed: '$res'"); |
|
608 | } |
|
609 | ||
610 | ||
611 | ||
@@ 617-625 (lines=9) @@ | ||
614 | * |
|
615 | * @return void |
|
616 | */ |
|
617 | 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"); |
|
624 | $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'"); |
|
625 | } |
|
626 | ||
627 | ||
628 | ||
@@ 634-642 (lines=9) @@ | ||
631 | * |
|
632 | * @return void |
|
633 | */ |
|
634 | 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"]); |
|
641 | $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'"); |
|
642 | } |
|
643 | ||
644 | ||
645 | ||
@@ 651-659 (lines=9) @@ | ||
648 | * |
|
649 | * @return void |
|
650 | */ |
|
651 | 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"]); |
|
658 | $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'"); |
|
659 | } |
|
660 | ||
661 | ||
662 | ||
@@ 668-676 (lines=9) @@ | ||
665 | * |
|
666 | * @return void |
|
667 | */ |
|
668 | 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"); |
|
675 | $this->assertEquals($exp, $res, "Markdown <h1> failed: '$res'"); |
|
676 | } |
|
677 | ||
678 | ||
679 | ||
@@ 685-693 (lines=9) @@ | ||
682 | * |
|
683 | * @return void |
|
684 | */ |
|
685 | 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"); |
|
692 | $this->assertEquals($exp, $res, "BBCode [b] failed: '$res'"); |
|
693 | } |
|
694 | ||
695 | ||
696 | ||
@@ 702-710 (lines=9) @@ | ||
699 | * |
|
700 | * @return void |
|
701 | */ |
|
702 | 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"); |
|
709 | $this->assertEquals($exp, $res, "clickable failed: '$res'"); |
|
710 | } |
|
711 | ||
712 | ||
713 | ||
@@ 719-727 (lines=9) @@ | ||
716 | * |
|
717 | * @return void |
|
718 | */ |
|
719 | public function testNl2Br() |
|
720 | { |
|
721 | $filter = new CTextFilter(); |
|
722 | ||
723 | $html = "hej\nhej"; |
|
724 | $exp = "hej<br />\nhej"; |
|
725 | $res = $filter->doFilter($html, "nl2br"); |
|
726 | $this->assertEquals($exp, $res, "nl2br failed: '$res'"); |
|
727 | } |
|
728 | ||
729 | ||
730 |