diff --git a/core/composer.json b/core/composer.json
index afb170a..a6214c7 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -9,6 +9,7 @@
     "symfony/console": "2.7.*",
     "symfony/dependency-injection": "2.7.*",
     "symfony/event-dispatcher": "2.7.*",
+    "symfony/finder": "2.7.*",
     "symfony/http-foundation": "~2.7.2",
     "symfony/http-kernel": "2.7.*",
     "symfony/routing": "2.7.*",
diff --git a/core/console b/core/console
new file mode 100755
index 0000000..c344627
--- /dev/null
+++ b/core/console
@@ -0,0 +1,31 @@
+#!/usr/bin/env php
+<?php
+
+/**
+ * @file
+ * Contains the Drupal console.
+ */
+
+$class_loader = require_once __DIR__ . '/../autoload.php';
+
+use Drupal\Component\FileCache\FileCacheFactory;
+use Drupal\Core\Console\CompilerPass;
+use Drupal\Core\Console\ServicesFinder;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\DependencyInjection\YamlFileLoader;
+
+FileCacheFactory::setPrefix('console_cache');
+$container = new ContainerBuilder();
+$container->setParameter('console.classloader', $class_loader);
+$loader = new YamlFileLoader($container);
+$services_finder = new ServicesFinder();
+foreach ($services_finder as $file) {
+  $loader->load($file->getPathname());
+}
+
+$pass = new CompilerPass();
+$container->addCompilerPass($pass);
+$container->compile();
+
+$app = $container->get('console.app');
+$app->run();
diff --git a/core/core.console.services.yml b/core/core.console.services.yml
new file mode 100644
index 0000000..98f5982
--- /dev/null
+++ b/core/core.console.services.yml
@@ -0,0 +1,24 @@
+parameters:
+  # Make the class a property so we can change it for testing.
+  console.app.class: Drupal\Core\Console\Application
+  # console.classloader is added in the console script.
+
+services:     
+  console.app:
+    class: "%console.app.class%"
+
+  console.bootstrap:
+    class: Drupal\Core\Console\Bootstrap
+    arguments: ['%console.classloader%']
+
+  console.command.cache_clear:
+    class: Drupal\Core\Console\Command\ClearCache
+    arguments: ['@console.bootstrap']
+    tags:
+      - { name: console.command }
+
+  console.command.run_cron:
+    class: Drupal\Core\Console\Command\RunCron
+    arguments: ['@console.bootstrap']
+    tags:
+      - { name: console.command }
diff --git a/core/lib/Drupal/Core/Console/Application.php b/core/lib/Drupal/Core/Console/Application.php
new file mode 100644
index 0000000..aa7deed
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/Application.php
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Console application for Drupal.
+ */
+
+namespace Drupal\Core\Console;
+
+use Symfony\Component\Console\Application as GenericApplication;
+
+class Application extends GenericApplication {
+
+  /**
+   * Constructs a new class instance.
+   */
+  public function __construct() {
+    parent::__construct('Drupal', \Drupal::VERSION);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/Bootstrap.php b/core/lib/Drupal/Core/Console/Bootstrap.php
new file mode 100644
index 0000000..ccece79
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/Bootstrap.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Console\Bootstrap.
+ */
+
+namespace Drupal\Core\Console;
+
+use Drupal\Core\DrupalKernel;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Bootstrap Drupal so we can run a console command.
+ */
+class Bootstrap implements BootstrapInterface {
+
+  protected $classLoader;
+
+  public function __construct($class_loader) {
+    $this->classLoader = $class_loader;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function bootstrap(Command $command, InputInterface $input, OutputInterface $output, Request $request = NULL) {
+    $env = $input->getOption('environment');
+    if (!$request) {
+      // Create a meaningful request object. We shouldn't really need this but
+      // Drupal complains if it's not present.
+      $request = Request::createFromGlobals();
+    }
+    try {
+//      $class_loader = require __DIR__ . '/../../../../../autoload.php';
+      $kernel = DrupalKernel::createFromRequest($request, $this->classLoader, $env);
+      $kernel->boot();
+
+      $container = $kernel->getContainer();
+      $container->set('request', $request);
+      $container->get('request_stack')->push($request);
+
+      return $kernel;
+    } catch (\Exception $e) {
+      /** @var \Symfony\Component\Console\Helper\FormatterHelper $formatter */
+      $formatter = $command->getHelperSet()->get('formatter');
+      $error_messages = array(
+        'Insufficient Drupal to proceed.',
+        'This command requires a bootable Drupal installation.',
+        $e->getMessage(),
+      );
+      $formatted_block = $formatter->formatBlock($error_messages, 'error', TRUE);
+      $output->writeln($formatted_block);
+    }
+    return FALSE;
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/BootstrapInterface.php b/core/lib/Drupal/Core/Console/BootstrapInterface.php
new file mode 100644
index 0000000..ae7767e
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/BootstrapInterface.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Console\BootstrapInterface.
+ */
+
+namespace Drupal\Core\Console;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Defines a bootstrap service.
+ */
+interface BootstrapInterface {
+
+  /**
+   * Bootstraps Drupal.
+   *
+   * @param \Symfony\Component\Console\Command\Command $command
+   *   Console command object.
+   * @param \Symfony\Component\Console\Input\InputInterface $input
+   *   Console input object.
+   * @param \Symfony\Component\Console\Output\OutputInterface $output
+   *   Console output object.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   Request object for the kernel. If NULL, one will be generated from
+   *   globals.
+   *
+   * @returns \Drupal\Core\DrupalKernelInterface|false
+   *   The booted kernel, or FALSE if the bootstrap failed.
+   */
+  public function bootstrap(Command $command, InputInterface $input, OutputInterface $output, Request $request = NULL);
+
+}
diff --git a/core/lib/Drupal/Core/Console/Command/ClearCache.php b/core/lib/Drupal/Core/Console/Command/ClearCache.php
new file mode 100644
index 0000000..20f049c
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/Command/ClearCache.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Console\Command\ClearCache.
+ */
+
+namespace Drupal\Core\Console\Command;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Clears all caches.
+ */
+class ClearCache extends CommandBootstrapBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    parent::configure();
+    $this
+      ->setName('drupal:cache-clear')
+      ->setAliases(array('cc'))
+      ->setDescription('Clears all caches.');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+    $kernel = $this->bootstrap->bootstrap($this, $input, $output);
+    if ($kernel) {
+      // @todo: This doesn't actually clear all caches.
+      $cache = $kernel->getContainer()->get('cache.default');
+      $cache->deleteAll();
+      $output->writeln('<info>Caches cleared.</info>');
+    }
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/Command/CommandBootstrapBase.php b/core/lib/Drupal/Core/Console/Command/CommandBootstrapBase.php
new file mode 100644
index 0000000..f9fb61a
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/Command/CommandBootstrapBase.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Contains CommandBootstrapBase.
+ */
+
+namespace Drupal\Core\Console\Command;
+
+use Drupal\Core\Console\BootstrapInterface;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputOption;
+
+/**
+ * Bootstraps Drupal so we can run a console command.
+ *
+ * Subclass this so you can write a command which requires a booted Drupal. If
+ * your command does not require a booted Drupal, don't subclass this.
+ *
+ * It's very important that we don't bootstrap Drupal before the subclass asks
+ * for it.
+ */
+abstract class CommandBootstrapBase extends Command {
+
+  /**
+   * The bootstrap service.
+   *
+   * @var \Drupal\Core\Console\BootstrapInterface
+   */
+  protected $bootstrap;
+
+  /**
+   * Constructs a new class instance.
+   *
+   * @param \Drupal\Core\Console\BootstrapInterface $bootstrap
+   *   A bootstrap builder object.
+   */
+  public function __construct(BootstrapInterface $bootstrap) {
+    parent::__construct();
+    $this->bootstrap = $bootstrap;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    parent::configure();
+    $this
+      ->addOption(
+        'environment', 'e', InputOption::VALUE_REQUIRED, 'Kernel environment.', 'prod'
+    );
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/Command/RunCron.php b/core/lib/Drupal/Core/Console/Command/RunCron.php
new file mode 100644
index 0000000..f47cedc
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/Command/RunCron.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Console\Command\RunCron.
+ */
+
+namespace Drupal\Core\Console\Command;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Runs cron from the console.
+ */
+class RunCron extends CommandBootstrapBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    parent::configure();
+    $this
+      ->setName('drupal:cron')
+      ->setAliases(array('cron'))
+      ->setDescription('Performs a cron run.');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+    $kernel = $this->bootstrap->bootstrap($this, $input, $output);
+    if ($kernel) {
+      $output->writeln('<info>Running cron...</info>');
+      /** @var \Drupal\Core\CronInterface $cron */
+      $cron = $kernel->getContainer()->get('cron');
+      $cron->run();
+      $output->writeln('<info>Done.</info>');
+    }
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/CompilerPass.php b/core/lib/Drupal/Core/Console/CompilerPass.php
new file mode 100644
index 0000000..39fda13
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/CompilerPass.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Console\CommandCompilerPass.
+ */
+
+namespace Drupal\Core\Console;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\Reference;
+
+/**
+ * Compiles dependencies between the console app and commands we've discovered.
+ *
+ * If you are making a console command, you must tag it with
+ * 'console.command' in order for it to be added to the console app.
+ *
+ * @code
+ *   namespace.console.command_name:
+ *     class: Name\Space\To\YourCommand
+ *     tags:
+ *       - { name: console.command }
+ * @endcode
+ */
+class CompilerPass implements CompilerPassInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function process(ContainerBuilder $container) {
+    $tagged_services = $container->findTaggedServiceIds('console.command');
+    $definition = $container->getDefinition('console.app');
+    foreach (array_keys($tagged_services) as $id) {
+      $definition->addMethodCall(
+        'add', array(new Reference($id))
+      );
+    }
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Console/ServicesFinder.php b/core/lib/Drupal/Core/Console/ServicesFinder.php
new file mode 100644
index 0000000..baa32de
--- /dev/null
+++ b/core/lib/Drupal/Core/Console/ServicesFinder.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\Core\Console;
+
+use Drupal\Core\Discovery\DrupalFinder;
+
+class ServicesFinder extends DrupalFinder {
+
+  /**
+   * Constructs a new class instance.
+   */
+  public function __construct() {
+    parent::__construct();
+    $this
+      ->inDrupalCore()
+      ->inContrib()
+      ->excludeVendor()
+      ->files()
+      ->ignoreUnreadableDirs()
+      ->ignoreVCS(TRUE)
+      ->name('*.console.services.yml');
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php
index 1c17c94..694ce49 100644
--- a/core/lib/Drupal/Core/Cron.php
+++ b/core/lib/Drupal/Core/Cron.php
@@ -111,7 +111,7 @@ public function run() {
     $this->accountSwitcher->switchTo(new AnonymousUserSession());
 
     // Try to allocate enough time to run all the hook_cron implementations.
-    drupal_set_time_limit(240);
+    \drupal_set_time_limit(240);
 
     $return = FALSE;
 
diff --git a/core/lib/Drupal/Core/Discovery/DrupalFinder.php b/core/lib/Drupal/Core/Discovery/DrupalFinder.php
new file mode 100644
index 0000000..9baf4a6
--- /dev/null
+++ b/core/lib/Drupal/Core/Discovery/DrupalFinder.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Discovery\DrupalFinder.
+ */
+
+namespace Drupal\Core\Discovery;
+
+use Symfony\Component\Finder\Finder;
+
+/**
+ * Provides a finder with helpers for searching Drupal directories.
+ */
+class DrupalFinder extends Finder {
+
+  /**
+   * The path to the Drupal root directory.
+   *
+   * @var string
+   */
+  protected $drupalRoot = '';
+
+  /**
+   * Constructs a new class instance.
+   *
+   * @param string $drupal_root
+   *   (optional) Path to initialize as the root of the Drupal installation.
+   */
+  public function __construct($drupal_root = NULL) {
+    parent::__construct();
+    if (!$drupal_root) {
+      $drupal_root = __DIR__ . '/../../../../..';
+    }
+    $this->drupalRoot = $drupal_root;
+  }
+
+  /**
+   * Gets the path to the root of the Drupal installation.
+   *
+   * @return string
+   *   The path to the root of the Drupal installation.
+   */
+  public function getDrupalRootPath() {
+    return $this->drupalRoot;
+  }
+
+  /**
+   * Gets the path to the Drupal installation's ./core directory.
+   *
+   * @return string
+   *   The path to the Drupal installation's core directory.
+   */
+  public function getDrupalCorePath() {
+    return $this->getDrupalRootPath() . '/core';
+  }
+
+  /**
+   * Sets the iterator to search the Drupal root directory.
+   *
+   * @return $this
+   */
+  public function inDrupalRoot() {
+    return $this->in($this->getDrupalRootPath());
+  }
+
+  /**
+   * Sets the iterator to search the Drupal core directory.
+   *
+   * @return $this
+   */
+  public function inDrupalCore() {
+    return $this->in($this->getDrupalCorePath());
+  }
+
+  /**
+   * Sets the iterator to search within Drupal's contrib directories.
+   *
+   * @return $this
+   */
+  public function inContrib() {
+    $this->in($this->getDrupalRootPath() . '/modules');
+    return $this->in($this->getDrupalRootPath() . '/sites');
+  }
+
+  /**
+   * Sets the iterator to exclude Composer's vendor directory.
+   *
+   * @return $this
+   */
+  public function excludeVendor() {
+    return $this->exclude($this->getDrupalCorePath() . '/vendor');
+  }
+
+}
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 278826e..6a967d7 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -342,7 +342,7 @@ public static function findSitePath(Request $request, $require_settings = TRUE)
     }
 
     // Check for a simpletest override.
-    if ($test_prefix = drupal_valid_test_ua()) {
+    if ($test_prefix = \drupal_valid_test_ua()) {
       return 'sites/simpletest/' . substr($test_prefix, 10);
     }
 
diff --git a/core/tests/Drupal/Tests/Core/Console/ApplicationTest.php b/core/tests/Drupal/Tests/Core/Console/ApplicationTest.php
new file mode 100644
index 0000000..7b7a74c
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Console/ApplicationTest.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Console\ApplicationTest.
+ */
+
+namespace Drupal\Tests\Core\Console;
+
+use Drupal\Core\Console\Application;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Console\Application
+ * 
+ * @group Console
+ */
+class ApplicationTest extends UnitTestCase {
+
+  /**
+   * @covers ::__construct
+   */
+  public function testConstruct() {
+    new Application();
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Console/Command/ClearCacheTest.php b/core/tests/Drupal/Tests/Core/Console/Command/ClearCacheTest.php
new file mode 100644
index 0000000..053fbd6
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Console/Command/ClearCacheTest.php
@@ -0,0 +1,69 @@
+<?php
+
+/**
+ * @file
+ *   Contains \Drupal\Tests\Core\Console\Command\ClearCacheTest.
+ */
+
+namespace Drupal\Tests\Core\Console\Command;
+
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Console\Command\ClearCache;
+use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Test the clear cache command.
+ *
+ * @coversDefaultClass \Drupal\Core\Console\Command\ClearCache
+ *
+ * @group Console
+ * @group Command
+ */
+class ClearCacheTest extends UnitTestCase {
+
+  /**
+   * @covers ::execute
+   */
+  public function testExecute() {
+    $bootstrap = $this->getMockBuilder('\Drupal\Core\Console\BootstrapInterface')
+      ->setMethods(['bootstrap'])
+      ->getMockForAbstractClass();
+
+    $kernel = $this->getMockBuilder('\Drupal\Core\DrupalKernelInterface')
+      ->setMethods(['getContainer'])
+      ->getMockForAbstractClass();
+
+    $bootstrap->expects($this->once())
+      ->method('bootstrap')
+      ->will($this->returnValue($kernel));
+
+    $cache_service = $this->getMockForAbstractClass(CacheBackendInterface::class);
+    $container = $this->getMockBuilder(ContainerInterface::class)
+      ->setMethods(['get'])
+      ->getMockForAbstractClass();
+    $container->expects($this->once())
+      ->method('get')
+      ->with('cache.default')
+      ->willReturn($cache_service);
+
+    $kernel->expects($this->once())
+      ->method('getContainer')
+      ->willReturn($container);
+
+    $command = new ClearCache($bootstrap);
+
+    $input = $this->getMockForAbstractClass('\Symfony\Component\Console\Input\InputInterface');
+
+    $output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')
+      ->setMethods(['writeln'])
+      ->getMockForAbstractClass();
+    $output->expects($this->atLeastOnce())
+      ->method('writeln');
+
+    $method = new \ReflectionMethod($command, 'execute');
+    $method->setAccessible(TRUE);
+    $method->invokeArgs($command, [$input, $output]);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Console/Command/RunCronTest.php b/core/tests/Drupal/Tests/Core/Console/Command/RunCronTest.php
new file mode 100644
index 0000000..865472b
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Console/Command/RunCronTest.php
@@ -0,0 +1,84 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Console\Command\RunCronTest.
+ */
+
+namespace Drupal\Tests\Core\Console\Command;
+
+use Drupal\Core\Console\Command\RunCron;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Test the console cron run command.
+ * 
+ * @coversDefaultClass \Drupal\Core\Console\Command\RunCron
+ * 
+ * @group Console
+ * @group Command
+ */
+class RunCronTest extends UnitTestCase {
+
+  /**
+   * The bootstrap service.
+   *
+   * @var \Drupal\Core\Console\BootstrapInterface|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $bootstrap;
+
+  /**
+   * The command under test.
+   *
+   * @var \Drupal\Core\Console\Command\RunCron
+   */
+  protected $command;
+
+  /**
+   * {@inheritdoc}
+   *
+   * @covers ::__construct
+   * @covers ::configure
+   */
+  public function setUp() {
+    $this->bootstrap = $this->getMock('\Drupal\Core\Console\BootstrapInterface');
+
+    $this->command = new RunCron($this->bootstrap);
+  }
+
+  /**
+   * @covers ::execute
+   */
+  public function testExecute() {
+    $input = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
+
+    $output = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+    $output->expects($this->atLeastOnce())
+      ->method('writeln');
+
+    $cron = $this->getMock('\Drupal\Core\CronInterface');
+    $cron->expects($this->once())
+      ->method('run');
+
+    $container = $this->getMock('\Symfony\Component\DependencyInjection\ContainerInterface');
+    $container->expects($this->once())
+      ->method('get')
+      ->with('cron')
+      ->will($this->returnValue($cron));
+
+    $kernel = $this->getMock('\Drupal\Core\DrupalKernelInterface');
+    $kernel->expects($this->atLeastOnce())
+      ->method('getContainer')
+      ->will($this->returnValue($container));
+
+    $this->bootstrap->expects($this->once())
+      ->method('bootstrap')
+      ->with($this->command, $input, $output)
+      ->will($this->returnValue($kernel));
+
+    $method = new \ReflectionMethod($this->command, 'execute');
+    $method->setAccessible(TRUE);
+    $method->invoke($this->command, $input, $output);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Console/CompilerPassTest.php b/core/tests/Drupal/Tests/Core/Console/CompilerPassTest.php
new file mode 100644
index 0000000..9eaeb87
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Console/CompilerPassTest.php
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Console\CompilerPassTest.
+ */
+
+namespace Drupal\Tests\Core\Console;
+
+use Drupal\Core\Console\CompilerPass;
+use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\Reference;
+
+/**
+ * Test console services compiler.
+ *
+ * @coversDefaultClass \Drupal\Core\Console\CompilerPass
+ *
+ * @group Console
+ */
+class CompilerPassTest extends UnitTestCase {
+
+  /**
+   * Test the process() method.
+   *
+   * @covers ::process
+   */
+  public function testProcess() {
+    $service_ids = array($this->randomMachineName(), $this->randomMachineName());
+    $references[] = new Reference($service_ids[0]);
+    $references[] = new Reference($service_ids[1]);
+
+    $definition = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Definition')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $definition->expects($this->at(0))
+      ->method('addMethodCall')
+      ->with('add', array($references[0]));
+    $definition->expects($this->at(1))
+      ->method('addMethodCall')
+      ->with('add', array($references[1]));
+
+    $container_builder = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder')
+      ->setMethods(array(
+        'get',
+        'findTaggedServiceIds',
+        'getDefinition',
+      ))
+      ->disableOriginalConstructor()
+      ->getMock();
+    $container_builder->expects($this->once())
+      ->method('findTaggedServiceIds')
+      ->with('console.command')
+      ->will($this->returnValue(array_fill_keys($service_ids, array())));
+    $container_builder->expects($this->once())
+      ->method('getDefinition')
+      ->with('console.app')
+      ->will($this->returnValue($definition));
+
+    $command = new CompilerPass();
+    $command->process($container_builder);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Console/ServicesFinderTest.php b/core/tests/Drupal/Tests/Core/Console/ServicesFinderTest.php
new file mode 100644
index 0000000..041515a
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Console/ServicesFinderTest.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Console\ServicesFinderTest.
+ */
+
+namespace Drupal\Tests\Core\Console;
+
+use Drupal\Core\Console\ServicesFinder;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Test the console services finder.
+ *
+ * @coversDefaultClass \Drupal\Core\Console\ServicesFinder
+ *
+ * @group Console
+ */
+class ServicesFinderTest extends UnitTestCase {
+
+  /**
+   * Basic test of constructing a new services finder.
+   *
+   * @covers ::__construct
+   */
+  public function testConstruct() {
+    $finder = new ServicesFinder();
+    $files = array();
+    foreach ($finder as $file) {
+      /** @var \Symfony\Component\Finder\SplFileInfo $file */
+      $files[] = $file->getRealPath();
+      $this->assertFileExists($file->getRealPath());
+    }
+    $this->assertNotCount(0, $files);
+  }
+
+}
