reverted: --- b/core/modules/user/src/Tests/UserFieldsTest.php +++ /dev/null @@ -1,56 +0,0 @@ -installEntitySchema('user'); - - // Setup a test theme that prints the user's mail field. - \Drupal::service('theme_handler')->install(array('user_test_theme')); - \Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('user_test_theme')); - // Clear the theme registry. - $this->container->set('theme.registry', NULL); - } - - /** - * Tests account's available fields. - */ - function testUserFields() { - // Create the user to test the user fields. - $user = User::create([ - 'name' => 'foobar', - 'mail' => 'foobar@example.com', - ]); - $build = user_view($user); - $output = \Drupal::service('renderer')->render($build); - $this->setRawContent($output); - $userEmail = $user->getEmail(); - $this->assertText($userEmail, "User's mail field is found in the twig template"); - } -} reverted: --- b/core/modules/user/tests/themes/user_test_theme/user.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{# -/** - * @file - * Theme override for testing presence all user data. - * - * This template is used when viewing a registered user's page, - * e.g., example.com/user/123. 123 being the user's ID. - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * print a subset such as 'content.field_example'. - * - Field variables: For each field attached to the user a corresponding - * variable is defined; e.g., account.field_example has a variable - * 'field_example' defined. When needing to access a field's raw values, - * developers/themers are strongly encouraged to use these variables. - * Otherwise they will have to explicitly specify the desired field language, - * e.g. account.field_example.en, thus overriding any language negotiation - * rule that was previously applied. - * - attributes: HTML attributes for the container element. - * - user: A Drupal User entity. - * - * @see template_preprocess_user() - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - {% if user %} -

{{- user.mail.value -}}

