9
9
* Class WPSEO_Taxonomy_Sitemap_Provider_Test.
10
10
*
11
11
* @group sitemaps
12
+ * @coversDefaultClass WPSEO_Taxonomy_Sitemap_Provider
12
13
*/
13
14
class WPSEO_Taxonomy_Sitemap_Provider_Test extends WPSEO_UnitTestCase {
14
15
@@ -31,7 +32,7 @@ public function set_up() {
31
32
/**
32
33
* Tests the retrieval of the index links.
33
34
*
34
- * @covers WPSEO_Taxonomy_Sitemap_Provider ::get_index_links
35
+ * @covers ::get_index_links
35
36
*/
36
37
public function test_get_index_links () {
37
38
@@ -57,7 +58,7 @@ public function test_get_index_links() {
57
58
/**
58
59
* Tests retrieval of the sitemap links.
59
60
*
60
- * @covers WPSEO_Taxonomy_Sitemap_Provider ::get_sitemap_links
61
+ * @covers ::get_sitemap_links
61
62
*/
62
63
public function test_get_sitemap_links () {
63
64
@@ -71,7 +72,7 @@ public function test_get_sitemap_links() {
71
72
/**
72
73
* Makes sure invalid sitemap pages return no contents (404).
73
74
*
74
- * @covers WPSEO_Taxonomy_Sitemap_Provider ::get_index_links
75
+ * @covers ::get_index_links
75
76
*/
76
77
public function test_get_index_links_empty_sitemap () {
77
78
// Fetch the global sitemap.
@@ -87,4 +88,44 @@ public function test_get_index_links_empty_sitemap() {
87
88
// Expect an empty page (404) to be returned.
88
89
$ this ->expectOutputString ( '' );
89
90
}
91
+
92
+ /**
93
+ * Data provider for is_valid_taxonomy test.
94
+ *
95
+ * @return array
96
+ */
97
+ public function data_provider_is_valis_taxonomy () {
98
+ return [
99
+ 'Pattern Categories ' => [
100
+ 'taxonomy ' => 'wp_pattern_category ' ,
101
+ 'expected ' => false ,
102
+ ],
103
+ 'nav_menu ' => [
104
+ 'taxonomy ' => 'nav_menu ' ,
105
+ 'expected ' => false ,
106
+ ],
107
+ 'link_category ' => [
108
+ 'taxonomy ' => 'link_category ' ,
109
+ 'expected ' => false ,
110
+ ],
111
+ 'post_format ' => [
112
+ 'taxonomy ' => 'post_format ' ,
113
+ 'expected ' => false ,
114
+ ],
115
+ ];
116
+ }
117
+
118
+ /**
119
+ * Tetst of is_valid_taxonomy.
120
+ *
121
+ * @covers ::is_valid_taxonomy
122
+ *
123
+ * @dataProvider data_provider_is_valis_taxonomy
124
+ *
125
+ * @param string $taxonomy Taxonomy name.
126
+ * @param bool $expected Expected result.
127
+ */
128
+ public function test_is_valid_taxonomy ( $ taxonomy , $ expected ) {
129
+ $ this ->assertSame ( $ expected , self ::$ class_instance ->is_valid_taxonomy ( $ taxonomy ) );
130
+ }
90
131
}
0 commit comments