Issue #3376281 by Indrapatil, nlisgo, longwave, smustgrave: Random machine names no longer need to be wrapped in strtolower()

merge-requests/4526/head
Lauri Eskola 2023-08-01 21:32:45 +03:00
parent a9199caf7c
commit b175481f32
No known key found for this signature in database
GPG Key ID: 382FC0F5B0DF53F8
173 changed files with 331 additions and 331 deletions

View File

@ -44,7 +44,7 @@ class BlockHookOperationTest extends BrowserTestBase {
public function testBlockOperationAlter() { public function testBlockOperationAlter() {
// Add a test block, any block will do. // Add a test block, any block will do.
// Set the machine name so the test_operation link can be built later. // Set the machine name so the test_operation link can be built later.
$block_id = mb_strtolower($this->randomMachineName(16)); $block_id = $this->randomMachineName(16);
$this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]); $this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]);
// Get the Block listing. // Get the Block listing.

View File

@ -79,7 +79,7 @@ class BlockLanguageTest extends BrowserTestBase {
// Enable a standard block and set the visibility setting for one language. // Enable a standard block and set the visibility setting for one language.
$edit = [ $edit = [
'visibility[language][langcodes][en]' => TRUE, 'visibility[language][langcodes][en]' => TRUE,
'id' => strtolower($this->randomMachineName(8)), 'id' => $this->randomMachineName(8),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
]; ];
$this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme); $this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
@ -165,7 +165,7 @@ class BlockLanguageTest extends BrowserTestBase {
$this->assertSession()->fieldExists('visibility[language][context_mapping][language]'); $this->assertSession()->fieldExists('visibility[language][context_mapping][language]');
// Enable a standard block and set visibility to French only. // Enable a standard block and set visibility to French only.
$block_id = strtolower($this->randomMachineName(8)); $block_id = $this->randomMachineName(8);
$edit = [ $edit = [
'visibility[language][context_mapping][language]' => '@language.current_language_context:language_interface', 'visibility[language][context_mapping][language]' => '@language.current_language_context:language_interface',
'visibility[language][langcodes][fr]' => TRUE, 'visibility[language][langcodes][fr]' => TRUE,

View File

@ -30,7 +30,7 @@ class BlockTest extends BlockTestBase {
// Enable a standard block. // Enable a standard block.
$default_theme = $this->config('system.theme')->get('default'); $default_theme = $this->config('system.theme')->get('default');
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName(8)), 'id' => $this->randomMachineName(8),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
'settings[label]' => $title, 'settings[label]' => $title,
'settings[label_display]' => TRUE, 'settings[label_display]' => TRUE,
@ -90,7 +90,7 @@ class BlockTest extends BlockTestBase {
// Enable a standard block. // Enable a standard block.
$default_theme = $this->config('system.theme')->get('default'); $default_theme = $this->config('system.theme')->get('default');
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName(8)), 'id' => $this->randomMachineName(8),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
'settings[label]' => $title, 'settings[label]' => $title,
]; ];
@ -127,7 +127,7 @@ class BlockTest extends BlockTestBase {
// Enable a standard block. // Enable a standard block.
$default_theme = $this->config('system.theme')->get('default'); $default_theme = $this->config('system.theme')->get('default');
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName(8)), 'id' => $this->randomMachineName(8),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
'settings[label]' => $title, 'settings[label]' => $title,
'visibility[request_path][negate]' => TRUE, 'visibility[request_path][negate]' => TRUE,
@ -187,7 +187,7 @@ class BlockTest extends BlockTestBase {
// Create a random title for the block. // Create a random title for the block.
$title = $this->randomMachineName(8); $title = $this->randomMachineName(8);
$block_id = strtolower($this->randomMachineName(8)); $block_id = $this->randomMachineName(8);
$edit = [ $edit = [
'id' => $block_id, 'id' => $block_id,
'settings[label]' => $title, 'settings[label]' => $title,
@ -304,7 +304,7 @@ class BlockTest extends BlockTestBase {
$this->assertSession()->titleEquals('Block layout | Drupal'); $this->assertSession()->titleEquals('Block layout | Drupal');
// Select the 'Powered by Drupal' block to be placed. // Select the 'Powered by Drupal' block to be placed.
$block = []; $block = [];
$block['id'] = strtolower($this->randomMachineName()); $block['id'] = $this->randomMachineName();
$block['theme'] = $theme; $block['theme'] = $theme;
$block['region'] = 'content'; $block['region'] = 'content';
$this->drupalGet('admin/structure/block/add/system_powered_by_block'); $this->drupalGet('admin/structure/block/add/system_powered_by_block');
@ -343,7 +343,7 @@ class BlockTest extends BlockTestBase {
$block_name = 'system_powered_by_block'; $block_name = 'system_powered_by_block';
// Create a random title for the block. // Create a random title for the block.
$title = $this->randomMachineName(8); $title = $this->randomMachineName(8);
$id = strtolower($this->randomMachineName(8)); $id = $this->randomMachineName(8);
// Enable a standard block. // Enable a standard block.
$default_theme = $this->config('system.theme')->get('default'); $default_theme = $this->config('system.theme')->get('default');
$edit = [ $edit = [

View File

@ -317,7 +317,7 @@ class BlockUiTest extends BrowserTestBase {
// Select the 'Powered by Drupal' block to be placed. // Select the 'Powered by Drupal' block to be placed.
$block = []; $block = [];
$block['id'] = strtolower($this->randomMachineName()); $block['id'] = $this->randomMachineName();
$block['theme'] = 'stark'; $block['theme'] = 'stark';
$block['region'] = 'content'; $block['region'] = 'content';

View File

@ -70,7 +70,7 @@ class DisplayBlockTest extends ViewTestBase {
// Create a new view in the UI. // Create a new view in the UI.
$edit = []; $edit = [];
$edit['label'] = $this->randomString(); $edit['label'] = $this->randomString();
$edit['id'] = strtolower($this->randomMachineName()); $edit['id'] = $this->randomMachineName();
$edit['show[wizard_key]'] = 'standard:views_test_data'; $edit['show[wizard_key]'] = 'standard:views_test_data';
$edit['description'] = $this->randomString(); $edit['description'] = $this->randomString();
$edit['block[create]'] = TRUE; $edit['block[create]'] = TRUE;

View File

@ -65,7 +65,7 @@ class BlockConfigSchemaTest extends KernelTestBase {
*/ */
public function testBlockConfigSchema() { public function testBlockConfigSchema() {
foreach ($this->blockManager->getDefinitions() as $block_id => $definition) { foreach ($this->blockManager->getDefinitions() as $block_id => $definition) {
$id = strtolower($this->randomMachineName()); $id = $this->randomMachineName();
$block = Block::create([ $block = Block::create([
'id' => $id, 'id' => $id,
'theme' => 'stark', 'theme' => 'stark',

View File

@ -35,15 +35,15 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
// Add two instances of the user login block. // Add two instances of the user login block.
$this->placeBlock('user_login_block', [ $this->placeBlock('user_login_block', [
'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)), 'id' => $default_theme . '_' . $this->randomMachineName(8),
]); ]);
$this->placeBlock('user_login_block', [ $this->placeBlock('user_login_block', [
'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)), 'id' => $default_theme . '_' . $this->randomMachineName(8),
]); ]);
// Add an instance of a different block. // Add an instance of a different block.
$this->placeBlock('system_powered_by_block', [ $this->placeBlock('system_powered_by_block', [
'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)), 'id' => $default_theme . '_' . $this->randomMachineName(8),
]); ]);
// Install a different theme that does not have blocks. // Install a different theme that does not have blocks.

View File

@ -43,7 +43,7 @@ trait BlockCreationTrait {
$settings += [ $settings += [
'plugin' => $plugin_id, 'plugin' => $plugin_id,
'region' => 'content', 'region' => 'content',
'id' => strtolower($this->randomMachineName(8)), 'id' => $this->randomMachineName(8),
'theme' => $config->get('system.theme')->get('default'), 'theme' => $config->get('system.theme')->get('default'),
'label' => $this->randomMachineName(8), 'label' => $this->randomMachineName(8),
'visibility' => [], 'visibility' => [],

View File

@ -108,7 +108,7 @@ abstract class BlockContentTestBase extends BrowserTestBase {
if (is_array($values)) { if (is_array($values)) {
if (!isset($values['id'])) { if (!isset($values['id'])) {
do { do {
$id = strtolower($this->randomMachineName(8)); $id = $this->randomMachineName(8);
} while (BlockContentType::load($id)); } while (BlockContentType::load($id));
} }
else { else {

View File

@ -88,7 +88,7 @@ class BlockContentTranslationUITest extends ContentTranslationUITestBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getNewEntityValues($langcode) { protected function getNewEntityValues($langcode) {
return ['info' => mb_strtolower($this->randomMachineName())] + parent::getNewEntityValues($langcode); return ['info' => $this->randomMachineName()] + parent::getNewEntityValues($langcode);
} }
/** /**

View File

@ -39,7 +39,7 @@ class PageEditTest extends BlockContentTestBase {
$body_key = 'body[0][value]'; $body_key = 'body[0][value]';
// Create block to edit. // Create block to edit.
$edit = []; $edit = [];
$edit['info[0][value]'] = mb_strtolower($this->randomMachineName(8)); $edit['info[0][value]'] = $this->randomMachineName(8);
$edit[$body_key] = $this->randomMachineName(16); $edit[$body_key] = $this->randomMachineName(16);
$this->drupalGet('block/add/basic'); $this->drupalGet('block/add/basic');
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');

View File

@ -88,7 +88,7 @@ abstract class BlockContentTestBase extends ViewTestBase {
// Find a non-existent random type name. // Find a non-existent random type name.
if (!isset($values['id'])) { if (!isset($values['id'])) {
do { do {
$id = strtolower($this->randomMachineName(8)); $id = $this->randomMachineName(8);
} while (BlockContentType::load($id)); } while (BlockContentType::load($id));
} }
else { else {

View File

@ -35,7 +35,7 @@ class BlockContentWizardTest extends BlockContentTestBase {
public function testViewAddBlockContent() { public function testViewAddBlockContent() {
$view = []; $view = [];
$view['label'] = $this->randomMachineName(16); $view['label'] = $this->randomMachineName(16);
$view['id'] = strtolower($this->randomMachineName(16)); $view['id'] = $this->randomMachineName(16);
$view['description'] = $this->randomMachineName(16); $view['description'] = $this->randomMachineName(16);
$view['page[create]'] = FALSE; $view['page[create]'] = FALSE;
$view['show[wizard_key]'] = 'block_content'; $view['show[wizard_key]'] = 'block_content';

View File

@ -309,7 +309,7 @@ class CommentInterfaceTest extends CommentTestBase {
$this->assertSession()->responseContains('<p>' . $comment_text . '</p>'); $this->assertSession()->responseContains('<p>' . $comment_text . '</p>');
// Create a new comment entity view mode. // Create a new comment entity view mode.
$mode = mb_strtolower($this->randomMachineName()); $mode = $this->randomMachineName();
EntityViewMode::create([ EntityViewMode::create([
'targetEntityType' => 'comment', 'targetEntityType' => 'comment',
'id' => "comment.$mode", 'id' => "comment.$mode",

View File

@ -44,7 +44,7 @@ class WizardTest extends WizardTestBase {
public function testCommentWizard() { public function testCommentWizard() {
$view = []; $view = [];
$view['label'] = $this->randomMachineName(16); $view['label'] = $this->randomMachineName(16);
$view['id'] = strtolower($this->randomMachineName(16)); $view['id'] = $this->randomMachineName(16);
$view['show[wizard_key]'] = 'comment'; $view['show[wizard_key]'] = 'comment';
$view['page[create]'] = TRUE; $view['page[create]'] = TRUE;
$view['page[path]'] = $this->randomMachineName(16); $view['page[path]'] = $this->randomMachineName(16);
@ -73,7 +73,7 @@ class WizardTest extends WizardTestBase {
} }
$this->assertEquals($expected_options, $actual_options); $this->assertEquals($expected_options, $actual_options);
$view['id'] = strtolower($this->randomMachineName(16)); $view['id'] = $this->randomMachineName(16);
$this->submitForm($view, 'Save and edit'); $this->submitForm($view, 'Save and edit');
// Verify that the view saving was successful and the browser got redirected // Verify that the view saving was successful and the browser got redirected
// to the edit page. // to the edit page.

View File

@ -58,7 +58,7 @@ class CommentIntegrationTest extends KernelTestBase {
* @see CommentDefaultFormatter::calculateDependencies() * @see CommentDefaultFormatter::calculateDependencies()
*/ */
public function testViewMode() { public function testViewMode() {
$mode = mb_strtolower($this->randomMachineName()); $mode = $this->randomMachineName();
// Create a new comment view mode and a view display entity. // Create a new comment view mode and a view display entity.
EntityViewMode::create([ EntityViewMode::create([
'id' => "comment.$mode", 'id' => "comment.$mode",
@ -75,7 +75,7 @@ class CommentIntegrationTest extends KernelTestBase {
FieldStorageConfig::create([ FieldStorageConfig::create([
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'comment', 'type' => 'comment',
'field_name' => $field_name = mb_strtolower($this->randomMachineName()), 'field_name' => $field_name = $this->randomMachineName(),
'settings' => [ 'settings' => [
'comment_type' => 'comment', 'comment_type' => 'comment',
], ],

View File

@ -31,7 +31,7 @@ class ConfigEntityStatusUITest extends BrowserTestBase {
'administer site configuration', 'administer site configuration',
])); ]));
$id = strtolower($this->randomMachineName()); $id = $this->randomMachineName();
$edit = [ $edit = [
'id' => $id, 'id' => $id,
'label' => $this->randomMachineName(), 'label' => $this->randomMachineName(),

View File

@ -230,7 +230,7 @@ class ConfigEntityTest extends BrowserTestBase {
'administer site configuration', 'administer site configuration',
])); ]));
$id = strtolower($this->randomMachineName()); $id = $this->randomMachineName();
$label1 = $this->randomMachineName(); $label1 = $this->randomMachineName();
$label2 = $this->randomMachineName(); $label2 = $this->randomMachineName();
$label3 = $this->randomMachineName(); $label3 = $this->randomMachineName();
@ -290,7 +290,7 @@ class ConfigEntityTest extends BrowserTestBase {
// Rename the configuration entity's ID/machine name. // Rename the configuration entity's ID/machine name.
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName()), 'id' => $this->randomMachineName(),
'label' => $label3, 'label' => $label3,
]; ];
$this->drupalGet("admin/structure/config_test/manage/{$id}"); $this->drupalGet("admin/structure/config_test/manage/{$id}");
@ -326,7 +326,7 @@ class ConfigEntityTest extends BrowserTestBase {
// @see \Drupal\Tests\config\FunctionalJavascript\ConfigEntityTest::testAjaxOnAddPage() // @see \Drupal\Tests\config\FunctionalJavascript\ConfigEntityTest::testAjaxOnAddPage()
$this->drupalGet('admin/structure/config_test/add'); $this->drupalGet('admin/structure/config_test/add');
$id = strtolower($this->randomMachineName()); $id = $this->randomMachineName();
$edit = [ $edit = [
'id' => $id, 'id' => $id,
'label' => $this->randomString(), 'label' => $this->randomString(),

View File

@ -106,7 +106,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
$this->contentType = $this->drupalCreateContentType(); $this->contentType = $this->drupalCreateContentType();
// Create a field. // Create a field.
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'entity_type' => 'node', 'entity_type' => 'node',

View File

@ -122,7 +122,7 @@ class ConfigTranslationCacheTest extends BrowserTestBase {
public function testFieldConfigTranslation() { public function testFieldConfigTranslation() {
// Add a test field which has a translatable field setting and a // Add a test field which has a translatable field setting and a
// translatable field storage setting. // translatable field storage setting.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -133,7 +133,7 @@ class ConfigTranslationCacheTest extends BrowserTestBase {
$field_storage->setSetting('translatable_storage_setting', $translatable_storage_setting); $field_storage->setSetting('translatable_storage_setting', $translatable_storage_setting);
$field_storage->save(); $field_storage->save();
$bundle = strtolower($this->randomMachineName()); $bundle = $this->randomMachineName();
entity_test_create_bundle($bundle); entity_test_create_bundle($bundle);
$field = FieldConfig::create([ $field = FieldConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,

View File

@ -104,7 +104,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
protected function doBlockListTest() { protected function doBlockListTest() {
// Add a test block, any block will do. // Add a test block, any block will do.
// Set the machine name so the translate link can be built later. // Set the machine name so the translate link can be built later.
$id = mb_strtolower($this->randomMachineName(16)); $id = $this->randomMachineName(16);
$this->drupalPlaceBlock('system_powered_by_block', ['id' => $id]); $this->drupalPlaceBlock('system_powered_by_block', ['id' => $id]);
// Get the Block listing. // Get the Block listing.
@ -127,7 +127,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// this does not test more than necessary. // this does not test more than necessary.
$this->drupalGet('admin/structure/menu/add'); $this->drupalGet('admin/structure/menu/add');
// Lowercase the machine name. // Lowercase the machine name.
$menu_name = mb_strtolower($this->randomMachineName(16)); $menu_name = $this->randomMachineName(16);
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$edit = [ $edit = [
'id' => $menu_name, 'id' => $menu_name,
@ -176,7 +176,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
$vocabulary = Vocabulary::create([ $vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(), 'description' => $this->randomMachineName(),
'vid' => mb_strtolower($this->randomMachineName()), 'vid' => $this->randomMachineName(),
]); ]);
$vocabulary->save(); $vocabulary->save();
@ -199,7 +199,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// Create a test block type to decouple looking for translate // Create a test block type to decouple looking for translate
// operations link so this does not test more than necessary. // operations link so this does not test more than necessary.
$block_content_type = BlockContentType::create([ $block_content_type = BlockContentType::create([
'id' => mb_strtolower($this->randomMachineName(16)), 'id' => $this->randomMachineName(16),
'label' => $this->randomMachineName(), 'label' => $this->randomMachineName(),
'revision' => FALSE, 'revision' => FALSE,
]); ]);
@ -224,7 +224,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// Create a test contact form to decouple looking for translate operations // Create a test contact form to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$contact_form = ContactForm::create([ $contact_form = ContactForm::create([
'id' => mb_strtolower($this->randomMachineName(16)), 'id' => $this->randomMachineName(16),
'label' => $this->randomMachineName(), 'label' => $this->randomMachineName(),
]); ]);
$contact_form->save(); $contact_form->save();
@ -248,7 +248,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// Create a test content type to decouple looking for translate operations // Create a test content type to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$content_type = $this->drupalCreateContentType([ $content_type = $this->drupalCreateContentType([
'type' => mb_strtolower($this->randomMachineName(16)), 'type' => $this->randomMachineName(16),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
]); ]);
@ -271,7 +271,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// Create a test format to decouple looking for translate operations // Create a test format to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$filter_format = FilterFormat::create([ $filter_format = FilterFormat::create([
'format' => mb_strtolower($this->randomMachineName(16)), 'format' => $this->randomMachineName(16),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
]); ]);
$filter_format->save(); $filter_format->save();
@ -295,7 +295,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
// Create a test shortcut to decouple looking for translate operations // Create a test shortcut to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$shortcut = ShortcutSet::create([ $shortcut = ShortcutSet::create([
'id' => mb_strtolower($this->randomMachineName(16)), 'id' => $this->randomMachineName(16),
'label' => $this->randomString(), 'label' => $this->randomString(),
]); ]);
$shortcut->save(); $shortcut->save();
@ -318,7 +318,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
public function doUserRoleListTest() { public function doUserRoleListTest() {
// Create a test role to decouple looking for translate operations // Create a test role to decouple looking for translate operations
// link so this does not test more than necessary. // link so this does not test more than necessary.
$role_id = mb_strtolower($this->randomMachineName(16)); $role_id = $this->randomMachineName(16);
$this->drupalCreateRole([], $role_id); $this->drupalCreateRole([], $role_id);
// Get the role listing. // Get the role listing.
@ -400,7 +400,7 @@ class ConfigTranslationListUiTest extends BrowserTestBase {
public function doFieldListTest() { public function doFieldListTest() {
// Create a base content type. // Create a base content type.
$content_type = $this->drupalCreateContentType([ $content_type = $this->drupalCreateContentType([
'type' => mb_strtolower($this->randomMachineName(16)), 'type' => $this->randomMachineName(16),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
]); ]);

View File

@ -746,7 +746,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
public function testFieldConfigTranslation() { public function testFieldConfigTranslation() {
// Add a test field which has a translatable field setting and a // Add a test field which has a translatable field setting and a
// translatable field storage setting. // translatable field storage setting.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -757,7 +757,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$field_storage->setSetting('translatable_storage_setting', $translatable_storage_setting); $field_storage->setSetting('translatable_storage_setting', $translatable_storage_setting);
$field_storage->save(); $field_storage->save();
$bundle = strtolower($this->randomMachineName()); $bundle = $this->randomMachineName();
entity_test_create_bundle($bundle); entity_test_create_bundle($bundle);
$field = FieldConfig::create([ $field = FieldConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
@ -785,14 +785,14 @@ class ConfigTranslationUiTest extends BrowserTestBase {
*/ */
public function testBooleanFieldConfigTranslation() { public function testBooleanFieldConfigTranslation() {
// Add a test boolean field. // Add a test boolean field.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'boolean', 'type' => 'boolean',
])->save(); ])->save();
$bundle = strtolower($this->randomMachineName()); $bundle = $this->randomMachineName();
entity_test_create_bundle($bundle); entity_test_create_bundle($bundle);
$field = FieldConfig::create([ $field = FieldConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,

View File

@ -163,16 +163,16 @@ class ContactSitewideTest extends BrowserTestBase {
$recipients = ['simpletest&@example.com', 'simpletest2@example.com', 'simpletest3@example.com']; $recipients = ['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 = mb_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE); $this->addContactForm($id = $this->randomMachineName($max_length_exceeded), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE);
$this->assertSession()->pageTextContains('Machine-readable name cannot be longer than ' . $max_length . ' characters but is currently ' . $max_length_exceeded . ' characters long.'); $this->assertSession()->pageTextContains('Machine-readable name cannot be longer than ' . $max_length . ' characters but is currently ' . $max_length_exceeded . ' characters long.');
$this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE); $this->addContactForm($id = $this->randomMachineName($max_length), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE);
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.'); $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
// Verify that the creation message contains a link to a contact form. // Verify that the creation message contains a link to a contact form.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]'); $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]');
// Create first valid form. // Create first valid form.
$this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE); $this->addContactForm($id = $this->randomMachineName(16), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE);
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.'); $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
// Verify that the creation message contains a link to a contact form. // Verify that the creation message contains a link to a contact form.
@ -214,10 +214,10 @@ class ContactSitewideTest extends BrowserTestBase {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Add more forms. // Add more forms.
$this->addContactForm(mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE); $this->addContactForm($this->randomMachineName(16), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE);
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.'); $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
$this->addContactForm($name = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE); $this->addContactForm($name = $this->randomMachineName(16), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE);
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.'); $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
// Try adding a form that already exists. // Try adding a form that already exists.
@ -282,7 +282,7 @@ class ContactSitewideTest extends BrowserTestBase {
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$recipients = implode(',', [$recipients[0], $recipients[1], $recipients[2]]); $recipients = implode(',', [$recipients[0], $recipients[1], $recipients[2]]);
$contact_form = mb_strtolower($this->randomMachineName(16)); $contact_form = $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('Edit'); $this->clickLink('Edit');
@ -314,7 +314,7 @@ class ContactSitewideTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a simple textfield. // Create a simple textfield.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_label = $this->randomMachineName(); $field_label = $this->randomMachineName();
$this->fieldUIAddNewField(NULL, $field_name, $field_label, 'text'); $this->fieldUIAddNewField(NULL, $field_name, $field_label, 'text');
$field_name = 'field_' . $field_name; $field_name = 'field_' . $field_name;

View File

@ -51,7 +51,7 @@ class ContactStorageTest extends ContactSitewideTest {
$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 = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$mail]), '', TRUE, 'Your message has been sent.', [ $this->addContactForm($id = $this->randomMachineName(16), $label = $this->randomMachineName(16), implode(',', [$mail]), '', TRUE, 'Your message has been sent.', [
'send_a_pony' => 1, 'send_a_pony' => 1,
]); ]);
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.'); $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');

View File

@ -34,7 +34,7 @@ class ContactFieldsTest extends KernelTestBase {
FieldStorageConfig::create([ FieldStorageConfig::create([
'type' => 'text', 'type' => 'text',
'entity_type' => 'contact_message', 'entity_type' => 'contact_message',
'field_name' => $field_name = strtolower($this->randomMachineName()), 'field_name' => $field_name = $this->randomMachineName(),
])->save(); ])->save();
ContactForm::create([ ContactForm::create([

View File

@ -114,8 +114,8 @@ abstract class DateTestBase extends BrowserTestBase {
* Creates a date test field. * Creates a date test field.
*/ */
protected function createField() { protected function createField() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_label = Unicode::ucfirst(mb_strtolower($this->randomMachineName())); $field_label = Unicode::ucfirst($this->randomMachineName());
$type = $this->getTestFieldType(); $type = $this->getTestFieldType();
$widget_type = $formatter_type = $type . '_default'; $widget_type = $formatter_type = $type . '_default';

View File

@ -688,7 +688,7 @@ class DateTimeFieldTest extends DateTestBase {
$this->drupalCreateContentType(['type' => 'date_content']); $this->drupalCreateContentType(['type' => 'date_content']);
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
@ -905,7 +905,7 @@ class DateTimeFieldTest extends DateTestBase {
$this->drupalCreateContentType(['type' => 'date_content']); $this->drupalCreateContentType(['type' => 'date_content']);
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',

View File

@ -1000,7 +1000,7 @@ class DateRangeFieldTest extends DateTestBase {
$this->drupalCreateContentType(['type' => 'date_content']); $this->drupalCreateContentType(['type' => 'date_content']);
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
@ -1391,7 +1391,7 @@ class DateRangeFieldTest extends DateTestBase {
$this->drupalCreateContentType(['type' => 'date_content']); $this->drupalCreateContentType(['type' => 'date_content']);
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',

View File

@ -46,7 +46,7 @@ class DateRangeItemTest extends FieldKernelTestBase {
// Add a datetime range field. // Add a datetime range field.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => mb_strtolower($this->randomMachineName()), 'field_name' => $this->randomMachineName(),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'daterange', 'type' => 'daterange',
'settings' => ['datetime_type' => DateRangeItem::DATETIME_TYPE_DATE], 'settings' => ['datetime_type' => DateRangeItem::DATETIME_TYPE_DATE],

View File

@ -57,7 +57,7 @@ class SeparatorTranslationTest extends KernelTestBase {
// Add a datetime range field. // Add a datetime range field.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => mb_strtolower($this->randomMachineName()), 'field_name' => $this->randomMachineName(),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'daterange', 'type' => 'daterange',
'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATE], 'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATE],

View File

@ -116,7 +116,7 @@ class EditorAdminTest extends BrowserTestBase {
$this->container->get('module_installer')->install(['node']); $this->container->get('module_installer')->install(['node']);
$this->resetAll(); $this->resetAll();
// Create a new node type and attach the 'body' field to it. // Create a new node type and attach the 'body' field to it.
$node_type = NodeType::create(['type' => mb_strtolower($this->randomMachineName()), 'name' => $this->randomString()]); $node_type = NodeType::create(['type' => $this->randomMachineName(), 'name' => $this->randomString()]);
$node_type->save(); $node_type->save();
node_add_body_field($node_type, $this->randomString()); node_add_body_field($node_type, $this->randomString());

View File

@ -24,7 +24,7 @@ class EditorFilterIntegrationTest extends KernelTestBase {
public function testTextFormatIntegration() { public function testTextFormatIntegration() {
// Create an arbitrary text format. // Create an arbitrary text format.
$format = FilterFormat::create([ $format = FilterFormat::create([
'format' => mb_strtolower($this->randomMachineName()), 'format' => $this->randomMachineName(),
'name' => $this->randomString(), 'name' => $this->randomString(),
]); ]);
$format->save(); $format->save();

View File

@ -68,7 +68,7 @@ class BooleanFieldTest extends BrowserTestBase {
$label = $this->randomMachineName(); $label = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -46,7 +46,7 @@ class BooleanFormatterSettingsTest extends BrowserTestBase {
parent::setUp(); parent::setUp();
// Create a content type. Use Node because it has Field UI pages that work. // Create a content type. Use Node because it has Field UI pages that work.
$type_name = mb_strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->bundle = $type->id(); $this->bundle = $type->id();
@ -60,7 +60,7 @@ class BooleanFormatterSettingsTest extends BrowserTestBase {
]); ]);
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
$this->fieldName = mb_strtolower($this->randomMachineName(8)); $this->fieldName = $this->randomMachineName(8);
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -58,7 +58,7 @@ class EmailFieldTest extends BrowserTestBase {
*/ */
public function testEmailField() { public function testEmailField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -57,7 +57,7 @@ class EntityReferenceAdminTest extends BrowserTestBase {
$this->drupalPlaceBlock('system_breadcrumb_block'); $this->drupalPlaceBlock('system_breadcrumb_block');
// Create a content type, with underscores. // Create a content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->type = $type->id(); $this->type = $type->id();
@ -303,7 +303,7 @@ class EntityReferenceAdminTest extends BrowserTestBase {
/** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */ /** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */
$vocabularies = []; $vocabularies = [];
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
$vid = mb_strtolower($this->randomMachineName()); $vid = $this->randomMachineName();
$vocabularies[$i] = Vocabulary::create([ $vocabularies[$i] = Vocabulary::create([
'name' => $this->randomString(), 'name' => $this->randomString(),
'vid' => $vid, 'vid' => $vid,
@ -374,7 +374,7 @@ class EntityReferenceAdminTest extends BrowserTestBase {
$bundle_path = 'admin/structure/types/manage/' . $this->type; $bundle_path = 'admin/structure/types/manage/' . $this->type;
// Generate a random field name, must be only lowercase characters. // Generate a random field name, must be only lowercase characters.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$storage_edit = $field_edit = []; $storage_edit = $field_edit = [];
$storage_edit['settings[target_type]'] = $target_type; $storage_edit['settings[target_type]'] = $target_type;

View File

@ -162,7 +162,7 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
/** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */ /** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */
$vocabularies = []; $vocabularies = [];
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
$vid = mb_strtolower($this->randomMachineName()); $vid = $this->randomMachineName();
$vocabularies[$i] = Vocabulary::create([ $vocabularies[$i] = Vocabulary::create([
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'vid' => $vid, 'vid' => $vid,
@ -173,7 +173,7 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
// Create a taxonomy term entity reference field that saves the auto-created // Create a taxonomy term entity reference field that saves the auto-created
// taxonomy terms in the second vocabulary from the two that were configured // taxonomy terms in the second vocabulary from the two that were configured
// as targets. // as targets.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$handler_settings = [ $handler_settings = [
'target_bundles' => [ 'target_bundles' => [
$vocabularies[0]->id() => $vocabularies[0]->id(), $vocabularies[0]->id() => $vocabularies[0]->id(),
@ -261,7 +261,7 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
]); ]);
$this->drupalLogin($account); $this->drupalLogin($account);
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$handler_settings = [ $handler_settings = [
'auto_create' => TRUE, 'auto_create' => TRUE,
]; ];

View File

@ -64,7 +64,7 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
// Create a node to be referenced. // Create a node to be referenced.
$referenced_node = $this->drupalCreateNode(['type' => 'referenced_content']); $referenced_node = $this->drupalCreateNode(['type' => 'referenced_content']);
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
@ -129,7 +129,7 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
$referenced_node_type = $this->drupalCreateContentType(['type' => 'referenced_config_to_delete']); $referenced_node_type = $this->drupalCreateContentType(['type' => 'referenced_config_to_delete']);
$referenced_node_type2 = $this->drupalCreateContentType(['type' => 'referenced_config_to_preserve']); $referenced_node_type2 = $this->drupalCreateContentType(['type' => 'referenced_config_to_preserve']);
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',

View File

@ -63,7 +63,7 @@ class StringFieldTest extends BrowserTestBase {
*/ */
public function _testTextfieldWidgets($field_type, $widget_type) { public function _testTextfieldWidgets($field_type, $widget_type) {
// Create a field. // Create a field.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -47,7 +47,7 @@ class NumberFieldTest extends BrowserTestBase {
*/ */
public function testNumberDecimalField() { public function testNumberDecimalField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -138,7 +138,7 @@ class NumberFieldTest extends BrowserTestBase {
$maximum = rand(2000, 4000); $maximum = rand(2000, 4000);
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$storage = FieldStorageConfig::create([ $storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -290,7 +290,7 @@ class NumberFieldTest extends BrowserTestBase {
*/ */
public function testNumberFloatField() { public function testNumberFloatField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -383,7 +383,7 @@ class NumberFieldTest extends BrowserTestBase {
*/ */
public function testCreateNumberFloatField() { public function testCreateNumberFloatField() {
// Create a float field. // Create a float field.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
@ -408,7 +408,7 @@ class NumberFieldTest extends BrowserTestBase {
*/ */
public function testCreateNumberDecimalField() { public function testCreateNumberDecimalField() {
// Create a decimal field. // Create a decimal field.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -60,7 +60,7 @@ class TranslationWebTest extends FieldTestBase {
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->fieldName = mb_strtolower($this->randomMachineName() . '_field_name'); $this->fieldName = $this->randomMachineName() . '_field_name';
$field_storage = [ $field_storage = [
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -46,7 +46,7 @@ class BooleanFormatterSettingsTest extends WebDriverTestBase {
parent::setUp(); parent::setUp();
// Create a content type. Use Node because it has Field UI pages that work. // Create a content type. Use Node because it has Field UI pages that work.
$type_name = mb_strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->bundle = $type->id(); $this->bundle = $type->id();
@ -60,7 +60,7 @@ class BooleanFormatterSettingsTest extends WebDriverTestBase {
]); ]);
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
$this->fieldName = mb_strtolower($this->randomMachineName(8)); $this->fieldName = $this->randomMachineName(8);
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -65,12 +65,12 @@ class EntityReferenceAdminTest extends WebDriverTestBase {
$this->drupalPlaceBlock('system_breadcrumb_block'); $this->drupalPlaceBlock('system_breadcrumb_block');
// Create a content type, with underscores. // Create a content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->type = $type->id(); $this->type = $type->id();
// Create a second content type, to be a target for entity reference fields. // Create a second content type, to be a target for entity reference fields.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->targetType = $type->id(); $this->targetType = $type->id();

View File

@ -45,9 +45,9 @@ class NumberFieldTest extends WebDriverTestBase {
* Tests default formatter behavior. * Tests default formatter behavior.
*/ */
public function testNumberFormatter() { public function testNumberFormatter() {
$type = mb_strtolower($this->randomMachineName()); $type = $this->randomMachineName();
$float_field = mb_strtolower($this->randomMachineName()); $float_field = $this->randomMachineName();
$integer_field = mb_strtolower($this->randomMachineName()); $integer_field = $this->randomMachineName();
$thousand_separators = ['', '.', ',', ' ', chr(8201), "'"]; $thousand_separators = ['', '.', ',', ' ', chr(8201), "'"];
$decimal_separators = ['.', ',']; $decimal_separators = ['.', ','];
$prefix = $this->randomMachineName(); $prefix = $this->randomMachineName();

View File

@ -60,7 +60,7 @@ class BooleanFormatterTest extends KernelTestBase {
$this->entityType = 'entity_test'; $this->entityType = 'entity_test';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -88,7 +88,7 @@ class EntityReferenceItemTest extends FieldKernelTestBase {
$this->vocabulary = Vocabulary::create([ $this->vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'vid' => mb_strtolower($this->randomMachineName()), 'vid' => $this->randomMachineName(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]); ]);
$this->vocabulary->save(); $this->vocabulary->save();
@ -291,7 +291,7 @@ class EntityReferenceItemTest extends FieldKernelTestBase {
// Make sure the computed term reflects updates to the term id. // Make sure the computed term reflects updates to the term id.
$vocabulary2 = $vocabulary = Vocabulary::create([ $vocabulary2 = $vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'vid' => mb_strtolower($this->randomMachineName()), 'vid' => $this->randomMachineName(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]); ]);
$vocabulary2->save(); $vocabulary2->save();
@ -362,7 +362,7 @@ class EntityReferenceItemTest extends FieldKernelTestBase {
* Tests that the 'handler' field setting stores the proper plugin ID. * Tests that the 'handler' field setting stores the proper plugin ID.
*/ */
public function testSelectionHandlerSettings() { public function testSelectionHandlerSettings() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -72,13 +72,13 @@ class EntityReferenceSettingsTest extends KernelTestBase {
$this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test');
$this->nodeType = NodeType::create([ $this->nodeType = NodeType::create([
'type' => mb_strtolower($this->randomMachineName()), 'type' => $this->randomMachineName(),
'name' => $this->randomString(), 'name' => $this->randomString(),
]); ]);
$this->nodeType->save(); $this->nodeType->save();
// Create a custom bundle. // Create a custom bundle.
$this->customBundle = 'test_bundle_' . mb_strtolower($this->randomMachineName()); $this->customBundle = 'test_bundle_' . $this->randomMachineName();
entity_test_create_bundle($this->customBundle, NULL, 'entity_test'); entity_test_create_bundle($this->customBundle, NULL, 'entity_test');
// Prepare the logger for collecting the expected critical error. // Prepare the logger for collecting the expected critical error.
@ -93,7 +93,7 @@ class EntityReferenceSettingsTest extends KernelTestBase {
/** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */ /** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */
$vocabularies = []; $vocabularies = [];
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
$vid = mb_strtolower($this->randomMachineName()); $vid = $this->randomMachineName();
$vocabularies[$i] = Vocabulary::create([ $vocabularies[$i] = Vocabulary::create([
'name' => $this->randomString(), 'name' => $this->randomString(),
'vid' => $vid, 'vid' => $vid,
@ -101,7 +101,7 @@ class EntityReferenceSettingsTest extends KernelTestBase {
$vocabularies[$i]->save(); $vocabularies[$i]->save();
} }
// Attach an entity reference field to $this->nodeType. // Attach an entity reference field to $this->nodeType.
$name = mb_strtolower($this->randomMachineName()); $name = $this->randomMachineName();
$label = $this->randomString(); $label = $this->randomString();
$handler_settings = [ $handler_settings = [
'target_bundles' => [ 'target_bundles' => [
@ -150,7 +150,7 @@ class EntityReferenceSettingsTest extends KernelTestBase {
*/ */
public function testCustomTargetBundleDeletion() { public function testCustomTargetBundleDeletion() {
// Attach an entity reference field to $this->nodeType. // Attach an entity reference field to $this->nodeType.
$name = mb_strtolower($this->randomMachineName()); $name = $this->randomMachineName();
$label = $this->randomString(); $label = $this->randomString();
$handler_settings = ['target_bundles' => [$this->customBundle => $this->customBundle]]; $handler_settings = ['target_bundles' => [$this->customBundle => $this->customBundle]];
$this->createEntityReferenceField('node', $this->nodeType->id(), $name, $label, 'entity_test', 'default', $handler_settings); $this->createEntityReferenceField('node', $this->nodeType->id(), $name, $label, 'entity_test', 'default', $handler_settings);

View File

@ -60,7 +60,7 @@ class SelectionTest extends KernelTestBase {
$this->installEntitySchema('node'); $this->installEntitySchema('node');
// Create test nodes. // Create test nodes.
$type = strtolower($this->randomMachineName()); $type = $this->randomMachineName();
NodeType::create(['type' => $type])->save(); NodeType::create(['type' => $type])->save();
$node1 = $this->createNode(['type' => $type]); $node1 = $this->createNode(['type' => $type]);
$node2 = $this->createNode(['type' => $type]); $node2 = $this->createNode(['type' => $type]);

View File

@ -294,7 +294,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$cardinality = $this->fieldTestData->field_storage->getCardinality(); $cardinality = $this->fieldTestData->field_storage->getCardinality();
// Create a new bundle. // Create a new bundle.
$new_bundle = 'test_bundle_' . mb_strtolower($this->randomMachineName()); $new_bundle = 'test_bundle_' . $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.
@ -321,7 +321,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$this->createFieldWithStorage('', $entity_type); $this->createFieldWithStorage('', $entity_type);
// Create a new bundle. // Create a new bundle.
$new_bundle = 'test_bundle_' . mb_strtolower($this->randomMachineName()); $new_bundle = 'test_bundle_' . $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 +329,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
FieldConfig::create($this->fieldTestData->field_definition)->save(); FieldConfig::create($this->fieldTestData->field_definition)->save();
// Create a second field for the test bundle // Create a second field for the test bundle
$field_name = mb_strtolower($this->randomMachineName() . '_field_name'); $field_name = $this->randomMachineName() . '_field_name';
$field_storage = [ $field_storage = [
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,

View File

@ -45,7 +45,7 @@ class FieldCrudTest extends FieldKernelTestBase {
parent::setUp(); parent::setUp();
$this->fieldStorageDefinition = [ $this->fieldStorageDefinition = [
'field_name' => mb_strtolower($this->randomMachineName()), 'field_name' => $this->randomMachineName(),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'test_field', 'type' => 'test_field',
]; ];
@ -201,7 +201,7 @@ class FieldCrudTest extends FieldKernelTestBase {
* Tests creating a field with custom storage set. * Tests creating a field with custom storage set.
*/ */
public function testCreateFieldCustomStorage() { public function testCreateFieldCustomStorage() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
\Drupal::state()->set('field_test_custom_storage', $field_name); \Drupal::state()->set('field_test_custom_storage', $field_name);
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([

View File

@ -67,7 +67,7 @@ class FieldDisplayTest extends KernelTestBase {
$this->entityType = 'entity_test_rev'; $this->entityType = 'entity_test_rev';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -54,7 +54,7 @@ class FieldFormatterTest extends KernelTestBase {
$entity_type = 'entity_test_rev'; $entity_type = 'entity_test_rev';
$bundle = $entity_type; $bundle = $entity_type;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -98,7 +98,7 @@ abstract class FieldKernelTestBase extends KernelTestBase {
$field = 'field' . $suffix; $field = 'field' . $suffix;
$field_definition = 'field_definition' . $suffix; $field_definition = 'field_definition' . $suffix;
$this->fieldTestData->$field_name = mb_strtolower($this->randomMachineName() . '_field_name' . $suffix); $this->fieldTestData->$field_name = $this->randomMachineName() . '_field_name' . $suffix;
$this->fieldTestData->$field_storage = FieldStorageConfig::create([ $this->fieldTestData->$field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldTestData->$field_name, 'field_name' => $this->fieldTestData->$field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,

View File

@ -62,7 +62,7 @@ class RawStringFormatterTest extends KernelTestBase {
$this->entityType = 'entity_test'; $this->entityType = 'entity_test';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -72,7 +72,7 @@ class StringFormatterTest extends KernelTestBase {
$this->entityType = 'entity_test_rev'; $this->entityType = 'entity_test_rev';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -60,7 +60,7 @@ class TimestampFormatterTest extends KernelTestBase {
$this->entityType = 'entity_test'; $this->entityType = 'entity_test';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,

View File

@ -76,7 +76,7 @@ class TranslationTest extends FieldKernelTestBase {
$this->installEntitySchema('node'); $this->installEntitySchema('node');
$this->installConfig(['language']); $this->installConfig(['language']);
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$this->entityType = 'entity_test'; $this->entityType = 'entity_test';
@ -141,7 +141,7 @@ class TranslationTest extends FieldKernelTestBase {
} }
// Test default values. // Test default values.
$field_name_default = mb_strtolower($this->randomMachineName() . '_field_name'); $field_name_default = $this->randomMachineName() . '_field_name';
$field_storage_definition = $this->fieldStorageDefinition; $field_storage_definition = $this->fieldStorageDefinition;
$field_storage_definition['field_name'] = $field_name_default; $field_storage_definition['field_name'] = $field_name_default;
$field_storage = FieldStorageConfig::create($field_storage_definition); $field_storage = FieldStorageConfig::create($field_storage_definition);

View File

@ -37,7 +37,7 @@ class UriItemTest extends FieldKernelTestBase {
$label = $this->randomMachineName(); $label = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -65,7 +65,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
// Test adding a view mode including dots in machine_name. // Test adding a view mode including dots in machine_name.
$this->clickLink('Test entity'); $this->clickLink('Test entity');
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()), 'id' => $this->randomMachineName() . '.' . $this->randomMachineName(),
'label' => $this->randomString(), 'label' => $this->randomString(),
]; ];
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');
@ -73,7 +73,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
// Test adding a view mode. // Test adding a view mode.
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName()), 'id' => $this->randomMachineName(),
'label' => $this->randomString(), 'label' => $this->randomString(),
]; ];
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');
@ -119,7 +119,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
// Test adding a view mode including dots in machine_name. // Test adding a view mode including dots in machine_name.
$this->clickLink('Test entity'); $this->clickLink('Test entity');
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()), 'id' => $this->randomMachineName() . '.' . $this->randomMachineName(),
'label' => $this->randomString(), 'label' => $this->randomString(),
]; ];
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');
@ -127,7 +127,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
// Test adding a form mode. // Test adding a form mode.
$edit = [ $edit = [
'id' => strtolower($this->randomMachineName()), 'id' => $this->randomMachineName(),
'label' => $this->randomString(), 'label' => $this->randomString(),
]; ];
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');

View File

@ -78,7 +78,7 @@ class FieldUIDeleteTest extends BrowserTestBase {
$field_name = 'field_test'; $field_name = 'field_test';
// Create an additional node type. // Create an additional node type.
$type_name1 = strtolower($this->randomMachineName(8)) . '_test'; $type_name1 = $this->randomMachineName(8) . '_test';
$type1 = $this->drupalCreateContentType(['name' => $type_name1, 'type' => $type_name1]); $type1 = $this->drupalCreateContentType(['name' => $type_name1, 'type' => $type_name1]);
$type_name1 = $type1->id(); $type_name1 = $type1->id();
@ -87,7 +87,7 @@ class FieldUIDeleteTest extends BrowserTestBase {
$this->fieldUIAddNewField($bundle_path1, $field_name_input, $field_label); $this->fieldUIAddNewField($bundle_path1, $field_name_input, $field_label);
// Create an additional node type. // Create an additional node type.
$type_name2 = strtolower($this->randomMachineName(8)) . '_test'; $type_name2 = $this->randomMachineName(8) . '_test';
$type2 = $this->drupalCreateContentType(['name' => $type_name2, 'type' => $type_name2]); $type2 = $this->drupalCreateContentType(['name' => $type_name2, 'type' => $type_name2]);
$type_name2 = $type2->id(); $type_name2 = $type2->id();

View File

@ -79,7 +79,7 @@ class ManageDisplayTest extends BrowserTestBase {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Create content type, with underscores. // Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->type = $type->id(); $this->type = $type->id();
@ -87,7 +87,7 @@ class ManageDisplayTest extends BrowserTestBase {
$vocabulary = Vocabulary::create([ $vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(), 'description' => $this->randomMachineName(),
'vid' => mb_strtolower($this->randomMachineName()), 'vid' => $this->randomMachineName(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'help' => '', 'help' => '',
'nodes' => ['article' => 'article'], 'nodes' => ['article' => 'article'],

View File

@ -104,13 +104,13 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Create content type, with underscores. // Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->contentType = $type->id(); $this->contentType = $type->id();
// Create random field name with markup to test escaping. // Create random field name with markup to test escaping.
$this->fieldLabel = '<em>' . $this->randomMachineName(8) . '</em>'; $this->fieldLabel = '<em>' . $this->randomMachineName(8) . '</em>';
$this->fieldNameInput = strtolower($this->randomMachineName(8)); $this->fieldNameInput = $this->randomMachineName(8);
$this->fieldName = 'field_' . $this->fieldNameInput; $this->fieldName = 'field_' . $this->fieldNameInput;
// Create Basic page and Article node types. // Create Basic page and Article node types.
@ -477,7 +477,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
*/ */
public function testFieldPrefix() { public function testFieldPrefix() {
// Change default field prefix. // Change default field prefix.
$field_prefix = strtolower($this->randomMachineName(10)); $field_prefix = $this->randomMachineName(10);
$this->config('field_ui.settings')->set('field_prefix', $field_prefix)->save(); $this->config('field_ui.settings')->set('field_prefix', $field_prefix)->save();
// Create a field input and label exceeding the new maxlength, which is 22. // Create a field input and label exceeding the new maxlength, which is 22.
@ -600,7 +600,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$this->fieldUIAddNewField($bundle_path1, $this->fieldNameInput, $this->fieldLabel); $this->fieldUIAddNewField($bundle_path1, $this->fieldNameInput, $this->fieldLabel);
// Create an additional node type. // Create an additional node type.
$type_name2 = strtolower($this->randomMachineName(8)) . '_test'; $type_name2 = $this->randomMachineName(8) . '_test';
$type2 = $this->drupalCreateContentType(['name' => $type_name2, 'type' => $type_name2]); $type2 = $this->drupalCreateContentType(['name' => $type_name2, 'type' => $type_name2]);
$type_name2 = $type2->id(); $type_name2 = $type2->id();
@ -659,7 +659,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
public function testLockedField() { public function testLockedField() {
// Create a locked field and attach it to a bundle. We need to do this // Create a locked field and attach it to a bundle. We need to do this
// programmatically as there's no way to create a locked field through UI. // programmatically as there's no way to create a locked field through UI.
$field_name = strtolower($this->randomMachineName(8)); $field_name = $this->randomMachineName(8);
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',

View File

@ -71,7 +71,7 @@ class ManageDisplayTest extends WebDriverTestBase {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
// Create content type, with underscores. // Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test'; $type_name = $this->randomMachineName(8) . '_test';
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->type = $type->id(); $this->type = $type->id();

View File

@ -533,14 +533,14 @@ class EntityDisplayTest extends KernelTestBase {
// Create two arbitrary user roles. // Create two arbitrary user roles.
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
$roles[$i] = Role::create([ $roles[$i] = Role::create([
'id' => mb_strtolower($this->randomMachineName()), 'id' => $this->randomMachineName(),
'label' => $this->randomString(), 'label' => $this->randomString(),
]); ]);
$roles[$i]->save(); $roles[$i]->save();
} }
// Create a field of type 'test_field' attached to 'entity_test'. // Create a field of type 'test_field' attached to 'entity_test'.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -25,7 +25,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
* Tests normal formatter display on node display. * Tests normal formatter display on node display.
*/ */
public function testNodeDisplay() { public function testNodeDisplay() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$type_name = 'article'; $type_name = 'article';
$field_storage_settings = [ $field_storage_settings = [
'display_field' => '1', 'display_field' => '1',
@ -131,7 +131,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
* Tests default display of File Field. * Tests default display of File Field.
*/ */
public function testDefaultFileFieldDisplay() { public function testDefaultFileFieldDisplay() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$type_name = 'article'; $type_name = 'article';
$field_storage_settings = [ $field_storage_settings = [
'display_field' => '1', 'display_field' => '1',
@ -160,7 +160,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
public function testDescToggle() { public function testDescToggle() {
$type_name = 'test'; $type_name = 'test';
$field_type = 'file'; $field_type = 'file';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Use the UI to add a new content type that also contains a file field. // Use the UI to add a new content type that also contains a file field.
$edit = [ $edit = [
'name' => $type_name, 'name' => $type_name,
@ -190,7 +190,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
* Tests description display of File Field. * Tests description display of File Field.
*/ */
public function testDescriptionDefaultFileFieldDisplay() { public function testDescriptionDefaultFileFieldDisplay() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$type_name = 'article'; $type_name = 'article';
$field_storage_settings = [ $field_storage_settings = [
'display_field' => '1', 'display_field' => '1',

View File

@ -25,7 +25,7 @@ class FileFieldFormatterAccessTest extends FileFieldTestBase {
*/ */
public function testFileAccessHandler() { public function testFileAccessHandler() {
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
\Drupal::state()->set('file_test_alternate_access_handler', TRUE); \Drupal::state()->set('file_test_alternate_access_handler', TRUE);
\Drupal::entityTypeManager()->clearCachedDefinitions(); \Drupal::entityTypeManager()->clearCachedDefinitions();

View File

@ -23,7 +23,7 @@ class FileFieldPathTest extends FileFieldTestBase {
public function testUploadPath() { public function testUploadPath() {
/** @var \Drupal\node\NodeStorageInterface $node_storage */ /** @var \Drupal\node\NodeStorageInterface $node_storage */
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$type_name = 'article'; $type_name = 'article';
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
/** @var \Drupal\file\FileInterface $test_file */ /** @var \Drupal\file\FileInterface $test_file */

View File

@ -28,7 +28,7 @@ class FileFieldRSSContentTest extends FileFieldTestBase {
*/ */
public function testFileFieldRSSContent() { public function testFileFieldRSSContent() {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$type_name = 'article'; $type_name = 'article';
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);

View File

@ -36,7 +36,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
->save(); ->save();
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
// Create the same fields for users. // Create the same fields for users.
$this->createFileField($field_name, 'user', 'user'); $this->createFileField($field_name, 'user', 'user');

View File

@ -28,7 +28,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
public function testRequired() { public function testRequired() {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$storage = $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']); $storage = $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
$field = FieldConfig::loadByName('node', $type_name, $field_name); $field = FieldConfig::loadByName('node', $type_name, $field_name);
@ -78,7 +78,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
public function testFileMaxSize() { public function testFileMaxSize() {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']); $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
// 128KB. // 128KB.
@ -130,7 +130,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
public function testFileExtension() { public function testFileExtension() {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$test_file = $this->getTestFile('image'); $test_file = $this->getTestFile('image');

View File

@ -81,7 +81,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
public function testSingleValuedWidget() { public function testSingleValuedWidget() {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$test_file = $this->getTestFile('text'); $test_file = $this->getTestFile('text');
@ -250,7 +250,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']); user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']);
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$field = FieldConfig::loadByName('node', $type_name, $field_name); $field = FieldConfig::loadByName('node', $type_name, $field_name);
$field_id = $field->id(); $field_id = $field->id();
@ -299,7 +299,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
// Create a new field. // Create a new field.
$this->addDefaultCommentField('node', 'article'); $this->addDefaultCommentField('node', 'article');
$name = strtolower($this->randomMachineName()); $name = $this->randomMachineName();
$label = $this->randomMachineName(); $label = $this->randomMachineName();
$storage_edit = ['settings[uri_scheme]' => 'private']; $storage_edit = ['settings[uri_scheme]' => 'private'];
$this->fieldUIAddNewField('admin/structure/comment/manage/comment', $name, $label, 'file', $storage_edit); $this->fieldUIAddNewField('admin/structure/comment/manage/comment', $name, $label, 'file', $storage_edit);
@ -362,7 +362,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
*/ */
public function testWidgetValidation() { public function testWidgetValidation() {
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$this->updateFileField($field_name, $type_name, ['file_extensions' => 'txt']); $this->updateFileField($field_name, $type_name, ['file_extensions' => 'txt']);
@ -391,7 +391,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
* Tests file widget element. * Tests file widget element.
*/ */
public function testWidgetElement() { public function testWidgetElement() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$html_name = str_replace('_', '-', $field_name); $html_name = str_replace('_', '-', $field_name);
$this->createFileField($field_name, 'node', 'article', ['cardinality' => FieldStorageConfig::CARDINALITY_UNLIMITED]); $this->createFileField($field_name, 'node', 'article', ['cardinality' => FieldStorageConfig::CARDINALITY_UNLIMITED]);
$file = $this->getTestFile('text'); $file = $this->getTestFile('text');
@ -477,7 +477,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']); user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']);
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
/** @var \Drupal\Field\FieldConfigInterface $field */ /** @var \Drupal\Field\FieldConfigInterface $field */
$field = FieldConfig::loadByName('node', $type_name, $field_name); $field = FieldConfig::loadByName('node', $type_name, $field_name);
@ -504,7 +504,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']); user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']);
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$field = FieldConfig::loadByName('node', $type_name, $field_name); $field = FieldConfig::loadByName('node', $type_name, $field_name);
$field_id = $field->id(); $field_id = $field->id();

View File

@ -45,7 +45,7 @@ class FileOnTranslatedEntityTest extends FileFieldTestBase {
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page', 'new_revision' => FALSE]); $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page', 'new_revision' => FALSE]);
// Create a file field on the "Basic page" node type. // Create a file field on the "Basic page" node type.
$this->fieldName = strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$this->createFileField($this->fieldName, 'node', 'page'); $this->createFileField($this->fieldName, 'node', 'page');
// Create and log in user. // Create and log in user.

View File

@ -47,7 +47,7 @@ class FilePrivateTest extends FileFieldTestBase {
/** @var \Drupal\Core\File\FileSystemInterface $file_system */ /** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system'); $file_system = \Drupal::service('file_system');
$type_name = 'article'; $type_name = 'article';
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name, ['uri_scheme' => 'private']); $this->createFileField($field_name, 'node', $type_name, ['uri_scheme' => 'private']);
$test_file = $this->getTestFile('text'); $test_file = $this->getTestFile('text');

View File

@ -31,7 +31,7 @@ class FileTokenReplaceTest extends FileFieldTestBase {
// Create file field. // Create file field.
$type_name = 'article'; $type_name = 'article';
$field_name = 'field_' . strtolower($this->randomMachineName()); $field_name = 'field_' . $this->randomMachineName();
$this->createFileField($field_name, 'node', $type_name); $this->createFileField($field_name, 'node', $type_name);
$test_file = $this->getTestFile('text'); $test_file = $this->getTestFile('text');

View File

@ -46,7 +46,7 @@ abstract class FileMediaFormatterTestBase extends BrowserTestBase {
*/ */
protected function createMediaField($formatter, $file_extensions, array $formatter_settings = []) { protected function createMediaField($formatter, $file_extensions, array $formatter_settings = []) {
$entity_type = $bundle = 'entity_test'; $entity_type = $bundle = 'entity_test';
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'entity_type' => $entity_type, 'entity_type' => $entity_type,

View File

@ -39,7 +39,7 @@ class PrivateFileOnTranslatedEntityTest extends FileFieldTestBase {
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
// Create a file field on the "Basic page" node type. // Create a file field on the "Basic page" node type.
$this->fieldName = strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$this->createFileField($this->fieldName, 'node', 'page', ['uri_scheme' => 'private']); $this->createFileField($this->fieldName, 'node', 'page', ['uri_scheme' => 'private']);
// Create and log in user. // Create and log in user.

View File

@ -33,7 +33,7 @@ class FileFieldValidateTest extends WebDriverTestBase {
* Tests the validation message is displayed only once for ajax uploads. * Tests the validation message is displayed only once for ajax uploads.
*/ */
public function testAjaxValidationMessage() { public function testAjaxValidationMessage() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
$this->createFileField($field_name, 'node', 'article', [], ['file_extensions' => 'txt']); $this->createFileField($field_name, 'node', 'article', [], ['file_extensions' => 'txt']);

View File

@ -129,7 +129,7 @@ class FilterAdminTest extends BrowserTestBase {
// Add text format. // Add text format.
$this->drupalGet('admin/config/content/formats'); $this->drupalGet('admin/config/content/formats');
$this->clickLink('Add text format'); $this->clickLink('Add text format');
$format_id = mb_strtolower($this->randomMachineName()); $format_id = $this->randomMachineName();
$name = $this->randomMachineName(); $name = $this->randomMachineName();
$edit = [ $edit = [
'format' => $format_id, 'format' => $format_id,
@ -248,7 +248,7 @@ class FilterAdminTest extends BrowserTestBase {
// Add format. // Add format.
$edit = []; $edit = [];
$edit['format'] = mb_strtolower($this->randomMachineName()); $edit['format'] = $this->randomMachineName();
$edit['name'] = $this->randomMachineName(); $edit['name'] = $this->randomMachineName();
$edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1; $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
$edit['filters[' . $second_filter . '][status]'] = TRUE; $edit['filters[' . $second_filter . '][status]'] = TRUE;
@ -412,14 +412,14 @@ class FilterAdminTest extends BrowserTestBase {
*/ */
public function testDisabledFormat() { public function testDisabledFormat() {
// Create a node type and add a standard body field. // Create a node type and add a standard body field.
$node_type = NodeType::create(['type' => mb_strtolower($this->randomMachineName())]); $node_type = NodeType::create(['type' => $this->randomMachineName()]);
$node_type->save(); $node_type->save();
node_add_body_field($node_type, $this->randomString()); node_add_body_field($node_type, $this->randomString());
// Create a text format with a filter that returns a static string. // Create a text format with a filter that returns a static string.
$format = FilterFormat::create([ $format = FilterFormat::create([
'name' => $this->randomString(), 'name' => $this->randomString(),
'format' => $format_id = mb_strtolower($this->randomMachineName()), 'format' => $format_id = $this->randomMachineName(),
]); ]);
$format->setFilterConfig('filter_static_text', ['status' => TRUE]); $format->setFilterConfig('filter_static_text', ['status' => TRUE]);
$format->save(); $format->save();

View File

@ -35,7 +35,7 @@ class FilterDefaultFormatTest extends BrowserTestBase {
$formats = []; $formats = [];
for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
$edit = [ $edit = [
'format' => mb_strtolower($this->randomMachineName()), 'format' => $this->randomMachineName(),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
]; ];
$this->drupalGet('admin/config/content/formats/add'); $this->drupalGet('admin/config/content/formats/add');

View File

@ -94,7 +94,7 @@ class FilterFormatAccessTest extends BrowserTestBase {
$formats = []; $formats = [];
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
$edit = [ $edit = [
'format' => mb_strtolower($this->randomMachineName()), 'format' => $this->randomMachineName(),
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
]; ];
$this->drupalGet('admin/config/content/formats/add'); $this->drupalGet('admin/config/content/formats/add');

View File

@ -32,7 +32,7 @@ class FilterHooksTest extends BrowserTestBase {
*/ */
public function testFilterHooks() { public function testFilterHooks() {
// Create content type, with underscores. // Create content type, with underscores.
$type_name = 'test_' . strtolower($this->randomMachineName()); $type_name = 'test_' . $this->randomMachineName();
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$node_permission = "create $type_name content"; $node_permission = "create $type_name content";
@ -46,7 +46,7 @@ class FilterHooksTest extends BrowserTestBase {
// Add a text format. // Add a text format.
$name = $this->randomMachineName(); $name = $this->randomMachineName();
$edit = []; $edit = [];
$edit['format'] = mb_strtolower($this->randomMachineName()); $edit['format'] = $this->randomMachineName();
$edit['name'] = $name; $edit['name'] = $name;
$edit['roles[' . RoleInterface::ANONYMOUS_ID . ']'] = 1; $edit['roles[' . RoleInterface::ANONYMOUS_ID . ']'] = 1;
$this->drupalGet('admin/config/content/formats/add'); $this->drupalGet('admin/config/content/formats/add');

View File

@ -80,7 +80,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
$admin_path = 'admin/config/media/image-styles'; $admin_path = 'admin/config/media/image-styles';
// Setup a style to be created and effects to add to it. // Setup a style to be created and effects to add to it.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomString(); $style_label = $this->randomString();
$style_path = $admin_path . '/manage/' . $style_name; $style_path = $admin_path . '/manage/' . $style_name;
$effect_edits = [ $effect_edits = [
@ -197,7 +197,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
// Test the style overview form. // Test the style overview form.
// Change the name of the style and adjust the weights of effects. // Change the name of the style and adjust the weights of effects.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomMachineName(); $style_label = $this->randomMachineName();
$weight = count($effect_edits); $weight = count($effect_edits);
$edit = [ $edit = [
@ -317,14 +317,14 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
*/ */
public function testStyleReplacement() { public function testStyleReplacement() {
// Create a new style. // Create a new style.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomString(); $style_label = $this->randomString();
$style = ImageStyle::create(['name' => $style_name, 'label' => $style_label]); $style = ImageStyle::create(['name' => $style_name, 'label' => $style_label]);
$style->save(); $style->save();
$style_path = 'admin/config/media/image-styles/manage/'; $style_path = 'admin/config/media/image-styles/manage/';
// Create an image field that uses the new style. // Create an image field that uses the new style.
$field_name = strtolower($this->randomMachineName(10)); $field_name = $this->randomMachineName(10);
$this->createImageField($field_name, 'article'); $this->createImageField($field_name, 'article');
\Drupal::service('entity_display.repository') \Drupal::service('entity_display.repository')
->getViewDisplay('node', 'article') ->getViewDisplay('node', 'article')
@ -351,7 +351,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
$this->assertSession()->responseContains($file_url_generator->transformRelative($style->buildUrl($original_uri))); $this->assertSession()->responseContains($file_url_generator->transformRelative($style->buildUrl($original_uri)));
// Rename the style and make sure the image field is updated. // Rename the style and make sure the image field is updated.
$new_style_name = strtolower($this->randomMachineName(10)); $new_style_name = $this->randomMachineName(10);
$new_style_label = $this->randomString(); $new_style_label = $this->randomString();
$edit = [ $edit = [
'name' => $new_style_name, 'name' => $new_style_name,
@ -441,7 +441,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
$admin_path = 'admin/config/media/image-styles'; $admin_path = 'admin/config/media/image-styles';
// Create a new style. // Create a new style.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style = ImageStyle::create(['name' => $style_name, 'label' => $this->randomString()]); $style = ImageStyle::create(['name' => $style_name, 'label' => $this->randomString()]);
$style->save(); $style->save();
@ -471,13 +471,13 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
*/ */
public function testConfigImport() { public function testConfigImport() {
// Create a new style. // Create a new style.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomString(); $style_label = $this->randomString();
$style = ImageStyle::create(['name' => $style_name, 'label' => $style_label]); $style = ImageStyle::create(['name' => $style_name, 'label' => $style_label]);
$style->save(); $style->save();
// Create an image field that uses the new style. // Create an image field that uses the new style.
$field_name = strtolower($this->randomMachineName(10)); $field_name = $this->randomMachineName(10);
$this->createImageField($field_name, 'article'); $this->createImageField($field_name, 'article');
\Drupal::service('entity_display.repository') \Drupal::service('entity_display.repository')
->getViewDisplay('node', 'article') ->getViewDisplay('node', 'article')

View File

@ -62,7 +62,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
// Create an image field storage and add a field to the article content // Create an image field storage and add a field to the article content
// type. // type.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$storage_settings['default_image'] = [ $storage_settings['default_image'] = [
'uuid' => $default_images['field_storage']->uuid(), 'uuid' => $default_images['field_storage']->uuid(),
'alt' => '', 'alt' => '',
@ -261,7 +261,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
*/ */
public function testInvalidDefaultImage() { public function testInvalidDefaultImage() {
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => mb_strtolower($this->randomMachineName()), 'field_name' => $this->randomMachineName(),
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'image', 'type' => 'image',
'settings' => [ 'settings' => [

View File

@ -59,7 +59,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */ /** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer'); $renderer = $this->container->get('renderer');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_settings = ['alt_field_required' => 0]; $field_settings = ['alt_field_required' => 0];
$instance = $this->createImageField($field_name, 'article', ['uri_scheme' => $scheme], $field_settings); $instance = $this->createImageField($field_name, 'article', ['uri_scheme' => $scheme], $field_settings);
@ -246,7 +246,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$test_image = current($this->drupalGetTestFiles('image')); $test_image = current($this->drupalGetTestFiles('image'));
[, $test_image_extension] = explode('.', $test_image->filename); [, $test_image_extension] = explode('.', $test_image->filename);
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_settings = [ $field_settings = [
'alt_field' => 1, 'alt_field' => 1,
'file_extensions' => $test_image_extension, 'file_extensions' => $test_image_extension,
@ -364,7 +364,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */ /** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer'); $renderer = $this->container->get('renderer');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_settings = ['alt_field_required' => 0]; $field_settings = ['alt_field_required' => 0];
$instance = $this->createImageField($field_name, 'article', [], $field_settings); $instance = $this->createImageField($field_name, 'article', [], $field_settings);
@ -480,7 +480,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Create a new image field. // Create a new image field.
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createImageField($field_name, 'article'); $this->createImageField($field_name, 'article');
// Create a new node, with no images and verify that no images are // Create a new node, with no images and verify that no images are
@ -569,7 +569,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$this->assertEmpty($default_image['uuid'], 'Default image removed from field.'); $this->assertEmpty($default_image['uuid'], 'Default image removed from field.');
// Create an image field that uses the private:// scheme and test that the // Create an image field that uses the private:// scheme and test that the
// default image works as expected. // default image works as expected.
$private_field_name = strtolower($this->randomMachineName()); $private_field_name = $this->randomMachineName();
$this->createImageField($private_field_name, 'article', ['uri_scheme' => 'private']); $this->createImageField($private_field_name, 'article', ['uri_scheme' => 'private']);
// Add a default image to the new field. // Add a default image to the new field.
$edit = [ $edit = [

View File

@ -29,7 +29,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
$file_system = $this->container->get('file_system'); $file_system = $this->container->get('file_system');
$image_files = $this->drupalGetTestFiles('image'); $image_files = $this->drupalGetTestFiles('image');
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createImageField($field_name, 'article', [], ['file_directory' => 'test-upload']); $this->createImageField($field_name, 'article', [], ['file_directory' => 'test-upload']);
$expected_path = 'public://test-upload'; $expected_path = 'public://test-upload';
@ -89,9 +89,9 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
*/ */
public function testResolution() { public function testResolution() {
$field_names = [ $field_names = [
0 => strtolower($this->randomMachineName()), 0 => $this->randomMachineName(),
1 => strtolower($this->randomMachineName()), 1 => $this->randomMachineName(),
2 => strtolower($this->randomMachineName()), 2 => $this->randomMachineName(),
]; ];
$min_resolution = [ $min_resolution = [
'width' => 50, 'width' => 50,
@ -163,7 +163,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
* Tests that required alt/title fields gets validated right. * Tests that required alt/title fields gets validated right.
*/ */
public function testRequiredAttributes() { public function testRequiredAttributes() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_settings = [ $field_settings = [
'alt_field' => 1, 'alt_field' => 1,
'alt_field_required' => 1, 'alt_field_required' => 1,

View File

@ -21,7 +21,7 @@ class ImageFieldWidgetTest extends ImageFieldTestBase {
*/ */
public function testWidgetElement() { public function testWidgetElement() {
// Check for image widget in add/node/article page // Check for image widget in add/node/article page
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$min_resolution = 50; $min_resolution = 50;
$max_resolution = 100; $max_resolution = 100;
$field_settings = [ $field_settings = [

View File

@ -49,7 +49,7 @@ class ImageOnTranslatedEntityTest extends ImageFieldTestBase {
$this->drupalCreateContentType(['type' => 'basicpage', 'name' => 'Basic page', 'new_revision' => FALSE]); $this->drupalCreateContentType(['type' => 'basicpage', 'name' => 'Basic page', 'new_revision' => FALSE]);
// Create an image field on the "Basic page" node type. // Create an image field on the "Basic page" node type.
$this->fieldName = strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
$this->createImageField($this->fieldName, 'basicpage', [], ['title_field' => 1]); $this->createImageField($this->fieldName, 'basicpage', [], ['title_field' => 1]);
// Create and log in user. // Create and log in user.

View File

@ -60,7 +60,7 @@ class ImageStyleFlushTest extends ImageFieldTestBase {
public function testFlush() { public function testFlush() {
// Setup a style to be created and effects to add to it. // Setup a style to be created and effects to add to it.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomString(); $style_label = $this->randomString();
$style_path = 'admin/config/media/image-styles/manage/' . $style_name; $style_path = 'admin/config/media/image-styles/manage/' . $style_name;
$effect_edits = [ $effect_edits = [

View File

@ -23,7 +23,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
$admin_path = 'admin/config/media/image-styles'; $admin_path = 'admin/config/media/image-styles';
// Setup a style to be created and effects to add to it. // Setup a style to be created and effects to add to it.
$style_name = strtolower($this->randomMachineName(10)); $style_name = $this->randomMachineName(10);
$style_label = $this->randomString(); $style_label = $this->randomString();
$style_path = $admin_path . '/manage/' . $style_name; $style_path = $admin_path . '/manage/' . $style_name;
$effect_edit = [ $effect_edit = [

View File

@ -21,7 +21,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
* Tests the validation message is displayed only once for ajax uploads. * Tests the validation message is displayed only once for ajax uploads.
*/ */
public function testAJAXValidationMessage() { public function testAJAXValidationMessage() {
$field_name = strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->createImageField($field_name, 'article', ['cardinality' => -1]); $this->createImageField($field_name, 'article', ['cardinality' => -1]);
$this->drupalGet('node/add/article'); $this->drupalGet('node/add/article');

View File

@ -58,7 +58,7 @@ class ImageFormatterTest extends FieldKernelTestBase {
$this->entityType = 'entity_test'; $this->entityType = 'entity_test';
$this->bundle = $this->entityType; $this->bundle = $this->entityType;
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'entity_type' => $this->entityType, 'entity_type' => $this->entityType,

View File

@ -212,8 +212,8 @@ class ConfigurableLanguageManagerTest extends BrowserTestBase {
]); ]);
// Create a field on the user entity. // Create a field on the user entity.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$label = mb_strtolower($this->randomMachineName()); $label = $this->randomMachineName();
$field_label_en = "English $label"; $field_label_en = "English $label";
$field_label_es = "Español $label"; $field_label_es = "Español $label";

View File

@ -86,7 +86,7 @@ class LinkFieldTest extends BrowserTestBase {
* Tests link field URL validation. * Tests link field URL validation.
*/ */
protected function doTestURLValidation() { protected function doTestURLValidation() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
@ -270,7 +270,7 @@ class LinkFieldTest extends BrowserTestBase {
* Tests the link title settings of a link field. * Tests the link title settings of a link field.
*/ */
protected function doTestLinkTitle() { protected function doTestLinkTitle() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
@ -395,7 +395,7 @@ class LinkFieldTest extends BrowserTestBase {
* Tests the default 'link' formatter. * Tests the default 'link' formatter.
*/ */
protected function doTestLinkFormatter() { protected function doTestLinkFormatter() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
@ -552,7 +552,7 @@ class LinkFieldTest extends BrowserTestBase {
* merged, since they involve different configuration and output. * merged, since they involve different configuration and output.
*/ */
protected function doTestLinkSeparateFormatter() { protected function doTestLinkSeparateFormatter() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
@ -681,7 +681,7 @@ class LinkFieldTest extends BrowserTestBase {
protected function doTestLinkTypeOnLinkWidget() { protected function doTestLinkTypeOnLinkWidget() {
$link_type = LinkItemInterface::LINK_EXTERNAL; $link_type = LinkItemInterface::LINK_EXTERNAL;
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
// Create a field with settings to validate. // Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
@ -779,7 +779,7 @@ class LinkFieldTest extends BrowserTestBase {
* Tests <nolink> and <none> as link uri. * Tests <nolink> and <none> as link uri.
*/ */
public function testNoLinkUri() { public function testNoLinkUri() {
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$this->fieldStorage = FieldStorageConfig::create([ $this->fieldStorage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -48,7 +48,7 @@ class MediaTypeCreationTest extends MediaFunctionalTestBase {
* Data provider for testMediaTypeCreationForm(). * Data provider for testMediaTypeCreationForm().
*/ */
public function providerMediaTypeCreationForm() { public function providerMediaTypeCreationForm() {
$machine_name = mb_strtolower($this->randomMachineName()); $machine_name = $this->randomMachineName();
return [ return [
[ [
'Save', 'Save',

View File

@ -29,7 +29,7 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase {
$this->createMediaType('test'); $this->createMediaType('test');
$view_id = strtolower($this->randomMachineName(16)); $view_id = $this->randomMachineName(16);
$this->drupalGet('admin/structure/views/add'); $this->drupalGet('admin/structure/views/add');
$page->fillField('label', $view_id); $page->fillField('label', $view_id);
$this->waitUntilVisible('.machine-name-value'); $this->waitUntilVisible('.machine-name-value');
@ -63,7 +63,7 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase {
$page = $session->getPage(); $page = $session->getPage();
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$view_id = strtolower($this->randomMachineName(16)); $view_id = $this->randomMachineName(16);
$this->drupalGet('admin/structure/views/add'); $this->drupalGet('admin/structure/views/add');
$page->fillField('label', $view_id); $page->fillField('label', $view_id);
$this->waitUntilVisible('.machine-name-value'); $this->waitUntilVisible('.machine-name-value');

View File

@ -61,7 +61,7 @@ class MenuUiLanguageTest extends BrowserTestBase {
public function testMenuLanguage() { public function testMenuLanguage() {
// Create a test menu to test the various language-related settings. // Create a test menu to test the various language-related settings.
// Machine name has to be lowercase. // Machine name has to be lowercase.
$menu_name = mb_strtolower($this->randomMachineName(16)); $menu_name = $this->randomMachineName(16);
$label = $this->randomString(); $label = $this->randomString();
$edit = [ $edit = [
'id' => $menu_name, 'id' => $menu_name,

View File

@ -226,7 +226,7 @@ class MenuUiTest extends BrowserTestBase {
*/ */
public function addCustomMenuCRUD() { public function addCustomMenuCRUD() {
// Add a new custom menu. // Add a new custom menu.
$menu_name = strtolower($this->randomMachineName(MenuStorage::MAX_ID_LENGTH)); $menu_name = $this->randomMachineName(MenuStorage::MAX_ID_LENGTH);
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$menu = Menu::create([ $menu = Menu::create([
@ -267,7 +267,7 @@ class MenuUiTest extends BrowserTestBase {
public function addCustomMenu() { public function addCustomMenu() {
// Try adding a menu using a menu_name that is too long. // Try adding a menu using a menu_name that is too long.
$this->drupalGet('admin/structure/menu/add'); $this->drupalGet('admin/structure/menu/add');
$menu_name = strtolower($this->randomMachineName(MenuStorage::MAX_ID_LENGTH + 1)); $menu_name = $this->randomMachineName(MenuStorage::MAX_ID_LENGTH + 1);
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$edit = [ $edit = [
'id' => $menu_name, 'id' => $menu_name,
@ -282,7 +282,7 @@ class MenuUiTest extends BrowserTestBase {
$this->assertSession()->pageTextContains("Menu name cannot be longer than " . MenuStorage::MAX_ID_LENGTH . " characters but is currently " . mb_strlen($menu_name) . " characters long."); $this->assertSession()->pageTextContains("Menu name cannot be longer than " . MenuStorage::MAX_ID_LENGTH . " characters but is currently " . mb_strlen($menu_name) . " characters long.");
// Change the menu_name so it no longer exceeds the maximum length. // Change the menu_name so it no longer exceeds the maximum length.
$menu_name = strtolower($this->randomMachineName(MenuStorage::MAX_ID_LENGTH)); $menu_name = $this->randomMachineName(MenuStorage::MAX_ID_LENGTH);
$edit['id'] = $menu_name; $edit['id'] = $menu_name;
$this->drupalGet('admin/structure/menu/add'); $this->drupalGet('admin/structure/menu/add');
$this->submitForm($edit, 'Save'); $this->submitForm($edit, 'Save');

View File

@ -75,7 +75,7 @@ class MenuUiJavascriptTest extends WebDriverTestBase {
protected function addCustomMenu() { protected function addCustomMenu() {
// Try adding a menu using a menu_name that is too long. // Try adding a menu using a menu_name that is too long.
$label = $this->randomMachineName(16); $label = $this->randomMachineName(16);
$menu_id = strtolower($this->randomMachineName(MenuStorage::MAX_ID_LENGTH + 1)); $menu_id = $this->randomMachineName(MenuStorage::MAX_ID_LENGTH + 1);
$this->drupalGet('admin/structure/menu/add'); $this->drupalGet('admin/structure/menu/add');
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();

View File

@ -188,7 +188,7 @@ class MigrateEntityContentValidationTest extends KernelTestBase {
$normal_user->save(); $normal_user->save();
// Add a "body" field with the text format. // Add a "body" field with the text format.
$field_name = mb_strtolower($this->randomMachineName()); $field_name = $this->randomMachineName();
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',

View File

@ -36,7 +36,7 @@ class MultiStepNodeFormBasicOptionsTest extends NodeTestBase {
$this->drupalLogin($web_user); $this->drupalLogin($web_user);
// Create an unlimited cardinality field. // Create an unlimited cardinality field.
$this->fieldName = mb_strtolower($this->randomMachineName()); $this->fieldName = $this->randomMachineName();
FieldStorageConfig::create([ FieldStorageConfig::create([
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'entity_type' => 'node', 'entity_type' => 'node',

Some files were not shown because too many files have changed in this diff Show More