public function TruncateTextTest::testTruncateTextByCharAndWordSafe in Tamper 8
Test Truncate Text By Characters And WordSafe.
File
- tests/
src/ Unit/ Plugin/ Tamper/ TruncateTextTest.php, line 52
Class
- TruncateTextTest
- Tests the Truncate Text plugin.
Namespace
Drupal\Tests\tamper\Unit\Plugin\TamperCode
public function testTruncateTextByCharAndWordSafe() {
$config = [
TruncateText::SETTING_NUM_CHAR => 12,
TruncateText::SETTING_ELLIPSE => FALSE,
TruncateText::SETTING_WORDSAFE => TRUE,
];
$plugin = new TruncateText($config, 'truncate_text', [], $this
->getMockSourceDefinition());
$this
->assertEquals('Hello, how', $plugin
->tamper('Hello, how are you today?'));
}