Issue #2324789 by tim.plunkett: Remove UnitTestBase.
parent
2d6516afec
commit
7fc47f3526
|
@ -35,7 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
*
|
||||
* @ingroup testing
|
||||
*/
|
||||
abstract class KernelTestBase extends UnitTestBase {
|
||||
abstract class KernelTestBase extends TestBase {
|
||||
|
||||
use AssertContentTrait;
|
||||
|
||||
|
@ -47,8 +47,8 @@ abstract class KernelTestBase extends UnitTestBase {
|
|||
* this property. The values of all properties in all classes in the hierarchy
|
||||
* are merged.
|
||||
*
|
||||
* Unlike UnitTestBase::setUp(), any modules specified in the $modules
|
||||
* property are automatically loaded and set as the fixed module list.
|
||||
* Any modules specified in the $modules property are automatically loaded and
|
||||
* set as the fixed module list.
|
||||
*
|
||||
* Unlike WebTestBase::setUp(), the specified modules are loaded only, but not
|
||||
* automatically installed. Modules need to be installed manually, if needed.
|
||||
|
@ -143,8 +143,6 @@ abstract class KernelTestBase extends UnitTestBase {
|
|||
copy($settings_services_file, DRUPAL_ROOT . '/' . $this->siteDirectory . '/services.yml');
|
||||
}
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// Create and set new configuration directories.
|
||||
$this->prepareConfigDirectories();
|
||||
|
||||
|
@ -212,9 +210,9 @@ abstract class KernelTestBase extends UnitTestBase {
|
|||
// StreamWrapper APIs.
|
||||
// @todo Move StreamWrapper management into DrupalKernel.
|
||||
// @see https://drupal.org/node/2028109
|
||||
file_prepare_directory($this->public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
|
||||
$this->settingsSet('file_public_path', $this->public_files_directory);
|
||||
$this->streamWrappers = array();
|
||||
// The public stream wrapper only depends on the file_public_path setting,
|
||||
// which is provided by UnitTestBase::setUp().
|
||||
$this->registerStreamWrapper('public', 'Drupal\Core\StreamWrapper\PublicStream');
|
||||
// The temporary stream wrapper is able to operate both with and without
|
||||
// configuration.
|
||||
|
|
|
@ -30,7 +30,7 @@ use Symfony\Component\DependencyInjection\Reference;
|
|||
* Base class for Drupal tests.
|
||||
*
|
||||
* Do not extend this class directly; use either
|
||||
* \Drupal\simpletest\WebTestBase or \Drupal\simpletest\UnitTestBase.
|
||||
* \Drupal\simpletest\WebTestBase or \Drupal\simpletest\KernelTestBase.
|
||||
*/
|
||||
abstract class TestBase {
|
||||
/**
|
||||
|
@ -1058,7 +1058,6 @@ abstract class TestBase {
|
|||
|
||||
// Unregister all custom stream wrappers of the parent site.
|
||||
// Availability of Drupal stream wrappers varies by test base class:
|
||||
// - UnitTestBase operates in a completely empty environment.
|
||||
// - KernelTestBase supports and maintains stream wrappers in a custom
|
||||
// way.
|
||||
// - WebTestBase re-initializes Drupal stream wrappers after installation.
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\simpletest\UnitTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\simpletest;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Database\ConnectionNotDefinedException;
|
||||
|
||||
/**
|
||||
* Base test case class for unit tests.
|
||||
*
|
||||
* These tests can not access the database nor files. Calling any Drupal
|
||||
* function that needs the database will throw exceptions. These include
|
||||
* watchdog(), \Drupal::moduleHandler()->getImplementations(),
|
||||
* \Drupal::moduleHandler()->invokeAll() etc.
|
||||
*/
|
||||
abstract class UnitTestBase extends TestBase {
|
||||
|
||||
/**
|
||||
* Constructor for UnitTestBase.
|
||||
*/
|
||||
function __construct($test_id = NULL) {
|
||||
parent::__construct($test_id);
|
||||
$this->skipClasses[__CLASS__] = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up unit test environment.
|
||||
*
|
||||
* Unlike \Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does
|
||||
* not install modules because tests are performed without accessing the
|
||||
* database. Any required files must be explicitly included by the child class
|
||||
* setUp() method.
|
||||
*/
|
||||
protected function setUp() {
|
||||
file_prepare_directory($this->public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
|
||||
$this->settingsSet('file_public_path', $this->public_files_directory);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue