| @@ 523-539 (lines=17) @@ | ||
| 520 | $this->assertTextContains($expected, $result); |
|
| 521 | } |
|
| 522 | ||
| 523 | public function testLinkAutoWithoutHttpPrefix() |
|
| 524 | { |
|
| 525 | $input = 'some www.example.com/foobar text'; |
|
| 526 | $expected = [ |
|
| 527 | 'some ', |
|
| 528 | 'a' => [ |
|
| 529 | 'href' => 'http://www.example.com/foobar', |
|
| 530 | 'rel' => 'external', |
|
| 531 | 'target' => '_blank', |
|
| 532 | ], |
|
| 533 | 'http://www.example.com/foobar', |
|
| 534 | '/a', |
|
| 535 | ' text' |
|
| 536 | ]; |
|
| 537 | $result = $this->_Parser->parse($input); |
|
| 538 | $this->assertHtml($expected, $result); |
|
| 539 | } |
|
| 540 | ||
| 541 | public function testLinkAutoUrlWithinParentheses() |
|
| 542 | { |
|
| @@ 541-557 (lines=17) @@ | ||
| 538 | $this->assertHtml($expected, $result); |
|
| 539 | } |
|
| 540 | ||
| 541 | public function testLinkAutoUrlWithinParentheses() |
|
| 542 | { |
|
| 543 | $input = 'some (www.example.com/foobar) text'; |
|
| 544 | $expected = [ |
|
| 545 | 'some (', |
|
| 546 | 'a' => [ |
|
| 547 | 'href' => 'http://www.example.com/foobar', |
|
| 548 | 'rel' => 'external', |
|
| 549 | 'target' => '_blank', |
|
| 550 | ], |
|
| 551 | 'http://www.example.com/foobar', |
|
| 552 | '/a', |
|
| 553 | ') text' |
|
| 554 | ]; |
|
| 555 | $result = $this->_Parser->parse($input); |
|
| 556 | $this->assertHtml($expected, $result); |
|
| 557 | } |
|
| 558 | ||
| 559 | public function testLinkAutoSurroundingChars() |
|
| 560 | { |
|
| @@ 697-714 (lines=18) @@ | ||
| 694 | $this->assertNotRegExp($expected, $result); |
|
| 695 | } |
|
| 696 | ||
| 697 | public function testExternalImageAbsoluteAutoLinked() |
|
| 698 | { |
|
| 699 | // test for standard URIs |
|
| 700 | $input = '[img]http://foo.bar/img/macnemo.png[/img]'; |
|
| 701 | $expected = [ |
|
| 702 | 'a' => [ |
|
| 703 | 'href' => 'http://foo.bar/img/macnemo.png', |
|
| 704 | // 'rel' => 'external', |
|
| 705 | 'target' => '_blank', |
|
| 706 | ], |
|
| 707 | 'img' => [ |
|
| 708 | 'src' => 'http://foo.bar/img/macnemo.png', |
|
| 709 | 'alt' => '' |
|
| 710 | ] |
|
| 711 | ]; |
|
| 712 | $result = $this->_Parser->parse($input); |
|
| 713 | $this->assertHtml($expected, $result); |
|
| 714 | } |
|
| 715 | ||
| 716 | public function testExternalImageRelativeAutoLinked() |
|
| 717 | { |
|
| @@ 716-732 (lines=17) @@ | ||
| 713 | $this->assertHtml($expected, $result); |
|
| 714 | } |
|
| 715 | ||
| 716 | public function testExternalImageRelativeAutoLinked() |
|
| 717 | { |
|
| 718 | // test for standard URIs |
|
| 719 | $input = '[img]/somewhere/macnemo.png[/img]'; |
|
| 720 | $expected = [ |
|
| 721 | 'a' => [ |
|
| 722 | 'href' => '/somewhere/macnemo.png', |
|
| 723 | 'target' => '_blank', |
|
| 724 | ], |
|
| 725 | 'img' => [ |
|
| 726 | 'src' => '/somewhere/macnemo.png', |
|
| 727 | 'alt' => '' |
|
| 728 | ] |
|
| 729 | ]; |
|
| 730 | $result = $this->_Parser->parse($input); |
|
| 731 | $this->assertHtml($expected, $result); |
|
| 732 | } |
|
| 733 | ||
| 734 | /** |
|
| 735 | * test scaling with 1 parameter |
|
| @@ 737-754 (lines=18) @@ | ||
| 734 | /** |
|
| 735 | * test scaling with 1 parameter |
|
| 736 | */ |
|
| 737 | public function testExternalImageAbsoluteAutoLinkedScaledByOne() |
|
| 738 | { |
|
| 739 | // test for standard URIs |
|
| 740 | $input = '[img=50]http://foo.bar/img/macnemo.png[/img]'; |
|
| 741 | $expected = [ |
|
| 742 | 'a' => [ |
|
| 743 | 'href' => 'http://foo.bar/img/macnemo.png', |
|
| 744 | 'target' => '_blank', |
|
| 745 | ], |
|
| 746 | 'img' => [ |
|
| 747 | 'src' => 'http://foo.bar/img/macnemo.png', |
|
| 748 | 'alt' => '', |
|
| 749 | 'width' => '50', |
|
| 750 | ] |
|
| 751 | ]; |
|
| 752 | $result = $this->_Parser->parse($input); |
|
| 753 | $this->assertHtml($expected, $result); |
|
| 754 | } |
|
| 755 | ||
| 756 | /** |
|
| 757 | * test scaling with 2 parameter |
|
| @@ 759-777 (lines=19) @@ | ||
| 756 | /** |
|
| 757 | * test scaling with 2 parameter |
|
| 758 | */ |
|
| 759 | public function testExternalImageAbsoluteAutoLinkedScaledByTwo() |
|
| 760 | { |
|
| 761 | // test for standard URIs |
|
| 762 | $input = '[img=50x100]http://foo.bar/img/macnemo.png[/img]'; |
|
| 763 | $expected = [ |
|
| 764 | 'a' => [ |
|
| 765 | 'href' => 'http://foo.bar/img/macnemo.png', |
|
| 766 | 'target' => '_blank', |
|
| 767 | ], |
|
| 768 | 'img' => [ |
|
| 769 | 'src' => 'http://foo.bar/img/macnemo.png', |
|
| 770 | 'alt' => '', |
|
| 771 | 'height' => '100', |
|
| 772 | 'width' => '50', |
|
| 773 | ] |
|
| 774 | ]; |
|
| 775 | $result = $this->_Parser->parse($input); |
|
| 776 | $this->assertHtml($expected, $result); |
|
| 777 | } |
|
| 778 | ||
| 779 | public function testExternalImageWithHttpsEnforced() |
|
| 780 | { |
|
| @@ 874-893 (lines=20) @@ | ||
| 871 | $this->assertNotRegExp($expected, $result); |
|
| 872 | } |
|
| 873 | ||
| 874 | public function testInternalImageExternallyLinked() |
|
| 875 | { |
|
| 876 | //// internal image |
|
| 877 | $input = '[url=http://foo.de][upload]test.png[/upload][/url]'; |
|
| 878 | $expected = [ |
|
| 879 | [ |
|
| 880 | 'a' => [ |
|
| 881 | 'href' => 'http://foo.de', |
|
| 882 | 'rel' => 'external', |
|
| 883 | 'target' => '_blank', |
|
| 884 | ], |
|
| 885 | 'img' => [ |
|
| 886 | 'src' => '/useruploads/test.png', |
|
| 887 | 'alt' => '', |
|
| 888 | ] |
|
| 889 | ], |
|
| 890 | ]; |
|
| 891 | $result = $this->_Parser->parse($input); |
|
| 892 | $this->assertHtml($expected, $result); |
|
| 893 | } |
|
| 894 | ||
| 895 | public function testUploadTypeImage() |
|
| 896 | { |
|