forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincludesMisc.php
More file actions
26 lines (25 loc) · 938 Bytes
/
includesMisc.php
File metadata and controls
26 lines (25 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* @group admin
*/
class Tests_Admin_includesMisc extends WP_UnitTestCase {
function test_shorten_url() {
$tests = array(
'wordpress\.org/about/philosophy'
=> 'wordpress\.org/about/philosophy', // No longer strips slashes.
'wordpress.org/about/philosophy'
=> 'wordpress.org/about/philosophy',
'http://wordpress.org/about/philosophy/'
=> 'wordpress.org/about/philosophy', // Remove http, trailing slash.
'http://www.wordpress.org/about/philosophy/'
=> 'wordpress.org/about/philosophy', // Remove http, www.
'http://wordpress.org/about/philosophy/#box'
=> 'wordpress.org/about/philosophy/#box', // Don't shorten 35 characters.
'http://wordpress.org/about/philosophy/#decisions'
=> 'wordpress.org/about/philosophy/#…', // Shorten to 32 if > 35 after cleaning.
);
foreach ( $tests as $k => $v ) {
$this->assertEquals( $v, url_shorten( $k ) );
}
}
}