Skip to content

Commit 74518e4

Browse files
committed
add integration tests
1 parent b097a7e commit 74518e4

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

tests/integration/sitemaps/test-class-wpseo-taxonomy-sitemap-provider.php

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Class WPSEO_Taxonomy_Sitemap_Provider_Test.
1010
*
1111
* @group sitemaps
12+
* @coversDefaultClass WPSEO_Taxonomy_Sitemap_Provider
1213
*/
1314
class WPSEO_Taxonomy_Sitemap_Provider_Test extends WPSEO_UnitTestCase {
1415

@@ -31,7 +32,7 @@ public function set_up() {
3132
/**
3233
* Tests the retrieval of the index links.
3334
*
34-
* @covers WPSEO_Taxonomy_Sitemap_Provider::get_index_links
35+
* @covers ::get_index_links
3536
*/
3637
public function test_get_index_links() {
3738

@@ -57,7 +58,7 @@ public function test_get_index_links() {
5758
/**
5859
* Tests retrieval of the sitemap links.
5960
*
60-
* @covers WPSEO_Taxonomy_Sitemap_Provider::get_sitemap_links
61+
* @covers ::get_sitemap_links
6162
*/
6263
public function test_get_sitemap_links() {
6364

@@ -71,7 +72,7 @@ public function test_get_sitemap_links() {
7172
/**
7273
* Makes sure invalid sitemap pages return no contents (404).
7374
*
74-
* @covers WPSEO_Taxonomy_Sitemap_Provider::get_index_links
75+
* @covers ::get_index_links
7576
*/
7677
public function test_get_index_links_empty_sitemap() {
7778
// Fetch the global sitemap.
@@ -87,4 +88,44 @@ public function test_get_index_links_empty_sitemap() {
8788
// Expect an empty page (404) to be returned.
8889
$this->expectOutputString( '' );
8990
}
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+
}
90131
}

0 commit comments

Comments
 (0)