function TruncateDeprecateTest::testDeprecateViewsUiTruncate

Same name and namespace in other branches
  1. 10 core/modules/views_ui/tests/src/Kernel/TruncateDeprecateTest.php \Drupal\Tests\views_ui\Kernel\TruncateDeprecateTest::testDeprecateViewsUiTruncate()

Tests the deprecation of views_ui_truncate() replaced by Unicode::truncate.

@group legacy

File

core/modules/views_ui/tests/src/Kernel/TruncateDeprecateTest.php, line 26

Class

TruncateDeprecateTest
Tests the deprecation of <a href="/api/drupal/core%21modules%21views_ui%21views_ui.module/function/views_ui_truncate/10" title="Truncate strings to a set length and provide a &#039;...&#039; if they truncated." class="local">views_ui_truncate</a>() function.

Namespace

Drupal\Tests\views_ui\Kernel

Code

public function testDeprecateViewsUiTruncate() {
    $string = 'one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen';
    $short_string = views_ui_truncate($string, 80);
    $this->expectDeprecation('views_ui_truncate() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \\Drupal\\Component\\Utility\\Unicode::truncate(). See https://www.drupal.org/node/3408283');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.