Make WordPress Core

Ticket #23922: 23922.tests.diff

File 23922.tests.diff, 1.1 KB (added by ericmann, 11 years ago)

Add some tests for a couple of specific hash conditions.

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

     
    340340                        $this->assertEquals( $urls_expected[$key], make_clickable( $url ) );
    341341                }
    342342        }
     343
     344        /**
     345         * @ticket 23922
     346         */
     347        function test_colon_in_hash() {
     348                $urls_before = array(
     349                        'http://example.com#comment:1', // Test punctuation character with non-punctuation follower
     350                        'http://example.com#tel:',      // Test colon character with end of line after
     351                        'http://example.com#anchor.',   // Test regular punctuation character with end of line after.
     352                );
     353                $urls_expected = array(
     354                        '<a href="http://example.com#comment:1" rel="nofollow">http://example.com#comment:1</a>',
     355                        '<a href="http://example.com#tel:" rel="nofollow">http://example.com#tel:</a>',
     356                        '<a href="http://example.com#anchor" rel="nofollow">http://example.com#anchor</a>.'
     357                );
     358
     359                foreach( $urls_before as $key => $url ) {
     360                        $this->assertEquals( $urls_expected[ $key ], make_clickable( $url ) );
     361                }
     362        }
    343363}