- {% endif %} - reverted: --- b/core/modules/user/tests/themes/user_test_theme/user_test_theme.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'User Test theme' -type: theme -description: 'Theme for testing the available fields in user twig template' -version: VERSION -core: 8.x -stylesheets-remove: - - system.module.css -regions: - content: Content - left: Left - right: Right only in patch2: unchanged: --- a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php @@ -8,6 +8,8 @@ namespace Drupal\entity_reference\Tests; use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\simpletest\WebTestBase; use Drupal\node\Entity\Node; @@ -44,7 +46,7 @@ protected function setUp() { $referenced = $this->drupalCreateContentType(); $this->referencedType = $referenced->id(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'node', 'translatable' => FALSE, @@ -56,7 +58,7 @@ protected function setUp() { 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, ))->save(); - entity_create('field_config', array( + FieldConfig::create(array( 'label' => 'Entity reference field', 'field_name' => 'test_field', 'entity_type' => 'node', only in patch2: unchanged: --- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php @@ -9,7 +9,9 @@ use Drupal\Component\Utility\Unicode; use Drupal\config\Tests\SchemaCheckTestTrait; +use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\node\Entity\Node; use Drupal\simpletest\WebTestBase; /** @@ -54,14 +56,14 @@ function testEntityReferenceDefaultValue() { $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content')); $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'entity_reference', 'settings' => array('target_type' => 'node'), )); $field_storage->save(); - $field = entity_create('field_config', array( + $field = FieldConfig::create(array( 'field_storage' => $field_storage, 'bundle' => 'reference_content', 'settings' => array( @@ -96,7 +98,7 @@ function testEntityReferenceDefaultValue() { \Drupal::entityManager()->clearCachedFieldDefinitions(); // Create a new node to check that UUID has been converted to numeric ID. - $new_node = entity_create('node', array('type' => 'reference_content')); + $new_node = Node::create(array('type' => 'reference_content')); $this->assertEqual($new_node->get($field_name)->offsetGet(0)->target_id, $referenced_node->id()); // Ensure that the entity reference config schemas are correct. @@ -117,7 +119,7 @@ function testEntityReferenceDefaultConfigValue() { $referenced_node_type2 = $this->drupalCreateContentType(array('type' => 'referenced_config_to_preserve')); $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'entity_reference', @@ -125,7 +127,7 @@ function testEntityReferenceDefaultConfigValue() { 'cardinality' => FieldStorageConfig::CARDINALITY_UNLIMITED, )); $field_storage->save(); - $field = entity_create('field_config', array( + $field = FieldConfig::create(array( 'field_storage' => $field_storage, 'bundle' => 'reference_content', 'settings' => array( only in patch2: unchanged: --- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -7,6 +7,9 @@ namespace Drupal\entity_reference\Tests; +use Drupal\Core\Entity\EntityManager; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\simpletest\WebTestBase; @@ -183,7 +186,7 @@ protected function enableTranslation() { * Adds term reference field for the article content type. */ protected function setUpEntityReferenceField() { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->referenceFieldName, 'entity_type' => $this->testEntityTypeName, 'type' => 'entity_reference', @@ -198,7 +201,7 @@ protected function setUpEntityReferenceField() { ), ))->save(); - entity_create('field_config', array( + FieldConfig::create(array( 'field_name' => $this->referenceFieldName, 'bundle' => $this->referrerType->id(), 'entity_type' => $this->testEntityTypeName, @@ -235,7 +238,7 @@ protected function setUpContentTypes() { */ protected function createReferencedEntityWithTranslation() { /** @var \Drupal\node\Entity\Node $node */ - $node = entity_create($this->testEntityTypeName, array( + $node = EntityManager::create($this->testEntityTypeName, array( 'title' => $this->originalLabel, 'type' => $this->referencedType->id(), 'description' => array( @@ -259,7 +262,7 @@ protected function createReferencedEntityWithTranslation() { */ protected function createNotTranslatedReferencedEntity() { /** @var \Drupal\node\Entity\Node $node */ - $node = entity_create($this->testEntityTypeName, array( + $node = EntityManager::create($this->testEntityTypeName, array( 'title' => $this->labelOfNotTranslatedReference, 'type' => $this->referencedType->id(), 'description' => array( @@ -278,7 +281,7 @@ protected function createNotTranslatedReferencedEntity() { */ protected function createReferrerEntity() { /** @var \Drupal\node\Entity\Node $node */ - $node = entity_create($this->testEntityTypeName, array( + $node = EntityManager::create($this->testEntityTypeName, array( 'title' => $this->randomMachineName(), 'type' => $this->referrerType->id(), 'description' => array( only in patch2: unchanged: --- a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php @@ -9,8 +9,10 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\config\Tests\AssertConfigEntityImportTrait; +use Drupal\config_test\Entity\ConfigTest; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\entity_reference\Tests\EntityReferenceTestTrait; +use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\simpletest\WebTestBase; @@ -199,14 +201,14 @@ protected function assertFieldValues($entity_name, $referenced_entities) { * An array of entity objects. */ protected function getTestEntities() { - $config_entity_1 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); + $config_entity_1 = ConfigTest::create(array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); $config_entity_1->save(); - $config_entity_2 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); + $config_entity_2 = ConfigTest::create(array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); $config_entity_2->save(); - $content_entity_1 = entity_create('entity_test', array('name' => $this->randomMachineName())); + $content_entity_1 = EntityTest::create(array('name' => $this->randomMachineName())); $content_entity_1->save(); - $content_entity_2 = entity_create('entity_test', array('name' => $this->randomMachineName())); + $content_entity_2 = EntityTest::create(array('name' => $this->randomMachineName())); $content_entity_2->save(); return array( only in patch2: unchanged: --- a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php +++ b/core/modules/entity_reference/src/Tests/Views/SelectionTest.php @@ -7,6 +7,8 @@ namespace Drupal\entity_reference\Tests\Views; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\simpletest\WebTestBase; use Drupal\views\Views; @@ -50,7 +52,7 @@ public function setUp() { } // Create a field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'entity_test', 'translatable' => FALSE, @@ -61,7 +63,7 @@ public function setUp() { 'cardinality' => '1', )); $field_storage->save(); - $field = entity_create('field_config', array( + $field = FieldConfig::create(array( 'field_storage' => $field_storage, 'bundle' => 'test_bundle', 'settings' => array(