mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Posts, Post Types: In wp_trim_words() make sure the $num_words parameter is always an integer, as documented, to avoid a PHP warning.
Props donmhico, pikamander2. Fixes #47867. git-svn-id: https://develop.svn.wordpress.org/trunk@45796 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -73,4 +73,14 @@ class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
|
||||
restore_previous_locale();
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 47867
|
||||
*/
|
||||
function test_works_with_non_numeric_num_words() {
|
||||
$this->assertEquals( '', wp_trim_words( $this->long_text, '', '' ) );
|
||||
$this->assertEquals( '', wp_trim_words( $this->long_text, 'abc', '' ) );
|
||||
$this->assertEquals( '', wp_trim_words( $this->long_text, null, '' ) );
|
||||
$this->assertEquals( 'Lorem ipsum dolor', wp_trim_words( $this->long_text, '3', '' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user