sitemaps-stylesheet.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @group sitemaps
  4. */
  5. class Test_WP_Sitemaps_Stylesheet extends WP_UnitTestCase {
  6. /**
  7. * Test that stylesheet content can be filtered.
  8. */
  9. public function test_filter_sitemaps_stylesheet_content() {
  10. $stylesheet = new WP_Sitemaps_Stylesheet();
  11. add_filter( 'wp_sitemaps_stylesheet_content', '__return_empty_string' );
  12. $content = $stylesheet->get_sitemap_stylesheet();
  13. $this->assertSame( '', $content, 'Could not filter stylesheet content' );
  14. }
  15. /**
  16. * Test that sitemap index stylesheet content can be filtered.
  17. */
  18. public function test_filter_sitemaps_stylesheet_index_content() {
  19. $stylesheet = new WP_Sitemaps_Stylesheet();
  20. add_filter( 'wp_sitemaps_stylesheet_index_content', '__return_empty_string' );
  21. $content = $stylesheet->get_sitemap_index_stylesheet();
  22. $this->assertSame( '', $content, 'Could not filter sitemap index stylesheet content' );
  23. }
  24. /**
  25. * Test that sitemap stylesheet CSS can be filtered.
  26. */
  27. public function test_filter_sitemaps_stylesheet_css() {
  28. $stylesheet = new WP_Sitemaps_Stylesheet();
  29. add_filter( 'wp_sitemaps_stylesheet_css', '__return_empty_string' );
  30. $css = $stylesheet->get_stylesheet_css();
  31. $this->assertSame( '', $css, 'Could not filter sitemap stylesheet CSS' );
  32. }
  33. }