Skip to content

Commit

Permalink
Tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc committed Sep 15, 2024
1 parent 113476c commit 8cb6599
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/phpunit/MslsUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ protected function setUp(): void {
Functions\when( 'esc_url' )->returnArg();
Functions\when( '__' )->returnArg();
Functions\when( 'wp_kses' )->returnArg();
Functions\when( 'sanitize_text_field' )->returnArg();
}


Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/TestMslsPostTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@ public function test_init(): void {
* Verify the static suggest-method
*/
public function test_suggest(): void {
$term = \Mockery::mock( \WP_Term::class );
$term->term_id = 42;
$term->name = 'test';

Functions\expect( 'wp_die' );
Functions\expect( 'filter_has_var' )->atLeast()->once()->andReturnTrue();
Functions\expect( 'filter_input' )->atLeast()->once()->andReturn( 'suggest_terms' );
Functions\expect( 'switch_to_blog' )->atLeast()->once();
Functions\expect( 'restore_current_blog' )->atLeast()->once();
Functions\expect( 'get_terms' )->atLeast()->once()->andReturn( array( $term ) );

self::expectOutputString( '' );

Expand Down

0 comments on commit 8cb6599

Please sign in to comment.