diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 8cea4dd..fefc526 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -176,7 +176,9 @@ function entity_module_preuninstall($module) { $storage = $entity_manager->getStorage($entity_type->id()); if ($storage instanceof SqlStorageInterface) { foreach ($storage->getSchema() as $table_name => $table_schema) { - if ($schema->tableExists($table_name)) { + // @todo Remove the drupal_get_schema() call once all entity types + // have been converted to an automatic schema. + if (!drupal_get_schema($table_name) && $schema->tableExists($table_name)) { $schema->dropTable($table_name, $table_schema); } } diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php index 865704d..a522385 100644 --- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php +++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php @@ -80,18 +80,12 @@ public function testNormalize() { 'id' => array( array('value' => 1), ), - 'revision_id' => array( - array('value' => 1), - ), 'uuid' => array( array('value' => $this->entity->uuid()), ), 'langcode' => array( array('value' => Language::LANGCODE_NOT_SPECIFIED), ), - 'default_langcode' => array( - array('value' => NULL), - ), 'name' => array( array('value' => $this->values['name']), ), @@ -101,6 +95,18 @@ public function testNormalize() { 'user_id' => array( array('target_id' => $this->values['user_id']), ), + 'revision_id' => array( + array('value' => 1), + ), + 'revision_timestamp' => array( + array('value' => NULL), + ), + 'revision_uid' => array( + array('target_id' => NULL), + ), + 'log' => array( + array('value' => NULL), + ), 'field_test_text' => array( array( 'value' => $this->values['field_test_text']['value'], @@ -141,13 +147,15 @@ public function testSerialize() { // order. $expected = array( 'id' => '' . $this->entity->id() . '', - 'revision_id' => '' . $this->entity->getRevisionId() . '', 'uuid' => '' . $this->entity->uuid() . '', 'langcode' => '' . Language::LANGCODE_NOT_SPECIFIED . '', - 'default_langcode' => '', 'name' => '' . $this->values['name'] . '', 'type' => 'entity_test_mulrev', 'user_id' => '' . $this->values['user_id'] . '', + 'revision_id' => '' . $this->entity->getRevisionId() . '', + 'revision_timestamp' => '', + 'revision_uid' => '', + 'log' => '', 'field_test_text' => '' . $this->values['field_test_text']['value'] . '' . $this->values['field_test_text']['format'] . '', ); // Sort it in the same order as normalised. diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php index 753745f..0ae29c8 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php @@ -27,7 +27,7 @@ class EditTestBase extends DrupalUnitTestBase { protected function setUp() { parent::setUp(); - $this->installSchema('entity_test', array('entity_test', 'entity_test_rev')); + $this->installEntitySchema('entity_test'); $this->installConfig(array('field', 'filter')); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php index f035f37..a516ba4 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php @@ -75,7 +75,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision')); + $this->installEntitySchema('entity_test'); // Setup a field and instance. entity_reference_create_instance( diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php index 4b0e85e..28f0567 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php @@ -36,7 +36,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision')); + $this->installEntitySchema('entity_test'); } /** diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 2acf138..88f49d3 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -19,7 +19,7 @@ class DrupalUnitTestBaseTest extends DrupalUnitTestBase { * * @var array */ - public static $modules = array('entity', 'entity_test'); + public static $modules = array('entity', 'entity_test', 'entity_install_schema_test'); public static function getInfo() { return array( @@ -33,8 +33,8 @@ public static function getInfo() { * Tests expected behavior of setUp(). */ function testSetUp() { - $modules = array('entity', 'entity_test'); - $table = 'entity_test'; + $modules = array('entity', 'entity_test', 'entity_install_schema_test'); + $tables = array('entity_test', 'entity_install_schema_test'); // Verify that specified $modules have been loaded. $this->assertTrue(function_exists('entity_test_permission'), 'entity_test.module was loaded.'); @@ -43,7 +43,9 @@ function testSetUp() { $this->assertIdentical(\Drupal::moduleHandler()->getImplementations('permission'), $modules); // Verify that no modules have been installed. - $this->assertFalse(db_table_exists($table), "'$table' database table not found."); + foreach($tables as $table){ + $this->assertFalse(db_table_exists($table), "'$table' database table not found."); + } } /** @@ -124,8 +126,8 @@ function testEnableModulesInstallContainer() { * Tests expected behavior of installSchema(). */ function testInstallSchema() { - $module = 'entity_test'; - $table = 'entity_test'; + $module = 'entity_install_schema_test'; + $table = 'entity_install_schema_test'; // Verify that we can install a table from the module schema. $this->installSchema($module, $table); $this->assertTrue(db_table_exists($table), "'$table' database table found."); diff --git a/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.info.yml b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.info.yml new file mode 100644 index 0000000..7ff72d1 --- /dev/null +++ b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.info.yml @@ -0,0 +1,7 @@ +name: Schema Test +type: module +description: 'Provides dummy schema for use by SimpleTest tests.' +package: Testing +version: VERSION +core: 8.x +hidden: TRUE diff --git a/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.install b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.install new file mode 100644 index 0000000..3bbe45a --- /dev/null +++ b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.install @@ -0,0 +1,50 @@ + 'Stores entity_install_schema_test data.', + 'fields' => array( + 'sid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => 'Primary Key: Unique ID.', + ), + 'uuid' => array( + 'description' => 'Unique Key: Universally unique identifier for this entity.', + 'type' => 'varchar', + 'length' => 128, + 'not null' => FALSE, + ), + 'dummy_textfield' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + 'description' => 'A Dummy text field.', + ), + 'dummy_integer' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'A dummy integer field.', + ), + ), + 'indexes' => array( + 'entity_install_schema_test_index' => array('sid', 'dummy_integer'), + ), + 'primary key' => array('sid'), + 'unique keys' => array( + 'uuid' => array('uuid'), + ), + ); + + return $schema; +} diff --git a/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.module b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.module new file mode 100644 index 0000000..d67c4bf --- /dev/null +++ b/core/modules/simpletest/tests/modules/entity_install_schema_test/entity_install_schema_test.module @@ -0,0 +1,25 @@ + array( + 'title' => t('Administer entity_install_schema_test content'), + 'description' => t('Manage entity_install_schema_test content'), + ), + 'view install schema test entity' => array( + 'title' => t('View install schema test entities'), + ), + 'view install schema test entity translations' => array( + 'title' => t('View translations of install schema test entities'), + ), + ); + return $permissions; +} diff --git a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php index 9b93095..cacbf5e 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php @@ -50,7 +50,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision')); + $this->installEntitySchema('entity_test'); // Create the necessary formats. $this->installConfig(array('filter'));