Make WordPress Core

Ticket #23050: 23050-unit-tests-nofollow.diff

File 23050-unit-tests-nofollow.diff, 3.7 KB (added by netweb, 10 years ago)

WITH rel="nofollow"

  • tests/phpunit/tests/formatting/MakeClickable.php

     
    340340                        $this->assertEquals( $urls_expected[$key], make_clickable( $url ) );
    341341                }
    342342        }
     343
     344        /**
     345         * anchor tag contains both a URL and some words.
     346         *
     347         * @ticket 23050
     348         *
     349         */
     350        function test_anchors_with_url_and_words() {
     351                $urls_before = array(
     352                        'Hey! <a href="http://wordpress.org">http://wordpress.org is awesome</a> if you have clicks to give!',
     353                        'Hey! <a href="http://wordpress.org/">http://wordpress.org/ is awesome</a> if you have clicks to give!',
     354                        'Hey! (<a href="http://wordpress.org">http://wordpress.org is awesome</a>) if you have clicks to give!',
     355                        'Hey! <<a href="http://wordpress.org">http://wordpress.org is awesome</a>> if you have clicks to give!',
     356                        'Hey! < <a href="http://wordpress.org">http://wordpress.org is awesome</a> > if you have clicks to give!',
     357                );
     358                $urls_expected = array(
     359                        'Hey! <a href="http://wordpress.org" rel="nofollow">http://wordpress.org is awesome</a> if you have clicks to give!',
     360                        'Hey! <a href="http://wordpress.org/" rel="nofollow">http://wordpress.org/ is awesome</a> if you have clicks to give!',
     361                        'Hey! (<a href="http://wordpress.org" rel="nofollow">http://wordpress.org is awesome</a>) if you have clicks to give!',
     362                        'Hey! <<a href="http://wordpress.org" rel="nofollow">http://wordpress.org is awesome</a>> if you have clicks to give!',
     363                        'Hey! < <a href="http://wordpress.org" rel="nofollow">http://wordpress.org is awesome</a> > if you have clicks to give!',
     364                );
     365                foreach ($urls_before as $key => $url) {
     366                        $this->assertEquals( $urls_expected[$key], make_clickable( $url ) );
     367                }
     368        }
    343369}