You are here

public function TruncateTextTest::testTruncateTextOnlyByChar in Tamper 8

Test Truncate Text Only By Characters.

File

tests/src/Unit/Plugin/Tamper/TruncateTextTest.php, line 25

Class

TruncateTextTest
Tests the Truncate Text plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testTruncateTextOnlyByChar() {
  $config = [
    TruncateText::SETTING_NUM_CHAR => 5,
    TruncateText::SETTING_ELLIPSE => FALSE,
    TruncateText::SETTING_WORDSAFE => FALSE,
  ];
  $plugin = new TruncateText($config, 'truncate_text', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('Hello', $plugin
    ->tamper('Hello, how are you today?'));
}