You are here

public function BambooTwigExtensionsTest::testTextTruncate in Bamboo Twig 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testTextTruncate()
  2. 8.2 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testTextTruncate()
  3. 8.4 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testTextTruncate()

Cover the \Twig_Extensions_Extension_Text::twig_truncate_filter.

File

tests/src/Functional/BambooTwigExtensionsTest.php, line 25

Class

BambooTwigExtensionsTest
Tests Extensions twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testTextTruncate() {
  $this
    ->drupalGet('/bamboo-twig-extensions');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-1');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-1', 'Th...');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-2');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-2', 'This i...');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-3');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-3', 'This...');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-4');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-4', 'This[...]');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-5');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-5', 'This is a very long sen...');
  $this
    ->assertElementPresent('.test-extensions div.text-truncat-6');
  $this
    ->assertElementContains('.test-extensions div.text-truncat-6', 'This is a very long sentence.', 23, TRUE, '...', 'This is a very long sentence.');
}