commit 3b4045174b90dd39b5881787b30a91b5c1ed0aa3 Author: Lee Rowlands Date: Wed Oct 31 21:33:02 2012 +1000 More work on test failures diff --git a/core/modules/comment/comment.field.inc b/core/modules/comment/comment.field.inc index fb24ab3..e801a10 100644 --- a/core/modules/comment/comment.field.inc +++ b/core/modules/comment/comment.field.inc @@ -232,7 +232,7 @@ function comment_field_formatter_view($entity_type, $entity, $field, $instance, $additions['comments'] = $build; } } - + // Append comment form if needed. if ($values['comment'] == COMMENT_ENTITY_OPEN && $comment_settings['comment_form_location'] == COMMENT_FORM_BELOW) { // Only show the add comment form if the user has permission and the diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index db550fa..55701d1 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -1,9 +1,12 @@ 'The entity_id to which this comment is a reply.', )); // Loop over defined node_types. - $node_types = array_keys(node_type_get_types()); + $node_types = array_keys(_update_7000_node_get_types()); foreach ($node_types as $node_type) { // Add a default comment field for existing node comments. $field = array( 'cardinality' => '1', // We need one per node type to match the existing bundles. - 'field_name' => 'comment_' . $node_type, + 'field_name' => 'comment_node_' . $node_type, 'module' => 'comment', 'settings' => array(), 'translatable' => '0', 'type' => 'comment', ); // Make sure field doesn't already exist. - if (!field_info_field('comment_' . $node_type)) { + if (!_update_7000_field_read_fields(array('field_name' => 'comment_node_' . $node_type))) { // Create the field. - field_create_field($field); + _update_7000_field_create_field($field); } // Add the comment field, setting the instance settings to match those for the // give node_type. @@ -519,7 +522,7 @@ function comment_update_8004(&$sandbox) { 'bundle' => $node_type, 'default_value' => array( 0 => array( - 'comment' => variable_get('comment_' . $node_type, COMMENT_ENTITY_HIDDEN), + 'comment' => variable_get('comment_' . $node_type, 0), ) ), 'deleted' => '0', @@ -550,18 +553,18 @@ function comment_update_8004(&$sandbox) { ), ), 'entity_type' => 'node', - 'field_name' => 'comment_' . $node_type, + 'field_name' => 'comment_node_' . $node_type, 'label' => 'Comment settings', 'required' => 1, 'settings' => array( 'comment' => array( - 'comment' => variable_get('comment_' . $node_type, COMMENT_ENTITY_HIDDEN), - 'comment_default_mode' => variable_get('comment_default_mode_' . $node_type, COMMENT_MODE_THREADED), + 'comment' => variable_get('comment_' . $node_type, 0), + 'comment_default_mode' => variable_get('comment_default_mode_' . $node_type, 1), 'comment_default_per_page' => variable_get('comment_default_per_page_' . $node_type, 50), - 'comment_anonymous' => variable_get('comment_anonymous_' . $node_type, COMMENT_ANONYMOUS_MAYNOT_CONTACT), + 'comment_anonymous' => variable_get('comment_anonymous_' . $node_type, 0), 'comment_subject_field' => variable_get('comment_subject_field_' . $node_type, 1), - 'comment_form_location' => variable_get('comment_form_location_' . $node_type, COMMENT_FORM_BELOW), - 'comment_preview' => variable_get('comment_preview_' . $node_type, DRUPAL_OPTIONAL) + 'comment_form_location' => variable_get('comment_form_location_' . $node_type, 1), + 'comment_preview' => variable_get('comment_preview_' . $node_type, 1) ) ), 'widget' => array( @@ -572,9 +575,8 @@ function comment_update_8004(&$sandbox) { 'weight' => '50', ), ); - field_create_instance($instance); + _update_7000_field_create_instance($field, $instance); // Rename the comment bundle for this node type. - field_attach_rename_bundle('comment', 'comment_node_' . $node_type, 'comment_' . $node_type); // Clean up old variables. variable_del('comment_' . $node_type); variable_del('comment_default_mode_' . $node_type); @@ -583,54 +585,76 @@ function comment_update_8004(&$sandbox) { variable_del('comment_subject_field_' . $node_type); variable_del('comment_form_location_' . $node_type); variable_del('comment_preview_' . $node_type); - } - return t('Updated comment module to field api.'); -} - -/** - * Write values for existing nodes. - */ -function comment_update_8005(&$sandbox) { - // Load each node in batch and initialize field values for comment field. - if (!isset($sandbox['progress'])) { - $sandbox['progress'] = 0; - $sandbox['current_nid'] = 0; - $sandbox['#finished'] = 1; - $sandbox['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField(); - } - - $nids = db_select('node', 'n') - ->fields('n', array('nid', 'comment')) - ->condition('nid', $sandbox['current_nid'], '>') - ->range(0, 50) - ->orderBy('nid', 'ASC') - ->execute() - ->fetchAllAssoc('nid'); - $nodes = node_load_multiple(array_keys($nids)); + // Set the initial values of comment fields for existing nodes. Note that + // contrib modules will need to handle the upgrade path on their own, as + // they are disabled during core upgrade. - foreach ($nodes as $node) { - // We use the value of comment to populate the field, defaulting to hidden. - $value = isset($nids[$node->nid]->comment) ? $nids[$node->nid]->comment : COMMENT_ENTITY_HIDDEN; - $node->{'comment_' . $node->type}[$node->langcode][] = array('comment' => $value); - $node->save(); - - $sandbox['progress']++; - $sandbox['current_nid'] = $node->nid; - } - - $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); - - if ($sandbox['#finished'] == 1) { // Node table will always exist up until here because in 7.x comment // depends on node. - // Remove the {node}.comment field. - db_drop_field('node', 'comment'); - // Remove the {node_revision}.comment field. - db_drop_field('node_revision', 'comment'); + $nodes = db_select('node', 'n') + ->fields('n', array('nid', 'comment', 'vid', 'langcode')) + ->condition('type', $node_type) + ->execute() + ->fetchAllAssoc('nid'); + + if (count($nodes) > 0) { + $insert = db_insert('field_data_comment_node_' . $node_type)-> + fields(array( + 'entity_type', + 'bundle', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_node_' . $node_type . '_comment', + )); + $revision = db_insert('field_revision_comment_node_' . $node_type)-> + fields(array( + 'entity_type', + 'bundle', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_node_' . $node_type . '_comment', + )); + + // Update the field name to match the node type. + db_update('comment')->fields( + array('field_name' => 'comment_node_' . $node_type) + )->condition('entity_id', array_keys($nodes)) + ->execute(); + foreach ($nodes as $nid => $node) { + $insert->values(array( + 'entity_type' => 'node', + 'bundle' => $node_type, + 'entity_id' => $nid, + 'revision_id' => $node->vid, + 'langcode' => $node->langcode, + 'delta' => 0, + 'comment_node_' . $node_type . '_comment' => $node->comment, + )); + $revision->values(array( + 'entity_type' => 'node', + 'bundle' => $node_type, + 'entity_id' => $nid, + 'revision_id' => $node->vid, + 'langcode' => $node->langcode, + 'delta' => 0, + 'comment_node_' . $node_type . '_comment' => $node->comment, + )); + } + $insert->execute(); + $revision->execute(); + } } - return t('Set initial value of comment field for existing nodes.'); + // Remove the {node}.comment field. + db_drop_field('node', 'comment'); + // Remove the {node_revision}.comment field. + db_drop_field('node_revision', 'comment'); + return t('Updated comment module to field api.'); } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 5e2f7a8..338e1d0 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -13,7 +13,6 @@ use Drupal\node\Plugin\Core\Entity\Node; use Drupal\file\Plugin\Core\Entity\File; use Drupal\Core\Entity\EntityInterface; -use Drupal\node\Node; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -934,7 +933,7 @@ function comment_prepare_thread(&$comments) { /** * Generates an array for rendering a comment. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object. * @param Drupal\Core\Entity\EntityInterface $entity * The entity the comment is attached to. @@ -954,7 +953,7 @@ function comment_view(Comment $comment, $view_mode = 'full', $langcode = NULL) { /** * Adds reply, edit, delete, etc. links, depending on user permissions. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object. * @param Drupal\Core\Entity\EntityInterface $entity * The entity the comment is attached to. @@ -1254,7 +1253,7 @@ function comment_user_predelete($account) { * @param $op * The operation that is to be performed on the comment. Only 'edit' is * recognized now. - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object. * * @return @@ -1271,7 +1270,7 @@ function comment_access($op, Comment $comment) { /** * Accepts a submission of new or changed comment content. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * A comment object. */ function comment_save(Comment $comment) { @@ -1461,7 +1460,7 @@ function comment_get_display_page($cid, $instance) { /** * Page callback: Displays the comment editing form. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object representing the comment to be edited. * * @see comment_menu() @@ -1474,7 +1473,7 @@ function comment_edit_page(Comment $comment) { /** * Generates a comment preview. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment */ function comment_preview(Comment $comment) { global $user; @@ -1779,7 +1778,7 @@ function comment_action_info() { /** * Publishes a comment. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * (optional) A comment object to publish. * @param array $context * Array with components: @@ -1806,7 +1805,7 @@ function comment_publish_action(Comment $comment = NULL, $context = array()) { /** * Unpublishes a comment. * - * @param Drupal\comment\Comment|null $comment + * @param Drupal\comment\Plugin\Core\Entity\comment|null $comment * (optional) A comment object to unpublish. * @param array $context * Array with components: @@ -1833,7 +1832,7 @@ function comment_unpublish_action(Comment $comment = NULL, $context = array()) { /** * Unpublishes a comment if it contains certain keywords. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * Comment object to modify. * @param array $context * Array with components: @@ -1885,7 +1884,7 @@ function comment_unpublish_by_keyword_action_submit($form, $form_state) { /** * Saves a comment. * - * @param Drupal\comment\Comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * * @ingroup actions */ @@ -2020,7 +2019,7 @@ function comment_get_comment_fields($entity_type = NULL) { return array_filter(field_info_fields(), function ($value) use($entity_type) { if ($value['type'] == 'comment') { if (isset($entity_type)) { - return in_array($entity_type, $value['bundles']); + return in_array($entity_type, array_keys($value['bundles'])); } return TRUE; } diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index f6e0b74..bc1641b 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -358,13 +358,13 @@ function comment_views_data() { if ($type == 'comment') { continue; } - if (comment_get_comment_fields($type) && isset($entity_info['base table'])) { + if (($fields = comment_get_comment_fields($type)) && isset($entity_info['base_table'])) { $data['comment'][$type] = array( 'relationship' => array( 'title' => $entity_info['label'], 'help' => t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_info['label'])), - 'base' => $entity_info['base table'], - 'base field' => $entity_info['entity keys']['id'], + 'base' => $entity_info['base_table'], + 'base field' => $entity_info['entity_keys']['id'], 'relationship field' => 'entity_id', 'id' => 'standard', 'label' => $entity_info['label'], @@ -372,6 +372,7 @@ function comment_views_data() { array( 'field' => 'entity_type', 'value' => 'node', + 'table' => 'comment' ), ), ), @@ -439,10 +440,10 @@ function comment_views_data() { continue; } // @todo As you can't have multiple joins this join doesn't use the field_name yet. - if (comment_get_comment_fields($type) && isset($entity_info['base table'])) { - $data['comment_entity_statistics']['table']['join'][$entity_info['base table']] = array( + if (comment_get_comment_fields($type) && isset($entity_info['base_table'])) { + $data['comment_entity_statistics']['table']['join'][$entity_info['base_table']] = array( 'type' => 'INNER', - 'left_field' => $entity_info['entity keys']['id'], + 'left_field' => $entity_info['entity_keys']['id'], 'field' => 'entity_id', 'extra' => array( array( @@ -594,11 +595,11 @@ function comment_views_data_alter(&$data) { // Provide a integration for each entity type. foreach (entity_get_info() as $entity_type => $entity_info) { - if (!isset($entity_info['base table'])) { + if (!isset($entity_info['base_table'])) { continue; } $fields = comment_get_comment_fields($entity_type); - $base_table = $entity_info['base table']; + $base_table = $entity_info['base_table']; $args = array('@entity_type' => $entity_type); if ($fields) { @@ -638,7 +639,7 @@ function comment_views_data_alter(&$data) { 'label' => t('Comments'), 'base' => 'comment', 'base field' => 'entity_id', - 'relationship field' => $entity_info['entity keys']['id'], + 'relationship field' => $entity_info['entity_keys']['id'], 'id' => 'standard', 'extra' => array( array( diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php index 09ad7e4..21c56f6 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php @@ -6,8 +6,7 @@ */ namespace Drupal\comment\Tests; - -use Drupal\comment\Comment; +use Drupal\comment\Plugin\Core\Entity\Comment; use Drupal\simpletest\WebTestBase; /** @@ -166,7 +165,7 @@ function postComment($account, $comment, $subject = '', $contact = NULL) { /** * Checks current page for specified comment. * - * @param Drupal\comment\Comment $comment + * @param use Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object. * @param boolean $reply * Boolean indicating whether the comment is a reply to another comment. diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index 3771f80..052cc9a 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -20,7 +20,7 @@ function forum_install() { drupal_load('module', 'comment'); // Add the comment field. field_info_cache_clear(); - comment_add_default_comment_field('node', 'forum', 'comment_forum', COMMENT_ENTITY_OPEN); + comment_add_default_comment_field('node', 'forum', 'comment_node_forum', COMMENT_ENTITY_OPEN); } /** @@ -129,7 +129,7 @@ function forum_uninstall() { // Delete comment field, load comment in case it has been disabled. drupal_load('module', 'comment'); // Remove the forum comment field. - field_delete_field('comment_forum'); + field_delete_field('comment_node_forum'); // Purge field data now to allow taxonomy and comment modules to be // uninstalled if these were the only fields remaining. We need to call diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 4e06a88..9dad7a1 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -813,7 +813,7 @@ function forum_forum_load($tid = NULL) { if (count($_forums)) { $query = db_select('node', 'n'); - $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_forum'"); + $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_node_forum'"); $query->join('forum', 'f', 'n.vid = f.vid'); $query->addExpression('COUNT(n.nid)', 'topic_count'); $query->addExpression('SUM(ces.comment_count)', 'comment_count'); @@ -845,7 +845,7 @@ function forum_forum_load($tid = NULL) { // Query "Last Post" information for this forum. $query = db_select('node', 'n'); $query->join('forum', 'f', 'n.vid = f.vid AND f.tid = :tid', array(':tid' => $forum->tid)); - $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_forum'"); + $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_node_forum'"); $query->join('users', 'u', 'ces.last_comment_uid = u.uid'); $query->addExpression('CASE ces.last_comment_uid WHEN 0 THEN ces.last_comment_name ELSE u.name END', 'last_comment_name'); @@ -968,7 +968,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { ->extend('Drupal\Core\Database\Query\TableSortExtender'); $query->fields('n', array('nid')); - $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_forum'"); + $query->join('comment_entity_statistics', 'ces', "n.nid = ces.entity_id AND ces.entity_type = 'node' AND ces.field_name = 'comment_node_forum'"); $query->fields('ces', array('cid', 'last_comment_uid', 'last_comment_timestamp', 'comment_count')); $query->join('forum_index', 'f', 'f.nid = ces.entity_id'); @@ -989,7 +989,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $result = array(); foreach ($query->execute() as $row) { $topic = $nodes[$row->nid]; - $topic->comment_mode = !empty($topic->comment_forum[LANGUAGE_NOT_SPECIFIED][0]['comment']) ? $topic->comment_forum[LANGUAGE_NOT_SPECIFIED][0]['comment'] : COMMENT_ENTITY_HIDDEN; + $topic->comment_mode = !empty($topic->comment_node_forum[LANGUAGE_NOT_SPECIFIED][0]['comment']) ? $topic->comment_node_forum[LANGUAGE_NOT_SPECIFIED][0]['comment'] : COMMENT_ENTITY_HIDDEN; foreach ($row as $key => $value) { $topic->{$key} = $value; @@ -1012,7 +1012,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { } else { $history = _forum_user_last_visit($topic->nid); - $topic->new_replies = comment_num_new('node', $topic->nid, 'comment_forum', $history); + $topic->new_replies = comment_num_new('node', $topic->nid, 'comment_node_forum', $history); $topic->new = $topic->new_replies || ($topic->last_comment_timestamp > $history); } } @@ -1238,7 +1238,7 @@ function template_preprocess_forum_topic_list(&$variables) { $variables['topics'][$id]->new_url = ''; if ($topic->new_replies) { $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new post in topic %title', '@count new posts in topic %title', array('%title' => $original_title)); - $variables['topics'][$id]->new_url = url("node/$topic->nid", array('query' => comment_new_page_count($topic->comment_count, $topic->new_replies, $topic, 'comment_forum'), 'fragment' => 'new')); + $variables['topics'][$id]->new_url = url("node/$topic->nid", array('query' => comment_new_page_count($topic->comment_count, $topic->new_replies, $topic, 'comment_node_forum'), 'fragment' => 'new')); } } @@ -1371,14 +1371,14 @@ function _forum_get_topic_order($sortby) { * The ID of the node to update. */ function _forum_update_forum_index($nid) { - $count = db_query("SELECT COUNT(cid) FROM {comment} c INNER JOIN {forum_index} i ON c.entity_id = i.nid AND c.entity_type = 'node' AND c.field_name = 'comment_forum' WHERE c.entity_id = :nid AND c.status = :status", array( + $count = db_query("SELECT COUNT(cid) FROM {comment} c INNER JOIN {forum_index} i ON c.entity_id = i.nid AND c.entity_type = 'node' AND c.field_name = 'comment_node_forum' WHERE c.entity_id = :nid AND c.status = :status", array( ':nid' => $nid, ':status' => COMMENT_PUBLISHED, ))->fetchField(); if ($count > 0) { // Comments exist. - $last_reply = db_query_range("SELECT cid, name, created, uid FROM {comment} WHERE entity_type = 'node' AND field_name = 'comment_forum' AND entity_id = :nid AND status = :status ORDER BY cid DESC", 0, 1, array( + $last_reply = db_query_range("SELECT cid, name, created, uid FROM {comment} WHERE entity_type = 'node' AND field_name = 'comment_node_forum' AND entity_id = :nid AND status = :status ORDER BY cid DESC", 0, 1, array( ':nid' => $nid, ':status' => COMMENT_PUBLISHED, ))->fetchObject(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php index 73f563b..2554b49 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php @@ -47,12 +47,16 @@ public function testLanguageUpgrade() { // Check that both comments display on the node. $this->drupalGet('node/50'); + $node = node_load(50); + debug($node); + debug(field_info_instance('node', 'comment_' . $node->type, $node->type)); $this->assertText('Node title 50', 'Node 50 displayed after update.'); $this->assertText('First test comment', 'Comment 1 displayed after update.'); $this->assertText('Reply to first test comment', 'Comment 2 displayed after update.'); // Directly check the comment language property on the first comment. $comment = db_query('SELECT * FROM {comment} WHERE cid = :cid', array(':cid' => 1))->fetchObject(); + debug($comment); $this->assertTrue($comment->langcode == 'und', 'Comment 1 language code found.'); // Ensure that the language switcher has been correctly upgraded. We need to diff --git a/core/modules/views/config/views.view.comments_recent.yml b/core/modules/views/config/views.view.comments_recent.yml index 4ef7638..edbb70b 100644 --- a/core/modules/views/config/views.view.comments_recent.yml +++ b/core/modules/views/config/views.view.comments_recent.yml @@ -32,9 +32,10 @@ display: items_per_page: 5 relationships: node: + field: node id: node + required: '1' table: comment - field: node fields: subject: id: subject diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php index eaa7833..cd798a0 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php @@ -72,7 +72,7 @@ public function setUp() { // Add a node of the new content type. $node_data = array( 'type' => $content_type->type, - 'comment_' . $content_type->type . "[$language_not_specified][0][comment]" => COMMENT_ENTITY_OPEN + "comment[$language_not_specified][0][comment]" => COMMENT_ENTITY_OPEN ); comment_add_default_comment_field('node', $content_type->type); @@ -85,10 +85,9 @@ public function setUp() { $comment = entity_create('comment', array()); $comment->uid = 0; $comment->entity_type = 'node'; - $comment->field_name = 'comment_'. $content_type->type; + $comment->field_name = 'comment'; $comment->entity_id = $this->node->nid; $comment->subject = 'Test comment ' . $i; - $comment->node_type = 'comment_node_' . $this->node->type; $comment->comment_body[LANGUAGE_NOT_SPECIFIED][0]['value'] = 'Test body ' . $i; $comment->comment_body[LANGUAGE_NOT_SPECIFIED][0]['format'] = 'full_html'; diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php index 5ee93f2..549162d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php @@ -61,6 +61,7 @@ public function testHandlers() { $view = views_new_view(); $view->base_table = $base_table; + debug('base table ' . $base_table); $view = new ViewExecutable($view); // @todo The groupwise relationship is currently broken. diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php index 9fb3fbc..eac0eee 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php @@ -92,6 +92,7 @@ public function testInitMethods() { * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). */ protected function getBasicView() { + comment_add_default_comment_field('node', 'page'); return $this->createViewFromConfig('test_destroy'); } diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml b/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml index cb22db4..1d14d56 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml @@ -47,7 +47,7 @@ display: group_type: group id: uid label: author - relationship: nid + relationship: node required: '0' table: node sorts: { } diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml b/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml index e53f8a5..263b7a4 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml @@ -15,12 +15,12 @@ display: comment_node: id: comment_node table: node - field: comment_node + field: comment_cid nid: id: nid table: comment field: node - relationship: comment_node + relationship: comment_cid display_plugin: default display_title: Master id: default diff --git a/core/update.php b/core/update.php index 968e8f4..1e43603 100644 --- a/core/update.php +++ b/core/update.php @@ -460,6 +460,7 @@ function update_check_requirements($skip_warnings = FALSE) { $container->register('router.builder', 'Drupal\Core\Routing\RouteBuilder') ->addArgument(new Reference('router.dumper')) ->addArgument(new Reference('lock')); +$container->register('plugin.manager.entity', 'Drupal\Core\Entity\EntityManager'); // Turn error reporting back on. From now on, only fatal errors (which are // not passed through the error handler) will cause a message to be printed.