diff --git a/core/core.services.yml b/core/core.services.yml
index 5080841..4ce0e83 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -1091,7 +1091,7 @@ services:
     arguments: ['@authentication']
   account_switcher:
     class: Drupal\Core\Session\AccountSwitcher
-    arguments: ['@current_user', '@session_manager']
+    arguments: ['@current_user', '@session_handler.write_check']
   current_user:
     class: Drupal\Core\Session\AccountProxy
     arguments: ['@authentication', '@request_stack']
diff --git a/core/lib/Drupal/Core/Session/AccountSwitcher.php b/core/lib/Drupal/Core/Session/AccountSwitcher.php
index 0737258..c2a8cef 100644
--- a/core/lib/Drupal/Core/Session/AccountSwitcher.php
+++ b/core/lib/Drupal/Core/Session/AccountSwitcher.php
@@ -31,11 +31,11 @@ class AccountSwitcher implements AccountSwitcherInterface {
   protected $currentUser = array();
 
   /**
-   * The session manager.
+   * The write check session handler.
    *
-   * @var \Drupal\Core\Session\SessionManagerInterface
+   * @var \Drupal\Core\Session\WriteCheckSessionHandlerInterface
    */
-  protected $sessionManager;
+  protected $sessionHandler;
 
   /**
    * The original state of session saving prior to account switching.
@@ -49,12 +49,12 @@ class AccountSwitcher implements AccountSwitcherInterface {
    *
    * @param \Drupal\Core\Session\AccountProxyInterface $current_user
    *   The current user service.
-   * @param \Drupal\Core\Session\SessionManagerInterface $session_manager
+   * @param \Drupal\Core\Session\WriteSafeSessionHandlerInterface $session_handler
    *   The session manager.
    */
-  public function __construct(AccountProxyInterface $current_user, SessionManagerInterface $session_manager) {
+  public function __construct(AccountProxyInterface $current_user, WriteSafeSessionHandlerInterface $session_handler) {
     $this->currentUser = $current_user;
-    $this->sessionManager = $session_manager;
+    $this->sessionHandler = $session_handler;
   }
 
   /**
@@ -64,9 +64,9 @@ public function switchTo(AccountInterface $account) {
     // Prevent session information from being saved and push previous account.
     if (!isset($this->originalSessionSaving)) {
       // Ensure that only the first session saving status is saved.
-      $this->originalSessionSaving = $this->sessionManager->isEnabled();
+      $this->originalSessionSaving = $this->sessionHandler->isSessionWritable();
     }
-    $this->sessionManager->disable();
+    $this->sessionHandler->setSessionWritable(FALSE);
     array_push($this->accountStack, $this->currentUser->getAccount());
     $this->currentUser->setAccount($account);
     return $this;
@@ -87,7 +87,7 @@ public function switchBack() {
     // reverted.
     if (empty($this->accountStack)) {
       if ($this->originalSessionSaving) {
-        $this->sessionManager->enable();
+        $this->sessionHandler->setSessionWritable(TRUE);
       }
     }
     return $this;
diff --git a/core/modules/system/src/Tests/Datetime/DrupalDateTimeTest.php b/core/modules/system/src/Tests/Datetime/DrupalDateTimeTest.php
index 29fec17..ae763ad 100644
--- a/core/modules/system/src/Tests/Datetime/DrupalDateTimeTest.php
+++ b/core/modules/system/src/Tests/Datetime/DrupalDateTimeTest.php
@@ -94,7 +94,7 @@ public function testDateTimezone() {
     $this->drupalPostForm('user/' . $test_user->id() . '/edit', $edit, t('Save'));
 
     // Disable session saving as we are about to modify the global $user.
-    \Drupal::service('session_manager')->disable();
+    \Drupal::service('session_handler.write_check')->setSessionWritable(FALSE);
     // Save the original user and then replace it with the test user.
     $real_user = $user;
     $user = user_load($test_user->id(), TRUE);
@@ -113,7 +113,7 @@ public function testDateTimezone() {
     $user = $real_user;
     // Restore default time zone.
     date_default_timezone_set(drupal_get_user_timezone());
-    \Drupal::service('session_manager')->enable();
+    \Drupal::service('session_handler.write_check')->setSessionWritable(TRUE);
 
 
   }
diff --git a/core/modules/system/src/Tests/Session/AccountSwitcherTest.php b/core/modules/system/src/Tests/Session/AccountSwitcherTest.php
index 8277488..331d73b 100644
--- a/core/modules/system/src/Tests/Session/AccountSwitcherTest.php
+++ b/core/modules/system/src/Tests/Session/AccountSwitcherTest.php
@@ -18,11 +18,11 @@
 class AccountSwitcherTest extends KernelTestBase {
 
   public function testAccountSwitching() {
-    $session_manager = $this->container->get('session_manager');
+    $session_handler = $this->container->get('session_handler.write_check');
     $user = $this->container->get('current_user');
     $switcher = $this->container->get('account_switcher');
     $original_user = $user->getAccount();
-    $original_session_saving = $session_manager->isEnabled();
+    $original_session_saving = $session_handler->isSessionWritable();
 
     // Switch to user with uid 2.
     $switcher->switchTo(new UserSession(array('uid' => 2)));
@@ -30,7 +30,7 @@ public function testAccountSwitching() {
     // Verify that the active user has changed, and that session saving is
     // disabled.
     $this->assertEqual($user->id(), 2, 'Switched to user 2.');
-    $this->assertFalse($session_manager->isEnabled(), 'Session saving is disabled.');
+    $this->assertFalse($session_handler->isSessionWritable(), 'Session saving is disabled.');
 
     // Perform a second (nested) user account switch.
     $switcher->switchTo(new UserSession(array('uid' => 3)));
@@ -43,7 +43,7 @@ public function testAccountSwitching() {
     // Since we are still in the account from the first switch, session handling
     // still needs to be disabled.
     $this->assertEqual($user->id(), 2, 'Reverted back to user 2.');
-    $this->assertFalse($session_manager->isEnabled(), 'Session saving still disabled.');
+    $this->assertFalse($session_handler->isSessionWritable(), 'Session saving still disabled.');
 
     // Revert to the original account which was active before the first switch.
     $switcher->switchBack();
@@ -51,7 +51,7 @@ public function testAccountSwitching() {
     // Assert that the original account is active again, and that session saving
     // has been re-enabled.
     $this->assertEqual($user->id(), $original_user->id(), 'Original user correctly restored.');
-    $this->assertEqual($session_manager->isEnabled(), $original_session_saving, 'Original session saving correctly restored.');
+    $this->assertEqual($session_handler->isSessionWritable(), $original_session_saving, 'Original session saving correctly restored.');
 
     // Verify that AccountSwitcherInterface::switchBack() will throw
     // an exception if there are no accounts left in the stack.
diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php
index bbe23f6..a5dc1b7 100644
--- a/core/modules/system/src/Tests/Session/SessionTest.php
+++ b/core/modules/system/src/Tests/Session/SessionTest.php
@@ -29,10 +29,10 @@ class SessionTest extends WebTestBase {
    * Tests for \Drupal\Core\Session\SessionManager::isEnabled() and ::regenerate().
    */
   function testSessionSaveRegenerate() {
-    $session_manager = $this->container->get('session_manager');
-    $this->assertTrue($session_manager->isEnabled(), 'SessionManager->isEnabled() initially returns TRUE.');
-    $this->assertFalse($session_manager->disable()->isEnabled(), 'SessionManager->isEnabled() returns FALSE after disabling.');
-    $this->assertTrue($session_manager->enable()->isEnabled(), 'SessionManager->isEnabled() returns TRUE after enabling.');
+    $session_handler = $this->container->get('session_handler.write_check');
+    $this->assertTrue($session_handler->isSessionWritable(), 'session_handler->isSessionWritable() initially returns TRUE.');
+    $this->assertFalse($session_handler->setSessionWritable(FALSE)->isSessionWritable(), '$session_handler->setSessionWritable(FALSE)->isSessionWritable() returns FALSE after disabling.');
+    $this->assertTrue($session_handler->setSessionWritable(TRUE)->isSessionWritable(), '$session_handler->setSessionWritable(TRUE)->isSessionWritable() returns TRUE after enabling.');
 
     // Test session hardening code from SA-2008-044.
     $user = $this->drupalCreateUser();
diff --git a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
index 249b1ea..26e87aa 100644
--- a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
+++ b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php
@@ -85,7 +85,7 @@ public function set($test_value) {
    *   A notification message.
    */
   public function noSet($test_value) {
-    \Drupal::service('session_manager')->disable();
+    \Drupal::service('session_handler.write_check')->setSessionWritable(FALSE);
     $this->set($test_value);
     return ['#markup' => $this->t('session saving was disabled, and then %val was set', array('%val' => $test_value))];
   }
@@ -111,7 +111,7 @@ public function setMessage() {
    *   A notification message.
    */
   public function setMessageButDontSave() {
-    \Drupal::service('session_manager')->disable();
+    \Drupal::service('session_handler.write_check')->setSessionWritable(FALSE);
     $this->setMessage();
     return ['#markup' => ''];
   }
diff --git a/core/modules/user/src/Tests/Views/ArgumentDefaultTest.php b/core/modules/user/src/Tests/Views/ArgumentDefaultTest.php
index f28565e..4742381 100644
--- a/core/modules/user/src/Tests/Views/ArgumentDefaultTest.php
+++ b/core/modules/user/src/Tests/Views/ArgumentDefaultTest.php
@@ -30,7 +30,7 @@ public function test_plugin_argument_default_current_user() {
     // Switch the user, we have to check the global user too, because drupalLogin is only for the simpletest browser.
     $this->drupalLogin($account);
     $admin = \Drupal::currentUser();
-    $session_manager = \Drupal::service('session_manager')->disable();
+    $session_handler = \Drupal::service('session_handler.write_check')->setSessionWritable(FALSE);
     \Drupal::currentUser()->setAccount($account);
 
     $view = Views::getView('test_plugin_argument_default_current_user');
@@ -39,7 +39,7 @@ public function test_plugin_argument_default_current_user() {
     $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->id(), 'Uid of the current user is used.');
     // Switch back.
     \Drupal::currentUser()->setAccount($admin);
-    $session_manager->enable();
+    $session_handler->setSessionWritable(TRUE);
   }
 
 }
diff --git a/core/vendor/bin/phpunit b/core/vendor/bin/phpunit
deleted file mode 120000
index 2c48930..0000000
--- a/core/vendor/bin/phpunit
+++ /dev/null
@@ -1 +0,0 @@
-../phpunit/phpunit/phpunit
\ No newline at end of file
diff --git a/core/vendor/bin/phpunit b/core/vendor/bin/phpunit
new file mode 100755
index 0000000..11f3cd5
--- /dev/null
+++ b/core/vendor/bin/phpunit
@@ -0,0 +1,36 @@
+#!/usr/bin/env php
+<?php
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <sebastian@phpunit.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (!ini_get('date.timezone')) {
+    ini_set('date.timezone', 'UTC');
+}
+
+foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
+    if (file_exists($file)) {
+        define('PHPUNIT_COMPOSER_INSTALL', $file);
+        break;
+    }
+}
+
+unset($file);
+
+if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
+    fwrite(STDERR,
+        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
+        'php composer.phar install' . PHP_EOL
+    );
+    die(1);
+}
+
+require PHPUNIT_COMPOSER_INSTALL;
+
+PHPUnit_TextUI_Command::main();
