Commit affc74cc authored by catch's avatar catch

Issue #1999322 by elvis2, alexander.ilivanov | Berdir: Remove node_save() and...

Issue #1999322 by elvis2, alexander.ilivanov | Berdir: Remove node_save() and node_delete()/node_delete_multiple() in favor of $node->save()/$node->delete().
parent a078c238
...@@ -384,7 +384,7 @@ function testBookDelete() { ...@@ -384,7 +384,7 @@ function testBookDelete() {
foreach ($nodes as $node) { foreach ($nodes as $node) {
$nids[] = $node->nid; $nids[] = $node->nid;
} }
node_delete_multiple($nids); entity_delete_multiple('node', $nids);
$this->drupalPost('node/' . $this->book->nid . '/outline/remove', $edit, t('Remove')); $this->drupalPost('node/' . $this->book->nid . '/outline/remove', $edit, t('Remove'));
$node = node_load($this->book->nid, TRUE); $node = node_load($this->book->nid, TRUE);
$this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.'); $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
......
...@@ -170,7 +170,7 @@ function setEnvironment(array $info) { ...@@ -170,7 +170,7 @@ function setEnvironment(array $info) {
variable_set('comment_anonymous_' . $this->node->type, $info['contact']); variable_set('comment_anonymous_' . $this->node->type, $info['contact']);
if ($this->node->comment != $info['comments']) { if ($this->node->comment != $info['comments']) {
$this->node->comment = $info['comments']; $this->node->comment = $info['comments'];
node_save($this->node); $this->node->save();
} }
// Change user settings. // Change user settings.
......
...@@ -27,7 +27,7 @@ function testNodeDeletion() { ...@@ -27,7 +27,7 @@ function testNodeDeletion() {
$this->drupalLogin($this->web_user); $this->drupalLogin($this->web_user);
$comment = $this->postComment($this->node, $this->randomName(), $this->randomName()); $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
$this->assertTrue($comment->id(), 'The comment could be loaded.'); $this->assertTrue($comment->id(), 'The comment could be loaded.');
node_delete($this->node->nid); $this->node->delete();
$this->assertFalse(comment_load($comment->id()), 'The comment could not be loaded after the node was deleted.'); $this->assertFalse(comment_load($comment->id()), 'The comment could not be loaded after the node was deleted.');
} }
} }
...@@ -40,7 +40,7 @@ function testCommentRss() { ...@@ -40,7 +40,7 @@ function testCommentRss() {
// Hide comments from RSS feed and check presence. // Hide comments from RSS feed and check presence.
$this->node->comment = COMMENT_NODE_HIDDEN; $this->node->comment = COMMENT_NODE_HIDDEN;
node_save($this->node); $this->node->save();
$this->drupalGet('rss.xml'); $this->drupalGet('rss.xml');
$this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.'); $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
} }
......
...@@ -229,7 +229,7 @@ function testPrivateFileSetting() { ...@@ -229,7 +229,7 @@ function testPrivateFileSetting() {
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.')); $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.'));
// Delete node and confirm that setting could be changed. // Delete node and confirm that setting could be changed.
node_delete($nid); $node->delete();
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field"); $this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field");
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.')); $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.'));
} }
......
...@@ -51,7 +51,7 @@ function setUp() { ...@@ -51,7 +51,7 @@ function setUp() {
$revision = clone $nodes[$type]; $revision = clone $nodes[$type];
$revision->setNewRevision(); $revision->setNewRevision();
$revision->log = $this->randomName(32); $revision->log = $this->randomName(32);
node_save($revision); $revision->save();
$this->node_revisions[$type][] = $revision; $this->node_revisions[$type][] = $revision;
} }
} }
......
...@@ -140,7 +140,7 @@ function testRevisions() { ...@@ -140,7 +140,7 @@ function testRevisions() {
// Save this as a non-default revision. // Save this as a non-default revision.
$new_node_revision->setNewRevision(); $new_node_revision->setNewRevision();
$new_node_revision->isDefaultRevision = FALSE; $new_node_revision->isDefaultRevision = FALSE;
node_save($new_node_revision); $new_node_revision->save();
$this->drupalGet("node/$node->nid"); $this->drupalGet("node/$node->nid");
$this->assertNoText($new_body, 'Revision body text is not present on default version of node.'); $this->assertNoText($new_body, 'Revision body text is not present on default version of node.');
......
...@@ -699,7 +699,7 @@ function node_multiple_delete_confirm($form, &$form_state, $nodes) { ...@@ -699,7 +699,7 @@ function node_multiple_delete_confirm($form, &$form_state, $nodes) {
*/ */
function node_multiple_delete_confirm_submit($form, &$form_state) { function node_multiple_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) { if ($form_state['values']['confirm']) {
node_delete_multiple(array_keys($form_state['values']['nodes'])); entity_delete_multiple('node', array_keys($form_state['values']['nodes']));
$count = count($form_state['values']['nodes']); $count = count($form_state['values']['nodes']);
watchdog('content', 'Deleted @count posts.', array('@count' => $count)); watchdog('content', 'Deleted @count posts.', array('@count' => $count));
drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.')); drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
* - Instantiating a new node: * - Instantiating a new node:
* - hook_node_create() (all) * - hook_node_create() (all)
* - hook_entity_create() (all) * - hook_entity_create() (all)
* - Creating a new node (calling node_save() on a new node): * - Creating a new node (calling $node->save() on a new node):
* - field_attach_presave() * - field_attach_presave()
* - hook_node_presave() (all) * - hook_node_presave() (all)
* - hook_entity_presave() (all) * - hook_entity_presave() (all)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* - hook_entity_insert() (all) * - hook_entity_insert() (all)
* - hook_node_access_records() (all) * - hook_node_access_records() (all)
* - hook_node_access_records_alter() (all) * - hook_node_access_records_alter() (all)
* - Updating an existing node (calling node_save() on an existing node): * - Updating an existing node (calling $node->save() on an existing node):
* - field_attach_presave() * - field_attach_presave()
* - hook_node_presave() (all) * - hook_node_presave() (all)
* - hook_entity_presave() (all) * - hook_entity_presave() (all)
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
* - hook_entity_view() (all) * - hook_entity_view() (all)
* - hook_node_view_alter() (all) * - hook_node_view_alter() (all)
* - hook_entity_view_alter() (all) * - hook_entity_view_alter() (all)
* - Deleting a node (calling node_delete() or node_delete_multiple()): * - Deleting a node (calling $node->delete() or entity_delete_multiple()):
* - Node is loaded (see Loading section above) * - Node is loaded (see Loading section above)
* - hook_delete() (node-type-specific) * - hook_delete() (node-type-specific)
* - hook_node_predelete() (all) * - hook_node_predelete() (all)
...@@ -462,7 +462,7 @@ function hook_node_operations() { ...@@ -462,7 +462,7 @@ function hook_node_operations() {
/** /**
* Act before node deletion. * Act before node deletion.
* *
* This hook is invoked from node_delete_multiple() after the type-specific * This hook is invoked from entity_delete_multiple() after the type-specific
* hook_delete() has been invoked, but before hook_entity_predelete() and * hook_delete() has been invoked, but before hook_entity_predelete() and
* field_attach_delete() are called, and before the node is removed from the * field_attach_delete() are called, and before the node is removed from the
* node table in the database. * node table in the database.
...@@ -471,7 +471,7 @@ function hook_node_operations() { ...@@ -471,7 +471,7 @@ function hook_node_operations() {
* The node that is about to be deleted. * The node that is about to be deleted.
* *
* @see hook_node_predelete() * @see hook_node_predelete()
* @see node_delete_multiple() * @see entity_delete_multiple()
* @ingroup node_api_hooks * @ingroup node_api_hooks
*/ */
function hook_node_predelete(\Drupal\Core\Entity\EntityInterface $node) { function hook_node_predelete(\Drupal\Core\Entity\EntityInterface $node) {
...@@ -483,14 +483,14 @@ function hook_node_predelete(\Drupal\Core\Entity\EntityInterface $node) { ...@@ -483,14 +483,14 @@ function hook_node_predelete(\Drupal\Core\Entity\EntityInterface $node) {
/** /**
* Respond to node deletion. * Respond to node deletion.
* *
* This hook is invoked from node_delete_multiple() after field_attach_delete() * This hook is invoked from entity_delete_multiple() after field_attach_delete()
* has been called and after the node has been removed from the database. * has been called and after the node has been removed from the database.
* *
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
* The node that has been deleted. * The node that has been deleted.
* *
* @see hook_node_predelete() * @see hook_node_predelete()
* @see node_delete_multiple() * @see entity_delete_multiple()
* @ingroup node_api_hooks * @ingroup node_api_hooks
*/ */
function hook_node_delete(\Drupal\Core\Entity\EntityInterface $node) { function hook_node_delete(\Drupal\Core\Entity\EntityInterface $node) {
...@@ -518,7 +518,7 @@ function hook_node_revision_delete(\Drupal\Core\Entity\EntityInterface $node) { ...@@ -518,7 +518,7 @@ function hook_node_revision_delete(\Drupal\Core\Entity\EntityInterface $node) {
/** /**
* Respond to creation of a new node. * Respond to creation of a new node.
* *
* This hook is invoked from node_save() after the database query that will * This hook is invoked from $node->save() after the database query that will
* insert the node into the node table is scheduled for execution, after the * insert the node into the node table is scheduled for execution, after the
* type-specific hook_insert() is invoked, and after field_attach_insert() is * type-specific hook_insert() is invoked, and after field_attach_insert() is
* called. * called.
...@@ -526,10 +526,10 @@ function hook_node_revision_delete(\Drupal\Core\Entity\EntityInterface $node) { ...@@ -526,10 +526,10 @@ function hook_node_revision_delete(\Drupal\Core\Entity\EntityInterface $node) {
* Note that when this hook is invoked, the changes have not yet been written to * Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The * the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed * transaction is not finalized until the save operation is entirely completed
* and node_save() goes out of scope. You should not rely on data in the * and $node->save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any * database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed * write/update database queries executed from this hook are also not committed
* immediately. Check node_save() and db_transaction() for more info. * immediately. Check $node->save() and db_transaction() for more info.
* *
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
* The node that is being created. * The node that is being created.
...@@ -718,7 +718,7 @@ function hook_node_search_result(\Drupal\Core\Entity\EntityInterface $node, $lan ...@@ -718,7 +718,7 @@ function hook_node_search_result(\Drupal\Core\Entity\EntityInterface $node, $lan
/** /**
* Act on a node being inserted or updated. * Act on a node being inserted or updated.
* *
* This hook is invoked from node_save() before the node is saved to the * This hook is invoked from $node->save() before the node is saved to the
* database. * database.
* *
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
...@@ -738,7 +738,7 @@ function hook_node_presave(\Drupal\Core\Entity\EntityInterface $node) { ...@@ -738,7 +738,7 @@ function hook_node_presave(\Drupal\Core\Entity\EntityInterface $node) {
/** /**
* Respond to updates to a node. * Respond to updates to a node.
* *
* This hook is invoked from node_save() after the database query that will * This hook is invoked from $node->save() after the database query that will
* update node in the node table is scheduled for execution, after the * update node in the node table is scheduled for execution, after the
* type-specific hook_update() is invoked, and after field_attach_update() is * type-specific hook_update() is invoked, and after field_attach_update() is
* called. * called.
...@@ -746,10 +746,10 @@ function hook_node_presave(\Drupal\Core\Entity\EntityInterface $node) { ...@@ -746,10 +746,10 @@ function hook_node_presave(\Drupal\Core\Entity\EntityInterface $node) {
* Note that when this hook is invoked, the changes have not yet been written to * Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The * the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed * transaction is not finalized until the save operation is entirely completed
* and node_save() goes out of scope. You should not rely on data in the * and $node->save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any * database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed * write/update database queries executed from this hook are also not committed
* immediately. Check node_save() and db_transaction() for more info. * immediately. Check $node->save() and db_transaction() for more info.
* *
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
* The node that is being updated. * The node that is being updated.
...@@ -1092,7 +1092,7 @@ function hook_node_type_delete($info) { ...@@ -1092,7 +1092,7 @@ function hook_node_type_delete($info) {
* This hook is invoked only on the module that defines the node's content type * This hook is invoked only on the module that defines the node's content type
* (use hook_node_delete() to respond to all node deletions). * (use hook_node_delete() to respond to all node deletions).
* *
* This hook is invoked from node_delete_multiple() after the node has been * This hook is invoked from entity_delete_multiple() after the node has been
* removed from the node table in the database, before hook_node_delete() is * removed from the node table in the database, before hook_node_delete() is
* invoked, and before field_attach_delete() is called. * invoked, and before field_attach_delete() is called.
* *
...@@ -1200,7 +1200,7 @@ function hook_form(\Drupal\Core\Entity\EntityInterface $node, &$form_state) { ...@@ -1200,7 +1200,7 @@ function hook_form(\Drupal\Core\Entity\EntityInterface $node, &$form_state) {
* This hook is invoked only on the module that defines the node's content type * This hook is invoked only on the module that defines the node's content type
* (use hook_node_insert() to act on all node insertions). * (use hook_node_insert() to act on all node insertions).
* *
* This hook is invoked from node_save() after the node is inserted into the * This hook is invoked from $node->save() after the node is inserted into the
* node table in the database, before field_attach_insert() is called, and * node table in the database, before field_attach_insert() is called, and
* before hook_node_insert() is invoked. * before hook_node_insert() is invoked.
* *
...@@ -1259,7 +1259,7 @@ function hook_load($nodes) { ...@@ -1259,7 +1259,7 @@ function hook_load($nodes) {
* This hook is invoked only on the module that defines the node's content type * This hook is invoked only on the module that defines the node's content type
* (use hook_node_update() to act on all node updates). * (use hook_node_update() to act on all node updates).
* *
* This hook is invoked from node_save() after the node is updated in the * This hook is invoked from $node->save() after the node is updated in the
* node table in the database, before field_attach_update() is called, and * node table in the database, before field_attach_update() is called, and
* before hook_node_update() is invoked. * before hook_node_update() is invoked.
* *
......
...@@ -984,40 +984,6 @@ function node_submit(EntityInterface $node) { ...@@ -984,40 +984,6 @@ function node_submit(EntityInterface $node) {
return $node; return $node;
} }
/**
* Saves changes to a node or adds a new node.
*
* @param \Drupal\Core\Entity\EntityInterface $node
* The $node entity to be saved. If $node->nid is
* omitted (or $node->is_new is TRUE), a new node will be added.
*/
function node_save(EntityInterface $node) {
$node->save();
}
/**
* Deletes a node.
*
* @param $nid
* A node ID.
*/
function node_delete($nid) {
node_delete_multiple(array($nid));
}
/**
* Deletes multiple nodes.
*
* @param $nids
* An array of node IDs.
*
* @see hook_node_predelete()
* @see hook_node_delete()
*/
function node_delete_multiple($nids) {
entity_delete_multiple('node', $nids);
}
/** /**
* Deletes a node revision. * Deletes a node revision.
* *
...@@ -1469,7 +1435,7 @@ function node_user_predelete($account) { ...@@ -1469,7 +1435,7 @@ function node_user_predelete($account) {
->condition('uid', $account->uid) ->condition('uid', $account->uid)
->execute() ->execute()
->fetchCol(); ->fetchCol();
node_delete_multiple($nodes); entity_delete_multiple('node', $nodes);
// Delete old revisions. // Delete old revisions.
$revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol(); $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
foreach ($revisions as $revision) { foreach ($revisions as $revision) {
......
...@@ -224,7 +224,7 @@ function node_delete_confirm($form, &$form_state, $node) { ...@@ -224,7 +224,7 @@ function node_delete_confirm($form, &$form_state, $node) {
function node_delete_confirm_submit($form, &$form_state) { function node_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) { if ($form_state['values']['confirm']) {
$node = node_load($form_state['values']['nid']); $node = node_load($form_state['values']['nid']);
node_delete($form_state['values']['nid']); $node->delete();
watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->label())); watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->label()));
drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_type_label($node), '%title' => $node->label()))); drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_type_label($node), '%title' => $node->label())));
} }
......
...@@ -177,6 +177,6 @@ function node_test_node_insert(EntityInterface $node) { ...@@ -177,6 +177,6 @@ function node_test_node_insert(EntityInterface $node) {
// Set the node title to the node ID and save. // Set the node title to the node ID and save.
if ($node->title == 'new') { if ($node->title == 'new') {
$node->title = 'Node '. $node->nid; $node->title = 'Node '. $node->nid;
node_save($node); $node->save();
} }
} }
...@@ -95,7 +95,7 @@ function testOptionsAllowedValuesInteger() { ...@@ -95,7 +95,7 @@ function testOptionsAllowedValuesInteger() {
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.'); $this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
// Delete the node, remove the value. // Delete the node, remove the value.
node_delete($node->nid); $node->delete();
$string = "0|Zero"; $string = "0|Zero";
$array = array('0' => 'Zero'); $array = array('0' => 'Zero');
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.'); $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
...@@ -145,7 +145,7 @@ function testOptionsAllowedValuesFloat() { ...@@ -145,7 +145,7 @@ function testOptionsAllowedValuesFloat() {
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.'); $this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
// Delete the node, remove the value. // Delete the node, remove the value.
node_delete($node->nid); $node->delete();
$string = "0|Zero"; $string = "0|Zero";
$array = array('0' => 'Zero'); $array = array('0' => 'Zero');
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.'); $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
...@@ -200,7 +200,7 @@ function testOptionsAllowedValuesText() { ...@@ -200,7 +200,7 @@ function testOptionsAllowedValuesText() {
$this->assertAllowedValuesInput("Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.'); $this->assertAllowedValuesInput("Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
// Delete the node, remove the value. // Delete the node, remove the value.
node_delete($node->nid); $node->delete();
$string = "Zero"; $string = "Zero";
$array = array('Zero' => 'Zero'); $array = array('Zero' => 'Zero');
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.'); $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
......
...@@ -90,9 +90,9 @@ function testSearchCommentCountToggle() { ...@@ -90,9 +90,9 @@ function testSearchCommentCountToggle() {
// Test comment count display for nodes with comment status set to Closed // Test comment count display for nodes with comment status set to Closed
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_CLOSED; $this->searchable_nodes['0 comments']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['0 comments']->save();
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_CLOSED; $this->searchable_nodes['1 comment']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['1 comment']); $this->searchable_nodes['1 comment']->save();
$this->drupalPost('', $edit, t('Search')); $this->drupalPost('', $edit, t('Search'));
$this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed'); $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed');
...@@ -100,9 +100,9 @@ function testSearchCommentCountToggle() { ...@@ -100,9 +100,9 @@ function testSearchCommentCountToggle() {
// Test comment count display for nodes with comment status set to Hidden // Test comment count display for nodes with comment status set to Hidden
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_HIDDEN; $this->searchable_nodes['0 comments']->comment = COMMENT_NODE_HIDDEN;
node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['0 comments']->save();
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_HIDDEN; $this->searchable_nodes['1 comment']->comment = COMMENT_NODE_HIDDEN;
node_save($this->searchable_nodes['1 comment']); $this->searchable_nodes['1 comment']->save();
$this->drupalPost('', $edit, t('Search')); $this->drupalPost('', $edit, t('Search'));
$this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden'); $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
......
...@@ -188,7 +188,7 @@ function testHTMLRankings() { ...@@ -188,7 +188,7 @@ function testHTMLRankings() {
$this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "<' . $tag . '>" order.'); $this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "<' . $tag . '>" order.');
// Delete node so it doesn't show up in subsequent search results. // Delete node so it doesn't show up in subsequent search results.
node_delete($node->nid); $node->delete();
} }
} }
......
...@@ -122,7 +122,7 @@ function testDeleteNode() { ...@@ -122,7 +122,7 @@ function testDeleteNode() {
->fetchAssoc(); ->fetchAssoc();
$this->assertEqual($result['nid'], $this->test_node->nid, 'Verifying that the node counter is incremented.'); $this->assertEqual($result['nid'], $this->test_node->nid, 'Verifying that the node counter is incremented.');
node_delete($this->test_node->nid); $this->test_node->delete();
$result = db_select('node_counter', 'n') $result = db_select('node_counter', 'n')
->fields('n', array('nid')) ->fields('n', array('nid'))
......
...@@ -324,7 +324,7 @@ public function testNodeHooks() { ...@@ -324,7 +324,7 @@ public function testNodeHooks() {
)); ));
$_SESSION['entity_crud_hook_test'] = array(); $_SESSION['entity_crud_hook_test'] = array();
node_delete($node->nid); $node->delete();
$this->assertHookMessageOrder(array( $this->assertHookMessageOrder(array(
'entity_crud_hook_test_node_predelete called', 'entity_crud_hook_test_node_predelete called',
......
...@@ -14,7 +14,7 @@ function menu_test_menu() { ...@@ -14,7 +14,7 @@ function menu_test_menu() {
// The name of the menu changes during the course of the test. Using a $_GET. // The name of the menu changes during the course of the test. Using a $_GET.
$items['menu_name_test'] = array( $items['menu_name_test'] = array(
'title' => 'Test menu_name router item', 'title' => 'Test menu_name router item',
'page callback' => 'node_save', 'page callback' => 'menu_test_callback',
'menu_name' => menu_test_menu_name(), 'menu_name' => menu_test_menu_name(),
); );
// This item is of type MENU_CALLBACK with no parents to test title. // This item is of type MENU_CALLBACK with no parents to test title.
......
...@@ -1188,7 +1188,7 @@ function taxonomy_build_node_index($node) { ...@@ -1188,7 +1188,7 @@ function taxonomy_build_node_index($node) {
// only data for current, published nodes. // only data for current, published nodes.
$status = NULL; $status = NULL;
if (config('taxonomy.settings')->get('maintain_index_table')) { if (config('taxonomy.settings')->get('maintain_index_table')) {
// If a node property is not set in the node object when node_save() is // If a node property is not set in the node object when $node->save() is
// called, the old value from $node->original is used. // called, the old value from $node->original is used.
if (!empty($node->original)) { if (!empty($node->original)) {
$status = (int)(!empty($node->status) || (!isset($node->status) && !empty($node->original->status))); $status = (int)(!empty($node->status) || (!isset($node->status) && !empty($node->original->status)));
...@@ -1207,7 +1207,7 @@ function taxonomy_build_node_index($node) { ...@@ -1207,7 +1207,7 @@ function taxonomy_build_node_index($node) {
$field_name = $instance['field_name']; $field_name = $instance['field_name'];
$field = field_info_field($field_name); $field = field_info_field($field_name);
if ($field['module'] == 'taxonomy' && $field['storage']['type'] == 'field_sql_storage') { if ($field['module'] == 'taxonomy' && $field['storage']['type'] == 'field_sql_storage') {
// If a field value is not set in the node object when node_save() is // If a field value is not set in the node object when $node->save() is
// called, the old value from $node->original is used. // called, the old value from $node->original is used.
if (isset($node->{$field_name})) { if (isset($node->{$field_name})) {
$items = $node->{$field_name}; $items = $node->{$field_name};
......
...@@ -78,7 +78,7 @@ function testTrackerAll() { ...@@ -78,7 +78,7 @@ function testTrackerAll() {
$this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.'); $this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
// Delete a node and ensure it no longer appears on the tracker. // Delete a node and ensure it no longer appears on the tracker.
node_delete($published->nid); $published->delete();
$this->drupalGet('tracker'); $this->drupalGet('tracker');
$this->assertNoText($published->label(), 'Deleted node do not show up in the tracker listing.'); $this->assertNoText($published->label(), 'Deleted node do not show up in the tracker listing.');
} }
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
else { else {
$node->taxonomy = $node_terms; $node->taxonomy = $node_terms;
} }
node_save($node); $node->save();
path_set_alias("node/$node->nid", "content/$node->created"); path_set_alias("node/$node->nid", "content/$node->created");
if ($node->revision) { if ($node->revision) {
$user = user_load($uid + 3); $user = user_load($uid + 3);
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
$node->body = str_repeat("node revision body ($node->type) - $i", 100); $node->body = str_repeat("node revision body ($node->type) - $i", 100);