本文整理汇总了PHP中TextHelper::wordSafeShortText方法的典型用法代码示例。如果您正苦于以下问题:PHP TextHelper::wordSafeShortText方法的具体用法?PHP TextHelper::wordSafeShortText怎么用?PHP TextHelper::wordSafeShortText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextHelper
的用法示例。
在下文中一共展示了TextHelper::wordSafeShortText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWordSafeShortText
public function testWordSafeShortText()
{
$this->assertEquals("This is a simple test...", $this->object->wordSafeShortText("This is a simple test case", 24, "..."));
$this->assertEquals("This is a simple test etc", $this->object->wordSafeShortText("This is a simple test case", 22, " etc"));
$this->assertEquals("This is a simple test.", $this->object->wordSafeShortText("This is a simple test case", 21, "."));
$this->assertEquals("The quick brown fox jumps over the lazy dog", $this->object->wordSafeShortText("The quick brown fox jumps over the lazy dog"));
$this->assertEquals("The lazy fox jumps over the quick brown dog", $this->object->wordSafeShortText("The lazy fox jumps over the quick brown dog", 0));
$this->assertEquals("This_is_a_simple_test_ca…", $this->object->wordSafeShortText("This_is_a_simple_test_case", 24, "…"));
}
示例2: testWordSafeShortText
/**
* @dataProvider shortenDataProvider
*/
public function testWordSafeShortText($expected, $input1, $input2, $input3)
{
$this->assertEquals($expected, $this->object->wordSafeShortText($input1, $input2, $input3));
}