SanitizeTitle.php 504 B

123456789101112131415161718
  1. <?php
  2. /**
  3. * @group formatting
  4. */
  5. class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase {
  6. function test_strips_html() {
  7. $input = 'Captain <strong>Awesome</strong>';
  8. $expected = 'captain-awesome';
  9. $this->assertSame( $expected, sanitize_title( $input ) );
  10. }
  11. function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
  12. $input = '<strong></strong>';
  13. $fallback = 'Captain Awesome';
  14. $this->assertSame( $fallback, sanitize_title( $input, $fallback ) );
  15. }
  16. }