Changeset 52010 for trunk/tests/phpunit/tests/formatting/wpTrimWords.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/wpTrimWords.php
r51623 r52010 15 15 private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit mollis viverra. Pellentesque id urna euismod dolor cursus sagittis.'; 16 16 17 function test_trims_to_55_by_default() {17 public function test_trims_to_55_by_default() { 18 18 $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit…'; 19 19 $this->assertSame( $trimmed, wp_trim_words( $this->long_text ) ); 20 20 } 21 21 22 function test_trims_to_10() {22 public function test_trims_to_10() { 23 23 $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius…'; 24 24 $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 10 ) ); 25 25 } 26 26 27 function test_trims_to_5_and_uses_custom_more() {27 public function test_trims_to_5_and_uses_custom_more() { 28 28 $trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!'; 29 29 $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) ); 30 30 } 31 31 32 function test_strips_tags_before_trimming() {32 public function test_strips_tags_before_trimming() { 33 33 $text = 'This text contains a <a href="http://wordpress.org"> link </a> to WordPress.org!'; 34 34 $trimmed = 'This text contains a link…'; … … 39 39 * @ticket 18726 40 40 */ 41 function test_strips_script_and_style_content() {41 public function test_strips_script_and_style_content() { 42 42 $trimmed = 'This text contains. It should go.'; 43 43 … … 49 49 } 50 50 51 function test_doesnt_trim_short_text() {51 public function test_doesnt_trim_short_text() { 52 52 $text = 'This is some short text.'; 53 53 $this->assertSame( $text, wp_trim_words( $text ) ); … … 57 57 * @ticket 44541 58 58 */ 59 function test_trims_to_20_counted_by_chars() {59 public function test_trims_to_20_counted_by_chars() { 60 60 switch_to_locale( 'ja_JP' ); 61 61 $expected = substr( $this->long_text, 0, 20 ) . '…'; … … 68 68 * @ticket 44541 69 69 */ 70 function test_trims_to_20_counted_by_chars_with_double_width_chars() {70 public function test_trims_to_20_counted_by_chars_with_double_width_chars() { 71 71 switch_to_locale( 'ja_JP' ); 72 72 $text = str_repeat( 'あ', 100 ); … … 80 80 * @ticket 47867 81 81 */ 82 function test_works_with_non_numeric_num_words() {82 public function test_works_with_non_numeric_num_words() { 83 83 $this->assertSame( '', wp_trim_words( $this->long_text, '', '' ) ); 84 84 $this->assertSame( '', wp_trim_words( $this->long_text, 'abc', '' ) );
Note: See TracChangeset
for help on using the changeset viewer.