Skip to content

Commit f3684d7

Browse files
authored
Merge pull request #376 from lloc/raise-coverage
Tests added
2 parents 7f79c18 + 8cb6599 commit f3684d7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/phpunit/MslsUnitTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function setUp(): void {
2626
Functions\when( 'esc_url' )->returnArg();
2727
Functions\when( '__' )->returnArg();
2828
Functions\when( 'wp_kses' )->returnArg();
29+
Functions\when( 'sanitize_text_field' )->returnArg();
2930
}
3031

3132

tests/phpunit/TestMslsPostTag.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ public function test_init(): void {
6161
* Verify the static suggest-method
6262
*/
6363
public function test_suggest(): void {
64+
$term = \Mockery::mock( \WP_Term::class );
65+
$term->term_id = 42;
66+
$term->name = 'test';
67+
6468
Functions\expect( 'wp_die' );
69+
Functions\expect( 'filter_has_var' )->atLeast()->once()->andReturnTrue();
70+
Functions\expect( 'filter_input' )->atLeast()->once()->andReturn( 'suggest_terms' );
71+
Functions\expect( 'switch_to_blog' )->atLeast()->once();
72+
Functions\expect( 'restore_current_blog' )->atLeast()->once();
73+
Functions\expect( 'get_terms' )->atLeast()->once()->andReturn( array( $term ) );
6574

6675
self::expectOutputString( '' );
6776

0 commit comments

Comments
 (0)