public function BambooTwigExtensionsTest::testTextTruncate in Bamboo Twig 8.5
Same name and namespace in other branches
- 8.2 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testTextTruncate()
- 8.3 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testTextTruncate()
- 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 26
Class
- BambooTwigExtensionsTest
- Tests Extensions twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
public function testTextTruncate() {
$this
->drupalGet('/bamboo-twig-extensions');
$this
->assertSession()
->elementExists('css', '.test-extensions div.text-truncat-1');
$this
->assertElementContains('.test-extensions div.text-truncat-1', 'Th...');
$this
->assertSession()
->elementExists('css', '.test-extensions div.text-truncat-2');
$this
->assertElementContains('.test-extensions div.text-truncat-2', 'This i...');
$this
->assertSession()
->elementExists('css', '.test-extensions div.text-truncat-3');
$this
->assertElementContains('.test-extensions div.text-truncat-3', 'This...');
$this
->assertSession()
->elementExists('css', '.test-extensions div.text-truncat-4');
$this
->assertElementContains('.test-extensions div.text-truncat-4', 'This[...]');
$this
->assertSession()
->elementExists('css', '.test-extensions div.text-truncat-5');
$this
->assertElementContains('.test-extensions div.text-truncat-5', 'This is a very long sen...');
$this
->assertSession()
->elementExists('css', '.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.');
}