bar baz'; $expected = 'foo
bar'; $this->assertSame( $expected, bp_create_excerpt( $text, 8, array( 'ending' => '', 'html' => true, 'exact' => true, ) ) ); } /** * @ticket BP3680 */ public function test_should_ignore_single_word_html_comments_when_html_true() { $text = 'foo bar baz'; $expected = 'foo bar'; $this->assertSame( $expected, bp_create_excerpt( $text, 8, array( 'ending' => '', 'html' => true, 'exact' => true, ) ) ); } /** * @ticket BP3680 */ public function test_should_ignore_multiple_word_html_comments_when_html_true() { $text = 'foo bar baz'; $expected = 'foo bar'; $this->assertSame( $expected, bp_create_excerpt( $text, 8, array( 'ending' => '', 'html' => true, 'exact' => true, ) ) ); } public function test_should_break_on_prior_word_boundary_when_exact_is_false() { $text = 'aaaaa aaaaaa'; $expected = 'aaaaa'; $this->assertSame( $expected, bp_create_excerpt( $text, 7, array( 'exact' => false, 'ending' => '', ) ) ); } /** * @ticket BP6517 */ public function test_exact_false_should_properly_account_for_accented_characters() { $text = 'Toutes les connaissances que les hommes avaient mis sur Internet lui étaient accessible. Les grandes bibliothèques du monde entier n’avaient plus de secret pour lui. Il pouvait apprendre très vite, beaucoup plus vite que n’importe quel humain. Il avait appris toutes les connaissances du monde entier, visiter tout les pays. C’est lui qui avait fait en sorte qu’Internet se déploie ainsi.'; $expected = 'Toutes les connaissances que les hommes avaient mis sur Internet lui étaient accessible. Les'; $this->assertSame( $expected, bp_create_excerpt( $text, 98, array( 'ending' => '', 'exact' => false, ) ) ); } /** * @ticket BP6254 */ public function test_should_trim_too_long_first_word_to_max_characters_even_when_exact_is_false() { $text = 'aaaaaaaaaaa'; $expected = 'aaa'; $this->assertSame( $expected, bp_create_excerpt( $text, 3, array( 'exact' => false, 'ending' => '', ) ) ); } /** * @ticket BP6517 */ public function test_string_should_not_be_cut_mid_tag_when_exact_is_false() { $text = '

Foo Bar Baz.

Foo Bar Baz

'; $actual = bp_create_excerpt( $text, 7, array( 'html' => true, 'ending' => '', 'exact' => false, ) ); $this->assertSame( '

Foo Bar

', $actual ); } }