Skip to content

Commit

Permalink
add unit test for archived label function/filter
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidnelson committed Jan 19, 2024
1 parent 504adcd commit edb71c2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/php/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,42 @@ public function setUp(): void {
);
}

/**
* Test the aps_archived_label_string() function.
*
* @since 0.3.9
*/
public function test_aps_archived_label_string() {

$string = 'Archived';

// Confirm the filter is applied.
\WP_Mock::expectFilter( 'aps_archived_label_string', $string );

// Confirm default condition is true.
$this->assertEquals( $string, aps_archived_label_string() );

}

/**
* Test the aps_is_excluded_post_type() function filters.
*
* @since 0.3.9
*/
public function test_aps_archived_label_string_filter() {

$string = 'Resolved';

// Pass false to the filter.
WP_Mock::onFilter( 'aps_archived_label_string' )
->with( 'Archived' )
->reply( $string );

// Confirm the filter is applied.
$this->assertEquals( $string, aps_archived_label_string() );

}

/**
* Test the aps_post_status_slug() function.
*
Expand Down

0 comments on commit edb71c2

Please sign in to comment.