forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetTagLink.php
More file actions
63 lines (50 loc) · 1.26 KB
/
getTagLink.php
File metadata and controls
63 lines (50 loc) · 1.26 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
57
58
59
60
61
62
63
<?php
/**
* @group taxonomy
* @covers ::get_tag_link
*/
class Tests_Term_GetTagLink extends WP_UnitTestCase {
public function test_success() {
$t = self::factory()->term->create(
array(
'taxonomy' => 'post_tag',
'slug' => 'term-slug',
)
);
$found = get_tag_link( $t );
$expected = home_url( '?tag=term-slug' );
$this->assertSame( $expected, $found );
}
/**
* @ticket 42771
*/
public function test_should_return_link_for_term_from_another_taxonomy_on_primed_cache() {
register_taxonomy( 'wptests_tax', 'post' );
$t = self::factory()->term->create(
array(
'taxonomy' => 'wptests_tax',
'slug' => 'test-term',
)
);
$term = get_term( $t );
$found = get_tag_link( $t );
$expected = home_url( '?wptests_tax=test-term' );
$this->assertSame( $expected, $found );
}
/**
* @ticket 42771
*/
public function test_should_return_link_for_term_from_another_taxonomy_on_empty_cache() {
register_taxonomy( 'wptests_tax', 'post' );
$t = self::factory()->term->create(
array(
'taxonomy' => 'wptests_tax',
'slug' => 'test-term',
)
);
clean_term_cache( $t );
$found = get_tag_link( $t );
$expected = home_url( '?wptests_tax=test-term' );
$this->assertSame( $expected, $found );
}
}