Unverified Commit 46bd90dc authored by alexpott's avatar alexpott
Browse files

Issue #3097453 by longwave, JeroenT, Berdir, Wim Leers: Remove system.module BC layers

parent 5fca5fee
......@@ -21,15 +21,10 @@ class AdminController extends ControllerBase {
/**
* AdminController constructor.
*
* @param \Drupal\Core\Extension\ModuleExtensionList|null $extension_list_module
* The module extension list. This is left optional for BC reasons, but the
* optional usage is deprecated and will become required in Drupal 9.0.0.
* @param \Drupal\Core\Extension\ModuleExtensionList $extension_list_module
* The module extension list.
*/
public function __construct(ModuleExtensionList $extension_list_module = NULL) {
if ($extension_list_module === NULL) {
@trigger_error('Calling AdminController::__construct() with the $module_extension_list argument is supported in drupal:8.8.0 and will be required before drupal:9.0.0. See https://www.drupal.org/node/2709919.', E_USER_DEPRECATED);
$extension_list_module = \Drupal::service('extension.list.module');
}
public function __construct(ModuleExtensionList $extension_list_module) {
$this->moduleExtensionList = $extension_list_module;
}
......
......@@ -28,11 +28,7 @@ class FileDownloadController extends ControllerBase {
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager
* The stream wrapper manager.
*/
public function __construct(StreamWrapperManagerInterface $streamWrapperManager = NULL) {
if (!$streamWrapperManager) {
@trigger_error('Calling FileDownloadController::__construct() without the $streamWrapperManager argument is deprecated in drupal:8.8.0. The $streamWrapperManager argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
$streamWrapperManager = \Drupal::service('stream_wrapper_manager');
}
public function __construct(StreamWrapperManagerInterface $streamWrapperManager) {
$this->streamWrapperManager = $streamWrapperManager;
}
......
......@@ -53,14 +53,10 @@ class FileSystemForm extends ConfigFormBase {
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system = NULL) {
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system) {
parent::__construct($config_factory);
$this->dateFormatter = $date_formatter;
$this->streamWrapperManager = $stream_wrapper_manager;
if (!$file_system) {
@trigger_error('Calling FileSystemForm::__construct() without the $file_system argument is deprecated in drupal:8.8.0. The $file_system argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3039255', E_USER_DEPRECATED);
$file_system = \Drupal::service('file_system');
}
$this->fileSystem = $file_system;
}
......
......@@ -82,17 +82,13 @@ class ThemeSettingsForm extends ConfigFormBase {
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, MimeTypeGuesserInterface $mime_type_guesser, ThemeManagerInterface $theme_manager, FileSystemInterface $file_system = NULL) {
public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, MimeTypeGuesserInterface $mime_type_guesser, ThemeManagerInterface $theme_manager, FileSystemInterface $file_system) {
parent::__construct($config_factory);
$this->moduleHandler = $module_handler;
$this->themeHandler = $theme_handler;
$this->mimeTypeGuesser = $mime_type_guesser;
$this->themeManager = $theme_manager;
if (!$file_system) {
@trigger_error('The file_system service must be passed to ThemeSettingsForm::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
$file_system = \Drupal::service('file_system');
}
$this->fileSystem = $file_system;
}
......
......@@ -54,13 +54,9 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa
* @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail
* The active menu trail service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail = NULL) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->menuTree = $menu_tree;
if ($menu_active_trail === NULL) {
@trigger_error('The menu.active_trail service must be passed to SystemMenuBlock::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2669550.', E_USER_DEPRECATED);
$menu_active_trail = \Drupal::service('menu.active_trail');
}
$this->menuActiveTrail = $menu_active_trail;
}
......
......@@ -88,13 +88,9 @@ class GDToolkit extends ImageToolkitBase {
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system = NULL) {
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $operation_manager, $logger, $config_factory);
$this->streamWrapperManager = $stream_wrapper_manager;
if (!$file_system) {
@trigger_error('The file_system service must be passed to GDToolkit::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
$file_system = \Drupal::service('file_system');
}
$this->fileSystem = $file_system;
}
......
<?php
namespace Drupal\system\Plugin\views\field;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\views\Plugin\views\field\BulkForm as ViewsBulkForm;
/**
* Defines a actions-based bulk operation form element.
*
* @ViewsField("legacy_bulk_form")
*
* @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use
* \Drupal\views\Plugin\views\field\BulkForm instead.
*
* @see https://www.drupal.org/node/2916716
*/
class BulkForm extends ViewsBulkForm {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, MessengerInterface $messenger, EntityRepositoryInterface $entity_repository) {
@trigger_error(__NAMESPACE__ . '\BulkForm is deprecated in drupal:8.5.0, will be removed before drupal:9.0.0. Use \Drupal\views\Plugin\views\field\BulkForm instead. See https://www.drupal.org/node/2916716.', E_USER_DEPRECATED);
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $language_manager, $messenger, $entity_repository);
}
}
<?php
namespace Drupal\system;
@trigger_error(__NAMESPACE__ . '\SystemRequirements is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All supported PHP versions support disabling multi-statement queries in MySQL. See https://www.drupal.org/node/3054692', E_USER_DEPRECATED);
/**
* Class for helper methods used for the system requirements.
*/
class SystemRequirements {
/**
* Determines whether the passed in PHP version disallows multiple statements.
*
* @param string $phpversion
*
* @return bool
*
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. All
* supported PHP versions support disabling multi-statement queries in
* MySQL.
*
* @see https://www.drupal.org/node/3054692
*/
public static function phpVersionWithPdoDisallowMultipleStatements($phpversion) {
@trigger_error(__NAMESPACE__ . '\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All supported PHP versions support disabling multi-statement queries in MySQL. See https://www.drupal.org/node/3054692', E_USER_DEPRECATED);
// PDO::MYSQL_ATTR_MULTI_STATEMENTS was introduced in PHP versions 5.5.21
// and 5.6.5.
return (version_compare($phpversion, '5.5.21', '>=') && version_compare($phpversion, '5.6.0', '<'))
|| version_compare($phpversion, '5.6.5', '>=');
}
}
<?php
namespace Drupal\system\Tests\Cache;
@trigger_error(__NAMESPACE__ . '\CacheTestBase is deprecated for removal before Drupal 9.0.0. Use \Drupal\Tests\system\Functional\Cache\CacheTestBase instead. See https://www.drupal.org/node/2999939', E_USER_DEPRECATED);
use Drupal\simpletest\WebTestBase;
/**
* Provides helper methods for cache tests.
*
* @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
* Use \Drupal\Tests\system\Functional\Cache\CacheTestBase instead.
*
* @see https://www.drupal.org/node/2999939
*/
abstract class CacheTestBase extends WebTestBase {
protected $defaultBin = 'render';
protected $defaultCid = 'test_temporary';
protected $defaultValue = 'CacheTest';
/**
* Checks whether or not a cache entry exists.
*
* @param $cid
* The cache id.
* @param $var
* The variable the cache should contain.
* @param $bin
* The bin the cache item was stored in.
* @return
* TRUE on pass, FALSE on fail.
*/
protected function checkCacheExists($cid, $var, $bin = NULL) {
if ($bin == NULL) {
$bin = $this->defaultBin;
}
$cached = \Drupal::cache($bin)->get($cid);
return isset($cached->data) && $cached->data == $var;
}
/**
* Asserts that a cache entry exists.
*
* @param $message
* Message to display.
* @param $var
* The variable the cache should contain.
* @param $cid
* The cache id.
* @param $bin
* The bin the cache item was stored in.
*/
protected function assertCacheExists($message, $var = NULL, $cid = NULL, $bin = NULL) {
if ($bin == NULL) {
$bin = $this->defaultBin;
}
if ($cid == NULL) {
$cid = $this->defaultCid;
}
if ($var == NULL) {
$var = $this->defaultValue;
}
$this->assertTrue($this->checkCacheExists($cid, $var, $bin), $message);
}
/**
* Asserts that a cache entry has been removed.
*
* @param $message
* Message to display.
* @param $cid
* The cache id.
* @param $bin
* The bin the cache item was stored in.
*/
public function assertCacheRemoved($message, $cid = NULL, $bin = NULL) {
if ($bin == NULL) {
$bin = $this->defaultBin;
}
if ($cid == NULL) {
$cid = $this->defaultCid;
}
$cached = \Drupal::cache($bin)->get($cid);
$this->assertFalse($cached, $message);
}
}
<?php
namespace Drupal\system\Tests\Cache;
@trigger_error(__NAMESPACE__ . '\PageCacheTagsTestBase is deprecated for removal before Drupal 9.0.0. Use \Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase instead. See https://www.drupal.org/node/2999939', E_USER_DEPRECATED);
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
use Drupal\Component\Render\FormattableMarkup;
/**
* Provides helper methods for page cache tags tests.
*
* @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
* Use \Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase instead.
*
* @see https://www.drupal.org/node/2999939
*/
abstract class PageCacheTagsTestBase extends WebTestBase {
/**
* {@inheritdoc}
*
* Always enable header dumping in page cache tags tests, this aids debugging.
*/
protected $dumpHeaders = TRUE;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Enable page caching.
$config = $this->config('system.performance');
$config->set('cache.page.max_age', 3600);
$config->save();
}
/**
* Verify that when loading a given page, it's a page cache hit or miss.
*
* @param \Drupal\Core\Url $url
* The page for this URL will be loaded.
* @param string $hit_or_miss
* 'HIT' if a page cache hit is expected, 'MISS' otherwise.
*
* @param array|false $tags
* When expecting a page cache hit, you may optionally specify an array of
* expected cache tags. While FALSE, the cache tags will not be verified.
*/
protected function verifyPageCache(Url $url, $hit_or_miss, $tags = FALSE) {
$this->drupalGet($url);
$message = new FormattableMarkup('Page cache @hit_or_miss for %path.', ['@hit_or_miss' => $hit_or_miss, '%path' => $url->toString()]);
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), $hit_or_miss, $message);
if ($hit_or_miss === 'HIT' && is_array($tags)) {
$absolute_url = $url->setAbsolute()->toString();
$cid_parts = [$absolute_url, 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$tags = array_unique($tags);
sort($tags);
$this->assertIdentical($cache_entry->tags, $tags);
}
}
}
<?php
namespace Drupal\system\Tests\Database;
@trigger_error(__NAMESPACE__ . '\DatabaseWebTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Database\DatabaseTestBase', E_USER_DEPRECATED);
use Drupal\KernelTests\Core\Database\DatabaseTestBase;
use Drupal\simpletest\WebTestBase;
/**
* Base class for databases database tests.
*
* @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Instead
* use \Drupal\Tests\system\Functional\Database\DatabaseTestBase.
*/
abstract class DatabaseWebTestBase extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['database_test'];
protected function setUp() {
parent::setUp();
DatabaseTestBase::addSampleData();
}
}
<?php
namespace Drupal\system\Tests\Database;
@trigger_error(__NAMESPACE__ . '\FakeRecord is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Database\FakeRecord', E_USER_DEPRECATED);
/**
* Fetches into a class.
*
* PDO supports using a new instance of an arbitrary class for records
* rather than just a stdClass or array. This class is for testing that
* functionality. (See testQueryFetchClass() below)
*
* @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Instead
* use \Drupal\Tests\system\Functional\Database\FakeRecord.
*/
class FakeRecord {}
<?php
namespace Drupal\system\Tests\Entity;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
@trigger_error(__NAMESPACE__ . '\EntityWithUriCacheTagsTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Entity\EntityWithUriCacheTagsTestBase. See https://www.drupal.org/node/2946549.', E_USER_DEPRECATED);
/**
* Provides helper methods for Entity cache tags tests; for entities with URIs.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0.
* Use \Drupal\Tests\system\Functional\Entity\EntityWithUriCacheTagsTestBase.
*
* @see https://www.drupal.org/node/2946549
*/
abstract class EntityWithUriCacheTagsTestBase extends EntityCacheTagsTestBase {
/**
* Tests cache tags presence and invalidation of the entity at its URI.
*
* Tests the following cache tags:
* - "<entity type>_view"
* - "<entity_type>:<entity ID>"
*/
public function testEntityUri() {
$entity_url = $this->entity->toUrl();
$entity_type = $this->entity->getEntityTypeId();
// Selects the view mode that will be used.
$view_mode = $this->selectViewMode($entity_type);
// The default cache contexts for rendered entities.
$entity_cache_contexts = $this->getDefaultCacheContexts();
// Generate the standardized entity cache tags.
$cache_tag = $this->entity->getCacheTags();
$view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)->getCacheTags();
$render_cache_tag = 'rendered';
$this->pass("Test entity.", 'Debug');
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit, but also the presence of the correct cache tags.
$this->verifyPageCache($entity_url, 'HIT');
// Also verify the existence of an entity render cache entry, if this entity
// type supports render caching.
if (\Drupal::entityTypeManager()->getDefinition($entity_type)->isRenderCacheable()) {
$cache_keys = ['entity_view', $entity_type, $this->entity->id(), $view_mode];
$cid = $this->createCacheId($cache_keys, $entity_cache_contexts);
$redirected_cid = NULL;
$additional_cache_contexts = $this->getAdditionalCacheContextsForEntity($this->entity);
if (count($additional_cache_contexts)) {
$redirected_cid = $this->createCacheId($cache_keys, Cache::mergeContexts($entity_cache_contexts, $additional_cache_contexts));
}
$expected_cache_tags = Cache::mergeTags($cache_tag, $view_cache_tag);
$expected_cache_tags = Cache::mergeTags($expected_cache_tags, $this->getAdditionalCacheTagsForEntity($this->entity));
$expected_cache_tags = Cache::mergeTags($expected_cache_tags, [$render_cache_tag]);
$this->verifyRenderCache($cid, $expected_cache_tags, $redirected_cid);
}
// Verify that after modifying the entity, there is a cache miss.
$this->pass("Test modification of entity.", 'Debug');
$this->entity->save();
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
// Verify that after modifying the entity's display, there is a cache miss.
$this->pass("Test modification of entity's '$view_mode' display.", 'Debug');
$entity_display = \Drupal::service('entity_display.repository')
->getViewDisplay($entity_type, $this->entity->bundle(), $view_mode);
$entity_display->save();
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
if ($bundle_entity_type_id = $this->entity->getEntityType()->getBundleEntityType()) {
// Verify that after modifying the corresponding bundle entity, there is a
// cache miss.
$this->pass("Test modification of entity's bundle entity.", 'Debug');
$bundle_entity = $this->container->get('entity_type.manager')
->getStorage($bundle_entity_type_id)
->load($this->entity->bundle());
$bundle_entity->save();
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
}
if ($this->entity->getEntityType()->get('field_ui_base_route')) {
// Verify that after modifying a configurable field on the entity, there
// is a cache miss.
$this->pass("Test modification of entity's configurable field.", 'Debug');
$field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field';
$field_storage = FieldStorageConfig::load($field_storage_name);
$field_storage->save();
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
// Verify that after modifying a configurable field on the entity, there
// is a cache miss.
$this->pass("Test modification of entity's configurable field.", 'Debug');
$field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field';
$field = FieldConfig::load($field_name);
$field->save();
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
}
// Verify that after invalidating the entity's cache tag directly, there is
// a cache miss.
$this->pass("Test invalidation of entity's cache tag.", 'Debug');
Cache::invalidateTags($this->entity->getCacheTagsToInvalidate());
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
// Verify that after invalidating the generic entity type's view cache tag
// directly, there is a cache miss.
$this->pass("Test invalidation of entity's 'view' cache tag.", 'Debug');
Cache::invalidateTags($view_cache_tag);
$this->verifyPageCache($entity_url, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($entity_url, 'HIT');
// Verify that after deleting the entity, there is a cache miss.
$this->pass('Test deletion of entity.', 'Debug');
$this->entity->delete();
$this->verifyPageCache($entity_url, 'MISS');
$this->assertResponse(404);
}
/**
* Gets the default cache contexts for rendered entities.
*
* @return array
* The default cache contexts for rendered entities.
*/
protected function getDefaultCacheContexts() {
return ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'];
}
}
<?php
namespace Drupal\system\Tests\Image;
@trigger_error(__FILE__ . ' is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use Drupal\FunctionalTests\Image\ToolkitTestBase instead. See https://www.drupal.org/node/2862641.', E_USER_DEPRECATED);
use Drupal\simpletest\WebTestBase;
use Drupal\Component\Render\FormattableMarkup;
/**
* Base class for image manipulation testing.
*
* @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0.
* Use Drupal\FunctionalTests\Image\ToolkitTestBase instead.
*
* @see https://www.drupal.org/node/2862641
*/
abstract class ToolkitTestBase extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['image_test'];
/**
* The URI for the file.
*
* @var string
*/
protected $file;