diff --git a/core/modules/taxonomy/taxonomy.post_update.php b/core/modules/taxonomy/taxonomy.post_update.php index 447a314222..6956915625 100644 --- a/core/modules/taxonomy/taxonomy.post_update.php +++ b/core/modules/taxonomy/taxonomy.post_update.php @@ -41,9 +41,8 @@ function taxonomy_post_update_add_unpublished_nodes_to_taxonomy_index(&$sandbox) if ($sandbox['total']) { // Operate on every unpublished node, in batches. $batch_size = Settings::get('entity_update_batch_size', 100); - $query = $database->select('node_field_data', 'n'); - $query - ->fields('n', ['nid']) + $query = $database->select('node_field_data', 'n'); + $query->fields('n', ['nid']) ->condition('n.nid', $sandbox['last'], '>') ->condition('n.status', NodeInterface::NOT_PUBLISHED) ->orderBy('n.nid', 'ASC') diff --git a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php index 159bcaabb3..f705c9517c 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php @@ -59,7 +59,7 @@ protected function setUp(): void { $handler_settings = [ 'target_bundles' => [ $this->vocabulary->id() => $this->vocabulary->id(), - ], + ], 'auto_create' => TRUE, ]; $this->createEntityReferenceField('node', 'article', $this->fieldName1, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); @@ -122,17 +122,17 @@ public function testTaxonomyIndex() { // Check that the node status is stored correctly. $node_status = (int) $connection->query('SELECT status FROM {taxonomy_index} WHERE nid = :nid AND tid = :tid', [ - ':nid' => $node->id(), - ':tid' => $term_1->id(), - ])->fetchField(); + ':nid' => $node->id(), + ':tid' => $term_1->id(), + ])->fetchField(); $this->assertEqual(1, $node_status, 'Term 1 is index once with the node status published.'); // Un publish the article, this should update the register. $node->setUnpublished()->save(); $node_status = (int) $connection->query('SELECT status FROM {taxonomy_index} WHERE nid = :nid AND tid = :tid', [ - ':nid' => $node->id(), - ':tid' => $term_1->id(), - ])->fetchField(); + ':nid' => $node->id(), + ':tid' => $term_1->id(), + ])->fetchField(); $this->assertEqual(0, $node_status, 'Term 1 is index once with the node status unpublished.'); // Update the article to change one term.