diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php
new file mode 100644
index 0000000..7fe7e3a
--- /dev/null
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\block\Tests\BlockRenderOrderTest.
+ */
+
+namespace Drupal\block\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests block HTML ID validity.
+ */
+class BlockRenderOrderTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('block', 'block_test', 'search');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Block Render Order',
+      'description' => 'Test blocks are being rendered in order by weight.',
+      'group' => 'Block',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    // Create a test user.
+    $end_user = $this->drupalCreateUser(array(
+      'access content',
+      'search content',
+    ));
+    $this->drupalLogin($end_user);
+  }
+
+  /**
+   * Tests the render order of the blocks.
+   */
+  function testBlockRenderOrder() {
+    // Enable test blocks and place them in the same region.
+    $region = 'header';
+    $test_blocks = array(
+      'system' => array(
+        'plugin_id' => 'system_powered_by_block',
+        'label' => $this->randomName(8),
+        'weight' => '3',
+        'machine_name' => 'powered',
+      ),
+      'search' => array(
+        'plugin_id' => 'search_form_block',
+        'label' => $this->randomName(8),
+        'weight' => '-3',
+        'machine_name' => 'searchbox',
+      ),
+    );
+
+    foreach ($test_blocks as $test_block) {
+      $this->drupalPlaceBlock($test_block['plugin_id'], array(
+        'region' => $region,
+        'label' => $test_block['label'],
+        'weight' => $test_block['weight'],
+        'machine_name' => $test_block['machine_name'],
+      ));
+    }
+
+    $this->drupalGet('');
+    $test_content = $this->drupalGetContent('');
+
+    $controller = $this->container->get('plugin.manager.entity')->getStorageController('block');
+    foreach ($controller->load() as $return_block) {
+      $settings = $return_block->get('settings');
+      if (isset($settings['weight'])) {
+        $this->assertTrue($test_blocks[$settings['module']]['weight'] == $settings['weight'], 'Block weight is set as "' . $settings['weight']  . '" for ' . $settings['label'] . ' block.');
+        $position[$settings['module']] = strpos($test_content, $settings['label']);
+      }
+    }
+    $this->assertTrue($position['search'] < $position['system'], 'The blocks are rendered in the correct order.');
+  }
+}
