diff -u b/core/modules/search/lib/Drupal/search/Tests/SearchNodeUpdateAndDeletionTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchNodeUpdateAndDeletionTest.php --- b/core/modules/search/lib/Drupal/search/Tests/SearchNodeUpdateAndDeletionTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNodeUpdateAndDeletionTest.php @@ -22,7 +22,7 @@ public static function getInfo() { return array( - 'name' => 'Search and node updating / removal', + 'name' => 'Search index synchronization on node updating / removal', 'description' => 'Tests search index is updated properly when nodes are removed or updated.', 'group' => 'Search', ); @@ -91,24 +91,21 @@ $this->assertText($node->label()); // Get the node info from the search index tables. - if (db_query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", array(':word' => 'dragons'))->fetchField() === FALSE) { - $this->fail(t('No node info found on the search_index')); - } - // If there's no info on the search index, makes no sense to test if it's - // removed after removing the node, as that could lead to a false positive. - else { - // Delete the node. - $node->delete(); - - // Check if the node info is gone from the search table. - $search_index_dataset = db_query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", array(':word' => 'dragons'))->fetchField(); - $this->assertFalse($search_index_dataset, t('Node info successfully removed from search_index')); - - // Search again to verify the node doesn't appear anymore. - $this->drupalPostForm('search/node', $edit, t('Search')); - $this->assertNoText($node->label()); - } + $search_index_dataset = db_query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", array(':word' => 'dragons')) + ->fetchField(); + $this->assertNotEqual($search_index_dataset, FALSE, t('Node info found on the search_index')); + + // Delete the node. + $node->delete(); + + // Check if the node info is gone from the search table. + $search_index_dataset = db_query("SELECT sid FROM {search_index} WHERE type = 'node_search' AND word = :word", array(':word' => 'dragons')) + ->fetchField(); + $this->assertFalse($search_index_dataset, t('Node info successfully removed from search_index')); + // Search again to verify the node doesn't appear anymore. + $this->drupalPostForm('search/node', $edit, t('Search')); + $this->assertNoText($node->label()); } }