Make WordPress Core

Ticket #23756: 23756.test.diff

File 23756.test.diff, 2.3 KB (added by helen, 10 years ago)
  • tests/formatting/MakeClickable.php

     
    316316        }
    317317
    318318        /**
     319         * @ticket 23756
     320         */
     321        function test_no_links_inside_pre_or_code() {
     322                $before = array(
     323                        '<pre>http://wordpress.org</pre>',
     324                        '<code>http://wordpress.org</code>',
     325                        'URL before pre http://wordpress.org<pre>http://wordpress.org</pre>',
     326                        'URL before code http://wordpress.org<code>http://wordpress.org</code>',
     327                        'URL after pre <pre>http://wordpress.org</pre>http://wordpress.org',
     328                        'URL after code <code>http://wordpress.org</code>http://wordpress.org',
     329                        'URL before and after pre http://wordpress.org<pre>http://wordpress.org</pre>http://wordpress.org',
     330                        'URL before and after code http://wordpress.org<code>http://wordpress.org</code>http://wordpress.org',
     331                        'code inside pre <pre>http://wordpress.org <code>http://wordpress.org</code> http://wordpress.org</pre>',
     332                );
     333
     334                $expected = array(
     335                        '<pre>http://wordpress.org</pre>',
     336                        '<code>http://wordpress.org</code>',
     337                        'URL before pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre>',
     338                        'URL before code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code>',
     339                        'URL after pre <pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
     340                        'URL after code <code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
     341                        'URL before and after pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
     342                        'URL before and after code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
     343                        'code inside pre <pre>http://wordpress.org <code>http://wordpress.org</code> http://wordpress.org</pre>',
     344                );
     345
     346                foreach ($before as $key => $url) {
     347                        $this->assertEquals($expected[$key], make_clickable($url));
     348                }
     349        }
     350
     351        /**
    319352         * ticket 16892
    320353         */
    321354        function test_no_segfault() {