Mercurial > hg > cmmr2012-drupal-site
diff core/modules/search/tests/src/Functional/SearchSimplifyTest.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
line wrap: on
line diff
--- a/core/modules/search/tests/src/Functional/SearchSimplifyTest.php Thu Feb 28 11:14:44 2019 +0000 +++ b/core/modules/search/tests/src/Functional/SearchSimplifyTest.php Thu Feb 28 13:11:55 2019 +0000 @@ -2,14 +2,20 @@ namespace Drupal\Tests\search\Functional; -use Drupal\Component\Utility\Unicode; +use Drupal\Tests\BrowserTestBase; /** * Tests that the search_simply() function works as intended. * * @group search */ -class SearchSimplifyTest extends SearchTestBase { +class SearchSimplifyTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['search']; + /** * Tests that all Unicode characters simplify correctly. */ @@ -21,7 +27,7 @@ // their own lines). So the even-numbered lines should simplify to nothing, // and the odd-numbered lines we need to split into shorter chunks and // verify that simplification doesn't lose any characters. - $input = file_get_contents(\Drupal::root() . '/core/modules/search/tests/UnicodeTest.txt'); + $input = file_get_contents($this->root . '/core/modules/search/tests/UnicodeTest.txt'); $basestrings = explode(chr(10), $input); $strings = []; foreach ($basestrings as $key => $string) { @@ -35,8 +41,8 @@ // Split this into 30-character chunks, so we don't run into limits // of truncation in search_simplify(). $start = 0; - while ($start < Unicode::strlen($string)) { - $newstr = Unicode::substr($string, $start, 30); + while ($start < mb_strlen($string)) { + $newstr = mb_substr($string, $start, 30); // Special case: leading zeros are removed from numeric strings, // and there's one string in this file that is numbers starting with // zero, so prepend a 1 on that string. @@ -50,7 +56,7 @@ } foreach ($strings as $key => $string) { $simplified = search_simplify($string); - $this->assertTrue(Unicode::strlen($simplified) >= Unicode::strlen($string), "Nothing is removed from string $key."); + $this->assertTrue(mb_strlen($simplified) >= mb_strlen($string), "Nothing is removed from string $key."); } // Test the low-numbered ASCII control characters separately. They are not