diff -u b/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php --- b/core/modules/link/src/Tests/LinkFieldTest.php +++ b/core/modules/link/src/Tests/LinkFieldTest.php @@ -602,14 +602,14 @@ function testRequiredLinkText() { $field_name = Unicode::strtolower($this->randomMachineName()); // Create a field with settings to validate. - $this->fieldStorage = FieldStorageConfig::create([ + FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', - ]); - $this->fieldStorage->save(); - $this->field = FieldConfig::create([ - 'field_storage' => $this->fieldStorage, + ])->save(); + FieldConfig::create([ + 'field_name' => $field_name, + 'entity_type' => 'entity_test', 'bundle' => 'entity_test', 'label' => 'Read more about this entity', 'required' => TRUE, @@ -618,24 +618,22 @@ 'link_type' => LinkItemInterface::LINK_GENERIC, ], - ]); - $this->field->save(); + ])->save(); EntityFormDisplay::load('entity_test.entity_test.default') - ->setComponent($field_name, array( + ->setComponent($field_name, [ 'type' => 'link_default', 'settings' => [ 'placeholder_url' => 'http://example.com', 'placeholder_title' => 'Enter the text for this link', ], - )) + ]) ->save(); // Display creation form. - $this->drupalGet('entity_test/add'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm('entity_test/add', [], t('Save')); - $result = $this->xpath('//label[contains(@class, :class) and contains(text(), :text)]', array(':class' => 'form-required', ':text' => 'Link text')); + $result = $this->xpath('//label[contains(@class, :class) and contains(text(), :text)]', [':class' => 'form-required', ':text' => 'Link text']); $this->assertEqual(count($result), 1, "Link text is marked as required when the link field is set to required."); - $this->assertText(t('@url field is required.', array('@url' => t('URL')))); - $this->assertText(t('@name field is required.', array('@name' => t('Link text')))); + $this->assertText(t('@url field is required.', ['@url' => t('URL')])); + $this->assertText(t('@name field is required.', ['@name' => t('Link text')])); } }