diff --git a/core/includes/common.inc b/core/includes/common.inc
index e4c9505..84cfa94 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1631,8 +1631,8 @@ function drupal_http_header_attributes(array $attributes = array()) {
  * This keeps the context of the link title ('settings' in the example) for
  * translators.
  *
- * @param string|array $text
- *   The link text for the anchor tag as a translated string or render array.
+ * @param string $text
+ *   The translated link text for the anchor tag.
  * @param string $path
  *   The internal path or external URL being linked to, such as "node/34" or
  *   "http://example.com/foo". After the url() function is called to construct
@@ -1665,9 +1665,10 @@ function drupal_http_header_attributes(array $attributes = array()) {
  * @see theme_link()
  */
 function l($text, $path, array $options = array()) {
-  // Start building a structured representation of our link to be altered later.
+  // Build a variables array to keep the structure of the alter consistent with
+  // theme_link().
   $variables = array(
-    'text' => is_array($text) ? drupal_render($text) : $text,
+    'text' => $text,
     'path' => $path,
     'options' => $options,
   );
diff --git a/core/includes/errors.inc b/core/includes/errors.inc
index 3fe23b7..f581599 100644
--- a/core/includes/errors.inc
+++ b/core/includes/errors.inc
@@ -136,9 +136,7 @@ function _drupal_decode_exception($exception) {
  *   An error message.
  */
 function _drupal_render_exception_safe($exception) {
-  $decode = _drupal_decode_exception($exception);
-  unset($decode['backtrace']);
-  return check_plain(strtr('%type: !message in %function (line %line of %file).', $decode));
+  return check_plain(strtr('%type: !message in %function (line %line of %file).', _drupal_decode_exception($exception)));
 }
 
 /**
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 395e314..9b95a47 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -266,6 +266,13 @@ function install_begin_request(&$install_state) {
   if (!$install_state['interactive']) {
     drupal_override_server_variables($install_state['server']);
   }
+  // The user agent header is used to pass a database prefix in the request when
+  // running tests. However, for security reasons, it is imperative that no
+  // installation be permitted using such a prefix.
+  elseif (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
+    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
+    exit;
+  }
 
   // Initialize conf_path().
   // This primes the site path to be used during installation. By not requiring
@@ -275,17 +282,6 @@ function install_begin_request(&$install_state) {
 
   drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
 
-  // If the hash salt leaks, it becomes possible to forge a valid testing user
-  // agent, install a new copy of Drupal, and take over the original site. To
-  // avoid this yet allow for automated testing of the installer, make sure
-  // there is also a special test-specific settings.php overriding conf_path().
-  // _drupal_load_test_overrides() sets the simpletest_conf_path in-memory
-  // setting in this case.
-  if ($install_state['interactive'] && drupal_valid_test_ua() && !settings()->get('simpletest_conf_path')) {
-    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
-    exit;
-  }
-
   // A request object from the HTTPFoundation to tell us about the request.
   $request = Request::createFromGlobals();
 
@@ -1083,12 +1079,6 @@ function install_settings_form($form, &$form_state, &$install_state) {
 function install_settings_form_validate($form, &$form_state) {
   $driver = $form_state['values']['driver'];
   $database = $form_state['values'][$driver];
-  // When testing the interactive installer, copy the database password and
-  // the test prefix.
-  if ($test_prefix = drupal_valid_test_ua()) {
-    $database['prefix'] = $test_prefix;
-    $database['password'] = $GLOBALS['databases']['default']['default']['password'];
-  }
   $drivers = drupal_get_database_types();
   $reflection = new \ReflectionClass($drivers[$driver]);
   $install_namespace = $reflection->getNamespaceName();
@@ -1096,11 +1086,9 @@ function install_settings_form_validate($form, &$form_state) {
   $database['namespace'] = substr($install_namespace, 0, strrpos($install_namespace, '\\'));
   $database['driver'] = $driver;
 
-  // @todo PIFR uses 'db_prefix' instead of 'prefix'. Remove this when it gets
-  //   fixed.
-  if (!$test_prefix) {
-    $database['prefix'] = $database['db_prefix'];
-  }
+  // TODO: remove when PIFR will be updated to use 'db_prefix' instead of
+  // 'prefix' in the database settings form.
+  $database['prefix'] = $database['db_prefix'];
   unset($database['db_prefix']);
 
   $form_state['storage']['database'] = $database;
@@ -1160,35 +1148,14 @@ function install_settings_form_submit($form, &$form_state) {
   global $install_state;
 
   // Update global settings array and save.
-  $settings = array();
-  $database = $form_state['storage']['database'];
-  // Ideally, there is no difference between the code executed by the
-  // automated test browser and an ordinary browser. However, the database
-  // settings need a different format and also need to skip the password
-  // when testing. The hash salt also needs to be skipped because the original
-  // salt is used to verify the validity of the automated test browser.
-  // Because of these, there's a little difference in the code following but
-  // it is small and self-contained.
-  if ($test_prefix = drupal_valid_test_ua()) {
-    foreach ($form_state['storage']['database'] as $k => $v) {
-      if ($k != 'password') {
-        $settings['databases']['default']['default'][$k] = (object) array(
-          'value'    => $v,
-          'required' => TRUE,
-        );
-      }
-    }
-  }
-  else {
-    $settings['databases']['default']['default'] = (object) array(
-      'value'    => $database,
-      'required' => TRUE,
-    );
-    $settings['drupal_hash_salt'] = (object) array(
-      'value'    => Crypt::randomStringHashed(55),
-      'required' => TRUE,
-    );
-  }
+  $settings['databases'] = (object) array(
+    'value' => array('default' => array('default' => $form_state['storage']['database'])),
+    'required' => TRUE,
+  );
+  $settings['drupal_hash_salt'] = (object) array(
+    'value' => Crypt::randomStringHashed(55),
+    'required' => TRUE,
+  );
 
   drupal_rewrite_settings($settings);
 
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 70cce1e..011db8d 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1673,12 +1673,14 @@ function theme_status_messages($variables) {
  *
  * @param $variables
  *   An associative array containing the keys 'text', 'path', and 'options'.
- *   See the l() function for information about these variables.
+ *   See the l() function for information about these variables. However, unlike
+ *   'text' in l(), both render arrays and strings are supported here.
  *
  * @see l()
  */
 function theme_link($variables) {
-  return l($variables['text'], $variables['path'], $variables['options']);
+  $rendered_text = is_array($variables['text']) ? drupal_render($variables['text']) : $variables['text'];
+  return l($rendered_text, $variables['path'], $variables['options']);
 }
 
 /**
diff --git a/core/lib/Drupal/Core/SystemListingInfo.php b/core/lib/Drupal/Core/SystemListingInfo.php
index 989b0f2..b2e42e1 100644
--- a/core/lib/Drupal/Core/SystemListingInfo.php
+++ b/core/lib/Drupal/Core/SystemListingInfo.php
@@ -28,7 +28,7 @@ protected function profiles($directory) {
     // For SimpleTest to be able to test modules packaged together with a
     // distribution we need to include the profile of the parent site (in
     // which test runs are triggered).
-    if (drupal_valid_test_ua() && !drupal_installation_attempted()) {
+    if (drupal_valid_test_ua()) {
       $testing_profile = config('simpletest.settings')->get('parent_profile');
       if ($testing_profile && $testing_profile != $profile) {
         $searchdir[] = drupal_get_path('profile', $testing_profile) . '/' . $directory;
diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc
index 10927bd..78df3fe 100644
--- a/core/modules/block/block.admin.inc
+++ b/core/modules/block/block.admin.inc
@@ -14,11 +14,8 @@
  * @see block_menu()
  */
 function block_admin_demo($theme = NULL) {
-  return array(
-    '#attached' => array(
-      'css' => array(drupal_get_path('module', 'block') . '/block.admin.css'),
-    ),
-  );
+  drupal_add_css(drupal_get_path('module', 'block') . '/block.admin.css');
+  return '';
 }
 
 /**
diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
index b13a4e7..f15c9a8 100644
--- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php
+++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
@@ -384,7 +384,7 @@ function testBookDelete() {
      foreach ($nodes as $node) {
        $nids[] = $node->nid;
      }
-     entity_delete_multiple('node', $nids);
+     node_delete_multiple($nids);
      $this->drupalPost('node/' . $this->book->nid . '/outline/remove', $edit, t('Remove'));
      $node = node_load($this->book->nid, TRUE);
      $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
index 315ab40..5523674 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
@@ -170,7 +170,7 @@ function setEnvironment(array $info) {
     variable_set('comment_anonymous_' . $this->node->type, $info['contact']);
     if ($this->node->comment != $info['comments']) {
       $this->node->comment = $info['comments'];
-      $this->node->save();
+      node_save($this->node);
     }
 
     // Change user settings.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
index 29d72d0..e932f68 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
@@ -27,7 +27,7 @@ function testNodeDeletion() {
     $this->drupalLogin($this->web_user);
     $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
     $this->assertTrue($comment->id(), 'The comment could be loaded.');
-    $this->node->delete();
+    node_delete($this->node->nid);
     $this->assertFalse(comment_load($comment->id()), 'The comment could not be loaded after the node was deleted.');
   }
 }
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
index f8af21b..86d256a 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
@@ -40,7 +40,7 @@ function testCommentRss() {
 
     // Hide comments from RSS feed and check presence.
     $this->node->comment = COMMENT_NODE_HIDDEN;
-    $this->node->save();
+    node_save($this->node);
     $this->drupalGet('rss.xml');
     $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
   }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index 359c6b3..50c8dbd 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -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.'));
 
     // Delete node and confirm that setting could be changed.
-    $node->delete();
+    node_delete($nid);
     $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.'));
   }
diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
index 2038b8d..b8dc6d9 100644
--- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php
+++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
@@ -46,12 +46,9 @@ public static function create(ContainerInterface $container) {
    *   An HTML string representing the contents of help page.
    */
   public function helpMain() {
-    $output = array(
-      '#attached' => array(
-        'css' => array(drupal_get_path('module', 'help') . '/help.css'),
-      ),
-      '#markup' => '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList(),
-    );
+    // Add CSS.
+    drupal_add_css(drupal_get_path('module', 'help') . '/help.css');
+    $output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList();
     return $output;
   }
 
diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index 9ed3aa9..e90fde8 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -11,9 +11,9 @@
 function image_style_list() {
   $page = array();
 
-  $styles = entity_load_multiple('image_style');
+  $image_style_list = array('#theme' => 'image_style_list', '#styles' => entity_load_multiple('image_style'));
   $page['image_style_list'] = array(
-    '#markup' => theme('image_style_list', array('styles' => $styles)),
+    '#markup' => drupal_render($image_style_list),
     '#attached' => array(
       'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array()),
     ),
@@ -42,10 +42,11 @@ function image_style_form($form, &$form_state, $style) {
   $form['#attached']['css'][drupal_get_path('module', 'image') . '/image.admin.css'] = array();
 
   // Show the thumbnail preview.
+  $image_style_preview = array('#theme' => 'image_style_preview', '#style' => $style);
   $form['preview'] = array(
     '#type' => 'item',
     '#title' => t('Preview'),
-    '#markup' => theme('image_style_preview', array('style' => $style)),
+    '#markup' => drupal_render($image_style_preview),
   );
 
   $form['label'] = array(
@@ -73,8 +74,9 @@ function image_style_form($form, &$form_state, $style) {
       $form['effects'][$key]['label'] = array(
         '#markup' => check_plain($effect['label']),
       );
+      $summary_theme = array('#theme' => $effect['summary theme'], '#data' => $effect['data']);
       $form['effects'][$key]['summary'] = array(
-        '#markup' => isset($effect['summary theme']) ? theme($effect['summary theme'], array('data' => $effect['data'])) : '',
+        '#markup' => isset($effect['summary theme']) ? drupal_render($summary_theme) : '',
       );
       $form['effects'][$key]['weight'] = array(
         '#type' => 'weight',
@@ -543,8 +545,8 @@ function theme_image_style_list($variables) {
       'data' => t('There are currently no styles. <a href="!url">Add a new one</a>.', array('!url' => url('admin/config/media/image-styles/add'))),
     ));
   }
-
-  return theme('table', array('header' => $header, 'rows' => $rows));
+  $table = array('#theme' => 'table','#header' => $header, 'rows' => $rows);
+  return drupal_render($table);
 }
 
 /**
@@ -595,9 +597,9 @@ function theme_image_style_effects($variables) {
     )));
   }
 
-  $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'image-style-effects')));
+  $output = array('#theme' => 'table','#header' => $header, 'rows' => $rows, '#attributes' => array('id' => 'image-style-effects'));
   drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight');
-  return $output;
+  return drupal_render($output);
 }
 
 /**
@@ -652,10 +654,11 @@ function theme_image_style_preview($variables) {
 
   // Build the preview of the original image.
   $original_url = file_create_url($original_path);
+  $image_build = array('#theme' => 'image', '#uri' => $original_path, '#alt' => t('Sample original image'), '#title' => '', '#attributes' => $original_attributes);
   $output .= '<div class="preview-image-wrapper">';
   $output .= t('original') . ' (' . l(t('view actual size'), $original_url) . ')';
   $output .= '<div class="preview-image original-image" style="' . $original_attributes['style'] . '">';
-  $output .= '<a href="' . $original_url . '">' . theme('image', array('uri' => $original_path, 'alt' => t('Sample original image'), 'title' => '', 'attributes' => $original_attributes)) . '</a>';
+  $output .= '<a href="' . $original_url . '">' . drupal_render($image_build) . '</a>';
   $output .= '<div class="height" style="height: ' . $original_height . 'px"><span>' . $original_image['height'] . 'px</span></div>';
   $output .= '<div class="width" style="width: ' . $original_width . 'px"><span>' . $original_image['width'] . 'px</span></div>';
   $output .= '</div>'; // End preview-image.
@@ -663,10 +666,11 @@ function theme_image_style_preview($variables) {
 
   // Build the preview of the image style.
   $preview_url = file_create_url($preview_file) . '?cache_bypass=' . REQUEST_TIME;
+  $image_style_build = array('#theme' => 'image', '#uri' => $preview_url, '#alt' => t('Sample modified image'), '#title' => '', '#attributes' => $preview_attributes);
   $output .= '<div class="preview-image-wrapper">';
   $output .= check_plain($style->label()) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
   $output .= '<div class="preview-image modified-image" style="' . $preview_attributes['style'] . '">';
-  $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', array('uri' => $preview_url, 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes)) . '</a>';
+  $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . drupal_render($image_style_build) . '</a>';
   $output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
   $output .= '<div class="width" style="width: ' . $preview_width . 'px"><span>' . $preview_image['width'] . 'px</span></div>';
   $output .= '</div>'; // End preview-image.
@@ -701,7 +705,8 @@ function theme_image_anchor($variables) {
     }
   }
 
-  return theme('table', array('header' => array(), 'rows' => $rows, 'attributes' => array('class' => array('image-anchor'))));
+  $table = array('#theme' => 'table' , '#header' => array(), '#rows' => $rows, '#attributes' => array('class' => array('image-anchor')));
+  return drupal_render($table);
 }
 
 /**
@@ -735,7 +740,8 @@ function theme_image_resize_summary($variables) {
  */
 function theme_image_scale_summary($variables) {
   $data = $variables['data'];
-  return theme('image_resize_summary', array('data' => $data)) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : '');
+  $image_resize_summary = array('#theme' => 'image_resize_summary', 'data' => $data);
+  return drupal_render($image_resize_summary) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : '');
 }
 
 /**
diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc
index a287620..506ea81 100644
--- a/core/modules/image/image.field.inc
+++ b/core/modules/image/image.field.inc
@@ -322,41 +322,42 @@ function image_field_widget_process($element, &$form_state, $form) {
   if (!empty($element['#files']) && $element['#preview_image_style']) {
     $file = reset($element['#files']);
     $variables = array(
-      'style_name' => $element['#preview_image_style'],
-      'uri' => $file->uri,
+      '#style_name' => $element['#preview_image_style'],
+      '#uri' => $file->uri,
+      '#theme' => 'image_style',
     );
 
     // Determine image dimensions.
     if (isset($element['#value']['width']) && isset($element['#value']['height'])) {
-      $variables['width'] = $element['#value']['width'];
-      $variables['height'] = $element['#value']['height'];
+      $variables['#width'] = $element['#value']['width'];
+      $variables['#height'] = $element['#value']['height'];
     }
     else {
       $info = image_get_info($file->uri);
 
       if (is_array($info)) {
-        $variables['width'] = $info['width'];
-        $variables['height'] = $info['height'];
+        $variables['#width'] = $info['width'];
+        $variables['#height'] = $info['height'];
       }
       else {
-        $variables['width'] = $variables['height'] = NULL;
+        $variables['#width'] = $variables['#height'] = NULL;
       }
     }
 
     $element['preview'] = array(
       '#type' => 'markup',
-      '#markup' => theme('image_style', $variables),
+      '#markup' => drupal_render($variables),
     );
 
     // Store the dimensions in the form so the file doesn't have to be accessed
     // again. This is important for remote files.
     $element['width'] = array(
       '#type' => 'hidden',
-      '#value' => $variables['width'],
+      '#value' => $variables['#width'],
     );
     $element['height'] = array(
       '#type' => 'hidden',
-      '#value' => $variables['height'],
+      '#value' => $variables['#height'],
     );
   }
 
diff --git a/core/modules/image/lib/Drupal/image/Plugin/field/widget/ImageWidget.php b/core/modules/image/lib/Drupal/image/Plugin/field/widget/ImageWidget.php
index 8062ff6..5bdf9ea 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/field/widget/ImageWidget.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/field/widget/ImageWidget.php
@@ -59,14 +59,20 @@ public function settingsForm(array $form, array &$form_state) {
   protected function formMultipleElements(EntityInterface $entity, array $items, $langcode, array &$form, array &$form_state) {
     $elements = parent::formMultipleElements($entity, $items, $langcode, $form, $form_state);
 
+    $file_upload_help = array(
+      '#theme' => 'file_upload_help',
+      '#upload_validators' => $elements[0]['#upload_validators'],
+      '#cardinality' => $this->field['cardinality'],
+    );
     if ($this->field['cardinality'] == 1) {
       // If there's only one field, return it as delta 0.
       if (empty($elements[0]['#default_value']['fids'])) {
-        $elements[0]['#description'] = theme('file_upload_help', array('description' => $this->instance['description'], 'upload_validators' => $elements[0]['#upload_validators'], 'cardinality' => $this->field['cardinality']));
+        $file_upload_help['#description'] = $this->instance['description'];
+        $elements[0]['#description'] = drupal_render($file_upload_help);
       }
     }
     else {
-      $elements['#file_upload_description'] = theme('file_upload_help', array('upload_validators' => $elements[0]['#upload_validators'], 'cardinality' => $this->field['cardinality']));
+      $elements['#file_upload_description'] = drupal_render($file_upload_help);
     }
 
     return $elements;
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index b679fb9..c393df6 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -60,11 +60,12 @@ function _testImageFieldFormatters($scheme) {
     // Test that the default formatter is being used.
     $image_uri = file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri;
     $image_info = array(
-      'uri' => $image_uri,
-      'width' => 40,
-      'height' => 20,
+      '#theme' => 'image',
+      '#uri' => $image_uri,
+      '#width' => 40,
+      '#height' => 20,
     );
-    $default_output = theme('image', $image_info);
+    $default_output = drupal_render($image_info);
     $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
 
     // Test the image linked to file formatter.
@@ -76,7 +77,7 @@ function _testImageFieldFormatters($scheme) {
     $display->setComponent($field_name, $display_options)
       ->save();
 
-    $default_output = l(theme('image', $image_info), file_create_url($image_uri), array('html' => TRUE));
+    $default_output = l(drupal_render($image_info), file_create_url($image_uri), array('html' => TRUE));
     $this->drupalGet('node/' . $nid);
     $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
     // Verify that the image can be downloaded.
@@ -100,7 +101,7 @@ function _testImageFieldFormatters($scheme) {
     $display_options['settings']['image_link'] = 'content';
     $display->setComponent($field_name, $display_options)
       ->save();
-    $default_output = l(theme('image', $image_info), 'node/' . $nid, array('html' => TRUE, 'attributes' => array('class' => 'active')));
+    $default_output = l(drupal_render($image_info), 'node/' . $nid, array('html' => TRUE, 'attributes' => array('class' => 'active')));
     $this->drupalGet('node/' . $nid);
     $this->assertRaw($default_output, 'Image linked to content formatter displaying correctly on full node view.');
 
@@ -113,11 +114,12 @@ function _testImageFieldFormatters($scheme) {
     // Ensure the derivative image is generated so we do not have to deal with
     // image style callback paths.
     $this->drupalGet(image_style_url('thumbnail', $image_uri));
-    $image_info['uri'] = $image_uri;
-    $image_info['width'] = 100;
-    $image_info['height'] = 50;
-    $image_info['style_name'] = 'thumbnail';
-    $default_output = theme('image_style', $image_info);
+    $image_info['#uri'] = $image_uri;
+    $image_info['#width'] = 100;
+    $image_info['#height'] = 50;
+    $image_info['#style_name'] = 'thumbnail';
+    $image_info['#theme'] = 'image_style';
+    $default_output = drupal_render($image_info);
     $this->drupalGet('node/' . $nid);
     $this->assertRaw($default_output, 'Image style thumbnail formatter displaying correctly on full node view.');
 
@@ -165,28 +167,30 @@ function testImageFieldSettings() {
     // style.
     $node = node_load($nid, TRUE);
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
-      'width' => 220,
-      'height' => 110,
-      'style_name' => 'medium',
+      '#uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
+      '#width' => 220,
+      '#height' => 110,
+      '#style_name' => 'medium',
+      '#theme' => 'image_style',
     );
-    $default_output = theme('image_style', $image_info);
+    $default_output = drupal_render($image_info);
     $this->assertRaw($default_output, "Preview image is displayed using 'medium' style.");
 
     // Add alt/title fields to the image and verify that they are displayed.
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
-      'alt' => $this->randomName(),
-      'title' => $this->randomName(),
-      'width' => 40,
-      'height' => 20,
+      '#uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
+      '#alt' => $this->randomName(),
+      '#title' => $this->randomName(),
+      '#width' => 40,
+      '#height' => 20,
+      '#theme' => 'image',
     );
     $edit = array(
-      $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][alt]' => $image_info['alt'],
-      $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][title]' => $image_info['title'],
+      $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][alt]' => $image_info['#alt'],
+      $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][title]' => $image_info['#title'],
     );
     $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published'));
-    $default_output = theme('image', $image_info);
+    $default_output = drupal_render($image_info);
     $this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.');
 
     // Verify that alt/title longer than allowed results in a validation error.
@@ -234,7 +238,8 @@ function testImageFieldDefaultImage() {
     $field = field_info_field($field_name);
     $image = file_load($field['settings']['default_image'][0]);
     $this->assertTrue($image->status == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
-    $default_output = theme('image', array('uri' => $image->uri));
+    $image_build = array('#theme' => 'image', '#uri' => $image->uri);
+    $default_output = drupal_render($image_build);
     $this->drupalGet('node/' . $node->nid);
     $this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
 
@@ -243,11 +248,12 @@ function testImageFieldDefaultImage() {
     $nid = $this->uploadNodeImage($images[1], $field_name, 'article');
     $node = node_load($nid, TRUE);
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
-      'width' => 40,
-      'height' => 20,
+      '#uri' => file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'])->uri,
+      '#width' => 40,
+      '#height' => 20,
+      '#theme' => 'image',
     );
-    $image_output = theme('image', $image_info);
+    $image_output = drupal_render($image_info);
     $this->drupalGet('node/' . $nid);
     $this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
     $this->assertRaw($image_output, 'User supplied image is displayed.');
@@ -280,7 +286,8 @@ function testImageFieldDefaultImage() {
     // Create a new node with no image attached and ensure that default private
     // image is displayed.
     $node = $this->drupalCreateNode(array('type' => 'article'));
-    $default_output = theme('image', array('uri' => $image->uri));
+    $image_build = array('#theme' => 'image', '#uri' => $image->uri);
+    $default_output = drupal_render($image_build);;
     $this->drupalGet('node/' . $node->nid);
     $this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.');
   }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
index e0db862..6898bc6 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
@@ -51,7 +51,7 @@ function setUp() {
         $revision = clone $nodes[$type];
         $revision->setNewRevision();
         $revision->log = $this->randomName(32);
-        $revision->save();
+        node_save($revision);
         $this->node_revisions[$type][] = $revision;
       }
     }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
index 640175a..9415b6b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
@@ -140,7 +140,7 @@ function testRevisions() {
     // Save this as a non-default revision.
     $new_node_revision->setNewRevision();
     $new_node_revision->isDefaultRevision = FALSE;
-    $new_node_revision->save();
+    node_save($new_node_revision);
 
     $this->drupalGet("node/$node->nid");
     $this->assertNoText($new_body, 'Revision body text is not present on default version of node.');
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index 39b54f1..69b6b0a 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -699,7 +699,7 @@ function node_multiple_delete_confirm($form, &$form_state, $nodes) {
  */
 function node_multiple_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
-    entity_delete_multiple('node', array_keys($form_state['values']['nodes']));
+    node_delete_multiple(array_keys($form_state['values']['nodes']));
     $count = count($form_state['values']['nodes']);
     watchdog('content', 'Deleted @count posts.', array('@count' => $count));
     drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index b458392..b6cd024 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -39,7 +39,7 @@
  * - Instantiating a new node:
  *   - hook_node_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()
  *   - hook_node_presave() (all)
  *   - hook_entity_presave() (all)
@@ -50,7 +50,7 @@
  *   - hook_entity_insert() (all)
  *   - hook_node_access_records() (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()
  *   - hook_node_presave() (all)
  *   - hook_entity_presave() (all)
@@ -89,7 +89,7 @@
  *   - hook_entity_view() (all)
  *   - hook_node_view_alter() (all)
  *   - hook_entity_view_alter() (all)
- * - Deleting a node (calling $node->delete() or entity_delete_multiple()):
+ * - Deleting a node (calling node_delete() or node_delete_multiple()):
  *   - Node is loaded (see Loading section above)
  *   - hook_delete() (node-type-specific)
  *   - hook_node_predelete() (all)
@@ -462,7 +462,7 @@ function hook_node_operations() {
 /**
  * Act before node deletion.
  *
- * This hook is invoked from entity_delete_multiple() after the type-specific
+ * This hook is invoked from node_delete_multiple() after the type-specific
  * hook_delete() has been invoked, but before hook_entity_predelete() and
  * field_attach_delete() are called, and before the node is removed from the
  * node table in the database.
@@ -471,7 +471,7 @@ function hook_node_operations() {
  *   The node that is about to be deleted.
  *
  * @see hook_node_predelete()
- * @see entity_delete_multiple()
+ * @see node_delete_multiple()
  * @ingroup node_api_hooks
  */
 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.
  *
- * This hook is invoked from entity_delete_multiple() after field_attach_delete()
+ * This hook is invoked from node_delete_multiple() after field_attach_delete()
  * has been called and after the node has been removed from the database.
  *
  * @param \Drupal\Core\Entity\EntityInterface $node
  *   The node that has been deleted.
  *
  * @see hook_node_predelete()
- * @see entity_delete_multiple()
+ * @see node_delete_multiple()
  * @ingroup node_api_hooks
  */
 function hook_node_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.
  *
- * 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
  * type-specific hook_insert() is invoked, and after field_attach_insert() is
  * called.
@@ -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
  * the database, because a database transaction is still in progress. The
  * 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
  * 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
  *   The node that is being created.
@@ -718,7 +718,7 @@ function hook_node_search_result(\Drupal\Core\Entity\EntityInterface $node, $lan
 /**
  * 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.
  *
  * @param \Drupal\Core\Entity\EntityInterface $node
@@ -738,7 +738,7 @@ function hook_node_presave(\Drupal\Core\Entity\EntityInterface $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
  * type-specific hook_update() is invoked, and after field_attach_update() is
  * called.
@@ -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
  * the database, because a database transaction is still in progress. The
  * 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
  * 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
  *   The node that is being updated.
@@ -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
  * (use hook_node_delete() to respond to all node deletions).
  *
- * This hook is invoked from entity_delete_multiple() after the node has been
+ * This hook is invoked from node_delete_multiple() after the node has been
  * removed from the node table in the database, before hook_node_delete() is
  * invoked, and before field_attach_delete() is called.
  *
@@ -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
  * (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
  * before hook_node_insert() is invoked.
  *
@@ -1259,7 +1259,7 @@ function hook_load($nodes) {
  * 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).
  *
- * 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
  * before hook_node_update() is invoked.
  *
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 1aebdd5..2cd835f 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -985,6 +985,40 @@ function node_submit(EntityInterface $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.
  *
  * @param $revision_id
@@ -1435,7 +1469,7 @@ function node_user_predelete($account) {
     ->condition('uid', $account->uid)
     ->execute()
     ->fetchCol();
-  entity_delete_multiple('node', $nodes);
+  node_delete_multiple($nodes);
   // Delete old revisions.
   $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
   foreach ($revisions as $revision) {
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index f2391be..9aa4982 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -224,7 +224,7 @@ function node_delete_confirm($form, &$form_state, $node) {
 function node_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
     $node = node_load($form_state['values']['nid']);
-    $node->delete();
+    node_delete($form_state['values']['nid']);
     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())));
   }
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index d726df5..f3fd04b 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -177,6 +177,6 @@ function node_test_node_insert(EntityInterface $node) {
   // Set the node title to the node ID and save.
   if ($node->title == 'new') {
     $node->title = 'Node '. $node->nid;
-    $node->save();
+    node_save($node);
   }
 }
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
index f28fb7c..3d54c81 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
@@ -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.');
 
     // Delete the node, remove the value.
-    $node->delete();
+    node_delete($node->nid);
     $string = "0|Zero";
     $array = array('0' => 'Zero');
     $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
@@ -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.');
 
     // Delete the node, remove the value.
-    $node->delete();
+    node_delete($node->nid);
     $string = "0|Zero";
     $array = array('0' => 'Zero');
     $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
@@ -200,7 +200,7 @@ function testOptionsAllowedValuesText() {
     $this->assertAllowedValuesInput("Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
 
     // Delete the node, remove the value.
-    $node->delete();
+    node_delete($node->nid);
     $string = "Zero";
     $array = array('Zero' => 'Zero');
     $this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
index 2548a4c..5ea6932 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
@@ -90,9 +90,9 @@ function testSearchCommentCountToggle() {
 
     // 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']->save();
+    node_save($this->searchable_nodes['0 comments']);
     $this->searchable_nodes['1 comment']->comment = COMMENT_NODE_CLOSED;
-    $this->searchable_nodes['1 comment']->save();
+    node_save($this->searchable_nodes['1 comment']);
 
     $this->drupalPost('', $edit, t('Search'));
     $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() {
 
     // 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']->save();
+    node_save($this->searchable_nodes['0 comments']);
     $this->searchable_nodes['1 comment']->comment = COMMENT_NODE_HIDDEN;
-    $this->searchable_nodes['1 comment']->save();
+    node_save($this->searchable_nodes['1 comment']);
 
     $this->drupalPost('', $edit, t('Search'));
     $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
index e85dcd6..f6c8646 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
@@ -188,7 +188,7 @@ function testHTMLRankings() {
       $this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "&lt;' . $tag . '&gt;" order.');
 
       // Delete node so it doesn't show up in subsequent search results.
-      $node->delete();
+      node_delete($node->nid);
     }
   }
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
index 7631016..a4641f6 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
@@ -64,9 +64,12 @@ function testInternalBrowser() {
       )));
       $this->assertNoTitle('Foo');
 
+      // Make sure that we are locked out of the installer when prefixing
+      // using the user-agent header. This is an important security check.
       global $base_url;
-      $this->drupalGet(url($base_url . '/core/install.php', array('external' => TRUE, 'absolute' => TRUE)));
-      $this->assertResponse(403, 'Cannot access install.php.');
+
+      $this->drupalGet($base_url . '/core/install.php', array('external' => TRUE));
+      $this->assertResponse(403, 'Cannot access install.php with a "simpletest" user-agent header.');
 
       $user = $this->drupalCreateUser();
       $this->drupalLogin($user);
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index a2bb55a..a75ade4 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -1385,9 +1385,9 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a
         $this->fail(t('Failed to set field @name to @value', array('@name' => $name, '@value' => $value)));
       }
       if (!$ajax && isset($submit)) {
-        $this->assertTrue($submit_matches, format_string('Found the @submit button', array('@submit' => $submit)));
+        $this->assertTrue($submit_matches, t('Found the @submit button', array('@submit' => $submit)));
       }
-      $this->fail(format_string('Found the requested form fields at @path', array('@path' => $path)));
+      $this->fail(t('Found the requested form fields at @path', array('@path' => $path)));
     }
   }
 
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
index b778c4f..37c5ffd 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
@@ -122,7 +122,7 @@ function testDeleteNode() {
       ->fetchAssoc();
     $this->assertEqual($result['nid'], $this->test_node->nid, 'Verifying that the node counter is incremented.');
 
-    $this->test_node->delete();
+    node_delete($this->test_node->nid);
 
     $result = db_select('node_counter', 'n')
       ->fields('n', array('nid'))
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
index a502e82..a241a31 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
@@ -134,17 +134,12 @@ function testLinkCustomClass() {
   }
 
   /**
-   * Tests that link functions support render arrays as 'text'.
+   * Tests that theme_link() supports render arrays in 'text' parameter.
    */
-  function testLinkRenderArrayText() {
+  function testLinkNestedRenderArrays() {
     // Build a link with l() for reference.
     $l = l('foo', 'http://drupal.org');
 
-    // Test a renderable array passed to l().
-    $renderable_text = array('#markup' => 'foo');
-    $l_renderable_text = l($renderable_text, 'http://drupal.org');
-    $this->assertEqual($l_renderable_text, $l);
-
     // Test a themed link with plain text 'text'.
     $theme_link_plain_array = array(
       '#theme' => 'link',
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 6b765af..da9db46 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -324,7 +324,7 @@ public function testNodeHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    $node->delete();
+    node_delete($node->nid);
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_node_predelete called',
diff --git a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php b/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
deleted file mode 100644
index 43824bf..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\InstallerTest.
- */
-
-namespace Drupal\system\Tests;
-
-use Drupal\Component\Utility\NestedArray;
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Allows testing of the interactive installer.
- */
-class InstallerTest extends WebTestBase {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Installer tests',
-      'description' => 'Tests the interactive installer.',
-      'group' => 'Installer',
-    );
-  }
-
-  protected function setUp() {
-    global $conf;
-
-    // When running tests through the SimpleTest UI (vs. on the command line),
-    // SimpleTest's batch conflicts with the installer's batch. Batch API does
-    // not support the concept of nested batches (in which the nested is not
-    // progressive), so we need to temporarily pretend there was no batch.
-    // Back up the currently running SimpleTest batch.
-    $this->originalBatch = batch_get();
-
-    // Create the database prefix for this test.
-    $this->prepareDatabasePrefix();
-
-    // Prepare the environment for running tests.
-    $this->prepareEnvironment();
-    if (!$this->setupEnvironment) {
-      return FALSE;
-    }
-
-    // Reset all statics and variables to perform tests in a clean environment.
-    $conf = array();
-    drupal_static_reset();
-
-    // Change the database prefix.
-    // All static variables need to be reset before the database prefix is
-    // changed, since \Drupal\Core\Utility\CacheArray implementations attempt to
-    // write back to persistent caches when they are destructed.
-    $this->changeDatabasePrefix();
-    if (!$this->setupDatabasePrefix) {
-      return FALSE;
-    }
-    $variable_groups = array(
-      'system.file' => array(
-        'path.private' =>  $this->private_files_directory,
-        'path.temporary' =>  $this->temp_files_directory,
-      ),
-      'locale.settings' =>  array(
-        'translation.path' => $this->translation_files_directory,
-      ),
-    );
-    foreach ($variable_groups as $config_base => $variables) {
-      foreach ($variables as $name => $value) {
-        NestedArray::setValue($GLOBALS['conf'], array_merge(array($config_base), explode('.', $name)), $value);
-      }
-    }
-    $settings['conf_path'] = (object) array(
-      'value' => $this->public_files_directory,
-      'required' => TRUE,
-    );
-    $settings['config_directories'] = (object) array(
-      'value' => array(),
-      'required' => TRUE,
-    );
-    $this->writeSettings($settings);
-
-    $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=minimal');
-    $this->drupalPost(NULL, array(), 'Save and continue');
-    // Reload config directories.
-    include $this->public_files_directory . '/settings.php';
-    $prefix = substr($this->public_files_directory, strlen(conf_path() . '/files/'));
-    foreach ($config_directories as $type => $data) {
-      $GLOBALS['config_directories'][$type]['path'] = $prefix . '/files/' . $data['path'];
-    }
-    $this->rebuildContainer();
-
-    foreach ($variable_groups as $config_base => $variables) {
-      $config = config($config_base);
-      foreach ($variables as $name => $value) {
-        $config->set($name, $value);
-      }
-      $config->save();
-    }
-
-    // Use the test mail class instead of the default mail handler class.
-    config('system.mail')->set('interface.default', 'Drupal\Core\Mail\VariableLog')->save();
-
-    drupal_set_time_limit($this->timeLimit);
-    // When running from run-tests.sh we don't get an empty current path which
-    // would indicate we're on the home page.
-    $path = current_path();
-    if (empty($path)) {
-      _current_path('run-tests');
-    }
-    $this->setup = TRUE;
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * During setup(), drupalPost calls refreshVariables() which tries to read
-   * variables which are not yet there because the child Drupal is not yet
-   * installed.
-   */
-  protected function refreshVariables() {
-    if (!empty($this->setup)) {
-      parent::refreshVariables();
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * This override is necessary because the parent drupalGet() calls t(), which
-   * is not available early during installation.
-   */
-  protected function drupalGet($path, array $options = array(), array $headers = array()) {
-    // We are re-using a CURL connection here. If that connection still has
-    // certain options set, it might change the GET into a POST. Make sure we
-    // clear out previous options.
-    $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => $this->getAbsoluteUrl($path), CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers));
-    $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
-
-    // Replace original page output with new output from redirected page(s).
-    if ($new = $this->checkForMetaRefresh()) {
-      $out = $new;
-    }
-    $this->verbose('GET request to: ' . $path .
-                   '<hr />Ending URL: ' . $this->getUrl() .
-                   '<hr />' . $out);
-    return $out;
-  }
-
-  /**
-   * Ensures that the user page is available after every test installation.
-   */
-  public function testInstaller() {
-    $this->drupalGet('user');
-    $this->assertResponse(200);
-  }
-
-}
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index c5a0be6..ce68fe9 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -14,7 +14,7 @@ function menu_test_menu() {
   // The name of the menu changes during the course of the test. Using a $_GET.
   $items['menu_name_test'] = array(
     'title' => 'Test menu_name router item',
-    'page callback' => 'menu_test_callback',
+    'page callback' => 'node_save',
     'menu_name' => menu_test_menu_name(),
   );
   // This item is of type MENU_CALLBACK with no parents to test title.
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index f1c2e01..c531daf 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -1188,7 +1188,7 @@ function taxonomy_build_node_index($node) {
   // only data for current, published nodes.
   $status = NULL;
   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.
     if (!empty($node->original)) {
       $status = (int)(!empty($node->status) || (!isset($node->status) && !empty($node->original->status)));
@@ -1207,7 +1207,7 @@ function taxonomy_build_node_index($node) {
       $field_name = $instance['field_name'];
       $field = field_info_field($field_name);
       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.
         if (isset($node->{$field_name})) {
           $items = $node->{$field_name};
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index aab8d9e..20883ad 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -78,7 +78,7 @@ function testTrackerAll() {
     $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.
-    $published->delete();
+    node_delete($published->nid);
     $this->drupalGet('tracker');
     $this->assertNoText($published->label(), 'Deleted node do not show up in the tracker listing.');
   }
diff --git a/core/scripts/generate-d6-content.sh b/core/scripts/generate-d6-content.sh
index 7a7e112..fc4c68f 100644
--- a/core/scripts/generate-d6-content.sh
+++ b/core/scripts/generate-d6-content.sh
@@ -131,7 +131,7 @@
   else {
     $node->taxonomy = $node_terms;
   }
-  $node->save();
+  node_save($node);
   path_set_alias("node/$node->nid", "content/$node->created");
   if ($node->revision) {
     $user = user_load($uid + 3);
@@ -140,7 +140,7 @@
     $node->body = str_repeat("node revision body ($node->type) - $i", 100);
     $node->log = "added $i revision";
     $node->taxonomy = $node_terms;
-    $node->save();
+    node_save($node);
   }
 }
 
@@ -171,7 +171,7 @@
   for ($c = 0; $c < $nbchoices; $c++) {
     $node->choice[] = array('chtext' => "Choice $c for poll $i");
   }
-  $node->save();
+  node_save($node);
   path_set_alias("node/$node->nid", "content/poll/$i");
   path_set_alias("node/$node->nid/results", "content/poll/$i/results");
 
@@ -202,5 +202,5 @@
 $node->promote = 0;
 $node->created = 1263769200;
 $node->log = "added $i node";
-$node->save();
+node_save($node);
 path_set_alias("node/$node->nid", "content/1263769200");
diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh
index bb81e5a..c171271 100644
--- a/core/scripts/generate-d7-content.sh
+++ b/core/scripts/generate-d7-content.sh
@@ -204,7 +204,7 @@
     $node->{$field_name}[LANGUAGE_NONE][] = array('tid' => $tid);
   }
   $node->path = array('alias' => "content/$node->created");
-  $node->save();
+  node_save($node);
   if ($node->revision) {
     $user = user_load($uid + 3);
     ++$revision_id;
@@ -220,7 +220,7 @@
       $field_name = $term_vocabs[$tid];
       $node->{$field_name}[LANGUAGE_NONE][] = array('tid' => $tid);
     }
-    $node->save();
+    node_save($node);
   }
 }
 
@@ -247,7 +247,7 @@
   for ($c = 0; $c < $nbchoices; $c++) {
     $node->choice[] = array('chtext' => "Choice $c for poll $i", 'chvotes' => 0, 'weight' => 0);
   }
-  $node->save();
+  node_save($node);
   $path = array(
     'alias' => "content/poll/$i/results",
     'source' => "node/$node->nid/results",
@@ -289,7 +289,7 @@
 $node->created = 1263769200;
 $node->log = "added a broken node";
 $node->path = array('alias' => "content/1263769200");
-$node->save();
+node_save($node);
 db_update('node')
   ->fields(array(
     'type' => $node_type,
