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
56 lines (50 loc) · 1.65 KB
/
includesMisc.php
File metadata and controls
56 lines (50 loc) · 1.65 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @group admin
*/
class Tests_Admin_IncludesMisc extends WP_UnitTestCase {
/**
* @covers ::url_shorten
*/
public 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->assertSame( $v, url_shorten( $k ) );
}
}
/**
* @ticket 59520
*/
public function test_new_admin_email_subject_filter() {
// Default value.
$mailer = tests_retrieve_phpmailer_instance();
update_option_new_admin_email( 'old@example.com', 'new@example.com' );
$this->assertSame( '[Test Blog] New Admin Email Address', $mailer->get_sent()->subject );
// Filtered value.
add_filter(
'new_admin_email_subject',
function () {
return 'Filtered Admin Email Address';
},
10,
1
);
$mailer->mock_sent = array();
$mailer = tests_retrieve_phpmailer_instance();
update_option_new_admin_email( 'old@example.com', 'new@example.com' );
$this->assertSame( 'Filtered Admin Email Address', $mailer->get_sent()->subject );
}
}