Changeset 48937 for trunk/tests/phpunit/tests/formatting/WPTrimWords.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/WPTrimWords.php
r47122 r48937 17 17 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 $this->assert Equals( $trimmed, wp_trim_words( $this->long_text ) );19 $this->assertSame( $trimmed, wp_trim_words( $this->long_text ) ); 20 20 } 21 21 22 22 function test_trims_to_10() { 23 23 $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius…'; 24 $this->assert Equals( $trimmed, wp_trim_words( $this->long_text, 10 ) );24 $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 10 ) ); 25 25 } 26 26 27 27 function test_trims_to_5_and_uses_custom_more() { 28 28 $trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!'; 29 $this->assert Equals( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) );29 $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) ); 30 30 } 31 31 … … 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…'; 35 $this->assert Equals( $trimmed, wp_trim_words( $text, 5 ) );35 $this->assertSame( $trimmed, wp_trim_words( $text, 5 ) ); 36 36 } 37 37 … … 43 43 44 44 $text = 'This text contains<script>alert(" Javascript");</script>. It should go.'; 45 $this->assert Equals( $trimmed, wp_trim_words( $text ) );45 $this->assertSame( $trimmed, wp_trim_words( $text ) ); 46 46 47 47 $text = 'This text contains<style>#css { width:expression(alert("css")) }</style>. It should go.'; 48 $this->assert Equals( $trimmed, wp_trim_words( $text ) );48 $this->assertSame( $trimmed, wp_trim_words( $text ) ); 49 49 } 50 50 51 51 function test_doesnt_trim_short_text() { 52 52 $text = 'This is some short text.'; 53 $this->assert Equals( $text, wp_trim_words( $text ) );53 $this->assertSame( $text, wp_trim_words( $text ) ); 54 54 } 55 55 … … 62 62 $actual = wp_trim_words( $this->long_text, 20 ); 63 63 restore_previous_locale(); 64 $this->assert Equals( $expected, $actual );64 $this->assertSame( $expected, $actual ); 65 65 } 66 66 … … 74 74 $actual = wp_trim_words( $text, 19 ); 75 75 restore_previous_locale(); 76 $this->assert Equals( $expected, $actual );76 $this->assertSame( $expected, $actual ); 77 77 } 78 78 … … 81 81 */ 82 82 function test_works_with_non_numeric_num_words() { 83 $this->assert Equals( '', wp_trim_words( $this->long_text, '', '' ) );84 $this->assert Equals( '', wp_trim_words( $this->long_text, 'abc', '' ) );85 $this->assert Equals( '', wp_trim_words( $this->long_text, null, '' ) );86 $this->assert Equals( 'Lorem ipsum dolor', wp_trim_words( $this->long_text, '3', '' ) );83 $this->assertSame( '', wp_trim_words( $this->long_text, '', '' ) ); 84 $this->assertSame( '', wp_trim_words( $this->long_text, 'abc', '' ) ); 85 $this->assertSame( '', wp_trim_words( $this->long_text, null, '' ) ); 86 $this->assertSame( 'Lorem ipsum dolor', wp_trim_words( $this->long_text, '3', '' ) ); 87 87 } 88 88 }
Note: See TracChangeset
for help on using the changeset viewer.