Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion tests/phpunit/tests/general/singleTermTitle.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

/**
* Tests for the `single_term_title()` function.
* Tests for the `single_term_title()`, `single_cat_title()`, and `single_tag_title()` functions.
*
* @group general
* @group template
* @group taxonomy
*
* @covers ::single_term_title
* @covers ::single_cat_title
* @covers ::single_tag_title
*/
class Tests_General_SingleTermTitle extends WP_UnitTestCase {

Expand Down Expand Up @@ -250,4 +252,36 @@ public function test_empty_filtered_title_returns_null() {
$this->assertNull( single_term_title( 'Archive: ' ), 'Displaying should return null.' );
$this->assertNull( single_term_title( 'Archive: ', false ), 'Returning should return null.' );
}

/**
* Tests that single_cat_title() displays and returns category title.
*
* @ticket 65819
*
* @covers ::single_cat_title

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: the class docblock already has these @covers tags, and the other tests here don't repeat them. Feel free to drop this one and the one at line 277.

*/
public function test_single_cat_title_displays_and_returns() {
$this->go_to_archive( 'category' );

$this->assertSame( 'Category: News &amp; Notes', single_cat_title( 'Category: ', false ) );

$this->expectOutputString( 'Category: News &amp; Notes' );
single_cat_title( 'Category: ' );
}

/**
* Tests that single_tag_title() displays and returns tag title.
*
* @ticket 65819
*
* @covers ::single_tag_title
*/
public function test_single_tag_title_displays_and_returns() {
$this->go_to_archive( 'tag' );

$this->assertSame( 'Tag: Featured', single_tag_title( 'Tag: ', false ) );

$this->expectOutputString( 'Tag: Featured' );
single_tag_title( 'Tag: ' );
}
}
Loading