Commit 80eccb18 authored by alexpott's avatar alexpott

Issue #2361823 by rpayanm, javivf: Remove usage of drupal_strtolower().

parent 51fcd31c
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Core\Database\Driver\pgsql; namespace Drupal\Core\Database\Driver\pgsql;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\Condition; use Drupal\Core\Database\Query\Condition;
use Drupal\Core\Database\SchemaObjectExistsException; use Drupal\Core\Database\SchemaObjectExistsException;
...@@ -294,7 +295,7 @@ protected function processField($field) { ...@@ -294,7 +295,7 @@ protected function processField($field) {
// Set the correct database-engine specific datatype. // Set the correct database-engine specific datatype.
// In case one is already provided, force it to lowercase. // In case one is already provided, force it to lowercase.
if (isset($field['pgsql_type'])) { if (isset($field['pgsql_type'])) {
$field['pgsql_type'] = drupal_strtolower($field['pgsql_type']); $field['pgsql_type'] = Unicode::strtolower($field['pgsql_type']);
} }
else { else {
$map = $this->getFieldTypeMap(); $map = $this->getFieldTypeMap();
......
...@@ -165,7 +165,7 @@ public function testBlockDelete() { ...@@ -165,7 +165,7 @@ public function testBlockDelete() {
// Place the block. // Place the block.
$instance = array( $instance = array(
'id' => drupal_strtolower($edit['info[0][value]']), 'id' => Unicode::strtolower($edit['info[0][value]']),
'settings[label]' => $edit['info[0][value]'], 'settings[label]' => $edit['info[0][value]'],
'region' => 'sidebar_first', 'region' => 'sidebar_first',
); );
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
namespace Drupal\block_content\Tests; namespace Drupal\block_content\Tests;
use Drupal\Component\Utility\Unicode;
/** /**
* Tests block fieldability. * Tests block fieldability.
...@@ -55,7 +56,7 @@ public function testBlockFields() { ...@@ -55,7 +56,7 @@ public function testBlockFields() {
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = entity_create('field_storage_config', array(
'field_name' => drupal_strtolower($this->randomMachineName()), 'field_name' => Unicode::strtolower($this->randomMachineName()),
'entity_type' => 'block_content', 'entity_type' => 'block_content',
'type' => 'link', 'type' => 'link',
'cardinality' => 2, 'cardinality' => 2,
...@@ -93,7 +94,7 @@ public function testBlockFields() { ...@@ -93,7 +94,7 @@ public function testBlockFields() {
$url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default'); $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
// Place the block. // Place the block.
$instance = array( $instance = array(
'id' => drupal_strtolower($edit['info[0][value]']), 'id' => Unicode::strtolower($edit['info[0][value]']),
'settings[label]' => $edit['info[0][value]'], 'settings[label]' => $edit['info[0][value]'],
'region' => 'sidebar_first', 'region' => 'sidebar_first',
); );
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
namespace Drupal\block_content\Tests; namespace Drupal\block_content\Tests;
use Drupal\Component\Utility\Unicode;
/** /**
* Create a block and test block edit functionality. * Create a block and test block edit functionality.
...@@ -24,7 +25,7 @@ public function testPageEdit() { ...@@ -24,7 +25,7 @@ public function testPageEdit() {
$body_key = 'body[0][value]'; $body_key = 'body[0][value]';
// Create block to edit. // Create block to edit.
$edit = array(); $edit = array();
$edit['info[0][value]'] = drupal_strtolower($this->randomMachineName(8)); $edit['info[0][value]'] = Unicode::strtolower($this->randomMachineName(8));
$edit[$body_key] = $this->randomMachineName(16); $edit[$body_key] = $this->randomMachineName(16);
$this->drupalPostForm('block/add/basic', $edit, t('Save')); $this->drupalPostForm('block/add/basic', $edit, t('Save'));
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Allows users to change the color scheme of themes. * Allows users to change the color scheme of themes.
*/ */
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Asset\CssOptimizer; use Drupal\Core\Asset\CssOptimizer;
use Drupal\Component\Utility\Bytes; use Drupal\Component\Utility\Bytes;
use Drupal\Component\Utility\Environment; use Drupal\Component\Utility\Environment;
...@@ -515,7 +516,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) { ...@@ -515,7 +516,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
// Prepare color conversion table. // Prepare color conversion table.
$conversion = $palette; $conversion = $palette;
foreach ($conversion as $k => $v) { foreach ($conversion as $k => $v) {
$conversion[$k] = drupal_strtolower($v); $conversion[$k] = Unicode::strtolower($v);
} }
$default = color_get_palette($theme, TRUE); $default = color_get_palette($theme, TRUE);
...@@ -534,7 +535,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) { ...@@ -534,7 +535,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
// Iterate over all the parts. // Iterate over all the parts.
foreach ($style as $chunk) { foreach ($style as $chunk) {
if ($is_color) { if ($is_color) {
$chunk = drupal_strtolower($chunk); $chunk = Unicode::strtolower($chunk);
// Check if this is one of the colors in the default palette. // Check if this is one of the colors in the default palette.
if ($key = array_search($chunk, $default)) { if ($key = array_search($chunk, $default)) {
$chunk = $conversion[$key]; $chunk = $conversion[$key];
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\config\Tests; namespace Drupal\config\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Archiver\ArchiveTar; use Drupal\Core\Archiver\ArchiveTar;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
...@@ -63,7 +64,7 @@ public function testExportImport() { ...@@ -63,7 +64,7 @@ public function testExportImport() {
$this->content_type = $this->drupalCreateContentType(); $this->content_type = $this->drupalCreateContentType();
// Create a field. // Create a field.
$this->fieldName = drupal_strtolower($this->randomMachineName()); $this->fieldName = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = entity_create('field_storage_config', array(
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'entity_type' => 'node', 'entity_type' => 'node',
......
...@@ -107,13 +107,13 @@ function testSiteWideContact() { ...@@ -107,13 +107,13 @@ function testSiteWideContact() {
$recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com'); $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
$max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH; $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
$max_length_exceeded = $max_length + 1; $max_length_exceeded = $max_length + 1;
$this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE); $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
$this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded))); $this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded)));
$this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE); $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
// Create first valid form. // Create first valid form.
$this->addContactForm($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE); $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
// Check that the form was created in site default language. // Check that the form was created in site default language.
...@@ -148,10 +148,10 @@ function testSiteWideContact() { ...@@ -148,10 +148,10 @@ function testSiteWideContact() {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Add more forms. // Add more forms.
$this->addContactForm(drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE); $this->addContactForm(Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->addContactForm($name = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE); $this->addContactForm($name = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
// Try adding a form that already exists. // Try adding a form that already exists.
...@@ -221,7 +221,7 @@ function testSiteWideContact() { ...@@ -221,7 +221,7 @@ function testSiteWideContact() {
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2])); $recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2]));
$contact_form = drupal_strtolower($this->randomMachineName(16)); $contact_form = Unicode::strtolower($this->randomMachineName(16));
$this->addContactForm($contact_form, $label, $recipients, '', FALSE); $this->addContactForm($contact_form, $label, $recipients, '', FALSE);
$this->drupalGet('admin/structure/contact'); $this->drupalGet('admin/structure/contact');
$this->clickLink(t('Edit')); $this->clickLink(t('Edit'));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\contact\Tests; namespace Drupal\contact\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\config\Tests\SchemaCheckTestTrait; use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\contact\Entity\Message; use Drupal\contact\Entity\Message;
...@@ -53,7 +54,7 @@ public function testContactStorage() { ...@@ -53,7 +54,7 @@ public function testContactStorage() {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Create first valid contact form. // Create first valid contact form.
$mail = 'simpletest@example.com'; $mail = 'simpletest@example.com';
$this->addContactForm($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [ $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [
'send_a_pony' => 1, 'send_a_pony' => 1,
]); ]);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\datetime\Tests; namespace Drupal\datetime\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Datetime\DrupalDateTime;
...@@ -52,7 +53,7 @@ protected function setUp() { ...@@ -52,7 +53,7 @@ protected function setUp() {
$this->drupalLogin($web_user); $this->drupalLogin($web_user);
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
...@@ -283,7 +284,7 @@ function testDefaultValue() { ...@@ -283,7 +284,7 @@ function testDefaultValue() {
$this->drupalCreateContentType(array('type' => 'date_content')); $this->drupalCreateContentType(array('type' => 'date_content'));
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$field_storage = entity_create('field_storage_config', array( $field_storage = entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\entity_reference; namespace Drupal\entity_reference;
use Drupal\Component\Utility\Tags; use Drupal\Component\Utility\Tags;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
...@@ -86,7 +87,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity ...@@ -86,7 +87,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
// Get the typed string, if exists from the URL. // Get the typed string, if exists from the URL.
$items_typed = $request->query->get('q'); $items_typed = $request->query->get('q');
$items_typed = Tags::explode($items_typed); $items_typed = Tags::explode($items_typed);
$last_item = drupal_strtolower(array_pop($items_typed)); $last_item = Unicode::strtolower(array_pop($items_typed));
$prefix = ''; $prefix = '';
// The user entered a comma-separated list of entity labels, so we generate // The user entered a comma-separated list of entity labels, so we generate
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\entity_reference\Tests; namespace Drupal\entity_reference\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -42,7 +43,7 @@ function testEntityReferenceDefaultValue() { ...@@ -42,7 +43,7 @@ function testEntityReferenceDefaultValue() {
// Create a node to be referenced. // Create a node to be referenced.
$referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content')); $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content'));
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$field_storage = entity_create('field_storage_config', array( $field_storage = entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\entity_reference\Tests; namespace Drupal\entity_reference\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageInterface;
...@@ -51,7 +52,7 @@ protected function setUp() { ...@@ -51,7 +52,7 @@ protected function setUp() {
$this->vocabulary = entity_create('taxonomy_vocabulary', array( $this->vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'vid' => drupal_strtolower($this->randomMachineName()), 'vid' => Unicode::strtolower($this->randomMachineName()),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
)); ));
$this->vocabulary->save(); $this->vocabulary->save();
...@@ -152,7 +153,7 @@ public function testConfigEntityReferenceItem() { ...@@ -152,7 +153,7 @@ public function testConfigEntityReferenceItem() {
// Make sure the computed term reflects updates to the term id. // Make sure the computed term reflects updates to the term id.
$vocabulary2 = entity_create('taxonomy_vocabulary', array( $vocabulary2 = entity_create('taxonomy_vocabulary', array(
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'vid' => drupal_strtolower($this->randomMachineName()), 'vid' => Unicode::strtolower($this->randomMachineName()),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
)); ));
$vocabulary2->save(); $vocabulary2->save();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field\Tests\Boolean; namespace Drupal\field\Tests\Boolean;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
...@@ -63,7 +64,7 @@ function testBooleanField() { ...@@ -63,7 +64,7 @@ function testBooleanField() {
$label = $this->randomMachineName(); $label = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$this->field_storage = FieldStorageConfig::create(array( $this->field_storage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field\Tests\Email; namespace Drupal\field\Tests\Email;
use Drupal\Component\Utility\Unicode;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -53,7 +54,7 @@ protected function setUp() { ...@@ -53,7 +54,7 @@ protected function setUp() {
*/ */
function testEmailField() { function testEmailField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
/** /**
...@@ -282,7 +283,7 @@ function testEntityCreateRenameBundle() { ...@@ -282,7 +283,7 @@ function testEntityCreateRenameBundle() {
$cardinality = $this->fieldTestData->field_storage->getCardinality(); $cardinality = $this->fieldTestData->field_storage->getCardinality();
// Create a new bundle. // Create a new bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName()); $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
entity_test_create_bundle($new_bundle, NULL, $entity_type); entity_test_create_bundle($new_bundle, NULL, $entity_type);
// Add a field to that bundle. // Add a field to that bundle.
...@@ -299,7 +300,7 @@ function testEntityCreateRenameBundle() { ...@@ -299,7 +300,7 @@ function testEntityCreateRenameBundle() {
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, "Data is retrieved for the new bundle"); $this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, "Data is retrieved for the new bundle");
// Rename the bundle. // Rename the bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName()); $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
entity_test_rename_bundle($this->fieldTestData->field_definition['bundle'], $new_bundle, $entity_type); entity_test_rename_bundle($this->fieldTestData->field_definition['bundle'], $new_bundle, $entity_type);
// Check that the field definition has been updated. // Check that the field definition has been updated.
...@@ -321,7 +322,7 @@ function testEntityDeleteBundle() { ...@@ -321,7 +322,7 @@ function testEntityDeleteBundle() {
$this->createFieldWithStorage('', $entity_type); $this->createFieldWithStorage('', $entity_type);
// Create a new bundle. // Create a new bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName()); $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
entity_test_create_bundle($new_bundle, NULL, $entity_type); entity_test_create_bundle($new_bundle, NULL, $entity_type);
// Add a field to that bundle. // Add a field to that bundle.
...@@ -329,7 +330,7 @@ function testEntityDeleteBundle() { ...@@ -329,7 +330,7 @@ function testEntityDeleteBundle() {
entity_create('field_config', $this->fieldTestData->field_definition)->save(); entity_create('field_config', $this->fieldTestData->field_definition)->save();
// Create a second field for the test bundle // Create a second field for the test bundle
$field_name = drupal_strtolower($this->randomMachineName() . '_field_name'); $field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
$field_storage = array( $field_storage = array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Field\FieldException; use Drupal\Core\Field\FieldException;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
...@@ -44,7 +45,7 @@ function setUp() { ...@@ -44,7 +45,7 @@ function setUp() {
parent::setUp(); parent::setUp();
$this->fieldStorageDefinition = array( $this->fieldStorageDefinition = array(
'field_name' => drupal_strtolower($this->randomMachineName()), 'field_name' => Unicode::strtolower($this->randomMachineName()),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'test_field', 'type' => 'test_field',
); );
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
...@@ -89,7 +90,7 @@ protected function createFieldWithStorage($suffix = '', $entity_type = 'entity_t ...@@ -89,7 +90,7 @@ protected function createFieldWithStorage($suffix = '', $entity_type = 'entity_t
$field = 'field' . $suffix; $field = 'field' . $suffix;
$field_definition = 'field_definition' . $suffix; $field_definition = 'field_definition' . $suffix;
$this->fieldTestData->$field_name = drupal_strtolower($this->randomMachineName() . '_field_name' . $suffix); $this->fieldTestData->$field_name = Unicode::strtolower($this->randomMachineName() . '_field_name' . $suffix);
$this->fieldTestData->$field_storage = entity_create('field_storage_config', array( $this->fieldTestData->$field_storage = entity_create('field_storage_config', array(
'field_name' => $this->fieldTestData->$field_name, 'field_name' => $this->fieldTestData->$field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\field\Tests\Number; namespace Drupal\field\Tests\Number;
use Drupal\Component\Utility\Unicode;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
...@@ -42,7 +43,7 @@ protected function setUp() { ...@@ -42,7 +43,7 @@ protected function setUp() {
*/ */
function testNumberDecimalField() { function testNumberDecimalField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = drupal_strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
entity_create('field_storage_config', array( entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
...@@ -132,7 +133,7 @@ function testNumberIntegerField() { ...@@ -132,7 +133,7 @@ function testNumberIntegerField() {