diff --git a/core/modules/config/src/Tests/Storage/CachedStorageTest.php b/core/modules/config/src/Tests/Storage/CachedStorageTest.php index a88b344..de1d443 100644 --- a/core/modules/config/src/Tests/Storage/CachedStorageTest.php +++ b/core/modules/config/src/Tests/Storage/CachedStorageTest.php @@ -36,7 +36,7 @@ class CachedStorageTest extends ConfigStorageTestBase { protected function setUp() { parent::setUp(); - $this->fileStorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]); + $this->fileStorage = new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY)); $this->storage = new CachedStorage($this->fileStorage, \Drupal::service('cache.config')); $this->cache = \Drupal::service('cache_factory')->get('config'); // ::listAll() verifications require other configuration data to exist. diff --git a/core/modules/node/src/Tests/NodeLastChangedTest.php b/core/modules/node/src/Tests/NodeLastChangedTest.php index cc44b98..4444cc1 100644 --- a/core/modules/node/src/Tests/NodeLastChangedTest.php +++ b/core/modules/node/src/Tests/NodeLastChangedTest.php @@ -21,7 +21,7 @@ class NodeLastChangedTest extends KernelTestBase { * * @var array */ - public static $modules = array('entity', 'user', 'node', 'field', 'text', 'filter'); + public static $modules = array('user', 'node', 'field', 'system', 'text', 'filter'); protected function setUp() { parent::setUp(); diff --git a/core/modules/rdf/src/Tests/CrudTest.php b/core/modules/rdf/src/Tests/CrudTest.php index e434e2f..1d7c1cb 100644 --- a/core/modules/rdf/src/Tests/CrudTest.php +++ b/core/modules/rdf/src/Tests/CrudTest.php @@ -23,7 +23,22 @@ class CrudTest extends KernelTestBase { */ public static $modules = array('entity_test', 'rdf', 'system'); - public function setUp() { + /** + * @var string + */ + protected $prefix; + + /** + * @var string + */ + protected $entityType; + + /** + * @var string + */ + protected $bundle; + + protected function setUp() { parent::setUp(); $this->prefix = 'rdf.mapping'; $this->entityType = $this->bundle = 'entity_test'; diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php index cc2138d..07f53a5 100644 --- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php +++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php @@ -23,7 +23,7 @@ class DrupalKernelSiteTest extends KernelTestBase { public function testServicesYml() { $container_yamls = Settings::get('container_yamls'); $container_yamls[] = $this->siteDirectory . '/services.yml'; - $this->settingsSet('container_yamls', $container_yamls); + $this->setSetting('container_yamls', $container_yamls); $this->assertFalse($this->container->has('site.service.yml')); // A service provider class always has precedence over services.yml files. // KernelTestBase::buildContainer() swaps out many services with in-memory diff --git a/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php b/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php index d794df9..7641cf2 100644 --- a/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php +++ b/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php @@ -22,7 +22,7 @@ class ConfigEntityQueryTest extends KernelTestBase { * * @var array */ - static $modules = array('entity', 'config_test'); + static $modules = array('config_test'); /** * Stores the search results for alter comparison. diff --git a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php index 2b0c42b..8f52cb0 100644 --- a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php @@ -53,6 +53,13 @@ public static $modules = array('language', 'entity_test'); + /** + * The used fieldapi field. + * + * @var \Drupal\field\Entity\FieldConfig + */ + protected $field; + protected function setUp() { parent::setUp(); diff --git a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php b/core/modules/system/src/Tests/Entity/EntitySchemaTest.php index 5bd22ed..6c2a9b2 100644 --- a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php +++ b/core/modules/system/src/Tests/Entity/EntitySchemaTest.php @@ -24,13 +24,6 @@ class EntitySchemaTest extends EntityUnitTestBase { protected $database; /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('menu_link'); - - /** * {@inheritdoc} */ public function setUp() { diff --git a/core/modules/system/src/Tests/PhpStorage/PhpStorageFactoryTest.php b/core/modules/system/src/Tests/PhpStorage/PhpStorageFactoryTest.php index 248d203..60d91eb 100644 --- a/core/modules/system/src/Tests/PhpStorage/PhpStorageFactoryTest.php +++ b/core/modules/system/src/Tests/PhpStorage/PhpStorageFactoryTest.php @@ -21,6 +21,15 @@ * @see \Drupal\Core\PhpStorage\PhpStorageFactory */ class PhpStorageFactoryTest extends KernelTestBase { + protected function setUp() { + parent::setUp(); + + // Empty the php storage settings, as KernelTestBase sets it by default. + $settings = Settings::getAll(); + unset($settings['php_storage']); + new Settings($settings); + } + /** * Tests the get() method with no settings. diff --git a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php index 8edb4b2..159c8ed 100644 --- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php +++ b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php @@ -50,7 +50,7 @@ public function testInlineTemplate() { $settings['twig_auto_reload'] = TRUE; new Settings($settings); - $this->container = $this->kernel->rebuildContainer(); + $this->container = $this->container->get('kernel')->rebuildContainer(); \Drupal::setContainer($this->container); $element = array(); diff --git a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php index 1d83776..824abb9 100644 --- a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php +++ b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php @@ -49,6 +49,13 @@ class RowEntityRenderersTest extends ViewUnitTestBase { protected $expected; /** + * Some values used in the test, keyed by langcode. + * + * @var array + */ + protected $values; + + /** * {@inheritdoc} */ protected function setUp() { diff --git a/core/modules/views/src/Tests/Plugin/RowEntityTest.php b/core/modules/views/src/Tests/Plugin/RowEntityTest.php index 35bd1e2..7de0305 100644 --- a/core/modules/views/src/Tests/Plugin/RowEntityTest.php +++ b/core/modules/views/src/Tests/Plugin/RowEntityTest.php @@ -24,7 +24,7 @@ class RowEntityTest extends ViewUnitTestBase { * * @var array */ - public static $modules = ['taxonomy', 'text', 'filter', 'field', 'entity', 'system', 'node', 'user']; + public static $modules = ['taxonomy', 'text', 'filter', 'field', 'system', 'node', 'user']; /** * Views used by this test. diff --git a/core/tests/Drupal/Tests/KernelTestBase.php b/core/tests/Drupal/Tests/KernelTestBase.php index e292308..75c4754 100644 --- a/core/tests/Drupal/Tests/KernelTestBase.php +++ b/core/tests/Drupal/Tests/KernelTestBase.php @@ -19,6 +19,7 @@ use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Extension\ExtensionDiscovery; use Drupal\Core\Language\Language; +use Drupal\Core\Logger\RfcLogLevel; use Drupal\Core\Site\Settings; use Drupal\Core\StreamWrapper\StreamWrapperInterface; use Drupal\simpletest\AssertContentTrait; @@ -803,7 +804,7 @@ protected function disableModules(array $modules) { // Unset the list of modules in the extension handler. $module_handler = $this->container->get('module_handler'); $extensions = $module_handler->getModuleList(); - $extension_config = $this->container->get('config.factory')->get('core.extension'); + $extension_config = $this->container->get('config.factory')->getEditable('core.extension'); foreach ($modules as $module) { if (!$module_handler->moduleExists($module)) { throw new \LogicException("$module module cannot be disabled because it is not enabled."); @@ -1000,6 +1001,21 @@ protected function copyConfig(StorageInterface $source_storage, StorageInterface * @todo Add support for `@expectedLogMessage*` test method annotations. */ protected function setExpectedLogMessage($severity, $message = '') { + // Provide mapping from PSR log level to RFC log level. + $mapping = [ + LogLevel::EMERGENCY => RfcLogLevel::EMERGENCY, + LogLevel::ALERT => RfcLogLevel::ALERT, + LogLevel::CRITICAL => RfcLogLevel::CRITICAL, + LogLevel::ERROR => RfcLogLevel::ERROR, + LogLevel::WARNING => RfcLogLevel::WARNING, + LogLevel::NOTICE => RfcLogLevel::NOTICE, + LogLevel::INFO => RfcLogLevel::INFO, + LogLevel::DEBUG => RfcLogLevel::DEBUG, + ]; + if (isset($mapping[$severity])) { + $severity = $mapping[$severity]; + } + $this->expectedLogSeverity = $severity; $this->expectedLogMessage = $message; } diff --git a/core/tests/Drupal/Tests/KernelTestBaseTest.php b/core/tests/Drupal/Tests/KernelTestBaseTest.php index ca5cd04..04e78b3 100644 --- a/core/tests/Drupal/Tests/KernelTestBaseTest.php +++ b/core/tests/Drupal/Tests/KernelTestBaseTest.php @@ -87,7 +87,7 @@ public function testSetUpDoesNotLeak() { $expected = [ 'config' => 'config', - 'cacheTags' => 'cacheTags', + 'cachetags' => 'cachetags', ]; $schema = $this->container->get('database')->schema(); $this->assertEquals($expected, $schema->findTables('%'));