Commit 6ab5a3aa authored by alexpott's avatar alexpott

Issue #2715741 by Mile23, pfrenssen: Fix 'Drupal.Classes.FullyQualifiedNamespace' coding standard

parent 3eeaeb64
......@@ -14,6 +14,7 @@
use Drupal\Component\Utility\SortArray;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Render\Element\Link;
use Drupal\Core\Render\Markup;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\PhpStorage\PhpStorageFactory;
......@@ -748,7 +749,7 @@ function drupal_clear_js_cache() {
* Use \Drupal\Core\Render\Element\Link::preRenderLink().
*/
function drupal_pre_render_link($element) {
return Element\Link::preRenderLink($element);
return Link::preRenderLink($element);
}
/**
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -29,7 +30,7 @@
function template_preprocess_select(&$variables) {
$element = $variables['element'];
Element::setAttributes($element, array('id', 'name', 'size'));
Element\RenderElement::setAttributes($element, array('form-select'));
RenderElement::setAttributes($element, array('form-select'));
$variables['attributes'] = $element['#attributes'];
$variables['options'] = form_select_options($element);
......@@ -191,7 +192,7 @@ function form_get_options($element, $key) {
function template_preprocess_fieldset(&$variables) {
$element = $variables['element'];
Element::setAttributes($element, array('id'));
Element\RenderElement::setAttributes($element);
RenderElement::setAttributes($element);
$variables['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array();
$variables['prefix'] = isset($element['#field_prefix']) ? $element['#field_prefix'] : NULL;
$variables['suffix'] = isset($element['#field_suffix']) ? $element['#field_suffix'] : NULL;
......@@ -376,7 +377,7 @@ function template_preprocess_form(&$variables) {
function template_preprocess_textarea(&$variables) {
$element = $variables['element'];
Element::setAttributes($element, array('id', 'name', 'rows', 'cols', 'placeholder'));
Element\RenderElement::setAttributes($element, array('form-textarea'));
RenderElement::setAttributes($element, array('form-textarea'));
$variables['wrapper_attributes'] = new Attribute();
$variables['attributes'] = new Attribute($element['#attributes']);
$variables['value'] = $element['#value'];
......
......@@ -2,6 +2,7 @@
namespace Drupal\Core;
use Drupal\Component\Assertion\Handle;
use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
......@@ -18,6 +19,7 @@
use Drupal\Core\Language\Language;
use Drupal\Core\Site\Settings;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -923,7 +925,7 @@ public static function bootEnvironment() {
assert_options(ASSERT_ACTIVE, TRUE);
// Now synchronize PHP 5 and 7's handling of assertions as much as
// possible.
\Drupal\Component\Assertion\Handle::register();
Handle::register();
// Log fatal errors to the test site directory.
ini_set('log_errors', 1);
......@@ -978,7 +980,7 @@ protected function initializeSettings(Request $request) {
&& Settings::get('class_loader_auto_detect', TRUE)
&& extension_loaded('apc')) {
$prefix = Settings::getApcuPrefix('class_loader', $this->root);
$apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader);
$apc_loader = new ApcClassLoader($prefix, $this->classLoader);
$this->classLoader->unregister();
$apc_loader->register();
$this->classLoader = $apc_loader;
......
......@@ -2,6 +2,8 @@
namespace Drupal\Core\PageCache;
use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\Session\SessionConfigurationInterface;
/**
......@@ -20,8 +22,8 @@ class DefaultRequestPolicy extends ChainRequestPolicy {
* The session configuration.
*/
public function __construct(SessionConfigurationInterface $session_configuration) {
$this->addPolicy(new RequestPolicy\CommandLineOrUnsafeMethod());
$this->addPolicy(new RequestPolicy\NoSessionOpen($session_configuration));
$this->addPolicy(new CommandLineOrUnsafeMethod());
$this->addPolicy(new NoSessionOpen($session_configuration));
}
}
......@@ -4,6 +4,7 @@
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
......@@ -63,7 +64,7 @@ protected function createEntity() {
*/
public function testEntityCreation() {
// Create a cache entry that is tagged with a feed cache tag.
\Drupal::cache('render')->set('foo', 'bar', \Drupal\Core\Cache\CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags());
\Drupal::cache('render')->set('foo', 'bar', CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags());
// Verify a cache hit.
$this->verifyRenderCache('foo', array('aggregator_feed:1'));
......
......@@ -9,6 +9,7 @@
use Drupal\big_pipe\Render\BigPipeMarkup;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -93,7 +94,7 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf
'theme' => 'classy',
'libraries' => 'big_pipe/big_pipe,classy/base,classy/messages,core/drupal.active-link,core/html5shiv,core/normalize,system/base',
],
'pluralDelimiter' => \Drupal\Core\StringTranslation\PluralTranslatableMarkup::DELIMITER,
'pluralDelimiter' => PluralTranslatableMarkup::DELIMITER,
'user' => [
'uid' => '1',
'permissionsHash' => $container->get('user_permissions_hash_generator')->generate($user),
......
......@@ -361,7 +361,7 @@ protected function getTestCases() {
$csrf_token_seed = unserialize(explode('_sf2_meta|', $session_data)[1])['s'];
$this->container->get('session_manager.metadata_bag')->setCsrfTokenSeed($csrf_token_seed);
return \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases($this->container, $this->rootUser);
return BigPipePlaceholderTestCases::cases($this->container, $this->rootUser);
}
/**
......
......@@ -3,6 +3,7 @@
namespace Drupal\big_pipe_test;
use Drupal\big_pipe\Render\BigPipeMarkup;
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber;
class BigPipeTestController {
......@@ -15,7 +16,7 @@ class BigPipeTestController {
public function test() {
$build = [];
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
$cases = BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
// 1. HTML placeholder: status messages. Drupal renders those automatically,
// so all that we need to do in this controller is set a message.
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\big_pipe\Unit\Render\Placeholder;
use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy;
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\SessionConfigurationInterface;
use Drupal\Tests\UnitTestCase;
......@@ -61,7 +62,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat
* @see \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases
*/
public function placeholdersProvider() {
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases();
$cases = BigPipePlaceholderTestCases::cases();
// Generate $placeholders variable as expected by
// \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders().
......
......@@ -82,7 +82,7 @@ protected function createEntity() {
'entity_id' => $this->entityTestCamelid->id(),
'entity_type' => 'entity_test',
'field_name' => 'comment',
'status' => \Drupal\comment\CommentInterface::PUBLISHED,
'status' => CommentInterface::PUBLISHED,
));
$comment->save();
......
......@@ -5,10 +5,12 @@
* Provides hook implementations for testing purposes.
*/
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_ENTITY_TYPE_create.
*/
function config_install_dependency_test_config_test_create(\Drupal\Core\Entity\EntityInterface $entity) {
function config_install_dependency_test_config_test_create(EntityInterface $entity) {
// Add an enforced dependency on this module so that we can test if this is
// possible during module installation.
$entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]);
......
......@@ -6,13 +6,14 @@
*/
use Drupal\contact\ContactFormInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_entity_base_field_info().
*/
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
function contact_storage_test_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() == 'contact_message') {
$fields = array();
......
......@@ -7,6 +7,7 @@
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface;
use Drupal\field\ConfigImporterFieldPurger;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldConfigInterface;
......@@ -168,7 +169,7 @@ function field_cron() {
/**
* Implements hook_entity_field_storage_info().
*/
function field_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
function field_entity_field_storage_info(EntityTypeInterface $entity_type) {
if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
// Query by filtering on the ID as this is more efficient than filtering
// on the entity_type property directly.
......@@ -301,7 +302,7 @@ function _field_create_entity_from_ids($ids) {
* Implements hook_config_import_steps_alter().
*/
function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_importer) {
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge(
$field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'),
$config_importer->getStorageComparer()->getChangelist('delete')
);
......@@ -327,7 +328,7 @@ function field_form_config_admin_import_form_alter(&$form, FormStateInterface $f
$user_input = $form_state->getUserInput();
$storage_comparer = $form_state->get('storage_comparer');
if ($storage_comparer && empty($user_input)) {
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge(
$field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$storage_comparer->getSourceStorage()->read('core.extension'),
$storage_comparer->getChangelist('delete')
);
......
......@@ -8,6 +8,7 @@
use Drupal\Core\Database\Database;
use Drupal\Component\Serialization\Yaml;
use Drupal\field\Entity\FieldStorageConfig;
$connection = Database::getConnection();
......@@ -59,8 +60,8 @@
->execute()
->fetchField();
$installed = unserialize($installed);
$installed['field_ref_views_select_2429191'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_views_select_2429191);
$installed['field_ref_autocreate_2412569'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_autocreate_2412569);
$installed['field_ref_views_select_2429191'] = new FieldStorageConfig($field_ref_views_select_2429191);
$installed['field_ref_autocreate_2412569'] = new FieldStorageConfig($field_ref_autocreate_2412569);
$connection->update('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'node.field_storage_definitions')
......
......@@ -13,8 +13,9 @@
* test helper functions
*/
use Drupal\field\FieldStorageConfigInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\field\FieldStorageConfigInterface;
require_once __DIR__ . '/field_test.entity.inc';
require_once __DIR__ . '/field_test.field.inc';
......@@ -149,7 +150,7 @@ function field_test_entity_extra_field_info_alter(&$info) {
/**
* Implements hook_entity_bundle_field_info_alter().
*/
function field_test_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
function field_test_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if (($field_name = \Drupal::state()->get('field_test_set_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) {
$fields[$field_name]->setPropertyConstraints('value', [
'Range' => [
......
......@@ -5,12 +5,15 @@
* Test module.
*/
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FormatterInterface;
use Drupal\Core\Field\WidgetInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_field_widget_third_party_settings_form().
*/
function field_third_party_test_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
function field_third_party_test_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
$element['field_test_widget_third_party_settings_form'] = array(
'#type' => 'textfield',
'#title' => t('3rd party widget settings form'),
......@@ -30,7 +33,7 @@ function field_third_party_test_field_widget_settings_summary_alter(&$summary, $
/**
* Implements hook_field_formatter_third_party_settings_form().
*/
function field_third_party_test_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
function field_third_party_test_field_formatter_third_party_settings_form(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
$element['field_test_field_formatter_third_party_settings_form'] = array(
'#type' => 'textfield',
'#title' => t('3rd party formatter settings form'),
......
......@@ -207,7 +207,7 @@ function testFilterFormatAPI() {
// Test on nonsensical_restricted_html, where the allowed attribute values
// contain asterisks, which do not have any meaning, but which we also
// cannot prevent because configuration can be modified outside of forms.
$nonsensical_restricted_html = \Drupal\filter\Entity\FilterFormat::create(array(
$nonsensical_restricted_html = FilterFormat::create(array(
'format' => 'nonsensical_restricted_html',
'name' => 'Nonsensical Restricted HTML',
'filters' => array(
......@@ -468,7 +468,7 @@ public function assertFilterFormatViolation(ConstraintViolationListInterface $vi
*/
public function testDependencyRemoval() {
$this->installSchema('user', array('users_data'));
$filter_format = \Drupal\filter\Entity\FilterFormat::load('filtered_html');
$filter_format = FilterFormat::load('filtered_html');
// Disable the filter_test_restrict_tags_and_attributes filter plugin but
// have custom configuration so that the filter plugin is still configured
......@@ -498,7 +498,7 @@ public function testDependencyRemoval() {
// Verify the filter format still exists but the dependency and filter is
// gone.
\Drupal::entityManager()->getStorage('filter_format')->resetCache();
$filter_format = \Drupal\filter\Entity\FilterFormat::load('filtered_html');
$filter_format = FilterFormat::load('filtered_html');
$this->assertEqual([], $filter_format->getDependencies());
// Use the get method since the FilterFormat::filters() method only returns
// existing plugins.
......
......@@ -8,6 +8,7 @@
use Drupal\comment\CommentInterface;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
......@@ -134,7 +135,7 @@ function forum_uri($forum) {
/**
* Implements hook_entity_bundle_field_info_alter().
*/
function forum_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
function forum_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if ($entity_type->id() == 'node' && !empty($fields['taxonomy_forums'])) {
$fields['taxonomy_forums']->addConstraint('ForumLeaf', []);
}
......
......@@ -340,7 +340,7 @@ function locale_translate_batch_refresh(&$context) {
// Clear cache and force refresh of JavaScript translations.
_locale_refresh_translations($context['sandbox']['refresh']['languages'], $next);
// Check whether we need to refresh configuration objects.
if ($names = \Drupal\locale\Locale::config()->getStringNames($next)) {
if ($names = Locale::config()->getStringNames($next)) {
$context['sandbox']['refresh']['names_finished'] = $context['finished'];
$context['sandbox']['refresh']['names'] = $names;
}
......@@ -533,7 +533,7 @@ function locale_translate_delete_translation_files(array $projects = array(), ar
*/
function locale_config_batch_update_components(array $options, array $langcodes = array(), array $components = array()) {
$langcodes = $langcodes ? $langcodes : array_keys(\Drupal::languageManager()->getLanguages());
if ($langcodes && $names = \Drupal\locale\Locale::config()->getComponentNames($components)) {
if ($langcodes && $names = Locale::config()->getComponentNames($components)) {
return locale_config_batch_build($names, $langcodes, $options);
}
}
......
......@@ -67,7 +67,7 @@ protected function setUp() {
// @see locale_system_update()
locale_system_set_config_langcodes();
$langcodes = array_keys(\Drupal::languageManager()->getLanguages());
$names = \Drupal\locale\Locale::config()->getComponentNames();
$names = Locale::config()->getComponentNames();
Locale::config()->updateConfigTranslations($names, $langcodes);
$this->configFactory = $this->container->get('config.factory');
......
......@@ -19,6 +19,7 @@
* @see \Drupal\node\Tests\NodeAccessBaseTableTest
*/
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
......@@ -144,7 +145,7 @@ function node_access_test_add_field(NodeTypeInterface $type) {
/**
* Implements hook_node_access().
*/
function node_access_test_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) {
function node_access_test_node_access(NodeInterface $node, $op, AccountInterface $account) {
$secret_catalan = \Drupal::state()
->get('node_access_test_secret_catalan') ?: 0;
if ($secret_catalan && $node->language()->getId() == 'ca') {
......
......@@ -8,6 +8,7 @@
* interaction with the Node module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
......@@ -151,7 +152,7 @@ function node_test_node_update(NodeInterface $node) {
/**
* Implements hook_entity_view_mode_alter().
*/
function node_test_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) {
function node_test_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
// Only alter the view mode if we are on the test callback.
$change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: '';
if ($change_view_mode) {
......
......@@ -2,6 +2,7 @@
namespace Drupal\Tests\node\Kernel;
use Drupal\user\UserInterface;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
......@@ -56,7 +57,7 @@ public function testFieldOverrides() {
/** @var \Drupal\node\NodeInterface $node */
$node = Node::create(['type' => 'ponies']);
$owner = $node->getOwner();
$this->assertTrue($owner instanceof \Drupal\user\UserInterface);
$this->assertTrue($owner instanceof UserInterface);
$this->assertEqual($owner->id(), $this->user->id());
}
......
......@@ -5,6 +5,8 @@
* Responsive image display formatter for image fields.
*/
use Drupal\Core\Template\Attribute;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\image\Entity\ImageStyle;
......@@ -162,7 +164,7 @@ function template_preprocess_responsive_image(&$variables) {
// execution.
if (!$responsive_image_style) {
$variables['img_element'] = [];
\Drupal::logger('responsive_image')->log(\Drupal\Core\Logger\RfcLogLevel::ERROR, 'Failed to load responsive image style: “@style“ while displaying responsive image.', ['@style' => $variables['responsive_image_style_id']]);
\Drupal::logger('responsive_image')->log(RfcLogLevel::ERROR, 'Failed to load responsive image style: “@style“ while displaying responsive image.', ['@style' => $variables['responsive_image_style_id']]);
return;
}
// Retrieve all breakpoints and multipliers and reverse order of breakpoints.
......@@ -411,7 +413,7 @@ function responsive_image_build_source_attributes(ImageInterface $image, array $
}
// Sort the srcset from small to large image width or multiplier.
ksort($srcset);
$source_attributes = new \Drupal\Core\Template\Attribute(array(
$source_attributes = new Attribute(array(
'srcset' => implode(', ', array_unique($srcset)),
));
$media_query = trim($breakpoint->getMediaQuery());
......@@ -494,7 +496,7 @@ function _responsive_image_image_style_url($style_name, $path) {
return 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
}
$entity = ImageStyle::load($style_name);
if ($entity instanceof Drupal\image\Entity\ImageStyle) {
if ($entity instanceof ImageStyle) {
return file_url_transform_relative($entity->buildUrl($path));
}
return file_url_transform_relative(file_create_url($path));
......
......@@ -2,6 +2,7 @@
namespace Drupal\shortcut\Tests;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
use Drupal\user\Entity\Role;
......@@ -55,7 +56,7 @@ protected function createEntity() {
public function testEntityCreation() {
// Create a cache entry that is tagged with a shortcut set cache tag.
$cache_tags = ['config:shortcut.set.default'];
\Drupal::cache('render')->set('foo', 'bar', \Drupal\Core\Cache\CacheBackendInterface::CACHE_PERMANENT, $cache_tags);
\Drupal::cache('render')->set('foo', 'bar', CacheBackendInterface::CACHE_PERMANENT, $cache_tags);
// Verify a cache hit.
$this->verifyRenderCache('foo', $cache_tags);
......
......@@ -2,6 +2,7 @@
namespace Drupal\simpletest;
use Drupal\Component\Assertion\Handle;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\SafeMarkup;
......@@ -1019,7 +1020,7 @@ public function run(array $methods = array()) {
// Force assertion failures to be thrown as AssertionError for PHP 5 & 7
// compatibility.
\Drupal\Component\Assertion\Handle::register();
Handle::register();
set_error_handler(array($this, 'errorHandler'));
// Iterate through all the methods in this class, unless a specific list of
......
......@@ -27,6 +27,7 @@
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Yaml\Yaml as SymfonyYaml;
use Zend\Diactoros\Uri;
/**
......@@ -635,7 +636,7 @@ protected function prepareSettings() {
copy($settings_services_file, $directory . '/services.yml');
if ($this->strictConfigSchema) {
// Add a listener to validate configuration schema on save.
$yaml = new \Symfony\Component\Yaml\Yaml();
$yaml = new SymfonyYaml();
$content = file_get_contents($directory . '/services.yml');
$services = $yaml->parse($content);
$services['services']['simpletest.config_schema_checker'] = [
......
......@@ -25,7 +25,7 @@ class TestInfoParsingTest extends UnitTestCase {
* @dataProvider infoParserProvider
*/
public function testTestInfoParser($expected, $classname, $doc_comment = NULL) {
$info = \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
$info = TestDiscovery::getTestInfo($classname, $doc_comment);
$this->assertEquals($expected, $info);
}
......@@ -245,7 +245,7 @@ public function testTestInfoParserMissingGroup() {
* Bulk delete storages and fields, and clean up afterwards.
*/
EOT;
\Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
TestDiscovery::getTestInfo($classname, $doc_comment);
}
/**
......@@ -258,7 +258,7 @@ public function testTestInfoParserMissingSummary() {
* @group field
*/
EOT;
$info = \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
$info = TestDiscovery::getTestInfo($classname, $doc_comment);
$this->assertEmpty($info['description']);
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\system\Tests\Ajax;
use Drupal\ajax_test\Controller\AjaxTestController;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Url;
......@@ -29,7 +30,7 @@ public function testDialog() {
$this->drupalGet('ajax-test/dialog');
// Set up variables for this test.
$dialog_renderable = \Drupal\ajax_test\Controller\AjaxTestController::dialogContents();
$dialog_renderable = AjaxTestController::dialogContents();
$dialog_contents = \Drupal::service('renderer')->renderRoot($dialog_renderable);
$modal_expected_response = array(
'command' => 'openDialog',
......
......@@ -2,6 +2,8 @@
namespace Drupal\system\Tests\System;
use Drupal\Core\Flood\DatabaseBackend;
use Drupal\Core\Flood\MemoryBackend;
use Drupal\simpletest\WebTestBase;
use Symfony\Component\HttpFoundation\Request;
......@@ -59,7 +61,7 @@ public function testMemoryBackend() {
$name = 'flood_test_cleanup';
$request_stack = \Drupal::service('request_stack');
$flood = new \Drupal\Core\Flood\MemoryBackend($request_stack);
$flood = new MemoryBackend($request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
......@@ -87,7 +89,7 @@ public function testDatabaseBackend() {
$connection = \Drupal::service('database');
$request_stack = \Drupal::service('request_stack');
$flood = new \Drupal\Core\Flood\DatabaseBackend($connection, $request_stack);
$flood = new DatabaseBackend($connection, $request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
......
......@@ -2,14 +2,22 @@
namespace Drupal\system\Tests\TypedData;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\TypedData\ListDataDefinition;
use Drupal\Core\TypedData\MapDataDefinition;
use Drupal\Core\TypedData\Type\BinaryInterface;
use Drupal\Core\TypedData\Type\BooleanInterface;
use Drupal\Core\TypedData\Type\DateTimeInterface;
use Drupal\Core\TypedData\Type\DurationInterface;
use Drupal\Core\TypedData\Type\FloatInterface;
use Drupal\Core\TypedData\Type\IntegerInterface;
use Drupal\Core\TypedData\Type\StringInterface;
use Drupal\Core\TypedData\Type\UriInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\file\Entity\File;
use Drupal\simpletest\KernelTestBase;
use Drupal\Core\Datetime\DrupalDateTime;
/**
* Tests the functionality of all core data types.
......@@ -49,7 +57,7 @@ protected function createTypedData($definition, $value = NULL, $name = NULL) {
$definition = DataDefinition::create($definition['type']);
}
$data = $this->typedDataManager->create($definition, $value, $name);
$this->assertTrue($data instanceof \Drupal\Core\TypedData\TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
$this->assertTrue($data instanceof TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
return $data;
}
......@@ -59,7 +67,7 @@ protected function createTypedData($definition, $value = NULL, $name = NULL) {
public function testGetAndSet() {
// Boolean type.
$typed_data = $this->createTypedData(array('type' => 'boolean'), TRUE);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
$this->assertTrue($typed_data instanceof BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
$this->assertTrue($typed_data->getValue() === TRUE, 'Boolean value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(FALSE);
......@@ -75,7 +83,7 @@ public function testGetAndSet() {
// String type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'string'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'String value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = $this->randomString();
......@@ -93,7 +101,7 @@ public function testGetAndSet() {
// Integer type.
$value = rand();
$typed_data = $this->createTypedData(array('type' => 'integer'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
$this->assertTrue($typed_data instanceof IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Integer value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = rand();
......@@ -110,7 +118,7 @@ public function testGetAndSet() {
// Float type.
$value = 123.45;
$typed_data = $this->createTypedData(array('type' => 'float'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\FloatInterface, 'Typed data object is an instance of FloatInterface.');
$this->assertTrue($typed_data instanceof FloatInterface, 'Typed data object is an instance of FloatInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Float value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = 678.90;
......@@ -127,7 +135,7 @@ public function testGetAndSet() {
// Date Time type.
$value = '2014-01-01T20:00:00+00:00';
$typed_data = $this->createTypedData(array('type' => 'datetime_iso8601'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data instanceof DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data->getValue() == $value, 'Date value was fetched.');
$this->assertEqual($typed_data->getValue(), $typed_data->getDateTime()->format('c'), 'Value representation of a date is ISO 8601');
$this->assertEqual($typed_data->validate()->count(), 0);
......@@ -153,7 +161,7 @@ public function testGetAndSet() {
// Timestamp type.
$value = REQUEST_TIME;
$typed_data = $this->createTypedData(array('type' => 'timestamp'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterf