wordpress-develop/tests/phpunit/tests/formatting/wpHtmlExcerpt.php
Andrew Ozz 5a3f8484d6 Build/Test Tools, Formatting group:
- Add and update @covers tags.
- Add and improve docs and inline comments.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53562 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 20:27:34 +00:00

22 lines
750 B
PHP

<?php
/**
* @group formatting
*
* @covers ::wp_html_excerpt
*/
class Tests_Formatting_wpHtmlExcerpt extends WP_UnitTestCase {
public function test_simple() {
$this->assertSame( 'Baba', wp_html_excerpt( 'Baba told me not to come', 4 ) );
}
public function test_html() {
$this->assertSame( 'Baba', wp_html_excerpt( "<a href='http://baba.net/'>Baba</a> told me not to come", 4 ) );
}
public function test_entities() {
$this->assertSame( 'Baba', wp_html_excerpt( 'Baba &amp; Dyado', 8 ) );
$this->assertSame( 'Baba', wp_html_excerpt( 'Baba &#038; Dyado', 8 ) );
$this->assertSame( 'Baba &amp; D', wp_html_excerpt( 'Baba &amp; Dyado', 12 ) );
$this->assertSame( 'Baba &amp; Dyado', wp_html_excerpt( 'Baba &amp; Dyado', 100 ) );
}
}