', 'No image displayed when no image is attached and no default image specified.');
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
// Add a default image to the public imagefield instance.
$images = $this->drupalGetTestFiles('image');
@@ -295,8 +285,6 @@ function testImageFieldDefaultImage() {
);
$default_output = drupal_render($image);
$this->drupalGet('node/' . $node->id());
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
$this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
// Create a node with an image attached and ensure that the default image
@@ -311,8 +299,6 @@ function testImageFieldDefaultImage() {
);
$image_output = drupal_render($image);
$this->drupalGet('node/' . $nid);
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
$this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
$this->assertRaw($image_output, 'User supplied image is displayed.');
@@ -358,9 +344,6 @@ function testImageFieldDefaultImage() {
);
$default_output = drupal_render($image);
$this->drupalGet('node/' . $node->id());
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
$this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.');
}
-
}
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
index 7803a11..e17987b 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
@@ -47,7 +47,8 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('file', array('file_managed', 'file_usage'));
+ $this->installEntitySchema('file');
+ $this->installSchema('file', array('file_usage'));
entity_create('field_config', array(
'name' => 'image_test',
diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module
index 0323875..a74b5ce 100644
--- a/core/modules/menu_ui/menu_ui.module
+++ b/core/modules/menu_ui/menu_ui.module
@@ -300,10 +300,12 @@ function menu_ui_block_view_system_menu_block_alter(array &$build, BlockPluginIn
// Add contextual links for system menu blocks.
$menus = menu_list_system_menus();
$menu_name = $block->getDerivativeId();
- if (isset($menus[$menu_name])) {
- $build['#contextual_links']['menu'] = array(
- 'route_parameters' => array('menu' => $menu_name),
- );
+ if (isset($menus[$menu_name]) && isset($build['content'])) {
+ foreach (Element::children($build['content']) as $key) {
+ $build['#contextual_links']['menu'] = array(
+ 'route_parameters' => array('menu' => $build['content'][$key]['#original_link']['menu_name']),
+ );
+ }
}
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/MigrateDrupalTestBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/MigrateDrupalTestBase.php
index f660102..7a6579c 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/MigrateDrupalTestBase.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/MigrateDrupalTestBase.php
@@ -17,15 +17,4 @@ class MigrateDrupalTestBase extends MigrateTestBase {
* @var array
*/
public static $modules = array('migrate_drupal');
-
- /**
- * Returns the path to the dump directory.
- *
- * @return string
- * A string that represents the dump directory path.
- */
- protected function getDumpDirectory() {
- return __DIR__ . '/Dump';
- }
-
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateActionConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateActionConfigsTest.php
index b3e36dd..7cb9862 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateActionConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateActionConfigsTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_action_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6ActionSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6ActionSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorConfigsTest.php
index 2cb114a..42b8633 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorConfigsTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_aggregator_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6AggregatorSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6AggregatorSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php
index 191bc38..a32d37b 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php
@@ -34,7 +34,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_aggregator_feed');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6AggregatorFeed.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php
index c5ca816..6668c53 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php
@@ -55,8 +55,9 @@ public function setUp() {
$entity->save();
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_aggregator_item');
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6AggregatorItem.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
index 3e617f4..2bf15b2 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
@@ -58,7 +58,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_block');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Block.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookConfigsTest.php
index 6f2e179..5a5fbd4 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookConfigsTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_book_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6BookSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6BookSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php
index d29ad95..d98fb5e 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php
@@ -38,6 +38,7 @@ protected function setUp() {
$entity = entity_create('node', array(
'type' => 'story',
'nid' => $i,
+ 'status' => TRUE,
));
$entity->enforceIsNew();
$entity->save();
@@ -46,7 +47,7 @@ protected function setUp() {
$this->prepareIdMappings($id_mappings);
// Load database dumps to provide source data.
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Book.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Book.php',
);
$this->loadDumps($dumps);
// Migrate books..
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php
index 2c4ec30..d18077b 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php
@@ -73,8 +73,9 @@ protected function setUp() {
),
);
$this->prepareIdMappings($id_mappings);
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6NodeRevision.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php',
);
$this->loadDumps($dumps);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php
index 409f6d2..06c1340 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php
@@ -57,7 +57,7 @@ public function setUp() {
$migration = entity_load('migration', 'd6_comment');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Comment.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php
index ac5c9c7..787d09a 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php
@@ -67,7 +67,7 @@ protected function setUp() {
))->save();
}
$this->dumps = array(
- $this->getDumpDirectory() . '/Drupal6CommentVariable.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php',
);
$id_mappings = array(
'd6_comment_field_instance' => array(
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php
index c5c88c4..6c5d11d 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php
@@ -39,7 +39,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_comment_field');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6CommentVariable.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php
index 60e9b57..0e37c12 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php
@@ -56,7 +56,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_comment_field_instance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6CommentVariable.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php
index 899d08c..f46884c 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php
@@ -42,7 +42,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_contact_category');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6ContactCategory.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactConfigsTest.php
index bd56509..21fc8b6 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactConfigsTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_contact_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6ContactSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6ContactSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
index eb9da18..7620793 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
@@ -43,7 +43,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_custom_block');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Box.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php
index a79df39..41e7cdc 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php
@@ -32,7 +32,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_date_formats');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6DateFormat.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDblogConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDblogConfigsTest.php
index e4753f4..333f815 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDblogConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDblogConfigsTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_dblog_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6DblogSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6DblogSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php
index 1e393a6..6b973c7 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php
@@ -79,66 +79,66 @@ public function tearDown() {
* Test the complete Drupal 6 migration.
*/
public function testDrupal6() {
- $tests_path = $this->getDumpDirectory();
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $tests_path . '/Drupal6ActionSettings.php',
- $tests_path . '/Drupal6AggregatorFeed.php',
- $tests_path . '/Drupal6AggregatorItem.php',
- $tests_path . '/Drupal6AggregatorSettings.php',
- $tests_path . '/Drupal6Block.php',
- $tests_path . '/Drupal6BookSettings.php',
- $tests_path . '/Drupal6Box.php',
- $tests_path . '/Drupal6Comment.php',
- $tests_path . '/Drupal6CommentVariable.php',
- $tests_path . '/Drupal6ContactCategory.php',
- $tests_path . '/Drupal6ContactSettings.php',
- $tests_path . '/Drupal6DateFormat.php',
- $tests_path . '/Drupal6DblogSettings.php',
- $tests_path . '/Drupal6FieldInstance.php',
- $tests_path . '/Drupal6FieldSettings.php',
- $tests_path . '/Drupal6File.php',
- $tests_path . '/Drupal6FileSettings.php',
- $tests_path . '/Drupal6FilterFormat.php',
- $tests_path . '/Drupal6ForumSettings.php',
- $tests_path . '/Drupal6LocaleSettings.php',
- $tests_path . '/Drupal6Menu.php',
- $tests_path . '/Drupal6MenuSettings.php',
- $tests_path . '/Drupal6NodeBodyInstance.php',
- $tests_path . '/Drupal6Node.php',
- $tests_path . '/Drupal6NodeRevision.php',
- $tests_path . '/Drupal6NodeSettings.php',
- $tests_path . '/Drupal6NodeType.php',
- $tests_path . '/Drupal6SearchPage.php',
- $tests_path . '/Drupal6SearchSettings.php',
- $tests_path . '/Drupal6SimpletestSettings.php',
- $tests_path . '/Drupal6StatisticsSettings.php',
- $tests_path . '/Drupal6SyslogSettings.php',
- $tests_path . '/Drupal6SystemCron.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ActionSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6BookSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DblogSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FileSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ForumSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6LocaleSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6MenuSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeBodyInstance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SimpletestSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6StatisticsSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SyslogSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemCron.php',
// This dump contains the file directory path to the simpletest directory
// where the files are.
- $tests_path . '/Drupal6SystemFile.php',
- $tests_path . '/Drupal6SystemFilter.php',
- $tests_path . '/Drupal6SystemImageGd.php',
- $tests_path . '/Drupal6SystemImage.php',
- $tests_path . '/Drupal6SystemMaintenance.php',
- $tests_path . '/Drupal6SystemPerformance.php',
- $tests_path . '/Drupal6SystemRss.php',
- $tests_path . '/Drupal6SystemSite.php',
- $tests_path . '/Drupal6SystemTheme.php',
- $tests_path . '/Drupal6TaxonomySettings.php',
- $tests_path . '/Drupal6TaxonomyTerm.php',
- $tests_path . '/Drupal6TaxonomyVocabulary.php',
- $tests_path . '/Drupal6TermNode.php',
- $tests_path . '/Drupal6TextSettings.php',
- $tests_path . '/Drupal6UpdateSettings.php',
- $tests_path . '/Drupal6UploadInstance.php',
- $tests_path . '/Drupal6Upload.php',
- $tests_path . '/Drupal6UrlAlias.php',
- $tests_path . '/Drupal6UserMail.php',
- $tests_path . '/Drupal6User.php',
- $tests_path . '/Drupal6UserProfileFields.php',
- $tests_path . '/Drupal6UserRole.php',
- $tests_path . '/Drupal6VocabularyField.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFile.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFilter.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImageGd.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImage.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemMaintenance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemPerformance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemRss.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemSite.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemTheme.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomySettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TextSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UpdateSettings.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserMail.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php',
);
$this->loadDumps($dumps);
$migrations = array(
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldConfigsTest.php
index 4a7e340..9f02830 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldConfigsTest.php
@@ -33,7 +33,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_field_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6FieldSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php
index 683a0f1..2cbc837 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php
@@ -74,7 +74,7 @@ public function setUp() {
$migration = entity_load('migration', 'd6_field_formatter_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php
index 4bd26f7..cf1c59b 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php
@@ -75,7 +75,7 @@ public function setUp() {
$migration = entity_load('migration', 'd6_field_instance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->createFields();
@@ -128,6 +128,7 @@ public function testFieldInstanceSettings() {
'uri_scheme' => 'public',
'handler' => 'default',
'target_bundle' => NULL,
+ 'max_length' => 255,
);
// This is the only way to compare arrays.
$this->assertFalse(array_diff_assoc($field->getSettings(), $expected));
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php
index a6737f0..005ad53 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php
@@ -41,7 +41,7 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_field');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php
index c18691f..c85e388 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php
@@ -72,7 +72,7 @@ public function setUp() {
$this->prepareIdMappings($id_mappings);
$migration = entity_load('migration', 'd6_field_instance_widget_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileConfigsTest.php
index fc7edc4..a09f17f 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileConfigsTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_file_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FileSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6FileSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php
index 9e5c6ab..f453641 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php
@@ -39,7 +39,7 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6File.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php',
);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_file');
@@ -69,7 +69,7 @@ public function testFiles() {
db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute();
$migration = entity_load_unchanged('migration', 'd6_file');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemFile.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFile.php',
);
$this->loadDumps($dumps, 'loadMigrateFileStandalone');
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php
index 47a3f32..fdb7d2b 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php
@@ -39,7 +39,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_filter_format');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FilterFormat.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateForumConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateForumConfigsTest.php
index d5fb297..9ebecf1 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateForumConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateForumConfigsTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_forum_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6ForumSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6ForumSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateLocaleConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateLocaleConfigsTest.php
index de89d92..c84aee2 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateLocaleConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateLocaleConfigsTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_locale_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6LocaleSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6LocaleSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuConfigsTest.php
index 404f281..510f411 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuConfigsTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_menu_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6MenuSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6MenuSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuTest.php
index d2839cb..95e95c7 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateMenuTest.php
@@ -35,7 +35,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_menu');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Menu.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeConfigsTest.php
index 165fe13..39edf2e 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeConfigsTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_node_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6NodeSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6NodeSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeRevisionTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeRevisionTest.php
index b121227..7f456cf 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeRevisionTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeRevisionTest.php
@@ -37,8 +37,9 @@ protected function setUp() {
);
$this->prepareIdMappings($id_mappings);
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6NodeRevision.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php',
);
$this->loadDumps($dumps);
/** @var \Drupal\migrate\entity\Migration $migration */
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTestBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTestBase.php
index 26a4c34..48e9d0a 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTestBase.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTestBase.php
@@ -43,10 +43,11 @@ protected function setUp() {
$node->save();
// Load dumps.
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Node.php',
- $this->getDumpDirectory() . '/Drupal6NodeType.php',
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->loadDumps($dumps);
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTypeTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTypeTest.php
index 3c72ad9..6867bc2 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTypeTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateNodeTypeTest.php
@@ -41,7 +41,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_node_type');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6NodeType.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateProfileValuesTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateProfileValuesTest.php
index e3e6d7e..e2b73b8 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateProfileValuesTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateProfileValuesTest.php
@@ -123,9 +123,10 @@ protected function setUp() {
$this->prepareIdMappings($id_mappings);
// Load database dumps to provide source data.
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
- $this->getDumpDirectory() . '/Drupal6User.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php',
);
$this->loadDumps($dumps);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchConfigsTest.php
index c2c5dbf..f34891d 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchConfigsTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_search_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SearchSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6SearchSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchPageTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchPageTest.php
index 838116b..6540099 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchPageTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSearchPageTest.php
@@ -42,7 +42,7 @@ protected function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_search_page');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SearchPage.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSimpletestConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSimpletestConfigsTest.php
index 688410b..00b3512 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSimpletestConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSimpletestConfigsTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_simpletest_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SimpletestSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6SimpletestSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateStatisticsConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateStatisticsConfigsTest.php
index eaac333..0be390e 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateStatisticsConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateStatisticsConfigsTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_statistics_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6StatisticsSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6StatisticsSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSyslogConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSyslogConfigsTest.php
index 587bbb8..86b3892 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSyslogConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSyslogConfigsTest.php
@@ -40,7 +40,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_syslog_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SyslogSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6SyslogSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemCronTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemCronTest.php
index 764dbac..e159c8a 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemCronTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemCronTest.php
@@ -34,7 +34,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_cron');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemCron.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemCron.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFileTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFileTest.php
index 6e9b6f8..797ee71 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFileTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFileTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_file');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemFile.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFile.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFilterTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFilterTest.php
index d501cc5..418e0c8 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFilterTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemFilterTest.php
@@ -34,7 +34,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_filter');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemFilter.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFilter.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageGdTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageGdTest.php
index 919d794..23d3373 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageGdTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageGdTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_image_gd');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemImageGd.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImageGd.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageTest.php
index 4f1dbac..1894f4f 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemImageTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_image');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemImage.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImage.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemMaintenanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemMaintenanceTest.php
index 70b78d3..d08f9c7 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemMaintenanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemMaintenanceTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_maintenance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemMaintenance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemMaintenance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemPerformanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemPerformanceTest.php
index ec98b7e..ff3feb8 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemPerformanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemPerformanceTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_performance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemPerformance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemPerformance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemRssTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemRssTest.php
index 1584910..69bc4e6 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemRssTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemRssTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_rss');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemRss.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemRss.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemSiteTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemSiteTest.php
index f4df9cf..bd17eb0 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemSiteTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemSiteTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_site');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemSite.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemSite.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemThemeTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemThemeTest.php
index b5c0ff5..31bef18 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemThemeTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemThemeTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_theme');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6SystemTheme.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemTheme.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyConfigsTest.php
index b89874b..07b60cc 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyConfigsTest.php
@@ -40,7 +40,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_taxonomy_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6TaxonomySettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6TaxonomySettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php
index a4f5b13..3b508f3 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php
@@ -42,9 +42,10 @@ protected function setUp() {
)));
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_taxonomy_term');
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6TaxonomyTerm.php',
- $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
@@ -60,11 +61,13 @@ public function testTaxonomyTerms() {
'source_vid' => 1,
'vid' => 'vocabulary_1_i_0_',
'weight' => 0,
+ 'parent' => array(0),
),
'2' => array(
'source_vid' => 2,
'vid' => 'vocabulary_2_i_1_',
'weight' => 3,
+ 'parent' => array(0),
),
'3' => array(
'source_vid' => 2,
@@ -76,6 +79,7 @@ public function testTaxonomyTerms() {
'source_vid' => 3,
'vid' => 'vocabulary_3_i_2_',
'weight' => 6,
+ 'parent' => array(0),
),
'5' => array(
'source_vid' => 3,
@@ -98,8 +102,8 @@ public function testTaxonomyTerms() {
$this->assertIdentical($term->description->value, "description of term {$tid} of vocabulary {$values['source_vid']}");
$this->assertEqual($term->vid->value, $values['vid']);
$this->assertEqual($term->weight->value, $values['weight']);
- if (empty($values['parent'])) {
- $this->assertNull($term->parent->value);
+ if ($values['parent'] === array(0)) {
+ $this->assertEqual($term->parent->value, 0);
}
else {
$parents = array();
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyVocabularyTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyVocabularyTest.php
index 719cd86..52977b5 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyVocabularyTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyVocabularyTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_taxonomy_vocabulary');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTermNodeTestBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTermNodeTestBase.php
index e7b64d1..c1f333b 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTermNodeTestBase.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTermNodeTestBase.php
@@ -83,11 +83,12 @@ protected function setUp() {
$node->save();
}
}
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Node.php',
- $this->getDumpDirectory() . '/Drupal6TermNode.php',
- $this->getDumpDirectory() . '/Drupal6TaxonomyTerm.php',
- $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php',
);
$this->loadDumps($dumps);
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTextConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTextConfigsTest.php
index 04e659b..8fc8489 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTextConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTextConfigsTest.php
@@ -40,7 +40,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_text_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6TextSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6TextSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUpdateConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUpdateConfigsTest.php
index 444fa7f..2296598 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUpdateConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUpdateConfigsTest.php
@@ -40,7 +40,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_update_settings');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UpdateSettings.php',
+ dirname(__DIR__) . '/Dump/Drupal6UpdateSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadBase.php
index c730cf1..90b46de 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadBase.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadBase.php
@@ -81,9 +81,10 @@ public function setUp() {
$node->save();
}
}
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6Node.php',
- $this->getDumpDirectory() . '/Drupal6Upload.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php',
);
$this->loadDumps($dumps);
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityDisplayTest.php
index ec994b6..3d312ba 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityDisplayTest.php
@@ -52,7 +52,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_upload_entity_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UploadInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityFormDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityFormDisplayTest.php
index 9d58993..fd74202 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityFormDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadEntityFormDisplayTest.php
@@ -52,7 +52,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_upload_entity_form_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UploadInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadFieldTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadFieldTest.php
index ceac437..83edcfb 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadFieldTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadFieldTest.php
@@ -42,7 +42,7 @@ protected function setUp() {
$executable = new MigrateExecutable($migration, $this);
$executable->import();
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UploadField.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadField.php',
);
$this->prepare($migration, $dumps);
}
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
index e12f04b..ee293df 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
@@ -58,7 +58,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_upload_field_instance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UploadInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUrlAliasTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUrlAliasTest.php
index bec9a4e..29e3ac9 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUrlAliasTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUrlAliasTest.php
@@ -35,7 +35,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_url_alias');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UrlAlias.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserConfigsTest.php
index ac5c9d3..6c41f5d 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserConfigsTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserConfigsTest.php
@@ -33,7 +33,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_user_mail');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserMail.php',
+ dirname(__DIR__) . '/Dump/Drupal6UserMail.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserPictureFileTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserPictureFileTest.php
index 7fe2895..0bf5947 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserPictureFileTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserPictureFileTest.php
@@ -39,7 +39,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6User.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php',
);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_user_picture_file');
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityDisplayTest.php
index 372126f..62ece55 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityDisplayTest.php
@@ -91,7 +91,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_user_profile_entity_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php
index 40257e9..028f465 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php
@@ -86,7 +86,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_user_profile_entity_form_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldInstanceTest.php
index 7393fea..3dd1d9f 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldInstanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldInstanceTest.php
@@ -44,7 +44,7 @@ protected function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_user_profile_field_instance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldTest.php
index 696695c..2d1a773 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserProfileFieldTest.php
@@ -35,7 +35,7 @@ protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_user_profile_field');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserRoleTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserRoleTest.php
index dffb1d2..46147f7 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserRoleTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserRoleTest.php
@@ -50,8 +50,8 @@ public function setUp() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_user_role');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6UserRole.php',
- $this->getDumpDirectory() . '/Drupal6FilterFormat.php',
+ dirname(__DIR__) . '/Dump/Drupal6UserRole.php',
+ dirname(__DIR__) . '/Dump/Drupal6FilterFormat.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserTest.php
index d894b1c..bc071ae 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUserTest.php
@@ -91,11 +91,12 @@ protected function setUp() {
$file->save();
// Load database dumps to provide source data.
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FilterFormat.php',
- $this->getDumpDirectory() . '/Drupal6UserProfileFields.php',
- $this->getDumpDirectory() . '/Drupal6UserRole.php',
- $this->getDumpDirectory() . '/Drupal6User.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php',
);
$this->loadDumps($dumps);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateViewModesTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateViewModesTest.php
index 2c43aee..b504e1e 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateViewModesTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateViewModesTest.php
@@ -40,7 +40,7 @@ public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_view_modes');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6FieldInstance.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityDisplayTest.php
index 4b7066c..891fb23 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityDisplayTest.php
@@ -70,7 +70,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_vocabulary_entity_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6VocabularyField.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityFormDisplayTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityFormDisplayTest.php
index 00022f6..dcabea4 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityFormDisplayTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyEntityFormDisplayTest.php
@@ -70,7 +70,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_vocabulary_entity_form_display');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6VocabularyField.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldInstanceTest.php
index a569062..74abb07 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldInstanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldInstanceTest.php
@@ -69,7 +69,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_vocabulary_field_instance');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6VocabularyField.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldTest.php
index df4781c..7127c77 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateVocabularyFieldTest.php
@@ -55,7 +55,7 @@ protected function setUp() {
$migration = entity_load('migration', 'd6_vocabulary_field');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6VocabularyField.php',
+ drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/dependencies/MigrateDependenciesTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/dependencies/MigrateDependenciesTest.php
index 32941fb..f9a53f3 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/dependencies/MigrateDependenciesTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/dependencies/MigrateDependenciesTest.php
@@ -56,8 +56,9 @@ public function testMigrateDependenciesOrder() {
public function testAggregatorMigrateDependencies() {
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_aggregator_item');
+ $path = drupal_get_path('module', 'migrate_drupal');
$dumps = array(
- $this->getDumpDirectory() . '/Drupal6AggregatorItem.php',
+ $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php
index 1fc6f03..ea6fe2a 100644
--- a/core/modules/node/lib/Drupal/node/Entity/Node.php
+++ b/core/modules/node/lib/Drupal/node/Entity/Node.php
@@ -24,6 +24,7 @@
* label = @Translation("Content"),
* bundle_label = @Translation("Content type"),
* controllers = {
+ * "storage" = "Drupal\node\NodeStorage",
* "view_builder" = "Drupal\node\NodeViewBuilder",
* "access" = "Drupal\node\NodeAccessController",
* "form" = {
@@ -64,6 +65,23 @@ class Node extends ContentEntityBase implements NodeInterface {
/**
* {@inheritdoc}
*/
+ public function preSave(EntityStorageInterface $storage) {
+ parent::preSave($storage);
+
+ // If no owner has been set explicitly, make the current user the owner.
+ if (!$this->getOwner()) {
+ $this->setOwnerId(\Drupal::currentUser()->id());
+ }
+ // If no revision author has been set explicitly, make the node owner the
+ // revision author.
+ if (!$this->getRevisionAuthor()) {
+ $this->setRevisionAuthorId($this->getOwnerId());
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record);
@@ -343,8 +361,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['langcode'] = FieldDefinition::create('language')
->setLabel(t('Language code'))
- ->setDescription(t('The node language code.'))
- ->setRevisionable(TRUE);
+ ->setDescription(t('The node language code.'));
$fields['title'] = FieldDefinition::create('string')
->setLabel(t('Title'))
@@ -373,7 +390,6 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setRevisionable(TRUE)
->setSettings(array(
'target_type' => 'user',
- 'default_value' => 0,
))
->setTranslatable(TRUE);
@@ -407,7 +423,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setRevisionable(TRUE)
->setTranslatable(TRUE);
- $fields['revision_timestamp'] = FieldDefinition::create('timestamp')
+ $fields['revision_timestamp'] = FieldDefinition::create('created')
->setLabel(t('Revision timestamp'))
->setDescription(t('The time that the current revision was created.'))
->setQueryable(FALSE)
@@ -435,10 +451,30 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
$node_type = node_type_load($bundle);
$fields = array();
+
+ // When deleting a node type the corresponding node displays are deleted as
+ // well. In order to be deleted, they need to be loaded first. Entity
+ // displays, however, fetch the field definitions of the respective entity
+ // type to fill in their defaults. Therefore this function ends up being
+ // called with a non-existing bundle.
+ // @todo Fix this in https://drupal.org/node/2248795
+ if (!$node_type) {
+ return $fields;
+ }
+
if (isset($node_type->title_label)) {
$fields['title'] = clone $base_field_definitions['title'];
$fields['title']->setLabel($node_type->title_label);
}
+
+ $options = $node_type->getModuleSettings('node')['options'];
+ $fields['status'] = clone $base_field_definitions['status'];
+ $fields['status']->setSetting('default_value', !empty($options['status']) ? NODE_PUBLISHED : NODE_NOT_PUBLISHED);
+ $fields['promote'] = clone $base_field_definitions['promote'];
+ $fields['promote']->setSetting('default_value', !empty($options['promote']) ? NODE_PROMOTED : NODE_NOT_PROMOTED);
+ $fields['sticky'] = clone $base_field_definitions['sticky'];
+ $fields['sticky']->setSetting('default_value', !empty($options['sticky']) ? NODE_STICKY : NODE_NOT_STICKY);
+
return $fields;
}
diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
index 1c3a839..6fbfe96 100644
--- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php
+++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
@@ -215,4 +215,14 @@ public static function preCreate(EntityStorageInterface $storage, array &$values
), $values['settings']['node']);
}
+ /**
+ * {@inheritdoc}
+ */
+ protected function onUpdateBundleEntity() {
+ // The bundle field definitions of nodes depend on the node type settings.
+ // @see \Drupal\node\Entity\Node::bundleFieldDefinitions()
+ $this->entityManager()->clearCachedFieldDefinitions();
+ parent::onUpdateBundleEntity();
+ }
+
}
diff --git a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
index ebc34c9..164ac5f 100644
--- a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
+++ b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php
@@ -58,8 +58,19 @@ public function getQuestion() {
/**
* {@inheritdoc}
*/
+ protected function actions(array $form, array &$form_state) {
+ $actions = parent::actions($form, $form_state);
+
+ // @todo Convert to getCancelRoute() after http://drupal.org/node/1987778.
+ $actions['cancel'] += $this->entity->urlInfo()->toRenderArray();
+
+ return $actions;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function getCancelRoute() {
- return $this->entity->urlInfo();
}
/**
diff --git a/core/modules/node/lib/Drupal/node/NodeForm.php b/core/modules/node/lib/Drupal/node/NodeForm.php
index 37bb7da..0c5bbc6 100644
--- a/core/modules/node/lib/Drupal/node/NodeForm.php
+++ b/core/modules/node/lib/Drupal/node/NodeForm.php
@@ -36,16 +36,7 @@ protected function prepareEntity() {
$type = entity_load('node_type', $node->bundle());
$this->settings = $type->getModuleSettings('node');
- // If this is a new node, fill in the default values.
- if ($node->isNew()) {
- foreach (array('status', 'promote', 'sticky') as $key) {
- // Multistep node forms might have filled in something already.
- if ($node->$key->isEmpty()) {
- $node->$key = (int) !empty($this->settings['options'][$key]);
- }
- }
- }
- else {
+ if (!$node->isNew()) {
$node->date = format_date($node->getCreatedTime(), 'custom', 'Y-m-d H:i:s O');
// Remove the log message from the original node entity.
$node->log = NULL;
diff --git a/core/modules/node/lib/Drupal/node/NodeStorage.php b/core/modules/node/lib/Drupal/node/NodeStorage.php
new file mode 100644
index 0000000..dd73f43
--- /dev/null
+++ b/core/modules/node/lib/Drupal/node/NodeStorage.php
@@ -0,0 +1,51 @@
+ array('langcode'),
+ );
+ $schema['node_revision']['foreign keys'] += array(
+ 'node__revision_author' => array(
+ 'table' => 'users',
+ 'columns' => array('revision_uid' => 'uid'),
+ ),
+ );
+
+ $schema['node_field_data']['indexes'] += array(
+ 'node__changed' => array('changed'),
+ 'node__created' => array('created'),
+ 'node__default_langcode' => array('default_langcode'),
+ 'node__langcode' => array('langcode'),
+ 'node__frontpage' => array('promote', 'status', 'sticky', 'created'),
+ 'node__status_type' => array('status', 'type', 'nid'),
+ 'node__title_type' => array('title', array('type', 4)),
+ );
+
+ $schema['node_field_revision']['indexes'] += array(
+ 'node__default_langcode' => array('default_langcode'),
+ 'node__langcode' => array('langcode'),
+ );
+
+ return $schema;
+ }
+
+}
diff --git a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
index 065cdca..a52b9fa 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
@@ -26,7 +26,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('node', array('node', 'node_field_data', 'node_field_revision', 'node_revision'));
+ $this->installEntitySchema('node');
// Create the node bundles required for testing.
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/Config/NodeImportCreateTest.php b/core/modules/node/lib/Drupal/node/Tests/Config/NodeImportCreateTest.php
index 1d59ca1..dcf4e7e 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Config/NodeImportCreateTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Config/NodeImportCreateTest.php
@@ -28,7 +28,7 @@ public function setUp() {
parent::setUp();
$this->installSchema('system', array('config_snapshot'));
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('user');
// Set default storage backend.
$this->installConfig(array('field'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php
index 1aa7dcd..9a6831d 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php
@@ -108,7 +108,10 @@ function testNodeFormButtons() {
// Set article content type default to unpublished. This will change the
// the initial order of buttons and/or status of the node when creating
// a node.
- \Drupal::config('node.type.article')->set('settings.node.options.status', FALSE)->save();
+ /** @var \Drupal\node\NodeTypeInterface $node_type */
+ $node_type = $this->container->get('entity.manager')->getStorage('node_type')->load('article');
+ $node_type->settings['node']['options']['status'] = FALSE;
+ $node_type->save();
// Verify the buttons on a node add form for an administrator.
$this->drupalLogin($this->admin_user);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
index bf23498..aa1dbfa 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
@@ -31,11 +31,8 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('node', 'node');
- $this->installSchema('node', 'node_revision');
- $this->installSchema('node', 'node_field_data');
- $this->installSchema('node', 'node_field_revision');
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('node');
+ $this->installEntitySchema('user');
}
/**
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
index 717abcc..2b1e07f 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
@@ -38,7 +38,7 @@ public static function getInfo() {
*/
public function setUp() {
parent::setUp();
- $this->installSchema('node', array('node', 'node_field_revision', 'node_field_data', 'node_revision'));
+ $this->installEntitySchema('node');
$this->installConfig(array('filter'));
$node_type = entity_create('node_type', array('type' => 'article', 'name' => 'Article'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeValidationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeValidationTest.php
index e71d75b..94c7ca3 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeValidationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeValidationTest.php
@@ -34,7 +34,7 @@ public static function getInfo() {
*/
public function setUp() {
parent::setUp();
- $this->installSchema('node', array('node', 'node_field_data', 'node_field_revision', 'node_revision'));
+ $this->installEntitySchema('node');
// Create a node type for testing.
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
diff --git a/core/modules/node/node.install b/core/modules/node/node.install
index 36f8345..e6b9a1c 100644
--- a/core/modules/node/node.install
+++ b/core/modules/node/node.install
@@ -39,311 +39,6 @@ function node_requirements($phase) {
* Implements hook_schema().
*/
function node_schema() {
- $schema['node'] = array(
- 'description' => 'The base table for nodes.',
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The primary identifier for a node.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- // Defaults to NULL in order to avoid a brief period of potential
- // deadlocks on the index.
- 'vid' => array(
- 'description' => 'The current {node_field_revision}.vid version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- ),
- 'type' => array(
- 'description' => 'The type of this node.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'indexes' => array(
- 'node_type' => array(array('type', 4)),
- ),
- 'unique keys' => array(
- 'vid' => array('vid'),
- 'uuid' => array('uuid'),
- ),
- 'foreign keys' => array(
- 'node_revision' => array(
- 'table' => 'node_revision',
- 'columns' => array('vid' => 'vid'),
- ),
- ),
- 'primary key' => array('nid'),
- );
-
- $schema['node_revision'] = array(
- 'description' => 'Stores information about each saved version of a {node}.',
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The {node} this version belongs to.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'vid' => array(
- 'description' => 'The primary identifier for this version.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'revision_uid' => array(
- 'description' => 'The {users}.uid that created this version.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'log' => array(
- 'description' => 'The log entry explaining the changes in this version.',
- 'type' => 'text',
- 'not null' => FALSE,
- 'size' => 'big',
- ),
- 'revision_timestamp' => array(
- 'description' => 'The Unix timestamp when the version was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this version.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'indexes' => array(
- 'nid' => array('nid'),
- 'revision_uid' => array('revision_uid'),
- 'node_langcode' => array('langcode'),
- ),
- 'foreign keys' => array(
- 'versioned_node' => array(
- 'table' => 'node',
- 'columns' => array('nid' => 'nid'),
- ),
- 'version_author' => array(
- 'table' => 'users',
- 'columns' => array('revision_uid' => 'uid'),
- ),
- ),
- 'primary key' => array('vid'),
- );
-
- // Node field storage.
- $schema['node_field_data'] = array(
- 'description' => 'Data table for node base fields.',
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The primary identifier for a node.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'vid' => array(
- 'description' => 'The current {node_field_revision}.vid version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'type' => array(
- 'description' => 'The {node_type}.type of this node.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of these node property values.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'default_langcode' => array(
- 'description' => 'Boolean indicating whether the property values are in the {language}.langcode of this node.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'title' => array(
- 'description' => 'The title of this node, always treated as non-markup plain text.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'uid' => array(
- 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'status' => array(
- 'description' => 'Boolean indicating whether the node translation is published (visible to non-administrators).',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'created' => array(
- 'description' => 'The Unix timestamp when the node translation was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'changed' => array(
- 'description' => 'The Unix timestamp when the node translation was most recently saved.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'promote' => array(
- 'description' => 'Boolean indicating whether the node translation should be displayed on the front page.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'sticky' => array(
- 'description' => 'Boolean indicating whether the node translation should be displayed at the top of lists in which it appears.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'node_changed' => array('changed'),
- 'node_created' => array('created'),
- 'node_default_langcode' => array('default_langcode'),
- 'node_langcode' => array('langcode'),
- 'node_frontpage' => array('promote', 'status', 'sticky', 'created'),
- 'node_status_type' => array('status', 'type', 'nid'),
- 'node_title_type' => array('title', array('type', 4)),
- 'node_type' => array(array('type', 4)),
- 'vid' => array('vid'),
- 'uid' => array('uid'),
- ),
- 'foreign keys' => array(
- 'node_base' => array(
- 'table' => 'node',
- 'columns' => array('nid' => 'nid'),
- ),
- 'node_author' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- ),
- 'primary key' => array('nid', 'langcode'),
- );
-
- $schema['node_field_revision'] = array(
- 'description' => 'Revision table for node base fields.',
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The {node} this version belongs to.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'vid' => array(
- 'description' => 'The primary identifier for this version.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this version.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'default_langcode' => array(
- 'description' => 'Boolean indicating whether the property values of this version are in the {language}.langcode of this node.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'title' => array(
- 'description' => 'The title of this version, always treated as non-markup plain text.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'uid' => array(
- 'description' => 'The {users}.uid that created this node.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'status' => array(
- 'description' => 'Boolean indicating whether the node (at the time of this revision) is published (visible to non-administrators).',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'created' => array(
- 'description' => 'The Unix timestamp when the node was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'changed' => array(
- 'description' => 'The Unix timestamp when the version was most recently saved.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'promote' => array(
- 'description' => 'Boolean indicating whether the node (at the time of this revision) should be displayed on the front page.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'sticky' => array(
- 'description' => 'Boolean indicating whether the node (at the time of this revision) should be displayed at the top of lists in which it appears.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'uid' => array('uid'),
- 'node_default_langcode' => array('default_langcode'),
- 'node_langcode' => array('langcode'),
- ),
- 'foreign keys' => array(
- 'versioned_node' => array(
- 'table' => 'node',
- 'columns' => array('nid' => 'nid'),
- ),
- 'node_author' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- ),
- 'primary key' => array('vid', 'langcode'),
- );
-
$schema['node_access'] = array(
'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.',
'fields' => array(
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 4092e76..9e4c966 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -820,6 +820,10 @@ function node_user_cancel($edit, $account, $method) {
->fetchCol();
node_mass_update($nodes, array('uid' => 0), NULL, TRUE);
// Anonymize old revisions.
+ db_update('node_revision')
+ ->fields(array('revision_uid' => 0))
+ ->condition('revision_uid', $account->id())
+ ->execute();
db_update('node_field_revision')
->fields(array('uid' => 0))
->condition('uid', $account->id())
diff --git a/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditTestBase.php b/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditTestBase.php
index 4fc19ed..b6bbf6f 100644
--- a/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditTestBase.php
+++ b/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditTestBase.php
@@ -27,7 +27,7 @@ class QuickEditTestBase 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/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
index f152e0b..d3cacfd 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
@@ -163,7 +163,7 @@ public function testCommentRdfaMarkup() {
$anonymous_user['name'] = $this->randomName();
$anonymous_user['mail'] = 'tester@simpletest.org';
$anonymous_user['homepage'] = 'http://example.org/';
- $comment2 = $this->saveComment($this->node->id(), NULL, $anonymous_user);
+ $comment2 = $this->saveComment($this->node->id(), 0, $anonymous_user);
// Tests comment #2 as anonymous user.
$parser = new \EasyRdf_Parser_Rdfa();
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
index 5086bf1..f733014 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
@@ -50,7 +50,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
+ $this->installEntitySchema('taxonomy_term');
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => $this->randomName(),
diff --git a/core/modules/responsive_image/lib/Drupal/responsive_image/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php b/core/modules/responsive_image/lib/Drupal/responsive_image/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
index ad4723f..65fa20b 100644
--- a/core/modules/responsive_image/lib/Drupal/responsive_image/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
+++ b/core/modules/responsive_image/lib/Drupal/responsive_image/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
@@ -7,7 +7,6 @@
namespace Drupal\responsive_image\Plugin\Field\FieldFormatter;
-use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterBase;
@@ -169,23 +168,6 @@ public function viewElements(FieldItemListInterface $items) {
$fallback_image_style = $this->getSetting('fallback_image_style');
}
- // Collect cache tags to be added for each item in the field.
- $all_cache_tags = array();
- if ($responsive_image_mapping) {
- $all_cache_tags[] = $responsive_image_mapping->getCacheTag();
- foreach ($breakpoint_styles as $breakpoint_name => $style_per_multiplier) {
- foreach ($style_per_multiplier as $multiplier => $image_style_name) {
- $image_style = entity_load('image_style', $image_style_name);
- $all_cache_tags[] = $image_style->getCacheTag();
- }
- }
- }
- if ($fallback_image_style) {
- $image_style = entity_load('image_style', $fallback_image_style);
- $all_cache_tags[] = $image_style->getCacheTag();
- }
- $cache_tags = NestedArray::mergeDeepArray($all_cache_tags);
-
foreach ($items as $delta => $item) {
if (isset($link_file)) {
$uri = array(
@@ -195,18 +177,13 @@ public function viewElements(FieldItemListInterface $items) {
}
$elements[$delta] = array(
'#theme' => 'responsive_image_formatter',
- '#attached' => array(
- 'library' => array(
- 'core/picturefill',
- )
- ),
+ '#attached' => array('library' => array(
+ 'core/picturefill',
+ )),
'#item' => $item,
'#image_style' => $fallback_image_style,
'#breakpoints' => $breakpoint_styles,
'#path' => isset($uri) ? $uri : '',
- '#cache' => array(
- 'tags' => $cache_tags,
- )
);
}
diff --git a/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
index e7e54a6..e6ad69d 100644
--- a/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
+++ b/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
@@ -16,8 +16,6 @@
*/
class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase {
- protected $dumpHeaders = TRUE;
-
/**
* Modules to enable.
*
@@ -154,9 +152,6 @@ public function _testResponsiveImageFieldFormatters($scheme) {
);
$default_output = l($image, file_create_url($image_uri), array('html' => TRUE));
$this->drupalGet('node/' . $nid);
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
-
$this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
// Verify that the image can be downloaded.
$this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.');
@@ -191,11 +186,6 @@ public function _testResponsiveImageFieldFormatters($scheme) {
$this->assertRaw('media="(min-width: 200px)"');
$this->assertRaw('media="(min-width: 400px)"');
$this->assertRaw('media="(min-width: 600px)"');
- $cache_tags = explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Tags'));
- $this->assertTrue(in_array('responsive_image_mapping:mapping_one', $cache_tags));
- $this->assertTrue(in_array('image_style:thumbnail', $cache_tags));
- $this->assertTrue(in_array('image_style:medium', $cache_tags));
- $this->assertTrue(in_array('image_style:large', $cache_tags));
// Test the fallback image style.
$large_style = entity_load('image_style', 'large');
@@ -212,8 +202,6 @@ public function _testResponsiveImageFieldFormatters($scheme) {
$this->drupalLogout();
$this->drupalGet($large_style->buildUrl($image_uri));
$this->assertResponse('403', 'Access denied to image style thumbnail as anonymous user.');
- $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
- $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
}
}
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
index 15ef7f3..7afedfa 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
@@ -58,7 +58,6 @@ public function testPatchUpdate() {
$patch_entity = entity_create($entity_type, $patch_values);
// We don't want to overwrite the UUID.
unset($patch_entity->uuid);
- $patch_entity->save();
$serialized = $serializer->serialize($patch_entity, $this->defaultFormat);
// Update the entity over the REST API.
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
index 865704d..1ad843a 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,9 @@ public function testNormalize() {
'user_id' => array(
array('target_id' => $this->values['user_id']),
),
+ 'revision_id' => array(
+ array('value' => 1),
+ ),
'field_test_text' => array(
array(
'value' => $this->values['field_test_text']['value'],
@@ -141,13 +138,12 @@ 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() . '',
'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/serialization/lib/Drupal/serialization/Tests/NormalizerTestBase.php b/core/modules/serialization/lib/Drupal/serialization/Tests/NormalizerTestBase.php
index 3b0cfd6..0c1dc03 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/NormalizerTestBase.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/NormalizerTestBase.php
@@ -21,8 +21,8 @@
protected function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array('entity_test_mulrev', 'entity_test_mulrev_revision', 'entity_test_mulrev_property_revision', 'entity_test_mulrev_property_data'));
- $this->installSchema('user', array('users', 'users_roles'));
+ $this->installEntitySchema('entity_test_mulrev');
+ $this->installEntitySchema('user');
$this->installSchema('system', array('url_alias'));
$this->installConfig(array('field'));
diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install
index b7ed49c..be6f8b2 100644
--- a/core/modules/shortcut/shortcut.install
+++ b/core/modules/shortcut/shortcut.install
@@ -12,96 +12,6 @@
* Implements hook_schema().
*/
function shortcut_schema() {
- $schema['shortcut'] = array(
- 'description' => 'Stores shortcut items.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique shortcut ID.',
- ),
- 'uuid' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- 'description' => 'Unique Key: Universally unique identifier for this shortcut.',
- ),
- 'shortcut_set' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The bundle of the shortcut.',
- ),
- 'langcode' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The {language}.langcode of the original variant of this shortcut.',
- ),
- 'weight' => array(
- 'description' => 'Weight among shortcuts in the same shortcut set.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'route_name' => array(
- 'description' => 'The machine name of a defined Symfony Route this menu item represents.',
- 'type' => 'varchar',
- 'length' => 255,
- ),
- 'route_parameters' => array(
- 'description' => 'Serialized array of route parameters of this shortcut.',
- 'type' => 'blob',
- 'size' => 'big',
- 'not null' => FALSE,
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- );
-
- $schema['shortcut_field_data'] = array(
- 'description' => 'Stores shortcut properties.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {shortcut}.id of the shortcut.',
- ),
- 'langcode' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The {language}.langcode of this variant of this shortcut.',
- ),
- 'default_langcode' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- 'description' => 'Boolean indicating whether the current variant is in the original entity language.',
- ),
- 'title' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => FALSE,
- 'description' => 'The title of the shortcut.',
- ),
- ),
- 'foreign keys' => array(
- 'shortcut' => array(
- 'table' => 'shortcut',
- 'columns' => array('id' => 'id'),
- ),
- ),
- 'primary key' => array('id', 'langcode'),
- );
$schema['shortcut_set_users'] = array(
'description' => 'Maps users to shortcut sets.',
diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php
index 71a33e4..15286dc 100644
--- a/core/modules/shortcut/src/Entity/Shortcut.php
+++ b/core/modules/shortcut/src/Entity/Shortcut.php
@@ -183,10 +183,6 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setLabel(t('Language code'))
->setDescription(t('The language code of the shortcut.'));
- $fields['default_langcode'] = FieldDefinition::create('boolean')
- ->setLabel(t('Default language'))
- ->setDescription(t('Flag to indicate whether this is the default language.'));
-
$fields['path'] = FieldDefinition::create('string')
->setLabel(t('Path'))
->setDescription(t('The computed shortcut path.'))
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
index d6bd64f..d7c34d9 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
@@ -7,8 +7,10 @@
namespace Drupal\simpletest;
+use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DrupalKernel;
+use Drupal\Core\Entity\Schema\ContentEntitySchemaHandlerInterface;
use Drupal\Core\KeyValueStore\KeyValueMemoryFactory;
use Drupal\Core\Language\Language;
use Symfony\Component\DependencyInjection\Reference;
@@ -336,6 +338,37 @@ protected function installSchema($module, $tables) {
}
/**
+ * Installs the tables for a specific entity type.
+ *
+ * @param string $entity_type_id
+ * The ID of the entity type.
+ */
+ protected function installEntitySchema($entity_type_id) {
+ /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
+ $entity_manager = $this->container->get('entity.manager');
+ /** @var \Drupal\Core\Database\Schema $schema_handler */
+ $schema_handler = $this->container->get('database')->schema();
+
+ $storage = $entity_manager->getStorage($entity_type_id);
+ if ($storage instanceof ContentEntitySchemaHandlerInterface) {
+ $schema = $storage->getSchema();
+ foreach ($schema as $table_name => $table_schema) {
+ $schema_handler->createTable($table_name, $table_schema);
+ }
+
+ $this->pass(String::format('Installed entity type tables for the %entity_type entity type: %tables', array(
+ '%entity_type' => $entity_type_id,
+ '%tables' => '{' . implode('}, {', array_keys($schema)) . '}',
+ )));
+ }
+ else {
+ throw new \RuntimeException(String::format('Entity type %entity_type does not support automatic schema installation.', array(
+ '%entity-type' => $entity_type_id,
+ )));
+ }
+ }
+
+ /**
* Enables modules for this test.
*
* @param array $modules
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
index 6c13c8a..5c9b464 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', 'field');
public static function getInfo() {
return array(
@@ -33,17 +33,18 @@ public static function getInfo() {
* Tests expected behavior of setUp().
*/
function testSetUp() {
- $modules = array('entity', 'entity_test');
- $table = 'entity_test';
+ $tables = array('entity_test', 'test');
// Verify that specified $modules have been loaded.
$this->assertTrue(function_exists('entity_test_permission'), 'entity_test.module was loaded.');
// Verify that there is a fixed module list.
- $this->assertIdentical(array_keys(\Drupal::moduleHandler()->getModuleList()), $modules);
- $this->assertIdentical(\Drupal::moduleHandler()->getImplementations('permission'), $modules);
+ $this->assertIdentical(array_keys(\Drupal::moduleHandler()->getModuleList()), static::$modules);
+ $this->assertIdentical(\Drupal::moduleHandler()->getImplementations('permission'), array('entity', 'entity_test'));
// 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.");
+ }
}
/**
@@ -74,8 +75,8 @@ function testEnableModulesLoad() {
* Tests expected installation behavior of enableModules().
*/
function testEnableModulesInstall() {
- $module = 'node';
- $table = 'node';
+ $module = 'ban';
+ $table = 'ban_ip';
// Verify that the module does not exist yet.
$this->assertFalse(\Drupal::moduleHandler()->moduleExists($module), "$module module not found.");
@@ -108,9 +109,9 @@ function testEnableModulesInstall() {
*/
function testEnableModulesInstallContainer() {
// Install Node module.
- $this->enableModules(array('field', 'node'));
+ $this->enableModules(array('field', 'node', 'user'));
- $this->installSchema('node', array('node', 'node_field_data'));
+ $this->installEntitySchema('node');
// Perform an entity query against node.
$query = \Drupal::entityQuery('node');
// Disable node access checks, since User module is not enabled.
@@ -124,20 +125,9 @@ function testEnableModulesInstallContainer() {
* Tests expected behavior of installSchema().
*/
function testInstallSchema() {
- $module = 'entity_test';
- $table = 'entity_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.");
-
- // Verify that the schema is known to Schema API.
- $schema = drupal_get_schema();
- $this->assertTrue($schema[$table], "'$table' table found in schema.");
- $schema = drupal_get_schema($table);
- $this->assertTrue($schema, "'$table' table schema found.");
-
- // Verify that a unknown table from an enabled module throws an error.
- $table = 'unknown_entity_test_table';
+ // Verify that a table from a unknown module cannot be installed.
+ $module = 'database_test';
+ $table = 'test';
try {
$this->installSchema($module, $table);
$this->fail('Exception for non-retrievable schema found.');
@@ -149,9 +139,19 @@ function testInstallSchema() {
$schema = drupal_get_schema($table);
$this->assertFalse($schema, "'$table' table schema not found.");
- // Verify that a table from a unknown module cannot be installed.
- $module = 'database_test';
- $table = 'test';
+ // Verify that the same table can be installed after enabling the module.
+ $this->enableModules(array($module));
+ $this->installSchema($module, $table);
+ $this->assertTrue(db_table_exists($table), "'$table' database table found.");
+
+ // Verify that the schema is known to Schema API.
+ $schema = drupal_get_schema();
+ $this->assertTrue($schema[$table], "'$table' table found in schema.");
+ $schema = drupal_get_schema($table);
+ $this->assertTrue($schema, "'$table' table schema found.");
+
+ // Verify that a unknown table from an enabled module throws an error.
+ $table = 'unknown_entity_test_table';
try {
$this->installSchema($module, $table);
$this->fail('Exception for non-retrievable schema found.');
@@ -162,13 +162,6 @@ function testInstallSchema() {
$this->assertFalse(db_table_exists($table), "'$table' database table not found.");
$schema = drupal_get_schema($table);
$this->assertFalse($schema, "'$table' table schema not found.");
-
- // Verify that the same table can be installed after enabling the module.
- $this->enableModules(array($module));
- $this->installSchema($module, $table);
- $this->assertTrue(db_table_exists($table), "'$table' database table found.");
- $schema = drupal_get_schema($table);
- $this->assertTrue($schema, "'$table' table schema found.");
}
/**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
index 7e2f651..70fc663 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
parent::setUp();
$this->actionManager = $this->container->get('plugin.manager.action');
- $this->installSchema('user', array('users', 'users_roles'));
+ $this->installEntitySchema('user');
$this->installSchema('system', array('sequences'));
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
index ffe5fdb..da88eda 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
@@ -7,19 +7,20 @@
namespace Drupal\system\Tests\Common;
+use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\simpletest\WebTestBase;
/**
* Tests writing of data records with drupal_write_record().
*/
-class WriteRecordTest extends WebTestBase {
+class WriteRecordTest extends DrupalUnitTestBase {
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('database_test', 'node');
+ public static $modules = array('database_test');
public static function getInfo() {
return array(
@@ -33,6 +34,8 @@ public static function getInfo() {
* Tests the drupal_write_record() API function.
*/
function testDrupalWriteRecord() {
+ $this->installSchema('database_test', array('test', 'test_null', 'test_serialized', 'test_composite_primary'));
+
// Insert a record with no columns populated.
$record = array();
$insert_result = drupal_write_record('test', $record);
@@ -135,15 +138,14 @@ function testDrupalWriteRecord() {
$this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a valid update is run without changing any values.');
// Insert an object record for a table with a multi-field primary key.
- $node_access = new \stdClass();
- $node_access->nid = mt_rand();
- $node_access->gid = mt_rand();
- $node_access->realm = $this->randomName();
- $insert_result = drupal_write_record('node_access', $node_access);
+ $composite_primary = new \stdClass();
+ $composite_primary->name = $this->randomName();
+ $composite_primary->age = mt_rand();
+ $insert_result = drupal_write_record('test_composite_primary', $composite_primary);
$this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.');
// Update the record.
- $update_result = drupal_write_record('node_access', $node_access, array('nid', 'gid', 'realm'));
+ $update_result = drupal_write_record('test_composite_primary', $composite_primary, array('name', 'job'));
$this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a record is updated with drupal_write_record() for a table with a multi-field primary key.');
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
index 490750e..2bc4464 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
@@ -25,16 +25,10 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array(
- 'entity_test_mul',
- 'entity_test_mul_property_data',
- 'entity_test_rev',
- 'entity_test_rev_revision',
- 'entity_test_mulrev',
- 'entity_test_mulrev_revision',
- 'entity_test_mulrev_property_data',
- 'entity_test_mulrev_property_revision'
- ));
+
+ $this->installEntitySchema('entity_test_rev');
+ $this->installEntitySchema('entity_test_mul');
+ $this->installEntitySchema('entity_test_mulrev');
}
/**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
index 1d49a02..fa701a7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -44,9 +44,14 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
+
+ $this->installEntitySchema('node');
+ $this->installEntitySchema('comment');
+
$this->installSchema('user', array('users_data'));
- $this->installSchema('node', array('node', 'node_revision', 'node_field_data', 'node_field_revision', 'node_access'));
- $this->installSchema('comment', array('comment', 'comment_entity_statistics'));
+ $this->installSchema('file', array('file_usage'));
+ $this->installSchema('node', array('node_access'));
+ $this->installSchema('comment', array('comment_entity_statistics'));
}
/**
@@ -219,7 +224,8 @@ public function testCommentHooks() {
* Tests hook invocations for CRUD operations on files.
*/
public function testFileHooks() {
- $this->installSchema('file', array('file_managed', 'file_usage'));
+ $this->installEntitySchema('file');
+
$url = 'public://entity_crud_hook_test.file';
file_put_contents($url, 'Test test test');
$file = entity_create('file', array(
@@ -346,7 +352,7 @@ public function testNodeHooks() {
* Tests hook invocations for CRUD operations on taxonomy terms.
*/
public function testTaxonomyTermHooks() {
- $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
+ $this->installEntitySchema('taxonomy_term');
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Test vocabulary',
@@ -415,7 +421,7 @@ public function testTaxonomyTermHooks() {
* Tests hook invocations for CRUD operations on taxonomy vocabularies.
*/
public function testTaxonomyVocabularyHooks() {
- $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
+ $this->installEntitySchema('taxonomy_term');
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Test vocabulary',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
index 4a05431..36b3655 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
@@ -40,18 +40,12 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('user', array('users_data'));
- $this->installSchema('node', array('node', 'node_revision', 'node_field_data', 'node_field_revision', 'node_access'));
- $this->installSchema('entity_test', array(
- 'entity_test_mul',
- 'entity_test_mul_property_data',
- 'entity_test_rev',
- 'entity_test_rev_revision',
- 'entity_test_mulrev',
- 'entity_test_mulrev_revision',
- 'entity_test_mulrev_property_data',
- 'entity_test_mulrev_property_revision'
- ));
+
+ $this->installEntitySchema('node');
+
+ $this->installEntitySchema('entity_test_rev');
+ $this->installEntitySchema('entity_test_mul');
+ $this->installEntitySchema('entity_test_mulrev');
// Create the test field.
entity_test_install();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
index bd2ceb9..db45c92 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
@@ -50,16 +50,10 @@ function setUp() {
$this->languageManager = $this->container->get('language_manager');
- $this->installSchema('entity_test', array(
- 'entity_test_mul',
- 'entity_test_mul_property_data',
- 'entity_test_rev',
- 'entity_test_rev_revision',
- 'entity_test_mulrev',
- 'entity_test_mulrev_revision',
- 'entity_test_mulrev_property_data',
- 'entity_test_mulrev_property_revision',
- ));
+ $this->installEntitySchema('entity_test_rev');
+ $this->installEntitySchema('entity_test_mul');
+ $this->installEntitySchema('entity_test_mulrev');
+
$this->installConfig(array('language'));
// Create the test field.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
index e5d8cf4..8d67666 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
@@ -70,7 +70,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
+ $this->installEntitySchema('taxonomy_term');
// We want a taxonomy term reference field. It needs a vocabulary, terms,
// a field and an instance. First, create the vocabulary.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
index 07ee0e9..b3cb9f7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
@@ -57,7 +57,9 @@ public static function getInfo() {
function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array('entity_test_mulrev', 'entity_test_mulrev_revision', 'entity_test_mulrev_property_data', 'entity_test_mulrev_property_revision'));
+
+ $this->installEntitySchema('entity_test_mulrev');
+
$this->installConfig(array('language'));
$figures = drupal_strtolower($this->randomName());
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
index ec7134c..a0ec726 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
@@ -23,16 +23,9 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array(
- 'entity_test_mul',
- 'entity_test_mul_property_data',
- 'entity_test_rev',
- 'entity_test_rev_revision',
- 'entity_test_mulrev',
- 'entity_test_mulrev_revision',
- 'entity_test_mulrev_property_data',
- 'entity_test_mulrev_property_revision',
- ));
+ $this->installEntitySchema('entity_test_rev');
+ $this->installEntitySchema('entity_test_mul');
+ $this->installEntitySchema('entity_test_mulrev');
}
/**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
index 8ea9daa..24a4de9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
@@ -42,9 +42,11 @@ public function setUp() {
$this->entityManager = $this->container->get('entity.manager');
$this->state = $this->container->get('state');
- $this->installSchema('user', array('users', 'users_roles'));
$this->installSchema('system', 'sequences');
- $this->installSchema('entity_test', 'entity_test');
+
+ $this->installEntitySchema('user');
+ $this->installEntitySchema('entity_test');
+
$this->installConfig(array('field'));
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
index 09e1e54..dceab23 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
@@ -32,17 +32,10 @@ public static function getInfo() {
*/
public function setUp() {
parent::setUp();
- $this->installSchema('user', array('users_data'));
- $this->installSchema('entity_test', array(
- 'entity_test_mul',
- 'entity_test_mul_property_data',
- 'entity_test_rev',
- 'entity_test_rev_revision',
- 'entity_test_mulrev',
- 'entity_test_mulrev_revision',
- 'entity_test_mulrev_property_data',
- 'entity_test_mulrev_property_revision'
- ));
+
+ $this->installEntitySchema('entity_test_rev');
+ $this->installEntitySchema('entity_test_mul');
+ $this->installEntitySchema('entity_test_mulrev');
// Create the test field.
entity_test_install();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
index 7395dfa..d72b297 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
@@ -44,8 +44,9 @@ protected function setUp() {
// Install field configuration.
$this->installConfig(array('field'));
// The users table is needed for creating dummy user accounts.
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('user');
// Register entity_test text field.
+ module_load_install('entity_test');
entity_test_install();
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
index 82e63b2..de4aa63 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
@@ -66,7 +66,8 @@ public static function getInfo() {
function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision'));
+
+ $this->installEntitySchema('entity_test_rev');
$entity_type = 'entity_test_rev';
$this->field_name = strtolower($this->randomName());
diff --git a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
index 5893f7b..37c4af9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
@@ -44,7 +44,7 @@ public static function getInfo() {
public function setUp() {
parent::setup();
- $this->installSchema('file', array('file_managed', "file_usage"));
+ $this->installEntitySchema('file');
$this->typedDataManager = $this->container->get('typed_data_manager');
}
diff --git a/core/modules/system/templates/form.html.twig b/core/modules/system/templates/form.html.twig
index 2cd1e95..b95fe71 100644
--- a/core/modules/system/templates/form.html.twig
+++ b/core/modules/system/templates/form.html.twig
@@ -12,6 +12,4 @@
* @ingroup themeable
*/
#}
-
+
diff --git a/core/modules/system/tests/modules/database_test/database_test.install b/core/modules/system/tests/modules/database_test/database_test.install
index 866d453..7c74c1c 100644
--- a/core/modules/system/tests/modules/database_test/database_test.install
+++ b/core/modules/system/tests/modules/database_test/database_test.install
@@ -245,5 +245,34 @@ function database_test_schema() {
),
);
+ $schema['test_composite_primary'] = array(
+ 'description' => 'Basic test table with a composite primary key',
+ 'fields' => array(
+ 'name' => array(
+ 'description' => "A person's name",
+ 'type' => 'varchar',
+ 'length' => 50,
+ 'not null' => TRUE,
+ 'default' => '',
+ 'binary' => TRUE,
+ ),
+ 'age' => array(
+ 'description' => "The person's age",
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'job' => array(
+ 'description' => "The person's job",
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => 'Undefined',
+ ),
+ ),
+ 'primary key' => array('name', 'age'),
+ );
+
return $schema;
}
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.install b/core/modules/system/tests/modules/entity_test/entity_test.install
index 9e48029..f2db594 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.install
+++ b/core/modules/system/tests/modules/entity_test/entity_test.install
@@ -36,406 +36,3 @@ function entity_test_install() {
->save();
}
}
-
-/**
- * Implements hook_schema().
- */
-function entity_test_schema() {
- // Schema for simple entity.
- $schema['entity_test'] = array(
- 'description' => 'Stores entity_test items.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique entity-test item ID.',
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'type' => array(
- 'description' => 'The bundle of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of the original variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- );
-
- // Schema for entity with revisions.
- $schema['entity_test_rev'] = array(
- 'description' => 'Stores entity_test_rev items.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique entity-test item ID.',
- ),
- 'revision_id' => array(
- 'description' => 'The current {entity_test_rev_property_revision}.revision_id version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'type' => array(
- 'description' => 'The bundle of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- );
- $schema['entity_test_rev_revision'] = array(
- 'description' => 'Stores entity_test_rev item property revisions.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {entity_test_rev}.id of the test entity.',
- ),
- 'revision_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The primary identifier for this version.',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'indexes' => array(
- 'user_id' => array('user_id'),
- ),
- 'foreign keys' => array(
- 'user_id' => array('users' => 'uid'),
- 'id' => array('entity_test_rev' => 'id'),
- ),
- 'primary key' => array('revision_id'),
- );
-
- // Schema for entity with data table.
- $schema['entity_test_mul'] = array(
- 'description' => 'Stores entity_test_mul items.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique entity-test item ID.',
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'type' => array(
- 'description' => 'The bundle of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of the original variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- );
- $schema['entity_test_mul_property_data'] = array(
- 'description' => 'Stores entity_test_mul item properties.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {entity_test_mul}.id of the test entity.',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'default_langcode' => array(
- 'description' => 'Boolean indicating whether the current variant is in the original entity language.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => FALSE,
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'indexes' => array(
- 'user_id' => array('user_id'),
- ),
- 'foreign keys' => array(
- 'user_id' => array('users' => 'uid'),
- 'id' => array('entity_test_mul' => 'id'),
- ),
- 'primary key' => array('id', 'langcode'),
- );
-
- // Schema for entity with data table and revisions.
- $schema['entity_test_mulrev'] = array(
- 'description' => 'Stores entity_test_mulrev items.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique entity-test item ID.',
- ),
- 'revision_id' => array(
- 'description' => 'The current {entity_test_mulrev_property_revision}.revision_id version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'type' => array(
- 'description' => 'The bundle of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- );
- $schema['entity_test_mulrev_revision'] = array(
- 'description' => 'Stores entity_test_rev item property revisions.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {entity_test_rev}.id of the test entity.',
- ),
- 'revision_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The primary identifier for this version.',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'foreign keys' => array(
- 'id' => array('entity_test_rev' => 'id'),
- ),
- 'primary key' => array('revision_id'),
- );
- $schema['entity_test_mulrev_property_data'] = array(
- 'description' => 'Stores entity_test_mulrev item properties.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {entity_test_mulrev}.id of the test entity.',
- ),
- 'revision_id' => array(
- 'description' => 'The current {entity_test_mulrev_property_revision}.revision_id version identifier.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'default_langcode' => array(
- 'description' => 'Boolean indicating whether the current variant is in the original entity language.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'indexes' => array(
- 'user_id' => array('user_id'),
- ),
- 'foreign keys' => array(
- 'user_id' => array('users' => 'uid'),
- 'id' => array('entity_test_mulrev' => 'id'),
- ),
- 'primary key' => array('id', 'langcode'),
- );
- $schema['entity_test_mulrev_property_revision'] = array(
- 'description' => 'Stores entity_test_mulrev item property revisions.',
- 'fields' => array(
- 'id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {entity_test_mulrev}.id of the test entity.',
- ),
- 'revision_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The primary identifier for this version.',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this variant of this test entity.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'default_langcode' => array(
- 'description' => 'Boolean indicating whether the current variant is in the original entity language.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 1,
- ),
- 'name' => array(
- 'description' => 'The name of the test entity.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'user_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => NULL,
- 'description' => 'The {users}.uid of the associated user.',
- ),
- ),
- 'indexes' => array(
- 'user_id' => array('user_id'),
- ),
- 'foreign keys' => array(
- 'user_id' => array('users' => 'uid'),
- 'id' => array('entity_test_mulrev' => 'id'),
- ),
- 'primary key' => array('revision_id', 'langcode'),
- );
-
- return $schema;
-}
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestBaseFieldDisplay.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestBaseFieldDisplay.php
index 6a8badd..0c0c753 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestBaseFieldDisplay.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestBaseFieldDisplay.php
@@ -28,7 +28,6 @@
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
- * "revision" = "revision_id",
* "bundle" = "type"
* },
* links = {
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestLabelCallback.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestLabelCallback.php
index 481711f..e881b9a 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestLabelCallback.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestLabelCallback.php
@@ -15,7 +15,6 @@
* label = @Translation("Entity test label callback"),
* field_cache = FALSE,
* base_table = "entity_test",
- * revision_table = "entity_test_revision",
* label_callback = "entity_test_label_callback",
* fieldable = TRUE,
* entity_keys = {
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
index 9930262..a8abda5 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
@@ -46,17 +46,4 @@
*/
class EntityTestMul extends EntityTest {
- /**
- * {@inheritdoc}
- */
- public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['default_langcode'] = FieldDefinition::create('boolean')
- ->setLabel(t('Default language'))
- ->setDescription(t('Flag to indicate whether this is the default language.'));
-
- return $fields;
- }
-
}
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
index 21f6c54..b30cbb1 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
@@ -46,23 +46,4 @@
*/
class EntityTestMulRev extends EntityTestRev {
- /**
- * {@inheritdoc}
- */
- public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- $fields = parent::baseFieldDefinitions($entity_type);
-
- $fields['revision_id'] = FieldDefinition::create('integer')
- ->setLabel(t('Revision ID'))
- ->setDescription(t('The version id of the test entity.'))
- ->setReadOnly(TRUE)
- ->setSetting('unsigned', TRUE);
-
- $fields['default_langcode'] = FieldDefinition::create('boolean')
- ->setLabel(t('Default language'))
- ->setDescription(t('Flag to indicate whether this is the default language.'));
-
- return $fields;
- }
-
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
index 510524a..8b6996a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
@@ -11,6 +11,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\taxonomy\TermInterface;
@@ -164,6 +165,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['parent'] = FieldDefinition::create('integer')
->setLabel(t('Term Parents'))
->setDescription(t('The parents of this term.'))
+ ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
// Save new terms with no parents by default.
->setSetting('default_value', 0)
->setSetting('unsigned', TRUE)
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php
index b7b9201..c103c0b 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php
@@ -8,6 +8,7 @@
namespace Drupal\taxonomy;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Entity\ContentEntityDatabaseStorage;
@@ -151,4 +152,98 @@ public function resetWeights($vid) {
->execute();
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getSchema() {
+ $schema = parent::getSchema();
+
+ unset($schema['taxonomy_term_data']['indexes']['field__vid']);
+ unset($schema['taxonomy_term_data']['indexes']['field__description__format']);
+ $schema['taxonomy_term_data']['indexes'] += array(
+ 'taxonomy_term__tree' => array('vid', 'weight', 'name'),
+ 'taxonomy_term__vid_name' => array('vid', 'name'),
+ 'taxonomy_term__name' => array('name'),
+ );
+
+ $schema['taxonomy_term_hierarchy'] = array(
+ 'description' => 'Stores the hierarchical relationship between terms.',
+ 'fields' => array(
+ 'tid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
+ ),
+ 'parent' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
+ ),
+ ),
+ 'indexes' => array(
+ 'parent' => array('parent'),
+ ),
+ 'foreign keys' => array(
+ 'taxonomy_term_data' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array('tid' => 'tid'),
+ ),
+ ),
+ 'primary key' => array('tid', 'parent'),
+ );
+
+ $schema['taxonomy_index'] = array(
+ 'description' => 'Maintains denormalized information about node/term relationships.',
+ 'fields' => array(
+ 'nid' => array(
+ 'description' => 'The {node}.nid this record tracks.',
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'tid' => array(
+ 'description' => 'The term ID.',
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'sticky' => array(
+ 'description' => 'Boolean indicating whether the node is sticky.',
+ 'type' => 'int',
+ 'not null' => FALSE,
+ 'default' => 0,
+ 'size' => 'tiny',
+ ),
+ 'created' => array(
+ 'description' => 'The Unix timestamp when the node was created.',
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default'=> 0,
+ ),
+ ),
+ 'primary key' => array('nid', 'tid'),
+ 'indexes' => array(
+ 'term_node' => array('tid', 'sticky', 'created'),
+ ),
+ 'foreign keys' => array(
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'term' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array('tid' => 'tid'),
+ ),
+ ),
+ );
+
+ return $schema;
+ }
+
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
index 0a67140..78c877f 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
@@ -42,8 +42,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
- $this->installSchema('taxonomy', 'taxonomy_term_data');
- $this->installSchema('taxonomy', 'taxonomy_term_hierarchy');
+ $this->installEntitySchema('taxonomy_term');
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => $this->randomName(),
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermValidationTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermValidationTest.php
index 737f662..f545403 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermValidationTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermValidationTest.php
@@ -34,7 +34,7 @@ public static function getInfo() {
*/
public function setUp() {
parent::setUp();
- $this->installSchema('taxonomy', array('taxonomy_term_data'));
+ $this->installEntitySchema('taxonomy_term');
}
/**
diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install
deleted file mode 100644
index ae5dc7f..0000000
--- a/core/modules/taxonomy/taxonomy.install
+++ /dev/null
@@ -1,164 +0,0 @@
- 'Stores term information.',
- 'fields' => array(
- 'tid' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique term ID.',
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'vid' => array(
- 'type' => 'varchar',
- 'length' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The ID of the vocabulary to which the term is assigned.',
- ),
- 'langcode' => array(
- 'description' => 'The {language}.langcode of this term.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The term name.',
- ),
- 'description__value' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'size' => 'big',
- 'description' => 'A description of the term.',
- ),
- 'description__format' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => 'The filter format ID of the description.',
- ),
- 'weight' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The weight of this term in relation to other terms.',
- ),
- 'changed' => array(
- 'description' => 'The Unix timestamp when the term was most recently saved.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('tid'),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- ),
- 'indexes' => array(
- 'taxonomy_tree' => array('vid', 'weight', 'name'),
- 'vid_name' => array('vid', 'name'),
- 'name' => array('name'),
- ),
- );
-
- $schema['taxonomy_term_hierarchy'] = array(
- 'description' => 'Stores the hierarchical relationship between terms.',
- 'fields' => array(
- 'tid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
- ),
- 'parent' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
- ),
- ),
- 'indexes' => array(
- 'parent' => array('parent'),
- ),
- 'foreign keys' => array(
- 'taxonomy_term_data' => array(
- 'table' => 'taxonomy_term_data',
- 'columns' => array('tid' => 'tid'),
- ),
- ),
- 'primary key' => array('tid', 'parent'),
- );
-
- $schema['taxonomy_index'] = array(
- 'description' => 'Maintains denormalized information about node/term relationships.',
- 'fields' => array(
- 'nid' => array(
- 'description' => 'The {node}.nid this record tracks.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'tid' => array(
- 'description' => 'The term ID.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'sticky' => array(
- 'description' => 'Boolean indicating whether the node is sticky.',
- 'type' => 'int',
- 'not null' => FALSE,
- 'default' => 0,
- 'size' => 'tiny',
- ),
- 'created' => array(
- 'description' => 'The Unix timestamp when the node was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default'=> 0,
- ),
- ),
- 'primary key' => array('nid', 'tid'),
- 'indexes' => array(
- 'term_node' => array('tid', 'sticky', 'created'),
- ),
- 'foreign keys' => array(
- 'tracked_node' => array(
- 'table' => 'node',
- 'columns' => array('nid' => 'nid'),
- ),
- 'term' => array(
- 'table' => 'taxonomy_term_data',
- 'columns' => array('tid' => 'tid'),
- ),
- ),
- );
-
- return $schema;
-}
diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
index 8e37920..633ee0b 100644
--- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
@@ -48,7 +48,7 @@ function setUp() {
// Configure the theme system.
$this->installConfig(array('system', 'field'));
- $this->installSchema('entity_test', 'entity_test');
+ $this->installEntitySchema('entity_test');
// @todo Add helper methods for all of the following.
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php
index 9b93095..30af0bf 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_rev');
// Create the necessary formats.
$this->installConfig(array('filter'));
diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install
index 5f3e5a0..2a72272 100644
--- a/core/modules/tracker/tracker.install
+++ b/core/modules/tracker/tracker.install
@@ -16,12 +16,18 @@ function tracker_uninstall() {
* Implements hook_install().
*/
function tracker_install() {
- $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField();
- if ($max_nid != 0) {
- \Drupal::state()->set('tracker.index_nid', $max_nid);
- // To avoid timing out while attempting to do a complete indexing, we
- // simply call our cron job to remove stale records and begin the process.
- tracker_cron();
+ // @todo Is there some way to avoid this check?
+ if (\Drupal::database()->schema()->tableExists('node')) {
+ $nids = \Drupal::entityQuery('node')
+ ->sort('nid', 'DESC')
+ ->range(0, 1)
+ ->execute();
+ if (!empty($nids)) {
+ \Drupal::state()->set('tracker.index_nid', reset($nids));
+ // To avoid timing out while attempting to do a complete indexing, we
+ // simply call our cron job to remove stale records and begin the process.
+ tracker_cron();
+ }
}
}
diff --git a/core/modules/user/lib/Drupal/user/AccountForm.php b/core/modules/user/lib/Drupal/user/AccountForm.php
index f85fca2..0b097d4 100644
--- a/core/modules/user/lib/Drupal/user/AccountForm.php
+++ b/core/modules/user/lib/Drupal/user/AccountForm.php
@@ -366,9 +366,12 @@ public function validate(array $form, array &$form_state) {
// Move text value for user signature into 'signature'.
$form_state['values']['signature'] = $form_state['values']['signature']['value'];
- $user_schema = drupal_get_schema('users');
- if (drupal_strlen($form_state['values']['signature']) > $user_schema['fields']['signature']['length']) {
- $this->setFormError('signature', $form_state, $this->t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['fields']['signature']['length'])));
+ // @todo Make the user signature field use a widget to benefit from
+ // automatic typed data validation in https://drupal.org/node/2227381.
+ $field_definitions = $this->entityManager->getFieldDefinitions('user', $this->getEntity()->bundle());
+ $max_length = $field_definitions['signature']->getSetting('max_length');
+ if (drupal_strlen($form_state['values']['signature']) > $max_length) {
+ $this->setFormError('signature', $form_state, $this->t('The signature is too long: it must be %max characters or less.', array('%max' => $max_length)));
}
}
}
diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php
index 25eb641..6c0fb85 100644
--- a/core/modules/user/lib/Drupal/user/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Entity/User.php
@@ -18,6 +18,9 @@
/**
* Defines the user entity class.
*
+ * The base table name here is plural, despite Drupal table naming standards,
+ * because "user" is a reserved word in many databases.
+ *
* @ContentEntityType(
* id = "user",
* label = @Translation("User"),
@@ -500,8 +503,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['status'] = FieldDefinition::create('boolean')
->setLabel(t('User status'))
- ->setDescription(t('Whether the user is active (1) or blocked (0).'))
- ->setSetting('default_value', 1);
+ ->setDescription(t('Whether the user is active or blocked.'))
+ // @todo As the status has access implications users should be created as
+ // blocked by default and activated explicitly if needed. See
+ // https://drupal.org/node/2248969.
+ ->setSetting('default_value', TRUE);
$fields['created'] = FieldDefinition::create('created')
->setLabel(t('Created'))
@@ -525,6 +531,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
// @todo Convert this to entity_reference_field, see
// https://drupal.org/node/2044859.
$fields['roles'] = FieldDefinition::create('string')
+ ->setCustomStorage(TRUE)
->setLabel(t('Roles'))
->setCardinality(FieldDefinitionInterface::CARDINALITY_UNLIMITED)
->setDescription(t('The roles the user has.'));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
index fb58bc1..6219f89 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
@@ -31,13 +31,22 @@ public static function getInfo() {
*/
function testUserAdmin() {
$user_a = $this->drupalCreateUser();
+ $user_a->name = 'User A';
$user_a->mail = $this->randomName() . '@example.com';
$user_a->save();
$user_b = $this->drupalCreateUser(array('administer taxonomy'));
+ $user_b->name = 'User B';
+ $user_b->save();
$user_c = $this->drupalCreateUser(array('administer taxonomy'));
+ $user_c->name = 'User C';
+ $user_c->save();
// Create admin user to delete registered user.
$admin_user = $this->drupalCreateUser(array('administer users'));
+ // Use a predictable name so that we can reliably order the user admin page
+ // by name.
+ $admin_user->name = 'Admin user';
+ $admin_user->save();
$this->drupalLogin($admin_user);
$this->drupalGet('admin/people');
$this->assertText($user_a->getUsername(), 'Found user A on admin users page');
@@ -83,8 +92,12 @@ function testUserAdmin() {
$this->assertTrue($account->isActive(), 'User C not blocked');
$edit = array();
$edit['action'] = 'user_block_user_action';
- $edit['user_bulk_form[1]'] = TRUE;
- $this->drupalPostForm('admin/people', $edit, t('Apply'));
+ $edit['user_bulk_form[4]'] = TRUE;
+ $this->drupalPostForm('admin/people', $edit, t('Apply'), array(
+ // Sort the table by username so that we know reliably which user will be
+ // targeted with the blocking action.
+ 'query' => array('order' => 'name', 'sort' => 'asc')
+ ));
$account = user_load($user_c->id(), TRUE);
$this->assertTrue($account->isBlocked(), 'User C blocked');
@@ -97,8 +110,12 @@ function testUserAdmin() {
// Test unblocking of a user from /admin/people page and sending of activation mail
$editunblock = array();
$editunblock['action'] = 'user_unblock_user_action';
- $editunblock['user_bulk_form[1]'] = TRUE;
- $this->drupalPostForm('admin/people', $editunblock, t('Apply'));
+ $editunblock['user_bulk_form[4]'] = TRUE;
+ $this->drupalPostForm('admin/people', $editunblock, t('Apply'), array(
+ // Sort the table by username so that we know reliably which user will be
+ // targeted with the blocking action.
+ 'query' => array('order' => 'name', 'sort' => 'asc')
+ ));
$account = user_load($user_c->id(), TRUE);
$this->assertTrue($account->isActive(), 'User C unblocked');
$this->assertMail("to", $account->getEmail(), "Activation mail sent to user C");
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php b/core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
index 4e54ff8..de2f399 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
@@ -37,7 +37,9 @@ public static function getInfo() {
*/
protected function setUp() {
parent::setUp();
- $this->installSchema('user', array('users'));
+ $this->container->get('module_handler')->loadInclude('user', 'install');
+ $this->installEntitySchema('user');
+ user_install();
}
@@ -45,7 +47,6 @@ protected function setUp() {
* Test that the initial users have correct values.
*/
public function testUserInstall() {
- user_install();
$anon = db_query('SELECT * FROM {users} WHERE uid = 0')->fetchObject();
$admin = db_query('SELECT * FROM {users} WHERE uid = 1')->fetchObject();
$this->assertFalse(empty($anon->uuid), 'Anon user has a UUID');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
index 499877e..06d42b9 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
@@ -36,7 +36,7 @@ public static function getInfo() {
*/
public function setUp() {
parent::setUp();
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('user');
$this->installSchema('system', array('sequences'));
}
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserUnitTestBase.php b/core/modules/user/lib/Drupal/user/Tests/Views/UserUnitTestBase.php
index eafc620..16ba123 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/UserUnitTestBase.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/UserUnitTestBase.php
@@ -48,7 +48,7 @@ protected function setUp() {
ViewTestData::createTestViews(get_class($this), array('user_test_views'));
- $this->installSchema('user', array('users', 'users_roles'));
+ $this->installEntitySchema('user');
$this->installSchema('system', 'sequences');
$entity_manager = $this->container->get('entity.manager');
diff --git a/core/modules/user/lib/Drupal/user/UserStorage.php b/core/modules/user/lib/Drupal/user/UserStorage.php
index afd53b3..6cbbab3 100644
--- a/core/modules/user/lib/Drupal/user/UserStorage.php
+++ b/core/modules/user/lib/Drupal/user/UserStorage.php
@@ -9,7 +9,9 @@
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Entity\Schema\ContentEntitySchemaHandlerInterface;
use Drupal\Core\Password\PasswordInterface;
use Drupal\Core\Database\Connection;
use Drupal\field\FieldInfo;
@@ -46,17 +48,18 @@ class UserStorage extends ContentEntityDatabaseStorage implements UserStorageInt
* The entity type definition.
* @param \Drupal\Core\Database\Connection $database
* The database connection to be used.
- * @param \Drupal\field\FieldInfo $field_info
- * The field info service.
- * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
- * The UUID Service.
+ * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+ * The entity manager.
* @param \Drupal\Core\Password\PasswordInterface $password
* The password hashing service.
* @param \Drupal\user\UserDataInterface $user_data
* The user data service.
+ * @param \Drupal\field\FieldInfo $field_info
+ * (optional) The field info service. Defaults to NULL as user storage can
+ * be instantiated before Field module is installed.
*/
- public function __construct(EntityTypeInterface $entity_type, Connection $database, FieldInfo $field_info, UuidInterface $uuid_service, PasswordInterface $password, UserDataInterface $user_data) {
- parent::__construct($entity_type, $database, $field_info, $uuid_service);
+ public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityManagerInterface $entity_manager, PasswordInterface $password, UserDataInterface $user_data, FieldInfo $field_info = NULL) {
+ parent::__construct($entity_type, $database, $entity_manager, $field_info);
$this->password = $password;
$this->userData = $user_data;
@@ -69,10 +72,10 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
return new static(
$entity_type,
$container->get('database'),
- $container->get('field.info'),
- $container->get('uuid'),
+ $container->get('entity.manager'),
$container->get('password'),
- $container->get('user.data')
+ $container->get('user.data'),
+ $container->has('field.info') ? $container->get('field.info') : NULL
);
}
@@ -153,4 +156,53 @@ public function updateLastLoginTimestamp(UserInterface $account) {
->execute();
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getSchema() {
+ $schema = parent::getSchema();
+
+ // The "users" table does not use serial identifiers.
+ $schema['users']['fields']['uid']['type'] = 'int';
+ $schema['users']['indexes'] += array(
+ 'user__access' => array('access'),
+ 'user__created' => array('created'),
+ 'user__mail' => array('mail'),
+ );
+ $schema['users']['unique keys'] += array(
+ 'user__name' => array('name'),
+ );
+
+ $schema['users_roles'] = array(
+ 'description' => 'Maps users to roles.',
+ 'fields' => array(
+ 'uid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'Primary Key: {users}.uid for user.',
+ ),
+ 'rid' => array(
+ 'type' => 'varchar',
+ 'length' => 64,
+ 'not null' => TRUE,
+ 'description' => 'Primary Key: ID for the role.',
+ ),
+ ),
+ 'primary key' => array('uid', 'rid'),
+ 'indexes' => array(
+ 'rid' => array('rid'),
+ ),
+ 'foreign keys' => array(
+ 'user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
+ ),
+ );
+
+ return $schema;
+ }
+
}
diff --git a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml
index b16cb3e..8b62fc7 100644
--- a/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_permission.yml
@@ -115,7 +115,20 @@ display:
group_items: { }
reduce_duplicates: '1'
plugin_id: user_permissions
- sorts: { }
+ sorts:
+ uid:
+ id: uid
+ table: users
+ field: uid
+ relationship: none
+ group_type: group
+ admin_label: ''
+ order: ASC
+ exposed: false
+ expose:
+ label: ''
+ plugin_id: standard
+ provider: views
human_name: test_filter_permission
module: views
id: test_filter_permission
diff --git a/core/modules/user/user.info.yml b/core/modules/user/user.info.yml
index 45a421a..dbdb520 100644
--- a/core/modules/user/user.info.yml
+++ b/core/modules/user/user.info.yml
@@ -6,3 +6,5 @@ version: VERSION
core: 8.x
required: true
configure: user.admin_index
+dependencies:
+ - entity
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 97515a2..b1c1064 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -5,137 +5,10 @@
* Install, update and uninstall functions for the user module.
*/
-use Drupal\Core\Language\Language;
-use Drupal\field\Field;
-
/**
* Implements hook_schema().
*/
function user_schema() {
- // The table name here is plural, despite Drupal table naming standards,
- // because "user" is a reserved word in many databases.
- $schema['users'] = array(
- 'description' => 'Stores user data.',
- 'fields' => array(
- 'uid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique user ID.',
- 'default' => 0,
- ),
- 'uuid' => array(
- 'description' => 'Unique Key: Universally unique identifier for this entity.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 60,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'Unique user name.',
- ),
- 'langcode' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => "The {language}.langcode of the user's profile.",
- ),
- 'pass' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => "User's password (hashed).",
- ),
- 'mail' => array(
- 'type' => 'varchar',
- 'length' => 254,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => "User's e-mail address.",
- ),
- 'signature' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => "User's signature.",
- ),
- 'signature_format' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => 'The filter format ID of the signature.',
- ),
- 'created' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Timestamp for when user was created.',
- ),
- 'access' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Timestamp for previous time user accessed the site.',
- ),
- 'login' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => "Timestamp for user's last login.",
- ),
- 'status' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Whether the user is active(1) or blocked(0).',
- ),
- 'timezone' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => FALSE,
- 'description' => "User's time zone.",
- ),
- 'preferred_langcode' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The {language}.langcode that the user prefers for receiving emails and viewing the site.',
- ),
- 'preferred_admin_langcode' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The {language}.langcode that the user prefers for viewing administration pages.',
- ),
- 'init' => array(
- 'type' => 'varchar',
- 'length' => 254,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'E-mail address used for initial account creation.',
- ),
- ),
- 'indexes' => array(
- 'access' => array('access'),
- 'created' => array('created'),
- 'mail' => array('mail'),
- ),
- 'unique keys' => array(
- 'uuid' => array('uuid'),
- 'name' => array('name'),
- ),
- 'primary key' => array('uid'),
- );
-
$schema['users_data'] = array(
'description' => 'Stores module data as key/value pairs per user.',
'fields' => array(
@@ -184,35 +57,6 @@ function user_schema() {
),
);
- $schema['users_roles'] = array(
- 'description' => 'Maps users to roles.',
- 'fields' => array(
- 'uid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Primary Key: {users}.uid for user.',
- ),
- 'rid' => array(
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'description' => 'Primary Key: ID for the role.',
- ),
- ),
- 'primary key' => array('uid', 'rid'),
- 'indexes' => array(
- 'rid' => array('rid'),
- ),
- 'foreign keys' => array(
- 'user' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- ),
- );
-
return $schema;
}
@@ -220,6 +64,8 @@ function user_schema() {
* Implements hook_install().
*/
function user_install() {
+ // @todo Clean this up in https://drupal.org/node/2249113
+ \Drupal::entityManager()->getStorage('user')->ensureSchemaExists();;
// Insert a row for the anonymous user.
db_insert('users')
->fields(array(
diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml
index 03bb4c2..33fe88a 100644
--- a/core/modules/user/user.services.yml
+++ b/core/modules/user/user.services.yml
@@ -46,6 +46,3 @@ services:
user.auth:
class: Drupal\user\UserAuth
arguments: ['@entity.manager', '@password']
- user.tempstore:
- class: Drupal\user\TempStoreFactory
- arguments: ['@serialization.phpserialize', '@database', '@lock']
diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php
index c3e19aa..8193ff5 100644
--- a/core/modules/views/lib/Drupal/views/Entity/View.php
+++ b/core/modules/views/lib/Drupal/views/Entity/View.php
@@ -275,7 +275,10 @@ public function calculateDependencies() {
// Ensure that the view is dependent on the module that provides the schema
// for the base table.
$schema = $this->drupalGetSchema($this->base_table);
- if ($this->module != $schema['module']) {
+ // @todo Entity base tables are no longer registered in hook_schema(). Once
+ // we automate the views data for entity types add the entity type
+ // type provider as a dependency.
+ if ($schema && $this->module != $schema['module']) {
$this->addDependency('module', $schema['module']);
}
@@ -283,7 +286,6 @@ public function calculateDependencies() {
foreach (Views::getHandlerTypes() as $type) {
$handler_types[] = $type['plural'];
}
-
foreach ($this->get('display') as $display) {
// Collect all dependencies of all handlers.
foreach ($handler_types as $handler_type) {
@@ -296,10 +298,10 @@ public function calculateDependencies() {
// Add the additional dependencies from the handler configuration.
if (!empty($handler['dependencies'])) {
$this->addDependencies($handler['dependencies']);
- }
}
}
}
+ }
// Collect all dependencies of plugins.
foreach (Views::getPluginTypes('plugin') as $plugin_type) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
index d91e4bf..1d280c6 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php
@@ -178,7 +178,14 @@ public function useCountQuery() {
* itself being executed.
*/
public function executeCountQuery(&$count_query) {
- $this->total_items = $count_query->execute()->fetchField();
+ try {
+ $this->total_items = $count_query->execute()->fetchField();
+ }
+ catch (\Exception $e) {
+ // If the database schema does not exist, there are no items in the
+ // database.
+ $this->total_items = 0;
+ }
if (!empty($this->options['offset'])) {
$this->total_items -= $this->options['offset'];
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
index 175e7f4..ad47e15 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
@@ -1423,10 +1423,15 @@ function execute(ViewExecutable $view) {
$query->range($offset, $limit);
}
- $result = $query->execute();
- $result->setFetchMode(\PDO::FETCH_CLASS, 'Drupal\views\ResultRow');
+ try {
+ $result = $query->execute();
+ $result->setFetchMode(\PDO::FETCH_CLASS, 'Drupal\views\ResultRow');
+ $view->result = iterator_to_array($result);
+ }
+ catch (\Exception $e) {
+ $view->result = array();
+ }
- $view->result = iterator_to_array($result);
$view->pager->postExecute($view->result);
$view->pager->updatePageInfo();
diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
index 1694fd0..be88bf2 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
@@ -56,8 +56,9 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
- $this->installSchema('node', array('node', 'node_revision', 'node_field_data', 'node_field_revision', 'node_access'));
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('node');
+ $this->installEntitySchema('user');
+ $this->installSchema('node', array('node_access'));
$this->installConfig(array('node', 'language'));
$this->langcodes = array(\Drupal::languageManager()->getDefaultLanguage()->id);
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
index 2ac78f8..3ab29d7 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
@@ -38,7 +38,7 @@ protected function setUp() {
parent::setUp();
$this->installConfig(array('system', 'filter'));
- $this->installSchema('user', array('users'));
+ $this->installEntitySchema('user');
}
public function testAreaText() {
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php
index caec4c7..ac9b920 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php
@@ -35,7 +35,7 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
- $this->installSchema('user', 'users');
+ $this->installEntitySchema('user');
}
/**
diff --git a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
index 94014f4..e938a58 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
@@ -24,13 +24,6 @@ class ModuleTest extends ViewUnitTestBase {
public static $testViews = array('test_view_status', 'test_view');
/**
- * Modules to enable.
- *
- * @var array
- */
- public static $modules = array('user', 'block');
-
- /**
* Stores the last triggered error, for example via debug().
*
* @var string
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
index dd2d2e8..42db1e0 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
@@ -26,7 +26,7 @@ class BlockDependenciesTest extends ViewUnitTestBase {
*
* @var array
*/
- public static $modules = array('node', 'block', 'user');
+ public static $modules = array('node', 'block');
/**
* {@inheritdoc}
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
index fae3515..5542619 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
@@ -26,7 +26,7 @@
* Overrides \Drupal\views\Tests\ViewUnitTestBase::setUpFixtures().
*/
protected function setUpFixtures() {
- $this->installSchema('user', array('users', 'users_roles'));
+ $this->installEntitySchema('user');
$this->installConfig(array('user'));
parent::setUpFixtures();
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
index 0b406f5..8cecbd1 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
@@ -53,7 +53,7 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
- $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
+ $this->installEntitySchema('taxonomy_term');
$this->installConfig(array('taxonomy'));
\Drupal::service('router.builder')->rebuild();
}
diff --git a/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php b/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php
index 7b7d0b7..ff0c225 100644
--- a/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php
@@ -49,7 +49,7 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
- $this->installSchema('entity_test', array('entity_test'));
+ $this->installEntitySchema('entity_test');
$this->storage = $this->container->get('entity.manager')->getStorage('entity_test');
}
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
index c0228ba..259e0db 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
@@ -84,10 +84,12 @@ public static function getInfo() {
}
protected function setUpFixtures() {
- $this->installSchema('user', array('users'));
- $this->installSchema('node', array('node', 'node_field_data'));
- $this->installSchema('comment', array('comment', 'comment_entity_statistics'));
+ $this->installEntitySchema('user');
+ $this->installEntitySchema('node');
+ $this->installEntitySchema('comment');
+ $this->installSchema('comment', array('comment_entity_statistics'));
$this->installConfig(array('field'));
+
entity_create('node_type', array(
'type' => 'page',
'name' => 'Page',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
index 78bb214..b654289 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
@@ -23,7 +23,7 @@ class WizardPluginBaseUnitTest extends ViewUnitTestBase {
*
* @var array
*/
- public static $modules = array('language', 'system', 'user');
+ public static $modules = array('language', 'system');
/**
* Contains thw wizard plugin manager.
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
index db2df4f..db67fde 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
@@ -20,7 +20,7 @@ class TagTest extends ViewUnitTestBase {
*
* @var array
*/
- public static $modules = array('views', 'views_ui', 'user');
+ public static $modules = array('views', 'views_ui');
public static function getInfo() {
return array(
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php
index 41358a6..66fe5b5 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php
@@ -120,9 +120,15 @@ public function testCreate() {
$module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
// @todo Add field definitions to test default values of fields.
- $entity_manager->expects($this->atLeastOnce())
+ $definitions = array();
+ $entity_manager->expects($this->once())
+ ->method('getFieldStorageDefinitions')
+ ->will($this->returnValue($definitions));
+ // ContentEntityStorageBase iterates over the entity which calls this method
+ // internally in ContentEntityBase::getProperties().
+ $entity_manager->expects($this->once())
->method('getFieldDefinitions')
- ->will($this->returnValue(array()));
+ ->will($this->returnValue($definitions));
$container = new ContainerBuilder();
$container->set('language_manager', $language_manager);
@@ -130,7 +136,10 @@ public function testCreate() {
$container->set('module_handler', $module_handler);
\Drupal::setContainer($container);
- $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\ContentEntityBase', array(), '', FALSE, TRUE, TRUE, array('id'));
+ $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
+ ->disableOriginalConstructor()
+ ->setMethods(array('id'))
+ ->getMockForAbstractClass();
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
$entity_type->expects($this->atLeastOnce())
->method('id')
@@ -154,10 +163,10 @@ public function testCreate() {
$connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
->disableOriginalConstructor()
->getMock();
- $field_info = $this->getMockBuilder('\Drupal\field\FieldInfo')
+ $field_info = $this->getMockBuilder('Drupal\field\FieldInfo')
->disableOriginalConstructor()
->getMock();
- $entity_storage = new ContentEntityDatabaseStorage($entity_type, $connection, $field_info);
+ $entity_storage = new ContentEntityDatabaseStorage($entity_type, $connection, $entity_manager, $field_info);
$entity = $entity_storage->create();
$entity->expects($this->atLeastOnce())
diff --git a/core/tests/Drupal/Tests/Core/Entity/Schema/ContentEntitySchemaHandlerTest.php b/core/tests/Drupal/Tests/Core/Entity/Schema/ContentEntitySchemaHandlerTest.php
new file mode 100644
index 0000000..b7373c2
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Entity/Schema/ContentEntitySchemaHandlerTest.php
@@ -0,0 +1,311 @@
+ 'Content entity schema handler',
+ 'description' => 'Tests the schema generation for content entities.',
+ 'group' => 'Entity',
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
+ $this->entityType = $this->getMock('Drupal\Core\Entity\ContentEntityTypeInterface');
+ $this->storage = $this->getMock('Drupal\Core\Entity\ContentEntityDefaultDatabaseStorageInterface');
+
+ // Set up basic expectations that apply to all tests.
+ $this->entityType->expects($this->any())
+ ->method('id')
+ ->will($this->returnValue('entity_test'));
+
+ $this->storage->expects($this->any())
+ ->method('getBaseTable')
+ ->will($this->returnValue('entity_test'));
+ }
+
+ /**
+ * Tests ContentEntitySchemaHandler::getSchema() with a basic table layout.
+ *
+ * This tests that the schema is generated correctly for non-revisionable,
+ * non-translatable entities.
+ *
+ * @covers ::getSchema
+ */
+ public function testGetSchemaLayoutBase() {
+ $this->entityType->expects($this->any())
+ ->method('getKey')
+ ->will($this->returnValueMap(array(
+ array('id', 'id'),
+ array('uuid', NULL),
+ )));
+
+ $this->storage->expects($this->once())
+ ->method('getTableLayout')
+ ->will($this->returnValue(ContentEntityDefaultDatabaseStorageInterface::LAYOUT_BASE));
+
+ $this->setupBaseLayoutFieldDefinitions();
+
+ $this->setupSchemaHandler();
+
+ $this->storage->expects($this->once())
+ ->method('getTableMapping')
+ ->will($this->returnValue(
+ array(
+ 'entity_test' => array(
+ 'id' => array('value' => 'id'),
+ 'name' => array('value' => 'name'),
+ 'type' => array('value' => 'type'),
+ ),
+ )
+ ));
+
+ $expected = array(
+ 'entity_test' => array(
+ 'description' => 'The base table for entity_test entities.',
+ 'fields' => array(
+ 'id' => array(
+ 'type' => 'serial',
+ 'description' => 'The id field.',
+ 'not null' => TRUE,
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'description' => 'The name field.',
+ 'not null' => FALSE,
+ ),
+ 'type' => array(
+ 'type' => 'varchar',
+ 'length' => 32,
+ 'description' => 'The type field.',
+ 'not null' => FALSE,
+ ),
+ ),
+ 'primary key' => array('id'),
+ 'indexes' => array(),
+ 'foreign keys' => array(),
+ ),
+ );
+ $actual = $this->schemaHandler->getSchema();
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Tests ContentEntitySchemaHandler::getSchema() with a basic table layout.
+ *
+ * This tests that the schema is generated correctly for non-revisionable,
+ * non-translatable entities with a UUID key.
+ *
+ * @covers ::getSchema
+ */
+ public function testGetSchemaLayoutBaseWithUuid() {
+ $this->entityType->expects($this->any())
+ ->method('getKey')
+ ->will($this->returnValueMap(array(
+ array('id', 'id'),
+ array('uuid', 'uuid'),
+ )));
+
+ $this->storage->expects($this->once())
+ ->method('getTableLayout')
+ ->will($this->returnValue(ContentEntityDefaultDatabaseStorageInterface::LAYOUT_BASE));
+
+ $this->setupBaseLayoutFieldDefinitions();
+ $this->setupStorageDefinition('uuid', array(
+ 'columns' => array(
+ 'value' => array(
+ 'type' => 'varchar',
+ 'length' => 128,
+ ),
+ ),
+ ));
+
+ $this->setupSchemaHandler();
+
+ $this->storage->expects($this->once())
+ ->method('getTableMapping')
+ ->will($this->returnValue(
+ array(
+ 'entity_test' => array(
+ 'id' => array('value' => 'id'),
+ 'uuid' => array('value' => 'uuid'),
+ 'name' => array('value' => 'name'),
+ 'type' => array('value' => 'type'),
+ ),
+ )
+ ));
+
+ $expected = array(
+ 'entity_test' => array(
+ 'description' => 'The base table for entity_test entities.',
+ 'fields' => array(
+ 'id' => array(
+ 'type' => 'serial',
+ 'description' => 'The id field.',
+ 'not null' => TRUE,
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'description' => 'The name field.',
+ 'not null' => FALSE,
+ ),
+ 'type' => array(
+ 'type' => 'varchar',
+ 'length' => 32,
+ 'description' => 'The type field.',
+ 'not null' => FALSE,
+ ),
+ 'uuid' => array(
+ 'type' => 'varchar',
+ 'length' => 128,
+ 'description' => 'The uuid field.',
+ 'not null' => TRUE,
+ ),
+ ),
+ 'primary key' => array('id'),
+ 'unique keys' => array(
+ 'entity_test__uuid' => array('uuid'),
+ ),
+ 'indexes' => array(),
+ 'foreign keys' => array(),
+ ),
+ );
+ $actual = $this->schemaHandler->getSchema();
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Sets up the field definitions that are used for the base storage layout.
+ */
+ protected function setupBaseLayoutFieldDefinitions() {
+ // @see \Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem::schema()
+ $this->setupStorageDefinition('id', array(
+ 'columns' => array(
+ 'value' => array(
+ 'type' => 'int',
+ ),
+ ),
+ ));
+ // @see \Drupal\Core\Field\Plugin\Field\FieldType\StringItem::schema()
+ $this->setupStorageDefinition('name', array(
+ 'columns' => array(
+ 'value' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ ),
+ ),
+ ));
+ // @see \Drupal\Core\Field\Plugin\Field\FieldType\StringItem::schema()
+ $this->setupStorageDefinition('type', array(
+ 'columns' => array(
+ 'value' => array(
+ 'type' => 'varchar',
+ 'length' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
+ ),
+ ),
+ ));
+ }
+
+ /**
+ * Sets up the schema handler.
+ *
+ * This uses the field definitions set in $this->fieldDefinitions.
+ */
+ public function setupSchemaHandler() {
+ $this->entityManager->expects($this->once())
+ ->method('getFieldStorageDefinitions')
+ ->with('entity_test')
+ ->will($this->returnValue($this->storageDefinitions));
+ $this->schemaHandler = new ContentEntitySchemaHandler(
+ $this->entityManager,
+ $this->entityType,
+ $this->storage
+ );
+ }
+
+ /**
+ * Sets up a field definition.
+ *
+ * @param string $field_name
+ * The field name.
+ * @param array $schema
+ * The schema array of the field definition, as returned from
+ * FieldDefinitionInterface::schema().
+ */
+ public function setupStorageDefinition($field_name, array $schema) {
+ $this->storageDefinitions[$field_name] = $this->getMock('Drupal\Core\Field\FieldStorageDefinitionInterface');
+ $this->storageDefinitions[$field_name]->expects($this->once())
+ ->method('getDescription')
+ ->will($this->returnValue("The $field_name field."));
+ $this->storageDefinitions[$field_name]->expects($this->exactly(1))
+ ->method('getSchema')
+ ->will($this->returnValue($schema));
+ }
+
+}
+