mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Tests: Expand sanitize_text_field() tests.
This change ensures that the `sanitize_text_field` and `sanitize_textarea_field` filters are correctly invoked for the respective functions. Follow-up to [38944]. Props pbearne, audrasjb. Fixes #60357. git-svn-id: https://develop.svn.wordpress.org/trunk@57368 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5c4b4887bf
commit
0c4cc89447
@ -143,4 +143,26 @@ class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 60357
|
||||
*/
|
||||
public function test_sanitize_text_field_filter() {
|
||||
$filter = new MockAction();
|
||||
add_filter( 'sanitize_text_field', array( $filter, 'filter' ) );
|
||||
|
||||
$this->assertSame( 'example', sanitize_text_field( 'example' ) );
|
||||
$this->assertSame( 1, $filter->get_call_count(), 'The sanitize_text_field filter was not called.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 60357
|
||||
*/
|
||||
public function test_sanitize_textarea_field_filter() {
|
||||
$filter = new MockAction();
|
||||
add_filter( 'sanitize_textarea_field', array( $filter, 'filter' ) );
|
||||
|
||||
$this->assertSame( 'example', sanitize_textarea_field( 'example' ) );
|
||||
$this->assertSame( 1, $filter->get_call_count(), 'The sanitize_textarea_field filter was not called.' );
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user