From 9eae24d84486d67b08695c8dc583e5c285d23427 Mon Sep 17 00:00:00 2001
From: Pantheon Automation
Date: Wed, 4 May 2016 14:35:41 -0700
Subject: [PATCH] Update to Drupal 8.1.1. For more information, see
https://www.drupal.org/node/2718713
---
core/CHANGELOG.txt | 19 +-
core/MAINTAINERS.txt | 1 +
core/composer.json | 4 +-
core/core.services.yml | 5 +
core/includes/bootstrap.inc | 2 +-
core/includes/common.inc | 3 +-
core/includes/form.inc | 7 +-
core/includes/install.core.inc | 6 +-
core/includes/install.inc | 2 +-
core/includes/theme.inc | 31 +-
core/lib/Drupal.php | 2 +-
.../Bridge/ZfExtensionManagerSfContainer.php | 8 +-
.../Component/Datetime/DateTimePlus.php | 2 +-
core/lib/Drupal/Component/Diff/Diff.php | 1 -
.../Drupal/Component/Diff/DiffFormatter.php | 2 +-
.../Component/Diff/Engine/DiffEngine.php | 14 +-
core/lib/Drupal/Component/Diff/MappedDiff.php | 1 -
.../Component/Discovery/YamlDiscovery.php | 1 -
.../Component/Gettext/PoStreamReader.php | 2 +-
.../Component/PhpStorage/FileStorage.php | 4 +-
.../Component/Render/FormattableMarkup.php | 4 +-
core/lib/Drupal/Component/Utility/Random.php | 2 +-
.../Drupal/Component/Utility/UrlHelper.php | 1 -
core/lib/Drupal/Core/Access/AccessResult.php | 2 +-
core/lib/Drupal/Core/Ajax/DataCommand.php | 1 -
core/lib/Drupal/Core/AppRootFactory.php | 1 -
.../Core/Archiver/ArchiverException.php | 1 -
core/lib/Drupal/Core/Archiver/Zip.php | 2 +-
core/lib/Drupal/Core/Asset/AssetResolver.php | 2 +-
.../Core/Asset/CssCollectionGrouper.php | 9 +-
.../Core/Asset/CssCollectionOptimizer.php | 10 -
core/lib/Drupal/Core/Asset/CssOptimizer.php | 21 +-
.../Drupal/Core/Asset/JsCollectionGrouper.php | 7 +-
.../Core/Asset/JsCollectionOptimizer.php | 6 +-
.../Core/Asset/JsCollectionRenderer.php | 2 +-
core/lib/Drupal/Core/Asset/JsOptimizer.php | 2 +-
.../Cache/Context/PathParentCacheContext.php | 41 ++
.../Drupal/Core/Config/ConfigCrudEvent.php | 1 -
core/lib/Drupal/Core/Config/ConfigFactory.php | 2 +-
.../lib/Drupal/Core/Config/ConfigImporter.php | 6 +-
.../Config/ConfigModuleOverridesEvent.php | 1 -
.../Config/Entity/ConfigDependencyManager.php | 10 +-
.../Config/Entity/ConfigEntityStorage.php | 26 +-
.../Core/Config/ExtensionInstallStorage.php | 1 -
.../Drupal/Core/Config/StorableConfigBase.php | 6 +-
.../Core/Controller/ControllerResolver.php | 2 +-
.../Core/Database/DatabaseException.php | 1 -
.../Core/Database/Driver/sqlite/Select.php | 2 +-
core/lib/Drupal/Core/Database/Log.php | 4 +-
.../lib/Drupal/Core/Database/Query/Select.php | 2 +-
.../Drupal/Core/Datetime/DateFormatter.php | 6 +-
core/lib/Drupal/Core/Datetime/DateHelper.php | 1 -
.../Core/Datetime/Element/DateElementBase.php | 1 -
.../Drupal/Core/Datetime/Element/Datelist.php | 15 +-
.../Compiler/ProxyServicesPass.php | 2 +-
.../DependencyInjection/ContainerBuilder.php | 1 +
.../DependencyInjection/YamlFileLoader.php | 1 +
core/lib/Drupal/Core/DrupalKernel.php | 23 +-
.../Controller/EntityListController.php | 1 -
.../Display/EntityFormDisplayInterface.php | 2 +-
core/lib/Drupal/Core/Entity/EntityManager.php | 2 +-
.../Drupal/Core/Entity/Query/QueryBase.php | 2 +-
.../Drupal/Core/Entity/Query/Sql/Tables.php | 41 +-
.../Core/Entity/Sql/DefaultTableMapping.php | 2 +-
.../Entity/Sql/SqlContentEntityStorage.php | 2 +-
core/lib/Drupal/Core/Entity/entity.api.php | 16 +-
.../EntityRouteProviderSubscriber.php | 1 -
.../Core/Executable/ExecutablePluginBase.php | 1 -
.../Core/Extension/InfoParserInterface.php | 1 -
.../Extension/ModuleInstallerInterface.php | 1 -
core/lib/Drupal/Core/Extension/module.api.php | 3 +
.../EntityReferenceEntityFormatter.php | 58 +-
.../Plugin/Field/FieldType/BooleanItem.php | 1 -
core/lib/Drupal/Core/Form/FormBuilder.php | 2 +-
.../Core/Http/TrustedHostsRequestFactory.php | 4 +-
.../Installer/Form/SelectLanguageForm.php | 2 +-
.../Core/Installer/Form/SelectProfileForm.php | 2 +-
.../Core/Installer/Form/SiteConfigureForm.php | 2 +-
.../Drupal/Core/Installer/InstallerKernel.php | 13 +
.../KeyValueExpirableFactory.php | 1 -
.../Core/KeyValueStore/KeyValueFactory.php | 1 -
.../KeyValueFactoryInterface.php | 1 -
.../lib/Drupal/Core/Menu/LocalTaskManager.php | 2 +-
.../Core/PageCache/DefaultRequestPolicy.php | 6 +-
.../ResponsePolicy/DenyNoCacheRoutes.php | 1 -
.../Core/Password/PhpassHashedPassword.php | 2 +-
core/lib/Drupal/Core/Queue/QueueFactory.php | 1 -
.../Drupal/Core/Render/Element/Actions.php | 2 +-
.../lib/Drupal/Core/Render/Element/Button.php | 7 +-
.../Drupal/Core/Render/Element/Checkbox.php | 2 +-
.../Drupal/Core/Render/Element/Checkboxes.php | 4 +-
core/lib/Drupal/Core/Render/Element/Color.php | 2 +-
.../Drupal/Core/Render/Element/Container.php | 4 +-
core/lib/Drupal/Core/Render/Element/Date.php | 10 +-
.../Drupal/Core/Render/Element/Details.php | 4 +-
core/lib/Drupal/Core/Render/Element/Email.php | 2 +-
.../Drupal/Core/Render/Element/Fieldset.php | 4 +-
.../lib/Drupal/Core/Render/Element/Number.php | 2 +-
.../Drupal/Core/Render/Element/Password.php | 2 +-
.../Core/Render/Element/PasswordConfirm.php | 6 +-
core/lib/Drupal/Core/Render/Element/Radio.php | 8 +-
.../lib/Drupal/Core/Render/Element/Radios.php | 4 +-
core/lib/Drupal/Core/Render/Element/Range.php | 2 +-
.../lib/Drupal/Core/Render/Element/Search.php | 2 +-
.../lib/Drupal/Core/Render/Element/Select.php | 10 +-
core/lib/Drupal/Core/Render/Element/Table.php | 14 +-
.../Core/Render/Element/Tableselect.php | 22 +-
core/lib/Drupal/Core/Render/Element/Tel.php | 2 +-
.../Drupal/Core/Render/Element/Textarea.php | 2 +-
.../Drupal/Core/Render/Element/Textfield.php | 2 +-
core/lib/Drupal/Core/Render/Element/Url.php | 2 +-
.../Core/Render/Element/VerticalTabs.php | 8 +-
.../lib/Drupal/Core/Render/Element/Weight.php | 2 +-
.../Core/Render/PlaceholderingRenderCache.php | 10 +
core/lib/Drupal/Core/Render/Renderer.php | 4 +-
.../Drupal/Core/Routing/AccessAwareRouter.php | 1 -
.../lib/Drupal/Core/Routing/CompiledRoute.php | 2 +-
.../lib/Drupal/Core/Routing/RouteCompiler.php | 2 +-
.../lib/Drupal/Core/Routing/RouteProvider.php | 8 +-
core/lib/Drupal/Core/Routing/UrlGenerator.php | 1 -
.../Drupal/Core/Session/AccountInterface.php | 2 +-
core/lib/Drupal/Core/SitePathFactory.php | 1 -
.../Core/StackMiddleware/KernelPreHandle.php | 1 -
.../StackMiddleware/NegotiationMiddleware.php | 2 +-
.../StreamWrapper/LocalReadOnlyStream.php | 4 +-
.../Core/StreamWrapper/ReadOnlyStream.php | 4 +-
.../Core/Template/Loader/StringLoader.php | 2 +-
.../Drupal/Core/Template/TwigExtension.php | 6 +-
.../Core/Theme/ThemeManagerInterface.php | 4 +-
.../Plugin/DataType/DateTimeIso8601.php | 1 -
.../Validation/RecursiveValidator.php | 2 +-
core/lib/Drupal/Core/Url.php | 66 +--
.../action/src/Plugin/Action/EmailAction.php | 3 +-
core/modules/aggregator/aggregator.module | 2 +-
.../src/Tests/ItemCacheTagsTest.php | 3 +-
.../tests/src/Kernel/AggregatorTitleTest.php | 2 +-
core/modules/big_pipe/big_pipe.services.yml | 2 +-
core/modules/big_pipe/src/Render/BigPipe.php | 21 +-
.../Render/Placeholder/BigPipeStrategy.php | 9 +-
.../src/Tests/BigPipePlaceholderTestCases.php | 3 +-
.../big_pipe/src/Tests/BigPipeTest.php | 2 +-
.../src/BigPipeTestController.php | 3 +-
.../Placeholder/BigPipeStrategyTest.php | 26 +-
.../block/src/Plugin/migrate/source/Block.php | 2 +-
.../block/src/Tests/BlockLanguageTest.php | 3 +-
.../Update/BlockContextMappingUpdateTest.php | 2 +-
.../src/Plugin/Block/TestAccessBlock.php | 1 -
.../block_content/block_content.module | 2 +-
.../src/Tests/BlockContentTestBase.php | 2 +-
.../Tests/BlockContentTranslationUITest.php | 4 +-
.../src/Tests/BlockContentTypeTest.php | 2 +-
.../modules/book/src/BookManagerInterface.php | 6 +-
.../book/src/Form/BookSettingsForm.php | 1 -
core/modules/book/src/Tests/BookTest.php | 4 +-
.../breakpoint/src/BreakpointManager.php | 2 +-
core/modules/ckeditor/ckeditor.admin.inc | 2 +-
.../src/Plugin/CKEditorPlugin/Internal.php | 11 +-
.../src/Unit/CKEditorPluginManagerTest.php | 2 +-
core/modules/color/color.module | 4 +-
core/modules/comment/src/CommentForm.php | 2 +-
.../comment/src/CommentLinkBuilder.php | 2 +-
.../src/CommentLinkBuilderInterface.php | 2 +-
.../modules/comment/src/CommentStatistics.php | 2 +-
core/modules/comment/src/CommentTypeForm.php | 2 +-
core/modules/comment/src/Entity/Comment.php | 2 +-
.../CommentDefaultFormatter.php | 2 +-
.../comment/src/Plugin/views/field/Depth.php | 2 +-
.../comment/src/Tests/CommentAdminTest.php | 4 +-
.../src/Tests/CommentAnonymousTest.php | 2 +-
.../src/Tests/CommentCacheTagsTest.php | 2 +-
.../comment/src/Tests/CommentLanguageTest.php | 2 +-
.../comment/src/Tests/CommentNonNodeTest.php | 2 +-
.../comment/src/Tests/CommentPreviewTest.php | 4 +-
.../comment/src/Tests/CommentTypeTest.php | 2 +-
core/modules/config/config.module | 2 +-
.../config/src/Form/ConfigImportForm.php | 1 -
.../config_install_dependency_test.module | 4 +-
.../tests/config_test/config_test.hooks.inc | 44 +-
.../tests/config_test/config_test.module | 11 -
.../config_translation.module | 1 -
.../src/Tests/ConfigTranslationListUiTest.php | 4 +-
.../Tests/ConfigTranslationOverviewTest.php | 2 +-
.../src/Tests/ConfigTranslationUiTest.php | 2 +-
.../Tests/ConfigTranslationUiThemeTest.php | 2 +-
.../contact/src/Tests/ContactLanguageTest.php | 2 +-
.../contact/src/Tests/ContactSitewideTest.php | 4 +-
.../contact/src/Tests/ContactStorageTest.php | 2 +-
.../tests/drupal-7.contact.database.php | 2 +-
.../contact_storage_test.module | 3 +-
.../Migrate/d6/MigrateContactSettingsTest.php | 2 +-
.../tests/src/Unit/MailHandlerTest.php | 2 +-
.../ContentTranslationRouteSubscriber.php | 4 +-
.../Tests/ContentTranslationUITestBase.php | 2 +-
.../tests/src/Kernel/ContextualUnitTest.php | 2 +-
core/modules/datetime/datetime.module | 2 +-
.../DateTimeDefaultFormatter.php | 6 +-
.../Field/FieldType/DateTimeFieldItemList.php | 4 +-
.../Plugin/Field/FieldType/DateTimeItem.php | 2 +-
.../FieldWidget/DateTimeDatelistWidget.php | 2 +-
.../FieldWidget/DateTimeDefaultWidget.php | 2 +-
.../datetime/src/Plugin/views/filter/Date.php | 2 +-
.../datetime/src/Tests/DateTimeFieldTest.php | 6 +-
core/modules/dblog/src/Tests/DbLogTest.php | 24 +-
.../editor/src/Tests/EditorAdminTest.php | 4 +-
.../src/Kernel}/QuickEditIntegrationTest.php | 4 +-
core/modules/field/field.module | 9 +-
.../field/src/Entity/FieldStorageConfig.php | 8 +-
.../src/Plugin/migrate/source/d6/Field.php | 2 +-
.../modules/field/src/Tests/FieldHelpTest.php | 2 +-
.../field/src/Tests/FieldUnitTestBase.php | 5 -
...views_entity_reference_plugins-2429191.php | 5 +-
.../modules/field_test/field_test.module | 5 +-
.../field_third_party_test.module | 8 +-
.../field/tests/src/Kernel/DisplayApiTest.php | 2 +-
.../EntityReferenceFormatterTest.php | 63 +++
.../EntityReferenceItemTest.php | 2 +-
.../src/Kernel/FieldAttachStorageTest.php | 6 +-
.../field/tests/src/Kernel/FieldCrudTest.php | 2 +-
.../tests/src/Kernel/FieldDataCountTest.php | 4 +-
.../src/Kernel/FieldImportChangeTest.php | 1 -
.../src/Kernel/FieldImportCreateTest.php | 1 -
.../src/Kernel/FieldImportDeleteTest.php | 1 -
.../Kernel/FieldImportDeleteUninstallTest.php | 2 +-
.../d7/MigrateFieldFormatterSettingsTest.php | 6 +-
.../src/Unit/FieldConfigEntityUnitTest.php | 4 +-
.../src/FieldStorageConfigListBuilder.php | 2 +-
.../field_ui/src/Form/FieldConfigEditForm.php | 2 +-
.../field_ui/src/Tests/ManageFieldsTest.php | 2 +-
.../field_ui_test/field_ui_test.module | 2 +-
.../tests/src/Kernel/EntityDisplayTest.php | 6 +-
.../src/Kernel/EntityFormDisplayTest.php | 4 +-
core/modules/file/file.module | 2 +-
core/modules/file/src/Element/ManagedFile.php | 46 +-
.../FileFieldAnonymousSubmissionTest.php | 169 ++++++
.../file/src/Tests/FileListingTest.php | 2 +-
.../src/Tests/FileOnTranslatedEntityTest.php | 2 +-
.../PrivateFileOnTranslatedEntityTest.php | 2 +-
.../src/Kernel/Migrate/EntityFileTest.php | 2 +-
.../install/filter.format.plain_text.yml | 1 -
.../Plugin/migrate/source/d6/FilterFormat.php | 2 -
.../filter/tests/src/Kernel/FilterAPITest.php | 6 +-
.../tests/src/Kernel/FilterUnitTest.php | 20 +-
core/modules/forum/forum.module | 5 +-
core/modules/forum/src/Tests/ForumTest.php | 14 +-
.../src/Kernel}/ForumValidationTest.php | 6 +-
core/modules/hal/src/HalServiceProvider.php | 1 -
.../hal/tests/src/Kernel/NormalizeTest.php | 2 +-
.../help/src/Controller/HelpController.php | 2 +-
.../help/src/Plugin/Block/HelpBlock.php | 19 +-
core/modules/help/src/Tests/HelpBlockTest.php | 8 +-
core/modules/help/src/Tests/HelpTest.php | 4 +-
.../help_page_test/help_page_test.module | 2 +
.../help_page_test/help_page_test.routing.yml | 7 +
.../src/HelpPageTestController.php | 10 +
.../more_help_page_test.info.yml | 7 +
.../more_help_page_test.module | 20 +
core/modules/history/history.module | 2 +-
.../views/field/HistoryUserTimestamp.php | 2 +-
.../src/Plugin/Field/FieldType/ImageItem.php | 4 +-
.../image/src/Tests/ImageFieldWidgetTest.php | 1 -
.../src/Tests/ImageOnTranslatedEntityTest.php | 2 +-
.../Migrate/d7/MigrateImageStylesTest.php | 4 +-
core/modules/language/language.module | 2 +-
.../src/ContentLanguageSettingsInterface.php | 1 -
.../language/src/Form/LanguageFormBase.php | 2 +-
.../src/Form/NegotiationBrowserForm.php | 1 -
.../LanguageNegotiationUrl.php | 2 +-
.../EntityTypeWithoutLanguageFormTest.php | 2 +-
.../src/Tests/LanguagePathMonolingualTest.php | 2 +-
.../src/Tests/LanguageSwitchingTest.php | 2 +-
.../src/Tests/LanguageUrlRewritingTest.php | 2 +-
.../Condition/LanguageConditionTest.php | 4 +-
.../src/Kernel}/ConfigurableLanguageTest.php | 4 +-
.../src/Kernel}/EntityDefaultLanguageTest.php | 6 +-
.../src/Kernel}/EntityUrlLanguageTest.php | 5 +-
.../LanguageConfigOverrideInstallTest.php | 4 +-
.../LanguageDependencyInjectionTest.php | 2 +-
.../src/Kernel}/LanguageFallbackTest.php | 2 +-
.../src/Kernel}/LanguageTestBase.php | 4 +-
.../Unit/ContentLanguageSettingsUnitTest.php | 32 +-
.../Field/FieldFormatter/LinkFormatter.php | 1 +
.../FieldFormatter/LinkSeparateFormatter.php | 1 -
.../Constraint/LinkTypeConstraint.php | 1 -
core/modules/link/src/Tests/LinkFieldTest.php | 41 +-
core/modules/locale/locale.bulk.inc | 4 +-
core/modules/locale/locale.module | 2 +-
.../locale/src/LocaleDefaultConfigStorage.php | 1 -
.../LocaleConfigTranslationImportTest.php | 2 +-
.../locale/src/Tests/LocaleContentTest.php | 4 +-
.../config/schema/locale_test.schema.yml | 4 +-
.../src/Kernel}/LocaleConfigManagerTest.php | 4 +-
.../LocaleConfigSubscriberForeignTest.php | 15 +-
.../Kernel}/LocaleConfigSubscriberTest.php | 9 +-
.../LocaleConfigurableLanguageManagerTest.php | 4 +-
.../src/Kernel}/LocaleStringIsSafeTest.php | 4 +-
.../Kernel}/LocaleTranslationProjectsTest.php | 6 +-
...enuLinkContentCacheabilityBubblingTest.php | 4 +-
.../Kernel}/MenuLinkContentDeriverTest.php | 4 +-
.../Kernel}/PathAliasMenuLinkContentTest.php | 8 +-
.../menu_ui/src/Tests/MenuLanguageTest.php | 2 +-
core/modules/menu_ui/src/Tests/MenuTest.php | 16 +-
.../modules/migrate/src/MigrateExecutable.php | 8 +-
core/modules/migrate/src/Plugin/Migration.php | 2 +-
.../Plugin/migrate/process/MenuLinkParent.php | 2 +-
.../src/Plugin/migrate/process/StaticMap.php | 2 +-
.../src/Unit/process/DedupeEntityTest.php | 2 +-
.../tests/src/Unit/process/StaticMapTest.php | 11 +
core/modules/node/node.api.php | 8 +-
core/modules/node/node.module | 6 +-
core/modules/node/node.views_execution.inc | 2 +-
.../node/src/Controller/NodeController.php | 2 +-
core/modules/node/src/NodeViewBuilder.php | 2 +-
.../src/Plugin/Action/AssignOwnerNode.php | 2 +-
.../node/src/Plugin/Search/NodeSearch.php | 2 +-
.../Tests/NodeActionsConfigurationTest.php | 84 +++
.../src/Tests/NodeBlockFunctionalTest.php | 2 +-
.../node/src/Tests/NodeEditFormTest.php | 2 +-
.../node/src/Tests/NodeFormButtonsTest.php | 6 +-
.../node/src/Tests/NodeRevisionsAllTest.php | 2 +-
.../node/src/Tests/NodeTranslationUITest.php | 2 +-
core/modules/node/src/Tests/NodeTypeTest.php | 2 +-
.../src/Tests/NodeTypeTranslationTest.php | 2 +-
.../node/src/Tests/Views/FrontPageTest.php | 2 +-
.../Tests/Views/NodeRevisionWizardTest.php | 1 -
core/modules/node/templates/node.html.twig | 13 +-
.../node_access_test/node_access_test.module | 3 +-
.../tests/modules/node_test/node_test.module | 3 +-
.../Kernel}/Config/NodeImportChangeTest.php | 4 +-
.../Kernel}/Config/NodeImportCreateTest.php | 8 +-
.../src/Kernel}/NodeBodyFieldStorageTest.php | 4 +-
.../src/Kernel}/NodeConditionTest.php | 6 +-
.../src/Kernel}/NodeFieldAccessTest.php | 6 +-
.../src/Kernel}/NodeFieldOverridesTest.php | 9 +-
.../src/Kernel}/NodeListBuilderTest.php | 4 +-
.../src/Kernel}/NodeOwnerTest.php | 6 +-
.../src/Kernel}/NodeTokenReplaceTest.php | 6 +-
.../src/Kernel}/NodeValidationTest.php | 6 +-
core/modules/page_cache/page_cache.module | 2 +-
.../modules/page_cache_form_test.install | 1 -
core/modules/path/src/Tests/PathAdminTest.php | 2 +-
core/modules/path/src/Tests/PathAliasTest.php | 2 +-
.../path/src/Tests/PathLanguageTest.php | 2 +-
.../path/src/Tests/PathLanguageUiTest.php | 4 +-
.../path/src/Tests/PathNodeFormTest.php | 2 +-
.../path/src/Tests/PathTaxonomyTermTest.php | 2 +-
.../tests/modules/quickedit_test.module | 1 -
.../src/Kernel}/EditorSelectionTest.php | 2 +-
.../src/Kernel}/MetadataGeneratorTest.php | 2 +-
.../src/Kernel}/QuickEditTestBase.php | 4 +-
core/modules/rdf/rdf.module | 2 +-
.../Tests => tests/src/Kernel}/CrudTest.php | 4 +-
.../Kernel/Field/DateTimeFieldRdfaTest.php | 2 +-
.../src/Kernel/Field/EmailFieldRdfaTest.php | 4 +-
.../Field/FieldRdfaDatatypeCallbackTest.php | 3 +-
.../src/Kernel/Field/LinkFieldRdfaTest.php | 2 +-
.../src/Kernel/Field/StringFieldRdfaTest.php | 2 +-
.../src/Kernel/Field/TextFieldRdfaTest.php | 6 +-
.../src/Kernel}/RdfaAttributesTest.php | 4 +-
.../responsive_image/responsive_image.module | 8 +-
.../tests/src/Kernel/RequestHandlerTest.php | 4 +-
.../src/Kernel}/RestLinkManagerTest.php | 5 +-
core/modules/search/search.api.php | 1 -
core/modules/search/search.module | 2 +-
core/modules/search/search.pages.inc | 1 -
core/modules/search/src/SearchQuery.php | 4 +-
.../Tests/SearchAdvancedSearchFormTest.php | 2 +-
.../search/src/Tests/SearchBlockTest.php | 2 +-
.../Tests/SearchCommentCountToggleTest.php | 2 +-
.../Tests/SearchConfigSettingsFormTest.php | 2 +-
.../search/src/Tests/SearchExactTest.php | 2 +-
.../Tests/SearchKeywordsConditionsTest.php | 2 +-
.../search/src/Tests/SearchLanguageTest.php | 10 +-
.../src/Tests/SearchPageCacheTagsTest.php | 2 +-
.../src/Tests/SearchPageOverrideTest.php | 2 +-
.../search/src/Tests/SearchQueryAlterTest.php | 2 +-
.../search/src/Tests/SearchRankingTest.php | 2 +-
.../search/src/Tests/SearchSimplifyTest.php | 2 +-
.../src/Kernel}/SearchExcerptTest.php | 4 +-
.../src/Kernel}/SearchMatchTest.php | 4 +-
.../src/Tests/EntitySerializationTest.php | 2 +
.../src/Kernel}/SerializationTest.php | 4 +-
.../Normalizer/ConfigEntityNormalizerTest.php | 1 -
.../src/Tests/ShortcutCacheTagsTest.php | 3 +-
.../shortcut/src/Tests/ShortcutLinksTest.php | 2 +-
.../src/Tests/ShortcutTranslationUITest.php | 2 +-
core/modules/simpletest/simpletest.install | 2 +-
.../modules/simpletest/src/KernelTestBase.php | 2 +-
.../simpletest/src/RandomGeneratorTrait.php | 123 +----
.../simpletest/src/SessionTestTrait.php | 35 +-
core/modules/simpletest/src/TestBase.php | 7 +-
.../simpletest/src/Tests/MailCaptureTest.php | 4 +-
core/modules/simpletest/src/WebAssert.php | 65 +--
core/modules/simpletest/src/WebTestBase.php | 6 +-
.../simpletest_phpunit_run_command_test.php | 1 -
.../Unit/SimpletestPhpunitRunCommandTest.php | 2 +-
.../tests/src/Unit/TestInfoParsingTest.php | 6 +-
.../statistics/src/StatisticsSettingsForm.php | 1 -
core/modules/statistics/statistics.php | 1 -
.../src/Controller/DbUpdateController.php | 3 +-
.../system/src/Form/DateFormatFormBase.php | 2 +-
.../system/src/Form/ModulesListForm.php | 2 +-
.../src/Form/ModulesUninstallConfirmForm.php | 2 +-
.../system/src/Form/ModulesUninstallForm.php | 2 +-
core/modules/system/src/Form/RegionalForm.php | 2 +-
.../system/src/PathBasedBreadcrumbBuilder.php | 6 +-
.../src/Plugin/Condition/RequestPath.php | 4 +-
.../system/src/Tests/Ajax/DialogTest.php | 3 +-
.../system/src/Tests/Ajax/MultiFormTest.php | 4 +-
.../Asset/LibraryDiscoveryIntegrationTest.php | 2 +-
.../Cache/GenericCacheBackendUnitTestBase.php | 2 +-
.../src/Tests/Common/AttachedAssetsTest.php | 2 +-
.../system/src/Tests/Common/RenderWebTest.php | 4 +-
.../Tests/Entity/EntityCacheTagsTestBase.php | 4 +-
.../Tests/Entity/EntityListBuilderTest.php | 2 +-
.../src/Tests/Entity/EntityOperationsTest.php | 2 +-
.../EntityReferenceSelectionAccessTest.php | 19 +
.../src/Tests/Entity/EntityRevisionsTest.php | 2 +-
.../InstallerExistingConfigDirectoryTest.php | 33 ++
.../KeyValueContentEntityStorageTest.php | 2 +-
.../src/Tests/Module/ClassLoaderTest.php | 4 +-
.../Plugin/Condition/RequestPathTest.php | 9 +
.../Plugin/Discovery/DiscoveryTestBase.php | 1 -
.../Plugin/Discovery/StaticDiscoveryTest.php | 1 -
.../src/Tests/Render/AjaxPageStateTest.php | 2 +-
.../src/Tests/Routing/MatcherDumperTest.php | 6 +-
.../src/Tests/Routing/MockAliasManager.php | 4 +
.../system/src/Tests/Session/SessionTest.php | 4 +-
.../src/Tests/System/AccessDeniedTest.php | 2 +-
.../system/src/Tests/System/DateTimeTest.php | 71 ++-
.../system/src/Tests/System/FloodTest.php | 6 +-
.../system/src/Tests/System/FrontPageTest.php | 2 +-
.../Tests/System/MainContentFallbackTest.php | 2 +-
.../src/Tests/System/PageNotFoundTest.php | 2 +-
.../System/SitesDirectoryHardeningTest.php | 4 +-
.../src/Tests/Theme/TwigEnvironmentTest.php | 1 -
.../src/Tests/TypedData/TypedDataTest.php | 36 +-
...sAndTasksConvertedIntoBlocksUpdateTest.php | 2 +-
.../PageTitleConvertedIntoBlockUpdateTest.php | 2 +-
...LocalTasksConvertedIntoBlockUpdateTest.php | 2 +-
...teBrandingConvertedIntoBlockUpdateTest.php | 2 +-
.../UpdatePathWithBrokenRoutingFilledTest.php | 2 +-
.../src/Tests/Update/UpdateScriptTest.php | 18 +
core/modules/system/system.admin.inc | 1 -
core/modules/system/system.install | 2 +-
core/modules/system/system.module | 2 +-
core/modules/system/system.routing.yml | 2 +-
.../drupal-8.block-content-uninstall.php | 1 -
...drupal-8.block-context-manager-2354889.php | 7 +-
.../update/drupal-8.broken_routing.php | 1 -
...local-actions-tasks-into-blocks-507488.php | 3 +-
...drupal-8.page-title-into-block-2476947.php | 3 +-
...en-secondary-local-tasks-block-2569529.php | 3 +-
...pal-8.site-branding-into-block-2005546.php | 3 +-
...rupal-8.update-test-postupdate-enabled.php | 1 -
...update-test-postupdate-failing-enabled.php | 1 -
...upal-8.views-entity-views-data-2455125.php | 3 +-
.../drupal-8.without_automated_cron.php | 4 +-
.../ajax_forms_test/ajax_forms_test.module | 48 +-
.../src/Tests/ConditionTestDualUserTest.php | 2 +-
.../database_test/database_test.module | 1 -
.../src/Form/DatabaseTestForm.php | 2 +-
.../entity_test/src/Entity/EntityTestRev.php | 7 +
.../entity_test_operation.module | 3 +-
.../src/Controller/ErrorTestController.php | 2 +-
.../src/Controller/ModuleTestController.php | 4 +-
.../plugin_test/fruit/FruitInterface.php | 1 -
.../plugin_test/mock_block/MockMenuBlock.php | 6 +-
.../PageCacheAcceptHeaderController.php | 1 -
.../system_test/src/MockFileTransfer.php | 2 +-
.../theme_test/src/ThemeTestController.php | 2 +-
.../Controller/TrustedHostsTestController.php | 1 -
.../twig_extension_test.module | 1 -
.../Controller/UpdateScriptTestController.php | 31 ++
.../update_script_test.routing.yml | 6 +
.../update_test_postupdate.post_update.php | 2 +-
.../Kernel/Extension/ModuleHandlerTest.php | 3 +-
.../Kernel/Token/TokenReplaceKernelTest.php} | 4 +-
.../Token/TokenReplaceKernelTestBase.php} | 6 +-
.../PathBasedBreadcrumbBuilderTest.php | 14 +-
.../InstallTranslationFilePatternTest.php | 2 +-
.../tests/src/Unit/SystemRequirementsTest.php | 3 +-
.../test_subsubtheme/test_subsubtheme.theme | 1 -
.../TermSelection.php | 2 +-
.../Plugin/migrate/source/d6/Vocabulary.php | 2 +-
.../Plugin/views/filter/TaxonomyIndexTid.php | 3 +-
.../taxonomy/src/TermStorageSchema.php | 2 +-
core/modules/taxonomy/src/TermViewsData.php | 2 +-
core/modules/taxonomy/src/Tests/TermTest.php | 2 +-
.../taxonomy/src/Tests/TokenReplaceTest.php | 1 -
.../Views/TaxonomyIndexTidFilterTest.php | 156 ++++++
.../src/Tests/Views/TaxonomyTestBase.php | 8 +-
core/modules/taxonomy/taxonomy.module | 6 +-
.../taxonomy_crud/taxonomy_crud.module | 4 +-
...omy_index_tid__non_existing_dependency.yml | 187 +++++++
.../src/Kernel}/TermKernelTest.php | 5 +-
.../src/Kernel}/TermValidationTest.php | 6 +-
.../Plugin/Field/FieldType/TelephoneItem.php | 2 +-
.../src/Kernel}/TextFormatterTest.php | 6 +-
.../src/Kernel}/TextSummaryTest.php | 4 +-
core/modules/text/text.module | 2 +-
core/modules/toolbar/src/Element/Toolbar.php | 2 +-
.../ToolbarIntegrationTest.php | 29 +-
core/modules/tour/src/Tests/TourTest.php | 2 +-
.../src/Kernel}/TourPluginTest.php | 4 +-
.../Migrate/d7/MigrateTrackerNodeTest.php | 1 -
.../update_test/src/MockFileTransfer.php | 2 +-
core/modules/update/update.authorize.inc | 4 +-
core/modules/update/update.fetch.inc | 1 -
core/modules/update/update.module | 2 +-
core/modules/update/update.report.inc | 2 +-
core/modules/user/src/AccountSettingsForm.php | 2 +-
.../user/src/Controller/UserController.php | 2 +-
.../MaintenanceModeSubscriber.php | 2 +-
.../user/src/Form/UserPasswordResetForm.php | 1 -
.../user/src/PermissionHandlerInterface.php | 1 -
.../UserSelection.php | 8 +-
.../user/src/Plugin/views/access/Role.php | 1 -
.../user/src/Tests/UserAdminLanguageTest.php | 6 +-
.../src/Tests/UserLanguageCreationTest.php | 2 +-
.../user/src/Tests/UserLanguageTest.php | 2 +-
.../user/src/Tests/UserRegistrationTest.php | 6 +-
.../src/Tests/Views/BulkFormAccessTest.php | 16 +-
.../user/src/Tests/Views/BulkFormTest.php | 2 +-
.../Condition/UserRoleConditionTest.php | 4 +-
.../Kernel}/Field/UserNameFormatterTest.php | 4 +-
...igrateUserProfileEntityFormDisplayTest.php | 2 +-
.../Migrate/d6/MigrateUserConfigsTest.php | 2 +-
.../src/Kernel}/TempStoreDatabaseTest.php | 4 +-
.../src/Kernel}/UserAccountFormFieldsTest.php | 4 +-
.../Kernel}/UserActionConfigSchemaTest.php | 4 +-
.../src/Kernel}/UserEntityReferenceTest.php | 10 +-
.../src/Kernel}/UserEntityTest.php | 4 +-
.../src/Kernel}/UserFieldsTest.php | 4 +-
.../src/Kernel}/UserInstallTest.php | 4 +-
.../src/Kernel}/UserRoleDeleteTest.php | 4 +-
.../src/Kernel}/UserSaveStatusTest.php | 4 +-
.../src/Kernel}/UserValidationTest.php | 4 +-
.../src/Unit/PermissionAccessCheckTest.php | 2 +-
.../tests/src/Unit/PrivateTempStoreTest.php | 1 -
.../tests/src/Unit/SharedTempStoreTest.php | 1 -
core/modules/user/user.module | 10 +-
core/modules/views/src/EntityViewsData.php | 2 +-
.../ViewsEntitySchemaSubscriber.php | 1 -
.../views/src/Plugin/ViewsHandlerManager.php | 2 +-
.../views/src/Plugin/views/HandlerBase.php | 2 +-
.../ArgumentValidatorPluginBase.php | 19 +-
.../views/src/Plugin/views/display/Block.php | 2 +-
.../views/display/DisplayPluginBase.php | 10 +-
.../views/src/Plugin/views/display/Embed.php | 9 +-
.../Plugin/views/display/PathPluginBase.php | 2 +-
.../views/field/FieldHandlerInterface.php | 5 +-
.../field/MultiItemsFieldHandlerInterface.php | 1 -
.../views/src/Plugin/views/filter/Combine.php | 2 +-
.../views/src/Plugin/views/query/Sql.php | 22 +-
.../Plugin/views/style/StylePluginBase.php | 2 +
.../Entity/FieldEntityTranslationTest.php | 4 +-
.../src/Tests/Plugin/DisplayExtenderTest.php | 3 +-
.../src/Tests/Plugin/ExposedFormTest.php | 2 +-
.../views/src/Tests/ViewElementTest.php | 45 +-
core/modules/views/src/ViewExecutable.php | 2 +-
core/modules/views/src/ViewsDataHelper.php | 1 -
.../fixtures/update/argument-placeholder.php | 7 +-
.../update/duplicate-field-handler.php | 7 +-
.../views.view.test_row_render_cache_none.yml | 503 ++++++++++++++++++
.../views_test_data/views_test_data.module | 4 +-
.../src/Kernel/Handler/FieldFieldTest.php | 2 +-
.../Handler/FilterBooleanOperatorTest.php | 1 -
.../views/tests/src/Kernel/ModuleTest.php | 5 +-
.../src/Kernel/Plugin/RowRenderCacheTest.php | 38 +-
.../src/Kernel/RenderCacheIntegrationTest.php | 2 +-
.../src/Kernel}/TestViewsTest.php | 4 +-
.../tests/src/Kernel/ViewExecutableTest.php | 2 +-
.../Wizard/WizardPluginBaseKernelTest.php | 1 -
.../Controller/ViewAjaxControllerTest.php | 1 -
.../Plugin/argument_validator/EntityTest.php | 2 +-
.../Unit/Plugin/field/FieldPluginBaseTest.php | 16 +-
.../views/tests/src/Unit/ViewsDataTest.php | 2 +-
core/modules/views/views.module | 2 +-
core/modules/views/views.post_update.php | 23 +
core/modules/views/views.views.inc | 6 +-
.../views_ui/src/Form/Ajax/AddHandler.php | 2 +-
.../src/Form/Ajax/ConfigHandlerExtra.php | 2 +-
.../src/Form/Ajax/RearrangeFilter.php | 1 -
.../views_ui/src/Form/Ajax/ViewsFormBase.php | 21 +-
.../views_ui/src/Tests/CachedDataUITest.php | 2 +-
.../views_ui/src/Tests/FieldUITest.php | 2 +-
.../views_ui/src/Tests/PreviewTest.php | 2 +-
.../views_ui/src/Tests/RedirectTest.php | 2 +-
.../views_ui/src/Tests/TranslatedViewTest.php | 2 +-
.../LibraryCachingTest.php | 69 +++
core/modules/views_ui/views_ui.module | 4 +-
core/modules/views_ui/views_ui.theme.inc | 6 +-
core/phpcs.xml.dist | 56 ++
core/phpunit.xml.dist | 6 +-
.../JavascriptTestBase.php | 6 +
.../Breadcrumb/Breadcrumb404Test.php | 57 ++
.../KernelTests/Config/DefaultConfigTest.php | 1 -
.../Core/Config/ConfigImporterTest.php | 94 ++++
.../Config/ConfigLanguageOverrideTest.php | 1 -
.../Config/ConfigOverridesPriorityTest.php | 2 +-
.../Core/Config/ConfigSchemaTest.php | 6 +-
.../KernelTests/Core/Database/AlterTest.php | 4 +-
.../KernelTests/Core/Database/SchemaTest.php | 2 +-
.../KernelTests/Core/Database/SelectTest.php | 6 +-
.../KernelTests/Core/Database/UpdateTest.php | 2 +-
.../ContentEntityNonRevisionableFieldTest.php | 177 ++++++
.../Entity/EntityDefinitionUpdateTest.php | 2 +-
.../Core/Entity/EntityFieldTest.php | 14 +-
.../Core/Entity/EntityQueryAggregateTest.php | 2 +-
.../Core/Entity/EntityQueryTest.php | 2 +-
.../EntityReferenceSelectionSortTest.php | 4 +-
.../Core/Entity/EntityViewBuilderTest.php | 4 +-
.../Core/Path/AliasStorageTest.php | 4 +-
.../Drupal/KernelTests/KernelTestBase.php | 15 +-
.../MissingDependentModuleUnitTest.php | 2 +-
core/tests/Drupal/Tests/BrowserTestBase.php | 12 +-
.../DependencyInjection/ContainerTest.php | 6 +-
.../Tests/Component/DrupalComponentTest.php | 4 +-
.../MTimeProtectedFileStorageBase.php | 4 +-
.../Component/Plugin/DefaultFactoryTest.php | 1 -
.../Discovery/DiscoveryCachedTraitTest.php | 4 +-
.../Plugin/Discovery/DiscoveryTraitTest.php | 10 +-
.../StaticDiscoveryDecoratorTest.php | 4 +-
.../Plugin/Factory/ReflectionFactoryTest.php | 2 +-
.../Component/Render/PlainTextOutputTest.php | 2 +-
.../Tests/Component/Utility/HtmlTest.php | 2 +-
.../Tests/Component/Utility/NumberTest.php | 12 +-
.../Drupal/Tests/ComposerIntegrationTest.php | 9 +
.../Tests/Core/Asset/CssOptimizerUnitTest.php | 2 +-
.../Asset/LibraryDependencyResolverTest.php | 2 +-
.../Tests/Core/Batch/PercentagesTest.php | 10 +-
.../Context/CacheContextsManagerTest.php | 2 +-
.../Context/PathParentCacheContextTest.php | 43 ++
.../Compiler/TaggedHandlersPassTest.php | 1 -
.../DiscoverServiceProvidersTest.php | 5 +-
.../Core/DrupalKernel/DrupalKernelTest.php | 6 +-
.../Sql/SqlContentEntityStorageSchemaTest.php | 46 +-
.../CustomPageExceptionHtmlSubscriberTest.php | 3 +-
.../Core/Extension/ModuleHandlerTest.php | 2 +-
.../Tests/Core/Form/FormBuilderTest.php | 2 +-
.../Drupal/Tests/Core/Form/FormTestBase.php | 1 -
.../Tests/Core/Form/FormValidatorTest.php | 2 +-
.../Tests/Core/Logger/LoggerChannelTest.php | 1 -
.../Tests/Core/Menu/LocalTaskManagerTest.php | 1 -
.../Core/PageCache/NoSessionOpenTest.php | 4 +-
.../ParamConverter/EntityConverterTest.php | 3 +-
.../Tests/Core/Path/AliasManagerTest.php | 2 +-
.../Tests/Core/Path/PathValidatorTest.php | 1 -
.../Plugin/Context/ContextDefinitionTest.php | 4 +-
.../DerivativeDiscoveryDecoratorTest.php | 2 +-
.../Core/Render/BubbleableMetadataTest.php | 8 +-
.../Core/Render/RendererPlaceholdersTest.php | 39 +-
.../Tests/Core/Render/RendererTestBase.php | 2 +-
.../NegotiationMiddlewareTest.php | 4 +-
.../Tests/Core/Template/AttributeTest.php | 2 +-
.../RecursiveContextualValidatorTest.php | 1 -
core/tests/Drupal/Tests/Core/UrlTest.php | 2 +-
.../Tests/Core/Utility/LinkGeneratorTest.php | 4 +-
.../PrimitiveTypeConstraintValidatorTest.php | 2 +-
.../Drupal/Tests/RandomGeneratorTrait.php | 126 +++++
core/tests/Drupal/Tests/SessionTestTrait.php | 40 ++
core/tests/Drupal/Tests/WebAssert.php | 67 +++
core/tests/bootstrap.php | 5 +-
core/themes/bartik/bartik.theme | 3 +-
core/themes/bartik/templates/node.html.twig | 13 +-
.../classy/templates/content/node.html.twig | 13 +-
.../stable/templates/content/node.html.twig | 13 +-
vendor/composer/autoload_classmap.php | 1 +
vendor/composer/autoload_files.php | 1 -
669 files changed, 3873 insertions(+), 1553 deletions(-)
create mode 100644 core/lib/Drupal/Core/Cache/Context/PathParentCacheContext.php
rename core/modules/editor/{src/Tests => tests/src/Kernel}/QuickEditIntegrationTest.php (98%)
create mode 100644 core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php
rename core/modules/forum/{src/Tests => tests/src/Kernel}/ForumValidationTest.php (91%)
create mode 100644 core/modules/help/tests/modules/more_help_page_test/more_help_page_test.info.yml
create mode 100644 core/modules/help/tests/modules/more_help_page_test/more_help_page_test.module
rename core/modules/language/{src/Tests => tests/src/Kernel}/Condition/LanguageConditionTest.php (97%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/ConfigurableLanguageTest.php (91%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/EntityDefaultLanguageTest.php (98%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/EntityUrlLanguageTest.php (98%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/LanguageConfigOverrideInstallTest.php (93%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/LanguageDependencyInjectionTest.php (98%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/LanguageFallbackTest.php (98%)
rename core/modules/language/{src/Tests => tests/src/Kernel}/LanguageTestBase.php (91%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleConfigManagerTest.php (98%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleConfigSubscriberForeignTest.php (94%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleConfigSubscriberTest.php (98%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleConfigurableLanguageManagerTest.php (95%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleStringIsSafeTest.php (97%)
rename core/modules/locale/{src/Tests => tests/src/Kernel}/LocaleTranslationProjectsTest.php (91%)
rename core/modules/menu_link_content/{src/Tests => tests/src/Kernel}/MenuLinkContentCacheabilityBubblingTest.php (98%)
rename core/modules/menu_link_content/{src/Tests => tests/src/Kernel}/MenuLinkContentDeriverTest.php (97%)
rename core/modules/menu_link_content/{src/Tests => tests/src/Kernel}/PathAliasMenuLinkContentTest.php (93%)
create mode 100644 core/modules/node/src/Tests/NodeActionsConfigurationTest.php
rename core/modules/node/{src/Tests => tests/src/Kernel}/Config/NodeImportChangeTest.php (95%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/Config/NodeImportCreateTest.php (90%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeBodyFieldStorageTest.php (96%)
rename core/modules/node/{src/Tests/Condition => tests/src/Kernel}/NodeConditionTest.php (95%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeFieldAccessTest.php (97%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeFieldOverridesTest.php (85%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeListBuilderTest.php (92%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeOwnerTest.php (92%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeTokenReplaceTest.php (96%)
rename core/modules/node/{src/Tests => tests/src/Kernel}/NodeValidationTest.php (94%)
rename core/modules/quickedit/{src/Tests => tests/src/Kernel}/EditorSelectionTest.php (99%)
rename core/modules/quickedit/{src/Tests => tests/src/Kernel}/MetadataGeneratorTest.php (99%)
rename core/modules/quickedit/{src/Tests => tests/src/Kernel}/QuickEditTestBase.php (97%)
rename core/modules/rdf/{src/Tests => tests/src/Kernel}/CrudTest.php (97%)
rename core/modules/rdf/{src/Tests => tests/src/Kernel}/RdfaAttributesTest.php (97%)
rename core/modules/rest/{src/Tests => tests/src/Kernel}/RestLinkManagerTest.php (97%)
rename core/modules/search/{src/Tests => tests/src/Kernel}/SearchExcerptTest.php (99%)
rename core/modules/search/{src/Tests => tests/src/Kernel}/SearchMatchTest.php (99%)
rename core/modules/serialization/{src/Tests => tests/src/Kernel}/SerializationTest.php (94%)
create mode 100644 core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php
create mode 100644 core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php
create mode 100644 core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml
rename core/modules/system/{src/Tests/System/TokenReplaceUnitTest.php => tests/src/Kernel/Token/TokenReplaceKernelTest.php} (98%)
rename core/modules/system/{src/Tests/System/TokenReplaceUnitTestBase.php => tests/src/Kernel/Token/TokenReplaceKernelTestBase.php} (80%)
create mode 100644 core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php
create mode 100644 core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid__non_existing_dependency.yml
rename core/modules/taxonomy/{src/Tests => tests/src/Kernel}/TermKernelTest.php (97%)
rename core/modules/taxonomy/{src/Tests => tests/src/Kernel}/TermValidationTest.php (93%)
rename core/modules/text/{src/Tests/Formatter => tests/src/Kernel}/TextFormatterTest.php (94%)
rename core/modules/text/{src/Tests => tests/src/Kernel}/TextSummaryTest.php (99%)
rename core/modules/tour/{src/Tests => tests/src/Kernel}/TourPluginTest.php (90%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/Condition/UserRoleConditionTest.php (98%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/Field/UserNameFormatterTest.php (96%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/TempStoreDatabaseTest.php (98%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserAccountFormFieldsTest.php (98%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserActionConfigSchemaTest.php (94%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserEntityReferenceTest.php (92%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserEntityTest.php (96%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserFieldsTest.php (94%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserInstallTest.php (94%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserRoleDeleteTest.php (96%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserSaveStatusTest.php (92%)
rename core/modules/user/{src/Tests => tests/src/Kernel}/UserValidationTest.php (99%)
create mode 100644 core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
rename core/modules/views/{src/Tests => tests/src/Kernel}/TestViewsTest.php (95%)
create mode 100644 core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
create mode 100644 core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
create mode 100644 core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php
rename core/{modules/simpletest/src/Tests => tests/Drupal/KernelTests}/MissingDependentModuleUnitTest.php (91%)
create mode 100644 core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php
create mode 100644 core/tests/Drupal/Tests/RandomGeneratorTrait.php
create mode 100644 core/tests/Drupal/Tests/SessionTestTrait.php
create mode 100644 core/tests/Drupal/Tests/WebAssert.php
diff --git a/core/CHANGELOG.txt b/core/CHANGELOG.txt
index 609fd4ae0..a632835ce 100644
--- a/core/CHANGELOG.txt
+++ b/core/CHANGELOG.txt
@@ -11,7 +11,7 @@ Drupal 8.1.0, 2016-04-20
* Added Symfony Polyfill Iconv 1.1.0.
* Added paragonie/random_compat 1.4.1.
- Updated vendor libraries:
- * Updated to Symfony 2.8.4.
+ * Updated to the last 2.x minor version of Symfony: 2.8 (2.8.4).
* Updated to CKEditor 4.5.8.
* Updated to Modernizr 3.3.1.
- Added modules:
@@ -34,12 +34,13 @@ Drupal 8.1.0, 2016-04-20
reducing the code needed to extend them.
* Simplified Migrate API by replacing migration configuration entities with
migration plugins.
- * Added support for entity types to specify translatable plural labels.
- * Added a revision log interface and trait for revisionable entity types.
- * Added key field definitions to ContentEntityBase, reducing code from
- child classes.
- * Added generic route providers for add-page and add-form entity routes,
- reducing the code needed to define an entity type.
+ * Various improvements for defining entity types:
+ * Added support for entity types to specify translatable plural labels.
+ * Added a revision log interface and trait for revisionable entity types.
+ * Added key field definitions to ContentEntityBase, reducing code from
+ child classes.
+ * Added generic route providers for add-page and add-form entity routes,
+ reducing the code needed to define an entity type.
- Testing improvements:
* Added support for automated JavaScript testing.
* Added verbose output for BrowserTestBase.
@@ -414,8 +415,8 @@ Drupal 7.0, 2011-01-05
are available.
- OpenID:
* Added support for Gmail and Google Apps for Domain identifiers. Users can
- now login with their user@example.com identifier when example.com is powered
- by Google.
+ now log in with their user@example.com identifier when example.com is
+ powered by Google.
* Made the OpenID module more pluggable.
- Added code registry:
* Using the registry, modules declare their includable files via their .info file,
diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt
index 8f456ebd9..8ca4bbd66 100644
--- a/core/MAINTAINERS.txt
+++ b/core/MAINTAINERS.txt
@@ -314,6 +314,7 @@ Database Logging module
- Khalid Baheyeldin 'kbahey' https://www.drupal.org/u/kbahey
DateTime module
+- Jonathan Hedstrom 'jhedstrom' https://www.drupal.org/u/jhedstrom
- Matthew Donadio 'mpdonadio' https://www.drupal.org/u/mpdonadio
Dynamic Page Cache module
diff --git a/core/composer.json b/core/composer.json
index 16e542a92..ad8542564 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -140,10 +140,8 @@
"Drupal\\Component\\": "lib/Drupal/Component",
"Drupal\\Driver\\": "../drivers/lib/Drupal/Driver"
},
- "files": [
- "lib/Drupal.php"
- ],
"classmap": [
+ "lib/Drupal.php",
"lib/Drupal/Component/Utility/Timer.php",
"lib/Drupal/Component/Utility/Unicode.php",
"lib/Drupal/Core/Database/Database.php",
diff --git a/core/core.services.yml b/core/core.services.yml
index d9b1839cd..5877a38c1 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -80,6 +80,11 @@ services:
arguments: ['@request_stack']
tags:
- { name: cache.context }
+ cache_context.url.path.parent:
+ class: Drupal\Core\Cache\Context\PathParentCacheContext
+ arguments: ['@request_stack']
+ tags:
+ - { name: cache.context }
cache_context.url.query_args:
class: Drupal\Core\Cache\Context\QueryArgsCacheContext
arguments: ['@request_stack']
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 589d451c3..2294d4705 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -623,7 +623,7 @@ function drupal_valid_test_ua($new_prefix = NULL) {
$user_agent = isset($_COOKIE['SIMPLETEST_USER_AGENT']) ? $_COOKIE['SIMPLETEST_USER_AGENT'] : $http_user_agent;
if (isset($user_agent) && preg_match("/^(simpletest\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) {
list(, $prefix, $time, $salt, $hmac) = $matches;
- $check_string = $prefix . ':' . $time . ':' . $salt;
+ $check_string = $prefix . ':' . $time . ':' . $salt;
// Read the hash salt prepared by drupal_generate_test_ua().
// This function is called before settings.php is read and Drupal's error
// handlers are set up. While Drupal's error handling may be properly
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 03af03bbb..feceb5bbe 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -14,6 +14,7 @@ use Drupal\Component\Utility\Html;
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);
}
/**
diff --git a/core/includes/form.inc b/core/includes/form.inc
index c110c5b31..06a806be9 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -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 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
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'];
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 7a9812f4a..1938ed691 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -7,7 +7,6 @@
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\DrupalKernel;
-use Drupal\Core\Config\BootstrapConfigStorageFactory;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\Core\Form\FormState;
@@ -489,8 +488,7 @@ function install_begin_request($class_loader, &$install_state) {
// Ensure that the active configuration is empty before installation starts.
if ($install_state['config_verified'] && empty($task)) {
- $config = BootstrapConfigStorageFactory::get()->listAll();
- if (!empty($config)) {
+ if (count($kernel->getConfigStorage()->listAll())) {
$task = NULL;
throw new AlreadyInstalledException($container->get('string_translation'));
}
@@ -1799,7 +1797,7 @@ function install_check_translations($langcode, $server_pattern) {
$writable = FALSE;
// @todo: Make this configurable.
$site_path = \Drupal::service('site.path');
- $files_directory = $site_path . '/files';
+ $files_directory = $site_path . '/files';
$translations_directory = $site_path . '/files/translations';
$translations_directory_exists = FALSE;
$online = FALSE;
diff --git a/core/includes/install.inc b/core/includes/install.inc
index 31207994e..6578a83ec 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -515,7 +515,7 @@ function drupal_install_config_directories() {
// they can later be added to git. Since this directory is auto-created, we
// have to write out the README rather than just adding it to the drupal core
// repo.
- $text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
+ $text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text);
}
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 54b038b6b..ec97db2dc 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -580,20 +580,29 @@ function template_preprocess_datetime_wrapper(&$variables) {
*
* Default template: links.html.twig.
*
+ * Unfortunately links templates duplicate the "active" class handling of l()
+ * and LinkGenerator::generate() because it needs to be able to set the "active"
+ * class not on the links themselves ("a" tags), but on the list items ("li"
+ * tags) that contain the links. This is necessary for CSS to be able to style
+ * list items differently when the link is active, since CSS does not yet allow
+ * one to style list items only if it contains a certain element with a certain
+ * class. I.e. we cannot yet convert this jQuery selector to a CSS selector:
+ * jQuery('li:has("a.is-active")')
+ *
* @param array $variables
* An associative array containing:
* - links: An array of links to be themed. Each link should be itself an
* array, with the following elements:
* - title: The link text.
- * - url: (optional) The url object to link to. If omitted, no a tag is
- * printed out.
+ * - url: (optional) The \Drupal\Core\Url object to link to. If omitted, no
+ * anchor tag is printed out.
* - attributes: (optional) Attributes for the anchor, or for the
* tag used in its place if no 'href' is supplied. If element 'class' is
* included, it must be an array of one or more class names.
* If the 'href' element is supplied, the entire link array is passed to
* l() as its $options parameter.
- * - attributes: A keyed array of attributes for the UL containing the
- * list of links.
+ * - attributes: A keyed array of attributes for the containing the list
+ * of links.
* - set_active_class: (optional) Whether each link should compare the
* route_name + route_parameters or href (path), language and query options
* to the current URL, to determine whether the link is "active". If so, an
@@ -622,15 +631,6 @@ function template_preprocess_datetime_wrapper(&$variables) {
* http://juicystudio.com/article/screen-readers-display-none.php and
* http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
*
- * Unfortunately links templates duplicate the "active" class handling of l()
- * and LinkGenerator::generate() because it needs to be able to set the "active"
- * class not on the links themselves ("a" tags), but on the list items ("li"
- * tags) that contain the links. This is necessary for CSS to be able to style
- * list items differently when the link is active, since CSS does not yet allow
- * one to style list items only if it contains a certain element with a certain
- * class. I.e. we cannot yet convert this jQuery selector to a CSS selector:
- * jQuery('li:has("a.is-active")')
- *
* @see \Drupal\Core\Utility\LinkGenerator
* @see \Drupal\Core\Utility\LinkGenerator::generate()
* @see system_page_attachments()
@@ -1052,6 +1052,7 @@ function template_preprocess_table(&$variables) {
* render properties for all nested child lists.
* - title: A title to be prepended to the list.
* - list_type: The type of list to return (e.g. "ul", "ol").
+ * - wrapper_attributes: HTML attributes to be applied to the list wrapper.
*
* @see https://www.drupal.org/node/1842756
*/
@@ -1264,7 +1265,7 @@ function template_preprocess_html(&$variables) {
// Add a variable for the root path. This can be used to create a class and
// theme the page depending on the current path (e.g. node, admin, user) as
// well as more specific data like path-frontpage.
- $is_front_page = \Drupal::service('path.matcher')->isFrontPage();
+ $is_front_page = \Drupal::service('path.matcher')->isFrontPage();
if ($is_front_page) {
$variables['root_path'] = FALSE;
@@ -1527,7 +1528,7 @@ function template_preprocess_field(&$variables, $hook) {
static $default_attributes;
if (!isset($default_attributes)) {
- $default_attributes = new Attribute;
+ $default_attributes = new Attribute();
}
// Merge attributes when a single-value field has a hidden label.
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 26dd905a6..8a10cb832 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -81,7 +81,7 @@ class Drupal {
/**
* The current system version.
*/
- const VERSION = '8.1.0';
+ const VERSION = '8.1.1';
/**
* Core API compatibility.
diff --git a/core/lib/Drupal/Component/Bridge/ZfExtensionManagerSfContainer.php b/core/lib/Drupal/Component/Bridge/ZfExtensionManagerSfContainer.php
index 3e2711e1d..3d8f77b17 100644
--- a/core/lib/Drupal/Component/Bridge/ZfExtensionManagerSfContainer.php
+++ b/core/lib/Drupal/Component/Bridge/ZfExtensionManagerSfContainer.php
@@ -15,9 +15,9 @@ class ZfExtensionManagerSfContainer implements ReaderManagerInterface, WriterMan
/**
* This property was based from Zend Framework (http://framework.zend.com/)
*
- * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @license http://framework.zend.com/license/new-bsd New BSD License
*
* A map of characters to be replaced through strtr.
*
@@ -75,9 +75,9 @@ class ZfExtensionManagerSfContainer implements ReaderManagerInterface, WriterMan
/**
* This method was based from Zend Framework (http://framework.zend.com/)
*
- * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @license http://framework.zend.com/license/new-bsd New BSD License
*
* Canonicalize the extension name to a service name.
*
diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
index 6c8dcd0b1..1d8bbb77f 100644
--- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php
+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -116,7 +116,7 @@ class DateTimePlus {
* date even if some values are missing.
*
* @param array $date_parts
- * An array of date parts, like ('year' => 2014, 'month => 4).
+ * An array of date parts, like ('year' => 2014, 'month' => 4).
* @param mixed $timezone
* (optional) \DateTimeZone object, time zone string or NULL. NULL uses the
* default system time zone. Defaults to NULL.
diff --git a/core/lib/Drupal/Component/Diff/Diff.php b/core/lib/Drupal/Component/Diff/Diff.php
index 637eca9ea..4afcbd3e3 100644
--- a/core/lib/Drupal/Component/Diff/Diff.php
+++ b/core/lib/Drupal/Component/Diff/Diff.php
@@ -169,4 +169,3 @@ class Diff {
return $this->edits;
}
}
-
diff --git a/core/lib/Drupal/Component/Diff/DiffFormatter.php b/core/lib/Drupal/Component/Diff/DiffFormatter.php
index 5dc9e1b15..558370627 100644
--- a/core/lib/Drupal/Component/Diff/DiffFormatter.php
+++ b/core/lib/Drupal/Component/Diff/DiffFormatter.php
@@ -73,7 +73,7 @@ class DiffFormatter {
$context = $edit->orig;
}
else {
- if (! is_array($block)) {
+ if (!is_array($block)) {
$context = array_slice($context, sizeof($context) - $nlead);
$x0 = $xi - sizeof($context);
$y0 = $yi - sizeof($context);
diff --git a/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php b/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php
index 78ec76a5f..ca470947e 100644
--- a/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php
+++ b/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php
@@ -181,7 +181,7 @@ class DiffEngine {
}
}
$this->lcs = 0;
- $this->seq[0]= $yoff - 1;
+ $this->seq[0] = $yoff - 1;
$this->in_seq = array();
$ymids[0] = array();
@@ -190,11 +190,11 @@ class DiffEngine {
for ($chunk = 0; $chunk < $nchunks; $chunk++) {
if ($chunk > 0) {
for ($i = 0; $i <= $this->lcs; $i++) {
- $ymids[$i][$chunk-1] = $this->seq[$i];
+ $ymids[$i][$chunk - 1] = $this->seq[$i];
}
}
- $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
+ $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line])) {
@@ -206,12 +206,12 @@ class DiffEngine {
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
- $ymids[$k] = $ymids[$k-1];
+ $ymids[$k] = $ymids[$k - 1];
break;
}
}
while (list ($junk, $y) = each($matches)) {
- if ($y > $this->seq[$k-1]) {
+ if ($y > $this->seq[$k - 1]) {
$this::USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
@@ -222,7 +222,7 @@ class DiffEngine {
elseif (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
- $ymids[$k] = $ymids[$k-1];
+ $ymids[$k] = $ymids[$k - 1];
}
}
}
@@ -363,7 +363,7 @@ class DiffEngine {
while ($j < $other_len && $other_changed[$j]) {
$j++;
}
- while ($i < $len && ! $changed[$i]) {
+ while ($i < $len && !$changed[$i]) {
$this::USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$i++;
$j++;
diff --git a/core/lib/Drupal/Component/Diff/MappedDiff.php b/core/lib/Drupal/Component/Diff/MappedDiff.php
index 10be64a78..a0bdc69b9 100644
--- a/core/lib/Drupal/Component/Diff/MappedDiff.php
+++ b/core/lib/Drupal/Component/Diff/MappedDiff.php
@@ -56,4 +56,3 @@ class MappedDiff extends Diff {
}
}
}
-
diff --git a/core/lib/Drupal/Component/Discovery/YamlDiscovery.php b/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
index c32628166..8f8b4443c 100644
--- a/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
+++ b/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
@@ -86,4 +86,3 @@ class YamlDiscovery implements DiscoverableInterface {
}
}
-
diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
index dbd06d1eb..faaa95f91 100644
--- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php
+++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
@@ -219,7 +219,7 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
if (!$item) {
return;
}
- $header = new PoHeader;
+ $header = new PoHeader();
$header->setFromString(trim($item->getTranslation()));
$this->_header = $header;
}
diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php
index 983091504..1e6a2b30e 100644
--- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php
+++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php
@@ -50,7 +50,7 @@ class FileStorage implements PhpStorageInterface {
$path = $this->getFullPath($name);
$directory = dirname($path);
if ($this->ensureDirectory($directory)) {
- $htaccess_path = $directory . '/.htaccess';
+ $htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
@@ -126,7 +126,7 @@ EOF;
*/
protected function ensureDirectory($directory, $mode = 0777) {
if ($this->createDirectory($directory, $mode)) {
- $htaccess_path = $directory . '/.htaccess';
+ $htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
diff --git a/core/lib/Drupal/Component/Render/FormattableMarkup.php b/core/lib/Drupal/Component/Render/FormattableMarkup.php
index f8274ee47..d9fbf2f43 100644
--- a/core/lib/Drupal/Component/Render/FormattableMarkup.php
+++ b/core/lib/Drupal/Component/Render/FormattableMarkup.php
@@ -163,9 +163,9 @@ class FormattableMarkup implements MarkupInterface, \Countable {
* wrapped in quotes:
* @code
* // Secure (with quotes):
- * $this->placeholderFormat('@variable', [':url' => $url, @variable => $variable]);
+ * $this->placeholderFormat('@variable', [':url' => $url, '@variable' => $variable]);
* // Insecure (without quotes):
- * $this->placeholderFormat('@variable', [':url' => $url, @variable => $variable]);
+ * $this->placeholderFormat('@variable', [':url' => $url, '@variable' => $variable]);
* @endcode
* When ":variable" comes from arbitrary user input, the result is secure,
* but not guaranteed to be a valid URL (which means the resulting output
diff --git a/core/lib/Drupal/Component/Utility/Random.php b/core/lib/Drupal/Component/Utility/Random.php
index e26d4a046..55772f803 100644
--- a/core/lib/Drupal/Component/Utility/Random.php
+++ b/core/lib/Drupal/Component/Utility/Random.php
@@ -139,7 +139,7 @@ class Random {
* @return string
*/
public function word($length) {
- mt_srand((double) microtime()*1000000);
+ mt_srand((double) microtime() * 1000000);
$vowels = array("a", "e", "i", "o", "u");
$cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr",
diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php
index a4052490e..1395d818f 100644
--- a/core/lib/Drupal/Component/Utility/UrlHelper.php
+++ b/core/lib/Drupal/Component/Utility/UrlHelper.php
@@ -19,7 +19,6 @@ class UrlHelper {
/**
* Parses an array into a valid, rawurlencoded query string.
*
- *
* rawurlencode() is RFC3986 compliant, and as a consequence RFC3987
* compliant. The latter defines the required format of "URLs" in HTML5.
* urlencode() is almost the same as rawurlencode(), except that it encodes
diff --git a/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php
index 65f9fb642..8148d4ca5 100644
--- a/core/lib/Drupal/Core/Access/AccessResult.php
+++ b/core/lib/Drupal/Core/Access/AccessResult.php
@@ -83,7 +83,7 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
* will be TRUE.
*/
public static function forbiddenIf($condition) {
- return $condition ? static::forbidden(): static::neutral();
+ return $condition ? static::forbidden() : static::neutral();
}
/**
diff --git a/core/lib/Drupal/Core/Ajax/DataCommand.php b/core/lib/Drupal/Core/Ajax/DataCommand.php
index 6c650a546..fe838cace 100644
--- a/core/lib/Drupal/Core/Ajax/DataCommand.php
+++ b/core/lib/Drupal/Core/Ajax/DataCommand.php
@@ -71,4 +71,3 @@ class DataCommand implements CommandInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/AppRootFactory.php b/core/lib/Drupal/Core/AppRootFactory.php
index 1d86a858f..65c4592ed 100644
--- a/core/lib/Drupal/Core/AppRootFactory.php
+++ b/core/lib/Drupal/Core/AppRootFactory.php
@@ -34,4 +34,3 @@ class AppRootFactory {
}
}
-
diff --git a/core/lib/Drupal/Core/Archiver/ArchiverException.php b/core/lib/Drupal/Core/Archiver/ArchiverException.php
index 35e76088e..b1ad0b6e9 100644
--- a/core/lib/Drupal/Core/Archiver/ArchiverException.php
+++ b/core/lib/Drupal/Core/Archiver/ArchiverException.php
@@ -6,4 +6,3 @@ namespace Drupal\Core\Archiver;
* Defines an exception class for Drupal\Core\Archiver\ArchiverInterface.
*/
class ArchiverException extends \Exception {}
-
diff --git a/core/lib/Drupal/Core/Archiver/Zip.php b/core/lib/Drupal/Core/Archiver/Zip.php
index 20eb9f316..045e6c046 100644
--- a/core/lib/Drupal/Core/Archiver/Zip.php
+++ b/core/lib/Drupal/Core/Archiver/Zip.php
@@ -70,7 +70,7 @@ class Zip implements ArchiverInterface {
*/
public function listContents() {
$files = array();
- for ($i=0; $i < $this->zip->numFiles; $i++) {
+ for ($i = 0; $i < $this->zip->numFiles; $i++) {
$files[] = $this->zip->getNameIndex($i);
}
return $files;
diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php
index f335a1539..79ac31605 100644
--- a/core/lib/Drupal/Core/Asset/AssetResolver.php
+++ b/core/lib/Drupal/Core/Asset/AssetResolver.php
@@ -214,7 +214,7 @@ class AssetResolver implements AssetResolverInterface {
// hook_library_info_alter(). Additionally add the current language to
// support translation of JavaScript files via hook_js_alter().
$libraries_to_load = $this->getLibrariesToLoad($assets);
- $cid = 'js:' . $theme_info->getName() . ':' . $this->languageManager->getCurrentLanguage()->getId() . ':' . Crypt::hashBase64(serialize($libraries_to_load)) . (int) (count($assets->getSettings()) > 0) . (int) $optimize;
+ $cid = 'js:' . $theme_info->getName() . ':' . $this->languageManager->getCurrentLanguage()->getId() . ':' . Crypt::hashBase64(serialize($libraries_to_load) . serialize($assets->getLibraries())) . (int) (count($assets->getSettings()) > 0) . (int) $optimize;
if ($cached = $this->cache->get($cid)) {
list($js_assets_header, $js_assets_footer, $settings, $settings_in_header) = $cached->data;
diff --git a/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php b/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php
index 4254f5fca..2c4122d58 100644
--- a/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php
+++ b/core/lib/Drupal/Core/Asset/CssCollectionGrouper.php
@@ -12,8 +12,8 @@ class CssCollectionGrouper implements AssetCollectionGrouperInterface {
*
* Puts multiple items into the same group if they are groupable and if they
* are for the same 'media' and 'browsers'. Items of the 'file' type are
- * groupable if their 'preprocess' flag is TRUE, items of the 'inline' type
- * are always groupable, and items of the 'external' type are never groupable.
+ * groupable if their 'preprocess' flag is TRUE, and items of the 'external'
+ * type are never groupable.
*
* Also ensures that the process of grouping items does not change their
* relative order. This requirement may result in multiple groups for the same
@@ -55,11 +55,6 @@ class CssCollectionGrouper implements AssetCollectionGrouperInterface {
$group_keys = $item['preprocess'] ? array($item['type'], $item['group'], $item['media'], $item['browsers']) : FALSE;
break;
- case 'inline':
- // Always group inline items.
- $group_keys = array($item['type'], $item['media'], $item['browsers']);
- break;
-
case 'external':
// Do not group external items.
$group_keys = FALSE;
diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php
index c596d8136..9beddd1d2 100644
--- a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php
@@ -133,16 +133,6 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
}
break;
- case 'inline':
- // We don't do any caching for inline CSS assets.
- $data = '';
- foreach ($css_group['items'] as $css_asset) {
- $data .= $this->optimizer->optimize($css_asset);
- }
- unset($css_assets[$order]['data']['items']);
- $css_assets[$order]['data'] = $data;
- break;
-
case 'external':
// We don't do any aggregation and hence also no caching for external
// CSS assets.
diff --git a/core/lib/Drupal/Core/Asset/CssOptimizer.php b/core/lib/Drupal/Core/Asset/CssOptimizer.php
index 168f315ca..2a316fa62 100644
--- a/core/lib/Drupal/Core/Asset/CssOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/CssOptimizer.php
@@ -20,19 +20,14 @@ class CssOptimizer implements AssetOptimizerInterface {
* {@inheritdoc}
*/
public function optimize(array $css_asset) {
- if (!in_array($css_asset['type'], array('file', 'inline'))) {
- throw new \Exception('Only file or inline CSS assets can be optimized.');
+ if ($css_asset['type'] != 'file') {
+ throw new \Exception('Only file CSS assets can be optimized.');
}
- if ($css_asset['type'] === 'file' && !$css_asset['preprocess']) {
+ if (!$css_asset['preprocess']) {
throw new \Exception('Only file CSS assets with preprocessing enabled can be optimized.');
}
- if ($css_asset['type'] === 'file') {
- return $this->processFile($css_asset);
- }
- else {
- return $this->processCss($css_asset['data'], $css_asset['preprocess']);
- }
+ return $this->processFile($css_asset);
}
/**
@@ -241,14 +236,14 @@ class CssOptimizer implements AssetOptimizerInterface {
/**
* Prefixes all paths within a CSS file for processFile().
*
- * @param array $matches
- * An array of matches by a preg_replace_callback() call that scans for
- * url() references in CSS files, except for external or absolute ones.
- *
* Note: the only reason this method is public is so color.module can call it;
* it is not on the AssetOptimizerInterface, so future refactorings can make
* it protected.
*
+ * @param array $matches
+ * An array of matches by a preg_replace_callback() call that scans for
+ * url() references in CSS files, except for external or absolute ones.
+ *
* @return string
* The file path.
*/
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php b/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php
index c4780bdda..710e3c0b9 100644
--- a/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php
+++ b/core/lib/Drupal/Core/Asset/JsCollectionGrouper.php
@@ -12,8 +12,7 @@ class JsCollectionGrouper implements AssetCollectionGrouperInterface {
*
* Puts multiple items into the same group if they are groupable and if they
* are for the same browsers. Items of the 'file' type are groupable if their
- * 'preprocess' flag is TRUE. Items of the 'inline', 'settings', or 'external'
- * type are not groupable.
+ * 'preprocess' flag is TRUE. Items of the 'external' type are not groupable.
*
* Also ensures that the process of grouping items does not change their
* relative order. This requirement may result in multiple groups for the same
@@ -43,9 +42,7 @@ class JsCollectionGrouper implements AssetCollectionGrouperInterface {
break;
case 'external':
- case 'setting':
- case 'inline':
- // Do not group external, settings, and inline items.
+ // Do not group external items.
$group_keys = FALSE;
break;
}
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
index bee73e7c8..aef10bf55 100644
--- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
@@ -138,10 +138,8 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface {
break;
case 'external':
- case 'setting':
- case 'inline':
- // We don't do any aggregation and hence also no caching for external,
- // setting or inline JS assets.
+ // We don't do any aggregation and hence also no caching for external
+ // JS assets.
$uri = $js_group['items'][0]['data'];
$js_assets[$order]['data'] = $uri;
break;
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php
index a1789f34a..c5f0a2b1e 100644
--- a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php
+++ b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php
@@ -68,7 +68,7 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface {
'type' => 'application/json',
'data-drupal-selector' => 'drupal-settings-json',
);
- $element['#value'] = Json::encode($js_asset['data']);
+ $element['#value'] = Json::encode($js_asset['data']);
break;
case 'file':
diff --git a/core/lib/Drupal/Core/Asset/JsOptimizer.php b/core/lib/Drupal/Core/Asset/JsOptimizer.php
index 3a3b74718..6b8c217fc 100644
--- a/core/lib/Drupal/Core/Asset/JsOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/JsOptimizer.php
@@ -16,7 +16,7 @@ class JsOptimizer implements AssetOptimizerInterface {
if ($js_asset['type'] !== 'file') {
throw new \Exception('Only file JavaScript assets can be optimized.');
}
- if ($js_asset['type'] === 'file' && !$js_asset['preprocess']) {
+ if (!$js_asset['preprocess']) {
throw new \Exception('Only file JavaScript assets with preprocessing enabled can be optimized.');
}
diff --git a/core/lib/Drupal/Core/Cache/Context/PathParentCacheContext.php b/core/lib/Drupal/Core/Cache/Context/PathParentCacheContext.php
new file mode 100644
index 000000000..76c22fb32
--- /dev/null
+++ b/core/lib/Drupal/Core/Cache/Context/PathParentCacheContext.php
@@ -0,0 +1,41 @@
+requestStack->getCurrentRequest();
+ $path_elements = explode('/', trim($request->getPathInfo(), '/'));
+ array_pop($path_elements);
+ return implode('/', $path_elements);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheableMetadata() {
+ return new CacheableMetadata();
+ }
+
+}
diff --git a/core/lib/Drupal/Core/Config/ConfigCrudEvent.php b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php
index b343e4c67..af25d3613 100644
--- a/core/lib/Drupal/Core/Config/ConfigCrudEvent.php
+++ b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php
@@ -49,4 +49,3 @@ class ConfigCrudEvent extends Event {
}
}
-
diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php
index a7fd9e6c2..c5e5931da 100644
--- a/core/lib/Drupal/Core/Config/ConfigFactory.php
+++ b/core/lib/Drupal/Core/Config/ConfigFactory.php
@@ -272,7 +272,7 @@ class ConfigFactory implements ConfigFactoryInterface, EventSubscriberInterface
// $this->configFactoryOverrides, add cache keys for each.
$keys[] = 'global_overrides';
foreach($this->configFactoryOverrides as $override) {
- $keys[] = $override->getCacheSuffix();
+ $keys[] = $override->getCacheSuffix();
}
return $keys;
}
diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php
index bd9af28e3..25071b006 100644
--- a/core/lib/Drupal/Core/Config/ConfigImporter.php
+++ b/core/lib/Drupal/Core/Config/ConfigImporter.php
@@ -484,14 +484,17 @@ class ConfigImporter {
*/
public function doSyncStep($sync_step, &$context) {
if (!is_array($sync_step) && method_exists($this, $sync_step)) {
+ \Drupal::service('config.installer')->setSyncing(TRUE);
$this->$sync_step($context);
}
elseif (is_callable($sync_step)) {
+ \Drupal::service('config.installer')->setSyncing(TRUE);
call_user_func_array($sync_step, array(&$context, $this));
}
else {
throw new \InvalidArgumentException('Invalid configuration synchronization step');
}
+ \Drupal::service('config.installer')->setSyncing(FALSE);
}
/**
@@ -778,7 +781,6 @@ class ConfigImporter {
// Set the config installer to use the sync directory instead of the
// extensions own default config directories.
\Drupal::service('config.installer')
- ->setSyncing(TRUE)
->setSourceStorage($this->storageComparer->getSourceStorage());
if ($type == 'module') {
$this->moduleInstaller->$op(array($name), FALSE);
@@ -805,8 +807,6 @@ class ConfigImporter {
}
$this->setProcessedExtension($type, $op, $name);
- \Drupal::service('config.installer')
- ->setSyncing(FALSE);
}
/**
diff --git a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
index f459878d8..aa5045ba1 100644
--- a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
+++ b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php
@@ -100,4 +100,3 @@ class ConfigModuleOverridesEvent extends Event {
return $this;
}
}
-
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
index 2fce5380f..bca31f42b 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
@@ -17,10 +17,10 @@ use Drupal\Component\Utility\SortArray;
* The configuration dependency value is structured like this:
* @code
* array(
- * 'config => array(
+ * 'config' => array(
* // An array of configuration entity object names. Recalculated on save.
* ),
- * 'content => array(
+ * 'content' => array(
* // An array of content entity configuration dependency names. The default
* // format is "ENTITY_TYPE_ID:BUNDLE:UUID". Recalculated on save.
* ),
@@ -165,7 +165,7 @@ class ConfigDependencyManager {
// If checking content, module, or theme dependencies, discover which
// entities are dependent on the entities that have a direct dependency.
foreach ($dependent_entities as $entity) {
- $entities_to_check[] = $entity->getConfigDependencyName();
+ $entities_to_check[] = $entity->getConfigDependencyName();
}
}
$dependencies = array_merge($this->createGraphConfigEntityDependencies($entities_to_check), $dependent_entities);
@@ -291,10 +291,10 @@ class ConfigDependencyManager {
* The configuration dependencies. The array is structured like this:
* @code
* array(
- * 'config => array(
+ * 'config' => array(
* // An array of configuration entity object names.
* ),
- * 'content => array(
+ * 'content' => array(
* // An array of content entity configuration dependency names. The default
* // format is "ENTITY_TYPE_ID:BUNDLE:UUID".
* ),
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
index 95d481146..3834dae08 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
@@ -382,8 +382,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
* {@inheritdoc}
*/
public function importCreate($name, Config $new_config, Config $old_config) {
- $entity = $this->createFromStorageRecord($new_config->get());
- $entity->setSyncing(TRUE);
+ $entity = $this->_doCreateFromStorageRecord($new_config->get(), TRUE);
$entity->save();
return TRUE;
}
@@ -425,6 +424,27 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
* {@inheritdoc}
*/
public function createFromStorageRecord(array $values) {
+ return $this->_doCreateFromStorageRecord($values);
+ }
+
+ /**
+ * Helps create a configuration entity from storage values.
+ *
+ * Allows the configuration entity storage to massage storage values before
+ * creating an entity.
+ *
+ * @param array $values
+ * The array of values from the configuration storage.
+ * @param bool $is_syncing
+ * Is the configuration entity being created as part of a config sync.
+ *
+ * @return ConfigEntityInterface
+ * The configuration entity.
+ *
+ * @see \Drupal\Core\Config\Entity\ConfigEntityStorageInterface::createFromStorageRecord()
+ * @see \Drupal\Core\Config\Entity\ImportableEntityStorageInterface::importCreate()
+ */
+ protected function _doCreateFromStorageRecord(array $values, $is_syncing = FALSE) {
// Assign a new UUID if there is none yet.
if ($this->uuidKey && $this->uuidService && !isset($values[$this->uuidKey])) {
$values[$this->uuidKey] = $this->uuidService->generate();
@@ -432,6 +452,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
$data = $this->mapFromStorageRecords(array($values));
$entity = current($data);
$entity->original = clone $entity;
+ $entity->setSyncing($is_syncing);
$entity->enforceIsNew();
$entity->postCreate($this);
@@ -439,6 +460,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
// entity object, for instance to fill-in default values.
$this->invokeHook('create', $entity);
return $entity;
+
}
/**
diff --git a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php
index 849903441..9fc7d4ceb 100644
--- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php
+++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php
@@ -132,4 +132,3 @@ class ExtensionInstallStorage extends InstallStorage {
return $this->folders;
}
}
-
diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php
index 80a0fb68c..40a25ef30 100644
--- a/core/lib/Drupal/Core/Config/StorableConfigBase.php
+++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php
@@ -60,13 +60,13 @@ abstract class StorableConfigBase extends ConfigBase {
/**
* Saves the configuration object.
*
+ * Must invalidate the cache tags associated with the configuration object.
+ *
* @param bool $has_trusted_data
* Set to TRUE if the configuration data has already been checked to ensure
* it conforms to schema. Generally this is only used during module and
* theme installation.
*
- * Must invalidate the cache tags associated with the configuration object.
- *
* @return $this
*
* @see \Drupal\Core\Config\ConfigInstaller::createConfiguration()
@@ -191,7 +191,7 @@ abstract class StorableConfigBase extends ConfigBase {
// we have to special case the meaning of an empty string for numeric
// types. In PHP this would be casted to a 0 but for the purposes of
// configuration we need to treat this as a NULL.
- $empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
+ $empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
if ($value === NULL || $empty_value) {
$value = NULL;
diff --git a/core/lib/Drupal/Core/Controller/ControllerResolver.php b/core/lib/Drupal/Core/Controller/ControllerResolver.php
index a8fad7479..d16b48da3 100644
--- a/core/lib/Drupal/Core/Controller/ControllerResolver.php
+++ b/core/lib/Drupal/Core/Controller/ControllerResolver.php
@@ -68,7 +68,7 @@ class ControllerResolver extends BaseControllerResolver implements ControllerRes
return $controller;
}
elseif (method_exists($controller, '__invoke')) {
- return new $controller;
+ return new $controller();
}
}
diff --git a/core/lib/Drupal/Core/Database/DatabaseException.php b/core/lib/Drupal/Core/Database/DatabaseException.php
index 3f3d0da21..a9470b90e 100644
--- a/core/lib/Drupal/Core/Database/DatabaseException.php
+++ b/core/lib/Drupal/Core/Database/DatabaseException.php
@@ -11,4 +11,3 @@ namespace Drupal\Core\Database;
* developers should account for it separately.
*/
interface DatabaseException { }
-
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Select.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Select.php
index 7d77922e3..be400adbd 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Select.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Select.php
@@ -12,4 +12,4 @@ class Select extends QuerySelect {
// SQLite does not support FOR UPDATE so nothing to do.
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Drupal/Core/Database/Log.php b/core/lib/Drupal/Core/Database/Log.php
index 9c4714c8b..84f55cba6 100644
--- a/core/lib/Drupal/Core/Database/Log.php
+++ b/core/lib/Drupal/Core/Database/Log.php
@@ -22,8 +22,8 @@ class Log {
*
* array(
* $logging_key = array(
- * array(query => '', args => array(), caller => '', target => '', time => 0),
- * array(query => '', args => array(), caller => '', target => '', time => 0),
+ * array('query' => '', 'args' => array(), 'caller' => '', 'target' => '', 'time' => 0),
+ * array('query' => '', 'args' => array(), 'caller' => '', 'target' => '', 'time' => 0),
* ),
* );
*
diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php
index 07f4b5f91..a7e340bfc 100644
--- a/core/lib/Drupal/Core/Database/Query/Select.php
+++ b/core/lib/Drupal/Core/Database/Query/Select.php
@@ -819,7 +819,7 @@ class Select extends Query implements SelectInterface {
// Don't use the AS keyword for table aliases, as some
// databases don't support it (e.g., Oracle).
- $query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
+ $query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
if (!empty($table['condition'])) {
$query .= ' ON ' . $table['condition'];
diff --git a/core/lib/Drupal/Core/Datetime/DateFormatter.php b/core/lib/Drupal/Core/Datetime/DateFormatter.php
index cb67ae5f3..eb107e8e3 100644
--- a/core/lib/Drupal/Core/Datetime/DateFormatter.php
+++ b/core/lib/Drupal/Core/Datetime/DateFormatter.php
@@ -234,12 +234,12 @@ class DateFormatter implements DateFormatterInterface {
switch ($value) {
case 'y':
$interval_output = $this->formatPlural($interval->y, '1 year', '@count years', array(), array('langcode' => $options['langcode']));
- $max_age = min($max_age, 365*86400);
+ $max_age = min($max_age, 365 * 86400);
break;
case 'm':
$interval_output = $this->formatPlural($interval->m, '1 month', '@count months', array(), array('langcode' => $options['langcode']));
- $max_age = min($max_age, 30*86400);
+ $max_age = min($max_age, 30 * 86400);
break;
case 'd':
@@ -252,7 +252,7 @@ class DateFormatter implements DateFormatterInterface {
$interval_output .= $this->formatPlural($weeks, '1 week', '@count weeks', array(), array('langcode' => $options['langcode']));
$days -= $weeks * 7;
$granularity--;
- $max_age = min($max_age, 7*86400);
+ $max_age = min($max_age, 7 * 86400);
}
if ((!$output || $weeks > 0) && $granularity > 0 && $days > 0) {
diff --git a/core/lib/Drupal/Core/Datetime/DateHelper.php b/core/lib/Drupal/Core/Datetime/DateHelper.php
index 1a8bf6c79..70db9b3c4 100644
--- a/core/lib/Drupal/Core/Datetime/DateHelper.php
+++ b/core/lib/Drupal/Core/Datetime/DateHelper.php
@@ -531,4 +531,3 @@ class DateHelper {
}
}
-
diff --git a/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php b/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php
index ca2ee4259..12ab03ba3 100644
--- a/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php
+++ b/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php
@@ -70,4 +70,3 @@ abstract class DateElementBase extends FormElement {
}
}
-
diff --git a/core/lib/Drupal/Core/Datetime/Element/Datelist.php b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
index 7a8f884f0..a6c678133 100644
--- a/core/lib/Drupal/Core/Datetime/Element/Datelist.php
+++ b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
@@ -61,7 +61,12 @@ class Datelist extends DateElementBase {
unset($input['ampm']);
}
$timezone = !empty($element['#date_timezone']) ? $element['#date_timezone'] : NULL;
- $date = DrupalDateTime::createFromArray($input, $timezone);
+ try {
+ $date = DrupalDateTime::createFromArray($input, $timezone);
+ }
+ catch (\Exception $e) {
+ $form_state->setError($element, t('Selected combination of day and month is not valid.'));
+ }
if ($date instanceof DrupalDateTime && !$date->hasErrors()) {
static::incrementRound($date, $increment);
}
@@ -88,7 +93,7 @@ class Datelist extends DateElementBase {
break;
case 'hour':
- $format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
+ $format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
break;
case 'minute':
@@ -218,7 +223,7 @@ class Datelist extends DateElementBase {
break;
case 'hour':
- $format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
+ $format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
$options = $date_helper->hours($format, $element['#required']);
$title = t('Hour');
break;
@@ -318,8 +323,8 @@ class Datelist extends DateElementBase {
if ($date instanceof DrupalDateTime && !$date->hasErrors()) {
$form_state->setValueForElement($element, $date);
}
- // If the input is invalid, set an error.
- else {
+ // If the input is invalid and an error doesn't exist, set one.
+ elseif ($form_state->getError($element) === NULL) {
$form_state->setError($element, t('The %field date is invalid.', array('%field' => !empty($element['#title']) ? $element['#title'] : '')));
}
}
diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/ProxyServicesPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/ProxyServicesPass.php
index 19c0aca85..b37e900f5 100644
--- a/core/lib/Drupal/Core/DependencyInjection/Compiler/ProxyServicesPass.php
+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/ProxyServicesPass.php
@@ -50,7 +50,7 @@ class ProxyServicesPass implements CompilerPassInterface {
$root_namespace_dir = $namespaces[$root_namespace];
}
- $message =<<environment, \Drupal::VERSION, Settings::get('deployment_identifier'), serialize(Settings::get('container_yamls')));
+ $parts = array('service_container', $this->environment, \Drupal::VERSION, Settings::get('deployment_identifier'), PHP_OS, serialize(Settings::get('container_yamls')));
return implode(':', $parts);
}
@@ -914,11 +925,15 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
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);
ini_set('error_log', DRUPAL_ROOT . '/sites/simpletest/' . substr($test_prefix, 10) . '/error.log');
+
+ // Ensure that a rewritten settings.php is used if opcache is on.
+ ini_set('opcache.validate_timestamps', 'on');
+ ini_set('opcache.revalidate_freq', 0);
}
else {
// Ensure that no other code defines this.
@@ -965,7 +980,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
&& 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;
@@ -1204,7 +1219,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
foreach ($this->serviceProviderClasses as $origin => $classes) {
foreach ($classes as $name => $class) {
if (!is_object($class)) {
- $this->serviceProviders[$origin][$name] = new $class;
+ $this->serviceProviders[$origin][$name] = new $class();
}
else {
$this->serviceProviders[$origin][$name] = $class;
diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityListController.php b/core/lib/Drupal/Core/Entity/Controller/EntityListController.php
index 1c93865e7..d8a1ea12d 100644
--- a/core/lib/Drupal/Core/Entity/Controller/EntityListController.php
+++ b/core/lib/Drupal/Core/Entity/Controller/EntityListController.php
@@ -23,4 +23,3 @@ class EntityListController extends ControllerBase {
}
}
-
diff --git a/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php b/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
index 6c8578970..ba6117d90 100644
--- a/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
+++ b/core/lib/Drupal/Core/Entity/Display/EntityFormDisplayInterface.php
@@ -55,7 +55,7 @@ interface EntityFormDisplayInterface extends EntityDisplayInterface {
* // For 'single-value' widgets:
* '#theme' => 'field_multiple_value_form',
* '#cardinality' => The field cardinality,
- * '#cardinality_multiple => TRUE if the field can contain multiple
+ * '#cardinality_multiple' => TRUE if the field can contain multiple
* items, FALSE otherwise.
* // One sub-array per copy of the widget, keyed by delta.
* 0 => array(
diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php
index aadd2e552..a11939bb2 100644
--- a/core/lib/Drupal/Core/Entity/EntityManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityManager.php
@@ -121,7 +121,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
*
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
*/
- public function createHandlerInstance($class, EntityTypeInterface $definition = null) {
+ public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition);
}
diff --git a/core/lib/Drupal/Core/Entity/Query/QueryBase.php b/core/lib/Drupal/Core/Entity/Query/QueryBase.php
index e8a8df8cd..9acfb77ff 100644
--- a/core/lib/Drupal/Core/Entity/Query/QueryBase.php
+++ b/core/lib/Drupal/Core/Entity/Query/QueryBase.php
@@ -305,7 +305,7 @@ abstract class QueryBase implements QueryInterface {
*/
public function tableSort(&$headers) {
// If 'field' is not initialized, the header columns aren't clickable.
- foreach ($headers as $key =>$header) {
+ foreach ($headers as $key => $header) {
if (is_array($header) && isset($header['specifier'])) {
$headers[$key]['field'] = '';
}
diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
index f3835ff11..ca25fb97a 100644
--- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
@@ -80,10 +80,21 @@ class Tables implements TablesInterface {
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$field_storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
- for ($key = 0; $key <= $count; $key ++) {
- // If there is revision support and only the current revision is being
- // queried then use the revision id. Otherwise, the entity id will do.
- if (($revision_key = $entity_type->getKey('revision')) && $all_revisions) {
+ for ($key = 0; $key <= $count; $key++) {
+ // This can either be the name of an entity base field or a configurable
+ // field.
+ $specifier = $specifiers[$key];
+ if (isset($field_storage_definitions[$specifier])) {
+ $field_storage = $field_storage_definitions[$specifier];
+ }
+ else {
+ $field_storage = FALSE;
+ }
+
+ // If there is revision support, only the current revisions are being
+ // queried, and the field is revisionable then use the revision id.
+ // Otherwise, the entity id will do.
+ if (($revision_key = $entity_type->getKey('revision')) && $all_revisions && $field_storage && $field_storage->isRevisionable()) {
// This contains the relevant SQL field to be used when joining entity
// tables.
$entity_id_field = $revision_key;
@@ -95,15 +106,6 @@ class Tables implements TablesInterface {
$entity_id_field = $entity_type->getKey('id');
$field_id_field = 'entity_id';
}
- // This can either be the name of an entity base field or a configurable
- // field.
- $specifier = $specifiers[$key];
- if (isset($field_storage_definitions[$specifier])) {
- $field_storage = $field_storage_definitions[$specifier];
- }
- else {
- $field_storage = FALSE;
- }
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = $this->entityManager->getStorage($entity_type_id)->getTableMapping();
@@ -152,11 +154,18 @@ class Tables implements TablesInterface {
// finds the property first. The data table is preferred, which is why
// it gets added before the base table.
$entity_tables = array();
- if ($data_table = $all_revisions ? $entity_type->getRevisionDataTable() : $entity_type->getDataTable()) {
+ if ($all_revisions && $field_storage && $field_storage->isRevisionable()) {
+ $data_table = $entity_type->getRevisionDataTable();
+ $entity_base_table = $entity_type->getRevisionTable();
+ }
+ else {
+ $data_table = $entity_type->getDataTable();
+ $entity_base_table = $entity_type->getBaseTable();
+ }
+ if ($data_table) {
$this->sqlQuery->addMetaData('simple_query', FALSE);
$entity_tables[$data_table] = $this->getTableMapping($data_table, $entity_type_id);
}
- $entity_base_table = $all_revisions ? $entity_type->getRevisionTable() : $entity_type->getBaseTable();
$entity_tables[$entity_base_table] = $this->getTableMapping($entity_base_table, $entity_type_id);
$sql_column = $specifier;
@@ -203,7 +212,7 @@ class Tables implements TablesInterface {
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$field_storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
// Add the new entity base table using the table and sql column.
- $join_condition= '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
+ $join_condition = '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
$base_table = $this->sqlQuery->leftJoin($entity_type->getBaseTable(), NULL, $join_condition);
$propertyDefinitions = array();
$key++;
diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
index b229d3a61..d71949ed6 100644
--- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
+++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
@@ -201,7 +201,7 @@ class DefaultTableMapping implements TableMappingInterface {
$field_name = $storage_definition->getName();
if ($this->allowsSharedTableStorage($storage_definition)) {
- $column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
+ $column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
}
elseif ($this->requiresDedicatedTableStorage($storage_definition)) {
$column_name = !in_array($property_name, $this->getReservedColumns()) ? $field_name . '_' . $property_name : $property_name;
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
index 05436513c..72c74580a 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
@@ -1174,7 +1174,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
$vid = $id;
}
- $original = !empty($entity->original) ? $entity->original: NULL;
+ $original = !empty($entity->original) ? $entity->original : NULL;
// Determine which fields should be actually stored.
$definitions = $this->entityManager->getFieldDefinitions($entity_type, $bundle);
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index ca1835eab..ca8bef5a9 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -1263,7 +1263,9 @@ function hook_entity_query_alter(\Drupal\Core\Entity\Query\QueryInterface $query
* Act on entities being assembled before rendering.
*
* @param &$build
- * A renderable array representing the entity content.
+ * A renderable array representing the entity content. The module may add
+ * elements to $build prior to rendering. The structure of $build is a
+ * renderable array as expected by drupal_render().
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
* @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display
@@ -1272,10 +1274,6 @@ function hook_entity_query_alter(\Drupal\Core\Entity\Query\QueryInterface $query
* @param $view_mode
* The view mode the entity is rendered in.
*
- * The module may add elements to $build prior to rendering. The
- * structure of $build is a renderable array as expected by
- * drupal_render().
- *
* @see hook_entity_view_alter()
* @see hook_ENTITY_TYPE_view()
*
@@ -1297,7 +1295,9 @@ function hook_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $en
* Act on entities of a particular type being assembled before rendering.
*
* @param &$build
- * A renderable array representing the entity content.
+ * A renderable array representing the entity content. The module may add
+ * elements to $build prior to rendering. The structure of $build is a
+ * renderable array as expected by drupal_render().
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
* @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display
@@ -1306,10 +1306,6 @@ function hook_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $en
* @param $view_mode
* The view mode the entity is rendered in.
*
- * The module may add elements to $build prior to rendering. The
- * structure of $build is a renderable array as expected by
- * drupal_render().
- *
* @see hook_ENTITY_TYPE_view_alter()
* @see hook_entity_view()
*
diff --git a/core/lib/Drupal/Core/EventSubscriber/EntityRouteProviderSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/EntityRouteProviderSubscriber.php
index a05cc585c..36a539d73 100644
--- a/core/lib/Drupal/Core/EventSubscriber/EntityRouteProviderSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/EntityRouteProviderSubscriber.php
@@ -68,4 +68,3 @@ class EntityRouteProviderSubscriber implements EventSubscriberInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php b/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php
index 10729752e..b6f559b25 100644
--- a/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php
+++ b/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php
@@ -84,4 +84,3 @@ abstract class ExecutablePluginBase extends ContextAwarePluginBase implements Ex
return $this;
}
}
-
diff --git a/core/lib/Drupal/Core/Extension/InfoParserInterface.php b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
index 195f1a33c..e5c99fe18 100644
--- a/core/lib/Drupal/Core/Extension/InfoParserInterface.php
+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -60,4 +60,3 @@ interface InfoParserInterface {
public function parse($filename);
}
-
diff --git a/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php b/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php
index 14875c673..ce14f86ae 100644
--- a/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php
@@ -82,4 +82,3 @@ interface ModuleInstallerInterface {
public function validateUninstall(array $module_list);
}
-
diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php
index 9abea30b9..7f65fea19 100644
--- a/core/lib/Drupal/Core/Extension/module.api.php
+++ b/core/lib/Drupal/Core/Extension/module.api.php
@@ -894,6 +894,9 @@ function hook_updater_info_alter(&$updaters) {
* Module dependencies do not belong to these installation requirements,
* but should be defined in the module's .info.yml file.
*
+ * During installation (when $phase == 'install'), if you need to load a class
+ * from your module, you'll need to include the class file directly.
+ *
* The 'runtime' phase is not limited to pure installation requirements
* but can also be used for more general status information like maintenance
* tasks and security issues.
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
index ee1952378..6f3ce021a 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -25,6 +25,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implements ContainerFactoryPluginInterface {
+ /**
+ * The number of times this formatter allows rendering the same entity.
+ *
+ * @var int
+ */
+ const RECURSIVE_RENDER_LIMIT = 20;
+
/**
* The logger factory.
*
@@ -47,7 +54,19 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
protected $entityDisplayRepository;
/**
- * Constructs a StringFormatter instance.
+ * An array of counters for the recursive rendering protection.
+ *
+ * Each counter takes into account all the relevant information about the
+ * field and the referenced entity that is being rendered.
+ *
+ * @see \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::viewElements()
+ *
+ * @var array
+ */
+ protected static $recursiveRenderDepth = [];
+
+ /**
+ * Constructs a EntityReferenceEntityFormatter instance.
*
* @param string $plugin_id
* The plugin_id for the formatter.
@@ -141,15 +160,35 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
$elements = array();
foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) {
- // Protect ourselves from recursive rendering.
- static $depth = 0;
- $depth++;
- if ($depth > 20) {
- $this->loggerFactory->get('entity')->error('Recursive rendering detected when rendering entity @entity_type @entity_id. Aborting rendering.', array('@entity_type' => $entity->getEntityTypeId(), '@entity_id' => $entity->id()));
- return $elements;
- }
-
if ($entity->id()) {
+ // Due to render caching and delayed calls, the viewElements() method
+ // will be called later in the rendering process through a '#pre_render'
+ // callback, so we need to generate a counter that takes into account
+ // all the relevant information about this field and the referenced
+ // entity that is being rendered.
+ $recursive_render_id = $items->getFieldDefinition()->getTargetEntityTypeId()
+ . $items->getFieldDefinition()->getTargetBundle()
+ . $items->getName()
+ . $entity->id();
+
+ if (isset(static::$recursiveRenderDepth[$recursive_render_id])) {
+ static::$recursiveRenderDepth[$recursive_render_id]++;
+ }
+ else {
+ static::$recursiveRenderDepth[$recursive_render_id] = 1;
+ }
+
+ // Protect ourselves from recursive rendering.
+ if (static::$recursiveRenderDepth[$recursive_render_id] > static::RECURSIVE_RENDER_LIMIT) {
+ $this->loggerFactory->get('entity')->error('Recursive rendering detected when rendering entity %entity_type: %entity_id, using the %field_name field on the %bundle_name bundle. Aborting rendering.', [
+ '%entity_type' => $entity->getEntityTypeId(),
+ '%entity_id' => $entity->id(),
+ '%field_name' => $items->getName(),
+ '%bundle_name' => $items->getFieldDefinition()->getTargetBundle(),
+ ]);
+ return $elements;
+ }
+
$view_builder = $this->entityTypeManager->getViewBuilder($entity->getEntityTypeId());
$elements[$delta] = $view_builder->view($entity, $view_mode, $entity->language()->getId());
@@ -164,7 +203,6 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
// This is an "auto_create" item.
$elements[$delta] = array('#markup' => $entity->label());
}
- $depth = 0;
}
return $elements;
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
index 93fb4655f..527d3eefc 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
@@ -120,4 +120,3 @@ class BooleanItem extends FieldItemBase implements OptionsProviderInterface {
return $values;
}
}
-
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 0da7c034d..544ee94b1 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -1032,7 +1032,7 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
// Assign a decimal placeholder weight to preserve original array order.
if (!isset($element[$key]['#weight'])) {
- $element[$key]['#weight'] = $count/1000;
+ $element[$key]['#weight'] = $count / 1000;
}
else {
// If one of the child elements has a weight then we will need to sort
diff --git a/core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php b/core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php
index adf7355e5..59751c06b 100644
--- a/core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php
+++ b/core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php
@@ -56,8 +56,8 @@ class TrustedHostsRequestFactory {
*
* @return \Symfony\Component\HttpFoundation\Request
* A new request object.
- **/
- public function createRequest(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) {
+ */
+ public function createRequest(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = NULL) {
if (empty($server['HTTP_HOST']) || ($server['HTTP_HOST'] === 'localhost' && $this->host !== 'localhost')) {
$server['HTTP_HOST'] = $this->host;
}
diff --git a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
index f56c12605..9342f5cf7 100644
--- a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
@@ -78,7 +78,7 @@ class SelectLanguageForm extends FormBase {
),
);
$form['actions'] = array('#type' => 'actions');
- $form['actions']['submit'] = array(
+ $form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => 'Save and continue',
'#button_type' => 'primary',
diff --git a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
index bc968b2e4..7ccdf2759 100644
--- a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
@@ -72,7 +72,7 @@ class SelectProfileForm extends FormBase {
$form['profile'][$profile_name]['#description'] = isset($profiles[$profile_name]['description']) ? $this->t($profiles[$profile_name]['description']) : '';
}
$form['actions'] = array('#type' => 'actions');
- $form['actions']['submit'] = array(
+ $form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save and continue'),
'#button_type' => 'primary',
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
index 908046684..6d5fe6526 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
@@ -131,7 +131,7 @@ class SiteConfigureForm extends ConfigFormBase {
// distract from the message that the Drupal installation has completed
// successfully.)
$post_params = $this->getRequest()->request->all();
- if (empty($post_params) && (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
+ if (empty($post_params) && (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook.', array('%dir' => $settings_dir, '%file' => $settings_file, ':handbook_url' => 'https://www.drupal.org/server-permissions')), 'warning');
}
diff --git a/core/lib/Drupal/Core/Installer/InstallerKernel.php b/core/lib/Drupal/Core/Installer/InstallerKernel.php
index ee3ca2f64..c9757158a 100644
--- a/core/lib/Drupal/Core/Installer/InstallerKernel.php
+++ b/core/lib/Drupal/Core/Installer/InstallerKernel.php
@@ -33,4 +33,17 @@ class InstallerKernel extends DrupalKernel {
$this->configStorage = NULL;
}
+ /**
+ * Returns the active configuration storage used during early install.
+ *
+ * This override changes the visibility so that the installer can access
+ * config storage before the container is properly built.
+ *
+ * @return \Drupal\Core\Config\StorageInterface
+ * The config storage.
+ */
+ public function getConfigStorage() {
+ return parent::getConfigStorage();
+ }
+
}
diff --git a/core/lib/Drupal/Core/KeyValueStore/KeyValueExpirableFactory.php b/core/lib/Drupal/Core/KeyValueStore/KeyValueExpirableFactory.php
index b39c7053d..360656ef0 100644
--- a/core/lib/Drupal/Core/KeyValueStore/KeyValueExpirableFactory.php
+++ b/core/lib/Drupal/Core/KeyValueStore/KeyValueExpirableFactory.php
@@ -14,4 +14,3 @@ class KeyValueExpirableFactory extends KeyValueFactory implements KeyValueExpira
const DEFAULT_SETTING = 'keyvalue_expirable_default';
}
-
diff --git a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
index 65674c0ff..9f6d28cc4 100644
--- a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
+++ b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
@@ -75,4 +75,3 @@ class KeyValueFactory implements KeyValueFactoryInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactoryInterface.php b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactoryInterface.php
index 81f383e30..15e39fb99 100644
--- a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactoryInterface.php
+++ b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactoryInterface.php
@@ -19,4 +19,3 @@ interface KeyValueFactoryInterface {
public function get($collection);
}
-
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
index dcaf890d0..928b740c1 100644
--- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php
+++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
@@ -178,7 +178,7 @@ class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerI
* {@inheritdoc}
*/
public function getDefinitions() {
- $definitions = parent::getDefinitions();
+ $definitions = parent::getDefinitions();
$count = 0;
foreach ($definitions as &$definition) {
diff --git a/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
index 731f22ff2..4616d989b 100644
--- a/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
+++ b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
@@ -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));
}
}
diff --git a/core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php b/core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php
index d66b65cce..debf3b0a8 100644
--- a/core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php
+++ b/core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php
@@ -42,4 +42,3 @@ class DenyNoCacheRoutes implements ResponsePolicyInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
index 1c77dc2db..712643a63 100644
--- a/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
+++ b/core/lib/Drupal/Core/Password/PhpassHashedPassword.php
@@ -187,7 +187,7 @@ class PhpassHashedPassword implements PasswordInterface {
} while (--$count);
$len = strlen($hash);
- $output = $setting . $this->base64Encode($hash, $len);
+ $output = $setting . $this->base64Encode($hash, $len);
// $this->base64Encode() of a 16 byte MD5 will always be 22 characters.
// $this->base64Encode() of a 64 byte sha512 will always be 86 characters.
$expected = 12 + ceil((8 * $len) / 6);
diff --git a/core/lib/Drupal/Core/Queue/QueueFactory.php b/core/lib/Drupal/Core/Queue/QueueFactory.php
index b37699e96..7c155a46e 100644
--- a/core/lib/Drupal/Core/Queue/QueueFactory.php
+++ b/core/lib/Drupal/Core/Queue/QueueFactory.php
@@ -64,4 +64,3 @@ class QueueFactory implements ContainerAwareInterface {
return $this->queues[$name];
}
}
-
diff --git a/core/lib/Drupal/Core/Render/Element/Actions.php b/core/lib/Drupal/Core/Render/Element/Actions.php
index 3b8b10b49..1f94466d8 100644
--- a/core/lib/Drupal/Core/Render/Element/Actions.php
+++ b/core/lib/Drupal/Core/Render/Element/Actions.php
@@ -17,7 +17,7 @@ use Drupal\Core\Render\Element;
* $form['actions'] = array('#type' => 'actions');
* $form['actions']['submit'] = array(
* '#type' => 'submit',
- * '#value' => t('Save'),
+ * '#value' => $this->t('Save'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Button.php b/core/lib/Drupal/Core/Render/Element/Button.php
index e75c55e0f..c5b84f078 100644
--- a/core/lib/Drupal/Core/Render/Element/Button.php
+++ b/core/lib/Drupal/Core/Render/Element/Button.php
@@ -72,10 +72,9 @@ class Button extends FormElement {
*
* @param array $element
* An associative array containing the properties of the element.
- * Properties used: #attributes, #button_type, #name, #value.
- *
- * The #button_type property accepts any value, though core themes have CSS that
- * styles the following button_types appropriately: 'primary', 'danger'.
+ * Properties used: #attributes, #button_type, #name, #value. The
+ * #button_type property accepts any value, though core themes have CSS that
+ * styles the following button_types appropriately: 'primary', 'danger'.
*
* @return array
* The $element with prepared variables ready for input.html.twig.
diff --git a/core/lib/Drupal/Core/Render/Element/Checkbox.php b/core/lib/Drupal/Core/Render/Element/Checkbox.php
index 266af5ab7..c9b881704 100644
--- a/core/lib/Drupal/Core/Render/Element/Checkbox.php
+++ b/core/lib/Drupal/Core/Render/Element/Checkbox.php
@@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['copy'] = array(
* '#type' => 'checkbox',
- * '#title' => t('Send me a copy'),
+ * '#title' => $this->t('Send me a copy'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Checkboxes.php b/core/lib/Drupal/Core/Render/Element/Checkboxes.php
index 989c0e644..8487a0960 100644
--- a/core/lib/Drupal/Core/Render/Element/Checkboxes.php
+++ b/core/lib/Drupal/Core/Render/Element/Checkboxes.php
@@ -17,8 +17,8 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['high_school']['tests_taken'] = array(
* '#type' => 'checkboxes',
- * '#options' => array('SAT' => t('SAT'), 'ACT' => t('ACT'))),
- * '#title' => t('What standardized tests did you take?'),
+ * '#options' => array('SAT' => $this->t('SAT'), 'ACT' => $this->t('ACT'))),
+ * '#title' => $this->t('What standardized tests did you take?'),
* ...
* );
* @endcode
diff --git a/core/lib/Drupal/Core/Render/Element/Color.php b/core/lib/Drupal/Core/Render/Element/Color.php
index 7cffdcdda..0f0228cc1 100644
--- a/core/lib/Drupal/Core/Render/Element/Color.php
+++ b/core/lib/Drupal/Core/Render/Element/Color.php
@@ -16,7 +16,7 @@ use Drupal\Component\Utility\Color as ColorUtility;
* @code
* $form['color'] = array(
* '#type' => 'color',
- * '#title' => 'Color',
+ * '#title' => $this->t('Color'),
* '#default_value' => '#ffffff',
* );
* @endcode
diff --git a/core/lib/Drupal/Core/Render/Element/Container.php b/core/lib/Drupal/Core/Render/Element/Container.php
index 8a2aa12c4..eb46f20ce 100644
--- a/core/lib/Drupal/Core/Render/Element/Container.php
+++ b/core/lib/Drupal/Core/Render/Element/Container.php
@@ -15,7 +15,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['needs_accommodation'] = array(
* '#type' => 'checkbox',
- * '#title' => 'Need Special Accommodations?',
+ * '#title' => $this->t('Need Special Accommodations?'),
* );
*
* $form['accommodation'] = array(
@@ -32,7 +32,7 @@ use Drupal\Core\Form\FormStateInterface;
*
* $form['accommodation']['diet'] = array(
* '#type' => 'textfield',
- * '#title' => t('Dietary Restrictions'),
+ * '#title' => $this->t('Dietary Restrictions'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Date.php b/core/lib/Drupal/Core/Render/Element/Date.php
index e322e71fe..dcee06228 100644
--- a/core/lib/Drupal/Core/Render/Element/Date.php
+++ b/core/lib/Drupal/Core/Render/Element/Date.php
@@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['expiration'] = array(
* '#type' => 'date',
- * '#title' => t('Content expiration'),
+ * '#title' => $this->t('Content expiration'),
* '#default_value' => array('year' => 2020, 'month' => 2, 'day' => 15,)
* );
* @endcode
@@ -76,11 +76,9 @@ class Date extends FormElement {
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
- * #attributes, #id, #name, #type, #min, #max, #step, #value, #size.
- *
- * Note: The input "name" attribute needs to be sanitized before output, which
- * is currently done by initializing Drupal\Core\Template\Attribute with
- * all the attributes.
+ * #attributes, #id, #name, #type, #min, #max, #step, #value, #size. The
+ * #name property will be sanitized before output. This is currently done by
+ * initializing Drupal\Core\Template\Attribute with all the attributes.
*
* @return array
* The $element with prepared variables ready for #theme 'input__date'.
diff --git a/core/lib/Drupal/Core/Render/Element/Details.php b/core/lib/Drupal/Core/Render/Element/Details.php
index bd0f9596e..ae25d345a 100644
--- a/core/lib/Drupal/Core/Render/Element/Details.php
+++ b/core/lib/Drupal/Core/Render/Element/Details.php
@@ -20,12 +20,12 @@ use Drupal\Core\Render\Element;
* @code
* $form['author'] = array(
* '#type' => 'details',
- * '#title' => 'Author',
+ * '#title' => $this->t('Author'),
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
- * '#title' => t('Name'),
+ * '#title' => $this->t('Name'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Email.php b/core/lib/Drupal/Core/Render/Element/Email.php
index 72e1107eb..4b4da7b04 100644
--- a/core/lib/Drupal/Core/Render/Element/Email.php
+++ b/core/lib/Drupal/Core/Render/Element/Email.php
@@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['email'] = array(
* '#type' => 'email',
- * '#title' => t('Email'),
+ * '#title' => $this->t('Email'),
* );
* @end
*
diff --git a/core/lib/Drupal/Core/Render/Element/Fieldset.php b/core/lib/Drupal/Core/Render/Element/Fieldset.php
index f21b7de0b..d8cb54033 100644
--- a/core/lib/Drupal/Core/Render/Element/Fieldset.php
+++ b/core/lib/Drupal/Core/Render/Element/Fieldset.php
@@ -9,12 +9,12 @@ namespace Drupal\Core\Render\Element;
* @code
* $form['author'] = array(
* '#type' => 'fieldset',
- * '#title' => 'Author',
+ * '#title' => $this->t('Author'),
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
- * '#title' => t('Name'),
+ * '#title' => $this->t('Name'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Number.php b/core/lib/Drupal/Core/Render/Element/Number.php
index b9a19dadd..b2fbb1125 100644
--- a/core/lib/Drupal/Core/Render/Element/Number.php
+++ b/core/lib/Drupal/Core/Render/Element/Number.php
@@ -21,7 +21,7 @@ use Drupal\Component\Utility\Number as NumberUtility;
* @code
* $form['quantity'] = array(
* '#type' => 'number',
- * '#title' => t('Quantity'),
+ * '#title' => $this->t('Quantity'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Password.php b/core/lib/Drupal/Core/Render/Element/Password.php
index 4eb0be8e8..e16e8bb43 100644
--- a/core/lib/Drupal/Core/Render/Element/Password.php
+++ b/core/lib/Drupal/Core/Render/Element/Password.php
@@ -12,7 +12,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['pass'] = array(
* '#type' => 'password',
- * '#title => t('Password'),
+ * '#title' => $this->t('Password'),
* '#size' => 25,
* );
* @endcode
diff --git a/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
index 83c97a536..98b65ed90 100644
--- a/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
+++ b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
@@ -14,7 +14,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['pass'] = array(
* '#type' => 'password_confirm',
- * '#title' => t('Password'),
+ * '#title' => $this->t('Password'),
* '#size' => 25,
* );
* @endcode
@@ -65,7 +65,7 @@ class PasswordConfirm extends FormElement {
* Expand a password_confirm field into two text boxes.
*/
public static function processPasswordConfirm(&$element, FormStateInterface $form_state, &$complete_form) {
- $element['pass1'] = array(
+ $element['pass1'] = array(
'#type' => 'password',
'#title' => t('Password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
@@ -73,7 +73,7 @@ class PasswordConfirm extends FormElement {
'#attributes' => array('class' => array('password-field', 'js-password-field')),
'#error_no_message' => TRUE,
);
- $element['pass2'] = array(
+ $element['pass2'] = array(
'#type' => 'password',
'#title' => t('Confirm password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
diff --git a/core/lib/Drupal/Core/Render/Element/Radio.php b/core/lib/Drupal/Core/Render/Element/Radio.php
index 58086fbbf..ae20284b9 100644
--- a/core/lib/Drupal/Core/Render/Element/Radio.php
+++ b/core/lib/Drupal/Core/Render/Element/Radio.php
@@ -43,11 +43,9 @@ class Radio extends FormElement {
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #required, #return_value, #value, #attributes, #title,
- * #description.
- *
- * Note: The input "name" attribute needs to be sanitized before output, which
- * is currently done by initializing Drupal\Core\Template\Attribute with
- * all the attributes.
+ * #description. The #name property will be sanitized before output. This is
+ * currently done by initializing Drupal\Core\Template\Attribute with all
+ * the attributes.
*
* @return array
* The $element with prepared variables ready for input.html.twig.
diff --git a/core/lib/Drupal/Core/Render/Element/Radios.php b/core/lib/Drupal/Core/Render/Element/Radios.php
index 478bd4449..e7179f479 100644
--- a/core/lib/Drupal/Core/Render/Element/Radios.php
+++ b/core/lib/Drupal/Core/Render/Element/Radios.php
@@ -16,9 +16,9 @@ use Drupal\Component\Utility\Html as HtmlUtility;
* @code
* $form['settings']['active'] = array(
* '#type' => 'radios',
- * '#title' => t('Poll status'),
+ * '#title' => $this->t('Poll status'),
* '#default_value' => 1,
- * '#options' => array(0 => t('Closed'), 1 => t('Active')),
+ * '#options' => array(0 => $this->t('Closed'), 1 => $this->t('Active')),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Range.php b/core/lib/Drupal/Core/Render/Element/Range.php
index acc52774b..a4eace62e 100644
--- a/core/lib/Drupal/Core/Render/Element/Range.php
+++ b/core/lib/Drupal/Core/Render/Element/Range.php
@@ -19,7 +19,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['quantity'] = array(
* '#type' => 'number',
- * '#title' => t('Quantity'),
+ * '#title' => $this->t('Quantity'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Search.php b/core/lib/Drupal/Core/Render/Element/Search.php
index f1b3b8441..45333c5da 100644
--- a/core/lib/Drupal/Core/Render/Element/Search.php
+++ b/core/lib/Drupal/Core/Render/Element/Search.php
@@ -11,7 +11,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['search'] = array(
* '#type' => 'search',
- * '#title' => t('Search'),
+ * '#title' => $this->t('Search'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Select.php b/core/lib/Drupal/Core/Render/Element/Select.php
index eeb12bdff..f78dfa9f1 100644
--- a/core/lib/Drupal/Core/Render/Element/Select.php
+++ b/core/lib/Drupal/Core/Render/Element/Select.php
@@ -21,14 +21,14 @@ use Drupal\Core\Render\Element;
* @code
* $form['example_select'] = [
* '#type' => 'select',
- * '#title' => t('Select element'),
+ * '#title' => $this->t('Select element'),
* '#options' => [
- * '1' => t('One'),
+ * '1' => $this->t('One'),
* '2' => [
- * '2.1' => t('Two point one'),
- * '2.2' => t('Two point two'),
+ * '2.1' => $this->t('Two point one'),
+ * '2.2' => $this->t('Two point two'),
* ],
- * '3' => t('Three'),
+ * '3' => $this->t('Three'),
* ],
* ];
* @endcode
diff --git a/core/lib/Drupal/Core/Render/Element/Table.php b/core/lib/Drupal/Core/Render/Element/Table.php
index b05d4adb4..2da6ef96d 100644
--- a/core/lib/Drupal/Core/Render/Element/Table.php
+++ b/core/lib/Drupal/Core/Render/Element/Table.php
@@ -29,20 +29,20 @@ use Drupal\Component\Utility\Html as HtmlUtility;
* @code
* $form['contacts'] = array(
* '#type' => 'table',
- * '#caption' => 'Sample Table',
- * '#header' => array('Name', 'Phone'),
+ * '#caption' => $this->t('Sample Table'),
+ * '#header' => array($this->t('Name'), $this->t('Phone')),
* );
*
* for ($i=1; $i<=4; $i++) {
* $form['contacts'][$i]['name'] = array(
* '#type' => 'textfield',
- * '#title' => t('Name'),
+ * '#title' => $this->t('Name'),
* '#title_display' => 'invisible',
* );
*
* $form['contacts'][$i]['phone'] = array(
* '#type' => 'tel',
- * '#title' => t('Phone'),
+ * '#title' => $this->t('Phone'),
* '#title_display' => 'invisible',
* );
* }
@@ -279,7 +279,7 @@ class Table extends FormElement {
* @code
* $form['table'] = array(
* '#type' => 'table',
- * '#header' => array(t('Title'), array('data' => t('Operations'), 'colspan' => '1')),
+ * '#header' => array($this->t('Title'), array('data' => $this->t('Operations'), 'colspan' => '1')),
* // Optionally, to add tableDrag support:
* '#tabledrag' => array(
* array(
@@ -301,7 +301,7 @@ class Table extends FormElement {
* $form['table'][$row]['#attributes']['class'][] = 'draggable';
* $form['table'][$row]['weight'] = array(
* '#type' => 'textfield',
- * '#title' => t('Weight for @title', array('@title' => $thing['title'])),
+ * '#title' => $this->t('Weight for @title', array('@title' => $thing['title'])),
* '#title_display' => 'invisible',
* '#size' => 4,
* '#default_value' => $thing['weight'],
@@ -312,7 +312,7 @@ class Table extends FormElement {
* // attribute in #header above.
* $form['table'][$row]['edit'] = array(
* '#type' => 'link',
- * '#title' => t('Edit'),
+ * '#title' => $this->t('Edit'),
* '#url' => Url::fromRoute('entity.test_entity.edit_form', ['test_entity' => $row]),
* );
* }
diff --git a/core/lib/Drupal/Core/Render/Element/Tableselect.php b/core/lib/Drupal/Core/Render/Element/Tableselect.php
index 62f2ff2e8..faa288e47 100644
--- a/core/lib/Drupal/Core/Render/Element/Tableselect.php
+++ b/core/lib/Drupal/Core/Render/Element/Tableselect.php
@@ -26,8 +26,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
* Usage example:
* @code
* $header = [
- * 'first_name' => t('First Name'),
- * 'last_name' => t('Last Name'),
+ * 'first_name' => $this->t('First Name'),
+ * 'last_name' => $this->t('Last Name'),
* ];
*
* $options = [
@@ -40,7 +40,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
* '#type' => 'tableselect',
* '#header' => $header,
* '#options' => $options,
- * '#empty' => t('No users found'),
+ * '#empty' => $this->t('No users found'),
* );
* @endcode
*
@@ -118,28 +118,28 @@ class Tableselect extends Table {
* @code
* $options = array(
* array(
- * 'title' => 'How to Learn Drupal',
- * 'content_type' => 'Article',
+ * 'title' => $this->t('How to Learn Drupal'),
+ * 'content_type' => $this->t('Article'),
* 'status' => 'published',
* '#attributes' => array('class' => array('article-row')),
* ),
* array(
- * 'title' => 'Privacy Policy',
- * 'content_type' => 'Page',
+ * 'title' => $this->t('Privacy Policy'),
+ * 'content_type' => $this->t('Page'),
* 'status' => 'published',
* '#attributes' => array('class' => array('page-row')),
* ),
* );
* $header = array(
- * 'title' => t('Title'),
- * 'content_type' => t('Content type'),
- * 'status' => t('Status'),
+ * 'title' => $this->t('Title'),
+ * 'content_type' => $this->t('Content type'),
+ * 'status' => $this->t('Status'),
* );
* $form['table'] = array(
* '#type' => 'tableselect',
* '#header' => $header,
* '#options' => $options,
- * '#empty' => t('No content available.'),
+ * '#empty' => $this->t('No content available.'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Tel.php b/core/lib/Drupal/Core/Render/Element/Tel.php
index 2c849bc1a..02b071d5a 100644
--- a/core/lib/Drupal/Core/Render/Element/Tel.php
+++ b/core/lib/Drupal/Core/Render/Element/Tel.php
@@ -14,7 +14,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['phone'] = array(
* '#type' => 'tel',
- * '#title' => t('Phone'),
+ * '#title' => $this->t('Phone'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Textarea.php b/core/lib/Drupal/Core/Render/Element/Textarea.php
index fc661e8a6..6adb18ca8 100644
--- a/core/lib/Drupal/Core/Render/Element/Textarea.php
+++ b/core/lib/Drupal/Core/Render/Element/Textarea.php
@@ -17,7 +17,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['text'] = array(
* '#type' => 'textarea',
- * '#title' => t('Text'),
+ * '#title' => $this->t('Text'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Textfield.php b/core/lib/Drupal/Core/Render/Element/Textfield.php
index 4a47363fc..1cb35e8a3 100644
--- a/core/lib/Drupal/Core/Render/Element/Textfield.php
+++ b/core/lib/Drupal/Core/Render/Element/Textfield.php
@@ -20,7 +20,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['title'] = array(
* '#type' => 'textfield',
- * '#title' => t('Subject'),
+ * '#title' => $this->t('Subject'),
* '#default_value' => $node->title,
* '#size' => 60,
* '#maxlength' => 128,
diff --git a/core/lib/Drupal/Core/Render/Element/Url.php b/core/lib/Drupal/Core/Render/Element/Url.php
index 666ec71db..33d91ed1c 100644
--- a/core/lib/Drupal/Core/Render/Element/Url.php
+++ b/core/lib/Drupal/Core/Render/Element/Url.php
@@ -16,7 +16,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['homepage'] = array(
* '#type' => 'url',
- * '#title' => t('Home Page'),
+ * '#title' => $this->t('Home Page'),
* '#size' => 30,
* ...
* );
diff --git a/core/lib/Drupal/Core/Render/Element/VerticalTabs.php b/core/lib/Drupal/Core/Render/Element/VerticalTabs.php
index 73d9f3131..8a637fb35 100644
--- a/core/lib/Drupal/Core/Render/Element/VerticalTabs.php
+++ b/core/lib/Drupal/Core/Render/Element/VerticalTabs.php
@@ -24,24 +24,24 @@ use Drupal\Core\Render\Element;
*
* $form['author'] = array(
* '#type' => 'details',
- * '#title' => 'Author',
+ * '#title' => $this->t('Author'),
* '#group' => 'information',
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
- * '#title' => t('Name'),
+ * '#title' => $this->t('Name'),
* );
*
* $form['publication'] = array(
* '#type' => 'details',
- * '#title' => t('Publication'),
+ * '#title' => $this->t('Publication'),
* '#group' => 'information',
* );
*
* $form['publication']['publisher'] = array(
* '#type' => 'textfield',
- * '#title' => t('Publisher'),
+ * '#title' => $this->t('Publisher'),
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Weight.php b/core/lib/Drupal/Core/Render/Element/Weight.php
index bfb2a22d3..a6ecbee76 100644
--- a/core/lib/Drupal/Core/Render/Element/Weight.php
+++ b/core/lib/Drupal/Core/Render/Element/Weight.php
@@ -18,7 +18,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['weight'] = array(
* '#type' => 'weight',
- * '#title' => t('Weight'),
+ * '#title' => $this->t('Weight'),
* '#default_value' => $edit['weight'],
* '#delta' => 10,
* );
diff --git a/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php b/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php
index 98b58fc14..42562834b 100644
--- a/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php
+++ b/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php
@@ -92,6 +92,11 @@ class PlaceholderingRenderCache extends RenderCache {
* {@inheritdoc}
*/
public function get(array $elements) {
+ // @todo remove this check when https://www.drupal.org/node/2367555 lands.
+ if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) {
+ return FALSE;
+ }
+
// When rendering placeholders, special case auto-placeholdered elements:
// avoid retrieving them from cache again, or rendering them again.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === FALSE) {
@@ -121,6 +126,11 @@ class PlaceholderingRenderCache extends RenderCache {
public function set(array &$elements, array $pre_bubbling_elements) {
$result = parent::set($elements, $pre_bubbling_elements);
+ // @todo remove this check when https://www.drupal.org/node/2367555 lands.
+ if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) {
+ return FALSE;
+ }
+
if ($this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements)) {
// Overwrite $elements with a placeholder. The Renderer (which called this
// method) will update the context with the bubbleable metadata of the
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 3c13dfd3b..09a1bf103 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -338,7 +338,9 @@ class Renderer implements RendererInterface {
// If instructed to create a placeholder, and a #lazy_builder callback is
// present (without such a callback, it would be impossible to replace the
// placeholder), replace the current element with a placeholder.
- if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE) {
+ // @todo remove the isMethodSafe() check when
+ // https://www.drupal.org/node/2367555 lands.
+ if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE && $this->requestStack->getCurrentRequest()->isMethodSafe()) {
if (!isset($elements['#lazy_builder'])) {
throw new \LogicException('When #create_placeholder is set, a #lazy_builder callback must be present as well.');
}
diff --git a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
index 4293ee50f..80e16ebb6 100644
--- a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
+++ b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php
@@ -134,4 +134,3 @@ class AccessAwareRouter implements AccessAwareRouterInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/Routing/CompiledRoute.php b/core/lib/Drupal/Core/Routing/CompiledRoute.php
index 62a879af2..a5dbbef12 100644
--- a/core/lib/Drupal/Core/Routing/CompiledRoute.php
+++ b/core/lib/Drupal/Core/Routing/CompiledRoute.php
@@ -61,7 +61,7 @@ class CompiledRoute extends SymfonyCompiledRoute {
* @param array $variables
* An array of variables (variables defined in the path and in the host patterns)
*/
- public function __construct($fit, $pattern_outline, $num_parts, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) {
+ public function __construct($fit, $pattern_outline, $num_parts, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = NULL, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) {
parent::__construct($staticPrefix, $regex, $tokens, $pathVariables, $hostRegex, $hostTokens, $hostVariables, $variables);
$this->fit = $fit;
diff --git a/core/lib/Drupal/Core/Routing/RouteCompiler.php b/core/lib/Drupal/Core/Routing/RouteCompiler.php
index be486e2fe..937bf485e 100644
--- a/core/lib/Drupal/Core/Routing/RouteCompiler.php
+++ b/core/lib/Drupal/Core/Routing/RouteCompiler.php
@@ -96,7 +96,7 @@ class RouteCompiler extends SymfonyRouteCompiler implements RouteCompilerInterfa
$fit = 0;
foreach ($parts as $k => $part) {
if (strpos($part, '{') === FALSE) {
- $fit |= 1 << ($slashes - $k);
+ $fit |= 1 << ($slashes - $k);
}
}
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 7708db652..96a33a4b1 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -207,13 +207,13 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
else {
try {
$result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', array(':names[]' => $routes_to_load));
+ $routes = $result->fetchAllKeyed();
+
+ $this->cache->set($cid, $routes, Cache::PERMANENT, ['routes']);
}
catch (\Exception $e) {
- $result = [];
+ $routes = [];
}
- $routes = $result->fetchAllKeyed();
-
- $this->cache->set($cid, $routes, Cache::PERMANENT, ['routes']);
}
$this->serializedRoutes += $routes;
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index af0ad304e..3cbbd5adf 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -153,7 +153,6 @@ class UrlGenerator implements UrlGeneratorInterface {
* @param string $name
* The route name or other identifying string from ::getRouteDebugMessage().
*
- *
* @return string
* The url path, without any base path, including possible query string.
*
diff --git a/core/lib/Drupal/Core/Session/AccountInterface.php b/core/lib/Drupal/Core/Session/AccountInterface.php
index 83df1c8c0..1cf82dcb6 100644
--- a/core/lib/Drupal/Core/Session/AccountInterface.php
+++ b/core/lib/Drupal/Core/Session/AccountInterface.php
@@ -106,7 +106,7 @@ interface AccountInterface {
* @return string
* An unsanitized plain-text string with the name of this account that is
* used to log in. Only display this name to admins and to the user who owns
- * this account, and only in the context of the name used to login. For
+ * this account, and only in the context of the name used to log in. For
* any other display purposes, use
* \Drupal\Core\Session\AccountInterface::getDisplayName() instead.
*
diff --git a/core/lib/Drupal/Core/SitePathFactory.php b/core/lib/Drupal/Core/SitePathFactory.php
index 06aff85e9..7a01ff17a 100644
--- a/core/lib/Drupal/Core/SitePathFactory.php
+++ b/core/lib/Drupal/Core/SitePathFactory.php
@@ -35,4 +35,3 @@ class SitePathFactory {
}
}
-
diff --git a/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php b/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php
index 6f3ed62b0..28819dc3d 100644
--- a/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php
+++ b/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php
@@ -49,4 +49,3 @@ class KernelPreHandle implements HttpKernelInterface {
}
}
-
diff --git a/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php b/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php
index a383f4269..2ff8bb766 100644
--- a/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php
+++ b/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php
@@ -39,7 +39,7 @@ class NegotiationMiddleware implements HttpKernelInterface {
/**
* {@inheritdoc}
*/
- public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) {
+ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
// Register available mime types.
foreach ($this->formats as $format => $mime_type) {
$request->setFormat($format, $mime_type);
diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
index 025830c3e..6e3197c8e 100644
--- a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
@@ -76,11 +76,11 @@ abstract class LocalReadOnlyStream extends LocalStream {
*/
public function stream_lock($operation) {
// Disallow exclusive lock or non-blocking lock requests
- if (in_array($operation, array(LOCK_EX, LOCK_EX|LOCK_NB))) {
+ if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
trigger_error('stream_lock() exclusive lock operations not supported for read-only stream wrappers', E_USER_WARNING);
return FALSE;
}
- if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH|LOCK_NB))) {
+ if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH | LOCK_NB))) {
return flock($this->handle, $operation);
}
diff --git a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
index 320f1da04..1b48910b4 100644
--- a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
@@ -111,11 +111,11 @@ abstract class ReadOnlyStream implements StreamWrapperInterface {
* @see http://php.net/manual/streamwrapper.stream-lock.php
*/
public function stream_lock($operation) {
- if (in_array($operation, array(LOCK_EX, LOCK_EX|LOCK_NB))) {
+ if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
trigger_error('stream_lock() exclusive lock operations not supported for read-only stream wrappers', E_USER_WARNING);
return FALSE;
}
- if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH|LOCK_NB))) {
+ if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH | LOCK_NB))) {
return flock($this->handle, $operation);
}
diff --git a/core/lib/Drupal/Core/Template/Loader/StringLoader.php b/core/lib/Drupal/Core/Template/Loader/StringLoader.php
index 77c185100..6325b9e98 100644
--- a/core/lib/Drupal/Core/Template/Loader/StringLoader.php
+++ b/core/lib/Drupal/Core/Template/Loader/StringLoader.php
@@ -52,7 +52,7 @@ class StringLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface
* {@inheritdoc}
*/
public function isFresh($name, $time) {
- return true;
+ return TRUE;
}
}
diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 49ec546e8..e204ba90b 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -150,12 +150,12 @@ class TwigExtension extends \Twig_Extension {
new \Twig_SimpleFilter('placeholder', [$this, 'escapePlaceholder'], array('is_safe' => array('html'), 'needs_environment' => TRUE)),
// Replace twig's escape filter with our own.
- new \Twig_SimpleFilter('drupal_escape', [$this, 'escapeFilter'], array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')),
+ new \Twig_SimpleFilter('drupal_escape', [$this, 'escapeFilter'], array('needs_environment' => TRUE, 'is_safe_callback' => 'twig_escape_filter_is_safe')),
// Implements safe joining.
// @todo Make that the default for |join? Upstream issue:
// https://github.com/fabpot/Twig/issues/1420
- new \Twig_SimpleFilter('safe_join', [$this, 'safeJoin'], ['needs_environment' => true, 'is_safe' => ['html']]),
+ new \Twig_SimpleFilter('safe_join', [$this, 'safeJoin'], ['needs_environment' => TRUE, 'is_safe' => ['html']]),
// Array filters.
new \Twig_SimpleFilter('without', 'twig_without'),
@@ -547,7 +547,7 @@ class TwigExtension extends \Twig_Extension {
*/
public function safeJoin(\Twig_Environment $env, $value, $glue = '') {
if ($value instanceof \Traversable) {
- $value = iterator_to_array($value, false);
+ $value = iterator_to_array($value, FALSE);
}
return implode($glue, array_map(function($item) use ($env) {
diff --git a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
index aba617a9d..2af80749c 100644
--- a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
+++ b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php
@@ -65,7 +65,8 @@ interface ThemeManagerInterface {
/**
* Passes alterable variables to specific $theme_TYPE_alter() implementations.
*
- * It also invokes alter hooks for all base themes.
+ * Executes an alter hook on the current theme. It also invokes alter hooks
+ * for all base themes.
*
* $theme specifies the theme name of the active theme and all its base
* themes.
@@ -114,7 +115,6 @@ interface ThemeManagerInterface {
* (optional) An additional variable that is passed by reference. If more
* context needs to be provided to implementations, then this should be an
* associative array as described above.
- * Execute the alter hook on the current theme.
*
* @see \Drupal\Core\Extension\ModuleHandlerInterface
*/
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
index da99f8f77..bf6d314bf 100644
--- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php
@@ -43,4 +43,3 @@ class DateTimeIso8601 extends StringData implements DateTimeInterface {
}
}
}
-
diff --git a/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php b/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php
index ba3ff9158..a2671b233 100644
--- a/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php
+++ b/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php
@@ -85,7 +85,7 @@ class RecursiveValidator implements ValidatorInterface {
/**
* {@inheritdoc}
*/
- public function validate($value, $constraints = null, $groups = null) {
+ public function validate($value, $constraints = NULL, $groups = NULL) {
return $this->startContext($value)
->validate($value, $constraints, $groups)
->getViolations();
diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index 6908bc81b..bf978bfc2 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -55,6 +55,8 @@ class Url {
/**
* The URL options.
*
+ * See \Drupal\Core\Url::fromUri() for details on the options.
+ *
* @var array
*/
protected $options = array();
@@ -101,21 +103,7 @@ class Url {
* @param array $route_parameters
* (optional) An associative array of parameter names and values.
* @param array $options
- * (optional) An associative array of additional options, with the following
- * elements:
- * - 'query': An array of query key/value-pairs (without any URL-encoding)
- * to append to the URL. Merged with the parameters array.
- * - 'fragment': A fragment identifier (named anchor) to append to the URL.
- * Do not include the leading '#' character.
- * - 'absolute': Defaults to FALSE. Whether to force the output to be an
- * absolute link (beginning with http:). Useful for links that will be
- * displayed outside the site, such as in an RSS feed.
- * - 'language': An optional language object used to look up the alias
- * for the URL. If $options['language'] is omitted, it defaults to the
- * current language for the language type LanguageInterface::TYPE_URL.
- * - 'https': Whether this URL should point to a secure location. If not
- * defined, the current scheme is used, so the user stays on HTTP or HTTPS
- * respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
+ * See \Drupal\Core\Url::fromUri() for details.
*
* @see static::fromRoute()
* @see static::fromUri()
@@ -141,21 +129,7 @@ class Url {
* @param array $route_parameters
* (optional) An associative array of route parameter names and values.
* @param array $options
- * (optional) An associative array of additional URL options, with the
- * following elements:
- * - 'query': An array of query key/value-pairs (without any URL-encoding)
- * to append to the URL. Merged with the parameters array.
- * - 'fragment': A fragment identifier (named anchor) to append to the URL.
- * Do not include the leading '#' character.
- * - 'absolute': Defaults to FALSE. Whether to force the output to be an
- * absolute link (beginning with http:). Useful for links that will be
- * displayed outside the site, such as in an RSS feed.
- * - 'language': An optional language object used to look up the alias
- * for the URL. If $options['language'] is omitted, it defaults to the
- * current language for the language type LanguageInterface::TYPE_URL.
- * - 'https': Whether this URL should point to a secure location. If not
- * defined, the current scheme is used, so the user stays on HTTP or HTTPS
- * respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
+ * See \Drupal\Core\Url::fromUri() for details.
*
* @return \Drupal\Core\Url
* A new Url object for a routed (internal to Drupal) URL.
@@ -254,7 +228,10 @@ class Url {
* that are known not to be handled by the Drupal routing system (such as
* static files), use base: for the scheme to get a link relative to the
* Drupal base path (like the HTML element). For a link to an entity
- * you may use entity:{entity_type}/{entity_id} URIs.
+ * you may use entity:{entity_type}/{entity_id} URIs. The internal: scheme
+ * should be avoided except when processing actual user input that may or
+ * may not correspond to a Drupal route. Normally use Url::fromRoute() for
+ * code linking to any any Drupal page.
* @param array $options
* (optional) An associative array of additional URL options, with the
* following elements:
@@ -265,6 +242,9 @@ class Url {
* - 'absolute': Defaults to FALSE. Whether to force the output to be an
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
+ * - 'attributes': An associative array of HTML attributes that will be
+ * added to the anchor tag if you use the \Drupal\Core\Link class to make
+ * the link.
* - 'language': An optional language object used to look up the alias
* for the URL. If $options['language'] is omitted, it defaults to the
* current language for the language type LanguageInterface::TYPE_URL.
@@ -272,14 +252,9 @@ class Url {
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
*
- * Note: the internal: scheme should be avoided except when processing actual
- * user input that may or may not correspond to a Drupal route. Normally use
- * Url::fromRoute() for code linking to any any Drupal page.
- *
- * You can call access() on the returned object to do access checking.
- *
* @return \Drupal\Core\Url
- * A new Url object with properties depending on the URI scheme.
+ * A new Url object with properties depending on the URI scheme. Call the
+ * access() method on this to do access checking.
*
* @throws \InvalidArgumentException
* Thrown when the passed in path has no scheme.
@@ -348,7 +323,7 @@ class Url {
* Parts from an URI of the form entity:{entity_type}/{entity_id} as from
* parse_url().
* @param array $options
- * An array of options, see static::fromUri() for details.
+ * An array of options, see \Drupal\Core\Url::fromUri() for details.
* @param string $uri
* The original entered URI.
*
@@ -400,7 +375,7 @@ class Url {
* @param array $uri_parts
* Parts from an URI of the form internal:{path} as from parse_url().
* @param array $options
- * An array of options, see static::fromUri() for details.
+ * An array of options, see \Drupal\Core\Url::fromUri() for details.
*
* @return \Drupal\Core\Url
* A new Url object for a 'internal:' URI.
@@ -447,7 +422,7 @@ class Url {
* from parse_url(), where the path is the route name optionally followed by
* a ";" followed by route parameters in key=value format with & separators.
* @param array $options
- * An array of options, see static::fromUri() for details.
+ * An array of options, see \Drupal\Core\Url::fromUri() for details.
* @param string $uri
* The original passed in URI.
*
@@ -638,6 +613,8 @@ class Url {
* Returns the URL options.
*
* @return array
+ * The array of options. See \Drupal\Core\Url::fromUri() for details on what
+ * it contains.
*/
public function getOptions() {
return $this->options;
@@ -646,6 +623,8 @@ class Url {
/**
* Gets a specific option.
*
+ * See \Drupal\Core\Url::fromUri() for details on the options.
+ *
* @param string $name
* The name of the option.
*
@@ -664,7 +643,8 @@ class Url {
* Sets the URL options.
*
* @param array $options
- * The array of options.
+ * The array of options. See \Drupal\Core\Url::fromUri() for details on what
+ * it contains.
*
* @return $this
*/
@@ -676,6 +656,8 @@ class Url {
/**
* Sets a specific option.
*
+ * See \Drupal\Core\Url::fromUri() for details on the options.
+ *
* @param string $name
* The name of the option.
* @param mixed $value
diff --git a/core/modules/action/src/Plugin/Action/EmailAction.php b/core/modules/action/src/Plugin/Action/EmailAction.php
index 771c04d5e..1ee618417 100644
--- a/core/modules/action/src/Plugin/Action/EmailAction.php
+++ b/core/modules/action/src/Plugin/Action/EmailAction.php
@@ -55,7 +55,8 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
*/
protected $mailManager;
- /** The language manager.
+ /**
+ * The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module
index 00bdbe455..740569947 100644
--- a/core/modules/aggregator/aggregator.module
+++ b/core/modules/aggregator/aggregator.module
@@ -50,7 +50,7 @@ function aggregator_help($route_name, RouteMatchInterface $route_match) {
case 'aggregator.admin_overview':
// Don't use placeholders for possibility to change URLs for translators.
$output = '' . t('Many sites publish their headlines and posts in feeds, using a number of standardized XML-based formats. The aggregator supports RSS, RDF, and Atom.') . '
';
- $output .= '' . t('Current feeds are listed below, and new feeds may be added. For each feed, the latest items block may be enabled at the blocks administration page.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '
';
+ $output .= '' . t('Current feeds are listed below, and new feeds may be added. For each feed, the latest items block may be enabled at the blocks administration page.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '
';
return $output;
case 'aggregator.feed_add':
diff --git a/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php b/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
index 46a5df7ad..1986ceaf5 100644
--- a/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
+++ b/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
@@ -4,6 +4,7 @@ namespace Drupal\aggregator\Tests;
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 @@ class ItemCacheTagsTest extends EntityCacheTagsTestBase {
*/
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'));
diff --git a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php
index e39d28a5f..eacd139c6 100644
--- a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php
+++ b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php
@@ -75,7 +75,7 @@ class AggregatorTitleTest extends KernelTestBase {
$this->assertNotContains($aggregator_feed->getUrl(), $result);
// Verify aggregator item title with and without links.
- $build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' =>TRUE]]);
+ $build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
$result = $this->render($build);
$this->assertContains('test title', $result);
diff --git a/core/modules/big_pipe/big_pipe.services.yml b/core/modules/big_pipe/big_pipe.services.yml
index b06255a70..523503773 100644
--- a/core/modules/big_pipe/big_pipe.services.yml
+++ b/core/modules/big_pipe/big_pipe.services.yml
@@ -11,7 +11,7 @@ services:
- { name: placeholder_strategy, priority: 0 }
big_pipe:
class: Drupal\big_pipe\Render\BigPipe
- arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher']
+ arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher', '@config.factory']
html_response.attachments_processor.big_pipe:
public: false
class: \Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor
diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php
index 18f25b896..3e67737f5 100644
--- a/core/modules/big_pipe/src/Render/BigPipe.php
+++ b/core/modules/big_pipe/src/Render/BigPipe.php
@@ -8,6 +8,7 @@ use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Asset\AttachedAssets;
use Drupal\Core\Asset\AttachedAssetsInterface;
+use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Render\HtmlResponse;
use Drupal\Core\Render\RendererInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -73,6 +74,13 @@ class BigPipe implements BigPipeInterface {
*/
protected $eventDispatcher;
+ /**
+ * The config factory.
+ *
+ * @var \Drupal\Core\Config\ConfigFactoryInterface
+ */
+ protected $configFactory;
+
/**
* Constructs a new BigPipe class.
*
@@ -86,13 +94,16 @@ class BigPipe implements BigPipeInterface {
* The HTTP kernel.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
+ * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+ * The config factory.
*/
- public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher) {
+ public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory) {
$this->renderer = $renderer;
$this->session = $session;
$this->requestStack = $request_stack;
$this->httpKernel = $http_kernel;
$this->eventDispatcher = $event_dispatcher;
+ $this->configFactory = $config_factory;
}
/**
@@ -243,7 +254,7 @@ class BigPipe implements BigPipeInterface {
$elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings);
}
catch (\Exception $e) {
- if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
+ if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e;
}
else {
@@ -280,7 +291,7 @@ class BigPipe implements BigPipeInterface {
$html_response = $this->filterEmbeddedResponse($fake_request, $html_response);
}
catch (\Exception $e) {
- if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
+ if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e;
}
else {
@@ -355,7 +366,7 @@ class BigPipe implements BigPipeInterface {
$elements = $this->renderPlaceholder($placeholder_id, $placeholder_render_array);
}
catch (\Exception $e) {
- if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
+ if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e;
}
else {
@@ -388,7 +399,7 @@ class BigPipe implements BigPipeInterface {
$ajax_response = $this->filterEmbeddedResponse($fake_request, $ajax_response);
}
catch (\Exception $e) {
- if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
+ if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e;
}
else {
diff --git a/core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php b/core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php
index 0edf3baa7..ae5cf1c4b 100644
--- a/core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php
+++ b/core/modules/big_pipe/src/Render/Placeholder/BigPipeStrategy.php
@@ -105,12 +105,19 @@ class BigPipeStrategy implements PlaceholderStrategyInterface {
* {@inheritdoc}
*/
public function processPlaceholders(array $placeholders) {
+ $request = $this->requestStack->getCurrentRequest();
+
+ // @todo remove this check when https://www.drupal.org/node/2367555 lands.
+ if (!$request->isMethodSafe()) {
+ return [];
+ }
+
// Routes can opt out from using the BigPipe HTML delivery technique.
if ($this->routeMatch->getRouteObject()->getOption('_no_big_pipe')) {
return [];
}
- if (!$this->sessionConfiguration->hasSession($this->requestStack->getCurrentRequest())) {
+ if (!$this->sessionConfiguration->hasSession($request)) {
return [];
}
diff --git a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
index 45958444b..1cf10d4dc 100644
--- a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
+++ b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
@@ -9,6 +9,7 @@ namespace Drupal\big_pipe\Tests;
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 @@ class BigPipePlaceholderTestCases {
'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),
diff --git a/core/modules/big_pipe/src/Tests/BigPipeTest.php b/core/modules/big_pipe/src/Tests/BigPipeTest.php
index 9ae960b63..f947c46bd 100644
--- a/core/modules/big_pipe/src/Tests/BigPipeTest.php
+++ b/core/modules/big_pipe/src/Tests/BigPipeTest.php
@@ -361,7 +361,7 @@ class BigPipeTest extends WebTestBase {
$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);
}
/**
diff --git a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
index 2ac5a9937..450a464bd 100644
--- a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
+++ b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
@@ -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.
diff --git a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
index 651f43437..f0f40ba29 100644
--- a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
@@ -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;
@@ -22,8 +23,9 @@ class BigPipeStrategyTest extends UnitTestCase {
*
* @dataProvider placeholdersProvider
*/
- public function testProcessPlaceholders(array $placeholders, $route_match_has_no_big_pipe_option, $request_has_session, $request_has_big_pipe_nojs_cookie, array $expected_big_pipe_placeholders) {
+ public function testProcessPlaceholders(array $placeholders, $method, $route_match_has_no_big_pipe_option, $request_has_session, $request_has_big_pipe_nojs_cookie, array $expected_big_pipe_placeholders) {
$request = new Request();
+ $request->setMethod($method);
if ($request_has_big_pipe_nojs_cookie) {
$request->cookies->set(BigPipeStrategy::NOJS_COOKIE, 1);
}
@@ -45,7 +47,7 @@ class BigPipeStrategyTest extends UnitTestCase {
$big_pipe_strategy = new BigPipeStrategy($session_configuration->reveal(), $request_stack->reveal(), $route_match->reveal());
$processed_placeholders = $big_pipe_strategy->processPlaceholders($placeholders);
- if (!$route_match_has_no_big_pipe_option && $request_has_session) {
+ if ($request->isMethodSafe() && !$route_match_has_no_big_pipe_option && $request_has_session) {
$this->assertSameSize($expected_big_pipe_placeholders, $processed_placeholders, 'BigPipe is able to deliver all placeholders.');
foreach (array_keys($placeholders) as $placeholder) {
$this->assertSame($expected_big_pipe_placeholders[$placeholder], $processed_placeholders[$placeholder], "Verifying how BigPipeStrategy handles the placeholder '$placeholder'");
@@ -60,7 +62,7 @@ class BigPipeStrategyTest extends UnitTestCase {
* @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().
@@ -75,13 +77,13 @@ class BigPipeStrategyTest extends UnitTestCase {
];
return [
- '_no_big_pipe absent, no session, no-JS cookie absent' => [$placeholders, FALSE, FALSE, FALSE, []],
- '_no_big_pipe absent, no session, no-JS cookie present' => [$placeholders, FALSE, FALSE, TRUE, []],
- '_no_big_pipe present, no session, no-JS cookie absent' => [$placeholders, TRUE, FALSE, FALSE, []],
- '_no_big_pipe present, no session, no-JS cookie present' => [$placeholders, TRUE, FALSE, TRUE, []],
- '_no_big_pipe present, session, no-JS cookie absent' => [$placeholders, TRUE, TRUE, FALSE, []],
- '_no_big_pipe present, session, no-JS cookie present' => [$placeholders, TRUE, TRUE, TRUE, []],
- '_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders' => [$placeholders, FALSE, TRUE, FALSE, [
+ '_no_big_pipe absent, no session, no-JS cookie absent' => [$placeholders, 'GET', FALSE, FALSE, FALSE, []],
+ '_no_big_pipe absent, no session, no-JS cookie present' => [$placeholders, 'GET', FALSE, FALSE, TRUE, []],
+ '_no_big_pipe present, no session, no-JS cookie absent' => [$placeholders, 'GET', TRUE, FALSE, FALSE, []],
+ '_no_big_pipe present, no session, no-JS cookie present' => [$placeholders, 'GET', TRUE, FALSE, TRUE, []],
+ '_no_big_pipe present, session, no-JS cookie absent' => [$placeholders, 'GET', TRUE, TRUE, FALSE, []],
+ '_no_big_pipe present, session, no-JS cookie present' => [$placeholders, 'GET', TRUE, TRUE, TRUE, []],
+ '_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders' => [$placeholders, 'GET', FALSE, TRUE, FALSE, [
$cases['html']->placeholder => $cases['html']->bigPipePlaceholderRenderArray,
$cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
$cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
@@ -90,7 +92,8 @@ class BigPipeStrategyTest extends UnitTestCase {
$cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipePlaceholderRenderArray,
$cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipePlaceholderRenderArray,
]],
- '_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders' => [$placeholders, FALSE, TRUE, TRUE, [
+ '_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders — but unsafe method' => [$placeholders, 'POST', FALSE, TRUE, FALSE, []],
+ '_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders' => [$placeholders, 'GET', FALSE, TRUE, TRUE, [
$cases['html']->placeholder => $cases['html']->bigPipeNoJsPlaceholderRenderArray,
$cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
$cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
@@ -99,6 +102,7 @@ class BigPipeStrategyTest extends UnitTestCase {
$cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipeNoJsPlaceholderRenderArray,
$cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipeNoJsPlaceholderRenderArray,
]],
+ '_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders — but unsafe method' => [$placeholders, 'POST', FALSE, TRUE, TRUE, []],
];
}
diff --git a/core/modules/block/src/Plugin/migrate/source/Block.php b/core/modules/block/src/Plugin/migrate/source/Block.php
index 9426190ff..b0fbff83e 100644
--- a/core/modules/block/src/Plugin/migrate/source/Block.php
+++ b/core/modules/block/src/Plugin/migrate/source/Block.php
@@ -63,7 +63,7 @@ class Block extends DrupalSqlBase {
*/
protected function initializeIterator() {
$this->defaultTheme = $this->variableGet('theme_default', 'Garland');
- $this->adminTheme = $this->variableGet('admin_theme', null);
+ $this->adminTheme = $this->variableGet('admin_theme', NULL);
return parent::initializeIterator();
}
diff --git a/core/modules/block/src/Tests/BlockLanguageTest.php b/core/modules/block/src/Tests/BlockLanguageTest.php
index d0554c456..a2bf24991 100644
--- a/core/modules/block/src/Tests/BlockLanguageTest.php
+++ b/core/modules/block/src/Tests/BlockLanguageTest.php
@@ -150,7 +150,8 @@ class BlockLanguageTest extends WebTestBase {
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
$this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
- // Re-login in order to clear the interface language stored in the session.
+ // Log in again in order to clear the interface language stored in the
+ // session.
$this->drupalLogout();
$this->drupalLogin($this->adminUser);
diff --git a/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php b/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
index a9688e6cb..8a3106d62 100644
--- a/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
+++ b/core/modules/block/src/Tests/Update/BlockContextMappingUpdateTest.php
@@ -42,7 +42,7 @@ class BlockContextMappingUpdateTest extends UpdatePathTestBase {
// Disable maintenance mode.
\Drupal::state()->set('system.maintenance_mode', FALSE);
- // We finished updating so we can login the user now.
+ // We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
// The block that we are testing has the following visibility rules:
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php
index 787f6751d..e558bcb90 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php
@@ -76,4 +76,3 @@ class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterfa
}
}
-
diff --git a/core/modules/block_content/block_content.module b/core/modules/block_content/block_content.module
index 3b4ae2e34..e0b572956 100644
--- a/core/modules/block_content/block_content.module
+++ b/core/modules/block_content/block_content.module
@@ -80,7 +80,7 @@ function block_content_add_body_field($block_type_id, $label = 'Body') {
$field = FieldConfig::loadByName('block_content', $block_type_id, 'body');
if (empty($field)) {
$field = FieldConfig::create([
- 'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
+ 'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
'bundle' => $block_type_id,
'label' => $label,
'settings' => array('display_summary' => FALSE),
diff --git a/core/modules/block_content/src/Tests/BlockContentTestBase.php b/core/modules/block_content/src/Tests/BlockContentTestBase.php
index 307933c27..402103253 100644
--- a/core/modules/block_content/src/Tests/BlockContentTestBase.php
+++ b/core/modules/block_content/src/Tests/BlockContentTestBase.php
@@ -74,7 +74,7 @@ abstract class BlockContentTestBase extends WebTestBase {
* Created custom block.
*/
protected function createBlockContent($title = FALSE, $bundle = 'basic', $save = TRUE) {
- $title = ($title ? : $this->randomMachineName());
+ $title = $title ?: $this->randomMachineName();
$block_content = BlockContent::create(array(
'info' => $title,
'type' => $bundle,
diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
index c08f92dec..7748b37c5 100644
--- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
@@ -91,8 +91,8 @@ class BlockContentTranslationUITest extends ContentTranslationUITestBase {
* Created custom block.
*/
protected function createBlockContent($title = FALSE, $bundle = FALSE) {
- $title = ($title ? : $this->randomMachineName());
- $bundle = ($bundle ? : $this->bundle);
+ $title = $title ?: $this->randomMachineName();
+ $bundle = $bundle ?: $this->bundle;
$block_content = BlockContent::create(array(
'info' => $title,
'type' => $bundle,
diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
index 6aea3f564..e73aa2a48 100644
--- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
@@ -46,7 +46,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
* Tests creating a block type programmatically and via a form.
*/
public function testBlockContentTypeCreation() {
- // Login a test user.
+ // Log in a test user.
$this->drupalLogin($this->adminUser);
// Test the page with no block-types.
diff --git a/core/modules/book/src/BookManagerInterface.php b/core/modules/book/src/BookManagerInterface.php
index 8f219427f..65acde5b6 100644
--- a/core/modules/book/src/BookManagerInterface.php
+++ b/core/modules/book/src/BookManagerInterface.php
@@ -135,11 +135,11 @@ interface BookManagerInterface {
/**
* Provides book loading, access control and translation.
*
- * @param array $link
- * A book link.
- *
* Note: copied from _menu_link_translate() in menu.inc, but reduced to the
* minimal code that's used.
+ *
+ * @param array $link
+ * A book link.
*/
public function bookLinkTranslate(&$link);
diff --git a/core/modules/book/src/Form/BookSettingsForm.php b/core/modules/book/src/Form/BookSettingsForm.php
index 31b2a4dd5..058d0cd06 100644
--- a/core/modules/book/src/Form/BookSettingsForm.php
+++ b/core/modules/book/src/Form/BookSettingsForm.php
@@ -81,4 +81,3 @@ class BookSettingsForm extends ConfigFormBase {
}
}
-
diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php
index 9582920b6..7ebec6361 100644
--- a/core/modules/book/src/Tests/BookTest.php
+++ b/core/modules/book/src/Tests/BookTest.php
@@ -377,7 +377,7 @@ class BookTest extends WebTestBase {
// Create a book.
$nodes = $this->createBook();
- // Login as web user and view printer-friendly version.
+ // Log in as web user and view printer-friendly version.
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $this->book->id());
$this->clickLink(t('Printer-friendly version'));
@@ -735,7 +735,7 @@ class BookTest extends WebTestBase {
$node_storage = \Drupal::entityManager()->getStorage('node');
$node_storage->resetCache();
- // Login as user without access to the book node, so no 'node test view'
+ // Log in as user without access to the book node, so no 'node test view'
// permission.
// @see node_access_test_node_grants().
$this->drupalLogin($this->webUserWithoutNodeAccess);
diff --git a/core/modules/breakpoint/src/BreakpointManager.php b/core/modules/breakpoint/src/BreakpointManager.php
index 1a70fe757..693ffa9b1 100644
--- a/core/modules/breakpoint/src/BreakpointManager.php
+++ b/core/modules/breakpoint/src/BreakpointManager.php
@@ -195,7 +195,7 @@ class BreakpointManager extends DefaultPluginManager implements BreakpointManage
// Get the labels. This is not cacheable due to translation.
$group_labels = array();
foreach ($groups as $group) {
- $group_labels[$group] = $this->getGroupLabel($group);
+ $group_labels[$group] = $this->getGroupLabel($group);
}
asort($group_labels);
return $group_labels;
diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc
index d27e477e9..14b2fd7c9 100644
--- a/core/modules/ckeditor/ckeditor.admin.inc
+++ b/core/modules/ckeditor/ckeditor.admin.inc
@@ -107,7 +107,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) {
// Set additional flag on the button if it can occur multiple times.
if (!empty($button['multiple'])) {
- $button_item['multiple'] = true;
+ $button_item['multiple'] = TRUE;
}
return $button_item;
diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
index 3cfaf88dc..3728790ca 100644
--- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
+++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
@@ -4,7 +4,7 @@ namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
-use Drupal\Component\Utility\NestedArray;
+use Drupal\ckeditor\CKEditorPluginManager;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -113,14 +113,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
list($config['allowedContent'], $config['disallowedContent']) = $this->generateACFSettings($editor);
// Add the format_tags setting, if its button is enabled.
- $toolbar_rows = array();
- $settings = $editor->getSettings();
- foreach ($settings['toolbar']['rows'] as $row_number => $row) {
- $toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function (&$result, $button_group) {
- return array_merge($result, $button_group['items']);
- }, array());
- }
- $toolbar_buttons = array_unique(NestedArray::mergeDeepArray($toolbar_rows));
+ $toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor);
if (in_array('Format', $toolbar_buttons)) {
$config['format_tags'] = $this->generateFormatTagsSetting($editor);
}
diff --git a/core/modules/ckeditor/tests/src/Unit/CKEditorPluginManagerTest.php b/core/modules/ckeditor/tests/src/Unit/CKEditorPluginManagerTest.php
index 418434768..6b9f9af87 100644
--- a/core/modules/ckeditor/tests/src/Unit/CKEditorPluginManagerTest.php
+++ b/core/modules/ckeditor/tests/src/Unit/CKEditorPluginManagerTest.php
@@ -86,7 +86,7 @@ class CKEditorPluginManagerTest extends UnitTestCase {
* @dataProvider providerGetEnabledButtons
*/
public function testGetEnabledButtons(array $toolbar_rows, array $expected_buttons) {
- $editor= $this->prophesize(Editor::class);
+ $editor = $this->prophesize(Editor::class);
$editor->getSettings()
->willReturn(['toolbar' => ['rows' => $toolbar_rows]]);
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index 055d750f7..d74025b7a 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -71,7 +71,7 @@ function color_form_system_theme_settings_alter(&$form, FormStateInterface $form
* Replaces style sheets declared in libraries with color-altered style sheets.
*/
function color_library_info_alter(&$libraries, $extension) {
- $themes = array_keys(\Drupal::service('theme_handler')->listInfo());
+ $themes = array_keys(\Drupal::service('theme_handler')->listInfo());
if (in_array($extension, $themes)) {
$color_paths = \Drupal::config('color.theme.' . $extension)->get('stylesheets');
if (!empty($color_paths)) {
@@ -780,7 +780,7 @@ function _color_hsl2rgb($hsl) {
$h = $hsl[0];
$s = $hsl[1];
$l = $hsl[2];
- $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s;
+ $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s;
$m1 = $l * 2 - $m2;
return array(
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index 223b815e9..2fb10f137 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -162,7 +162,7 @@ class CommentForm extends ContentEntityForm {
'#maxlength' => 60,
'#access' => $this->currentUser->isAnonymous() || $is_admin,
'#size' => 30,
- '#attributes'=> [
+ '#attributes' => [
'data-drupal-default-value' => $config->get('anonymous'),
],
);
diff --git a/core/modules/comment/src/CommentLinkBuilder.php b/core/modules/comment/src/CommentLinkBuilder.php
index b9fff0596..9998e3f3d 100644
--- a/core/modules/comment/src/CommentLinkBuilder.php
+++ b/core/modules/comment/src/CommentLinkBuilder.php
@@ -15,7 +15,7 @@ use Drupal\Core\Url;
/**
* Defines a class for building markup for comment links on a commented entity.
*
- * Comment links include 'login to post new comment', 'add new comment' etc.
+ * Comment links include 'log in to post new comment', 'add new comment' etc.
*/
class CommentLinkBuilder implements CommentLinkBuilderInterface {
diff --git a/core/modules/comment/src/CommentLinkBuilderInterface.php b/core/modules/comment/src/CommentLinkBuilderInterface.php
index 28079d473..8db7f12c3 100644
--- a/core/modules/comment/src/CommentLinkBuilderInterface.php
+++ b/core/modules/comment/src/CommentLinkBuilderInterface.php
@@ -7,7 +7,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
/**
* Defines an interface for building comment links on a commented entity.
*
- * Comment links include 'login to post new comment', 'add new comment' etc.
+ * Comment links include 'log in to post new comment', 'add new comment' etc.
*/
interface CommentLinkBuilderInterface {
diff --git a/core/modules/comment/src/CommentStatistics.php b/core/modules/comment/src/CommentStatistics.php
index 44c2f4580..74061ee61 100644
--- a/core/modules/comment/src/CommentStatistics.php
+++ b/core/modules/comment/src/CommentStatistics.php
@@ -66,7 +66,7 @@ class CommentStatistics implements CommentStatisticsInterface {
*/
public function read($entities, $entity_type, $accurate = TRUE) {
$options = $accurate ? array() : array('target' => 'replica');
- $stats = $this->database->select('comment_entity_statistics', 'ces', $options)
+ $stats = $this->database->select('comment_entity_statistics', 'ces', $options)
->fields('ces')
->condition('ces.entity_id', array_keys($entities), 'IN')
->condition('ces.entity_type', $entity_type)
diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php
index 12de0360c..594726ae6 100644
--- a/core/modules/comment/src/CommentTypeForm.php
+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -164,7 +164,7 @@ class CommentTypeForm extends EntityForm {
else {
$this->commentManager->addBodyField($comment_type->id());
drupal_set_message(t('Comment type %label has been added.', array('%label' => $comment_type->label())));
- $this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
+ $this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
}
$form_state->setRedirectUrl($comment_type->urlInfo('collection'));
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index 0f34925bb..7a659f87d 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -20,7 +20,7 @@ use Drupal\user\UserInterface;
* @ContentEntityType(
* id = "comment",
* label = @Translation("Comment"),
- * bundle_label = @Translation("Content type"),
+ * bundle_label = @Translation("Comment type"),
* handlers = {
* "storage" = "Drupal\comment\CommentStorage",
* "storage_schema" = "Drupal\comment\CommentStorageSchema",
diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index 8904861f2..80b1af40a 100644
--- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -174,7 +174,7 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
// that page, we need to pass that subrequest route to our pager to
// keep the pager working.
$build['pager']['#route_name'] = $this->routeMatch->getRouteObject();
- $build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
+ $build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
if ($this->getSetting('pager_id')) {
$build['pager']['#element'] = $this->getSetting('pager_id');
}
diff --git a/core/modules/comment/src/Plugin/views/field/Depth.php b/core/modules/comment/src/Plugin/views/field/Depth.php
index 827e6bd6c..8136e2ab4 100644
--- a/core/modules/comment/src/Plugin/views/field/Depth.php
+++ b/core/modules/comment/src/Plugin/views/field/Depth.php
@@ -23,7 +23,7 @@ class Depth extends Field {
foreach ($items as &$item) {
// Work out the depth of this comment.
$comment_thread = $item['rendered']['#markup'];
- $item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
+ $item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
}
return $items;
}
diff --git a/core/modules/comment/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php
index 8a0176e03..f6dc5c6f7 100644
--- a/core/modules/comment/src/Tests/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/CommentAdminTest.php
@@ -184,7 +184,7 @@ class CommentAdminTest extends CommentTestBase {
'skip comment approval',
));
- // Login as a web user.
+ // Log in as a web user.
$this->drupalLogin($this->webUser);
// Post a comment.
$comment = $this->postComment($this->node, $this->randomMachineName());
@@ -201,7 +201,7 @@ class CommentAdminTest extends CommentTestBase {
$author_mail = $this->randomMachineName() . '@example.com';
$anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), array('name' => $author_name, 'mail' => $author_mail));
- // Login as an admin user.
+ // Log in as an admin user.
$this->drupalLogin($this->adminUser);
// Make sure the comment field is not visible when
diff --git a/core/modules/comment/src/Tests/CommentAnonymousTest.php b/core/modules/comment/src/Tests/CommentAnonymousTest.php
index 1949063be..660d75406 100644
--- a/core/modules/comment/src/Tests/CommentAnonymousTest.php
+++ b/core/modules/comment/src/Tests/CommentAnonymousTest.php
@@ -173,7 +173,7 @@ class CommentAnonymousTest extends CommentTestBase {
));
$this->drupalGet('node/' . $this->node->id());
$this->assertPattern('@]*>Comments
@', 'Comments were displayed.');
- $this->assertLink('Log in', 1, 'Link to log in was found.');
+ $this->assertLink('Log in', 1, 'Link to login was found.');
$this->assertLink('register', 1, 'Link to register was found.');
user_role_change_permissions(RoleInterface::ANONYMOUS_ID, array(
diff --git a/core/modules/comment/src/Tests/CommentCacheTagsTest.php b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
index e0e84c858..3c7ab0096 100644
--- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
@@ -82,7 +82,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
'entity_id' => $this->entityTestCamelid->id(),
'entity_type' => 'entity_test',
'field_name' => 'comment',
- 'status' => \Drupal\comment\CommentInterface::PUBLISHED,
+ 'status' => CommentInterface::PUBLISHED,
));
$comment->save();
diff --git a/core/modules/comment/src/Tests/CommentLanguageTest.php b/core/modules/comment/src/Tests/CommentLanguageTest.php
index da72429a6..c60f82783 100644
--- a/core/modules/comment/src/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/src/Tests/CommentLanguageTest.php
@@ -32,7 +32,7 @@ class CommentLanguageTest extends WebTestBase {
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
- // Create and login user.
+ // Create and log in user.
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($admin_user);
diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index b60f9b61c..1b37c1f79 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -356,7 +356,7 @@ class CommentNonNodeTest extends WebTestBase {
));
$this->drupalGet('entity_test/' . $this->entity->id());
$this->assertPattern('@]*>Comments
@', 'Comments were displayed.');
- $this->assertLink('Log in', 0, 'Link to log in was found.');
+ $this->assertLink('Log in', 0, 'Link to login was found.');
$this->assertLink('register', 0, 'Link to register was found.');
$this->assertNoFieldByName('subject[0][value]', '', 'Subject field not found.');
$this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.');
diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php
index 071c97038..837a78aa9 100644
--- a/core/modules/comment/src/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/src/Tests/CommentPreviewTest.php
@@ -35,7 +35,7 @@ class CommentPreviewTest extends CommentTestBase {
$this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
$this->drupalLogout();
- // Login as web user.
+ // Log in as web user.
$this->drupalLogin($this->webUser);
// Test escaping of the username on the preview form.
@@ -86,7 +86,7 @@ class CommentPreviewTest extends CommentTestBase {
$this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
$this->drupalLogout();
- // Login as web user.
+ // Log in as web user.
$this->drupalLogin($this->webUser);
// As the web user, fill in the comment form and preview the comment.
diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php
index e739ba1d5..fb5028f71 100644
--- a/core/modules/comment/src/Tests/CommentTypeTest.php
+++ b/core/modules/comment/src/Tests/CommentTypeTest.php
@@ -54,7 +54,7 @@ class CommentTypeTest extends CommentTestBase {
$comment_type = CommentType::load('other');
$this->assertTrue($comment_type, 'The new comment type has been created.');
- // Login a test user.
+ // Log in a test user.
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/comment/manage/' . $type->id());
diff --git a/core/modules/config/config.module b/core/modules/config/config.module
index 7a1256a9e..73baee4d9 100644
--- a/core/modules/config/config.module
+++ b/core/modules/config/config.module
@@ -19,7 +19,7 @@ function config_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Exporting the full configuration') . '
';
- $output .= '- ' . t('You can create and download an archive consisting of all your site\'s configuration exported as *.yml files on the Export page.' , array(':url' => \Drupal::url('config.export_full'))) . '
';
+ $output .= '- ' . t('You can create and download an archive consisting of all your site\'s configuration exported as *.yml files on the Export page.', array(':url' => \Drupal::url('config.export_full'))) . '
';
$output .= '- ' . t('Importing a full configuration') . '
';
$output .= '- ' . t('You can upload a full site configuration from an archive file on the Import page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the system.site configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array(':url' => \Drupal::url('config.import_full'))) . '
';
$output .= '- ' . t('Synchronizing configuration'). '
';
diff --git a/core/modules/config/src/Form/ConfigImportForm.php b/core/modules/config/src/Form/ConfigImportForm.php
index 04958ef2b..c0f606b4e 100644
--- a/core/modules/config/src/Form/ConfigImportForm.php
+++ b/core/modules/config/src/Form/ConfigImportForm.php
@@ -100,4 +100,3 @@ class ConfigImportForm extends FormBase {
}
}
-
diff --git a/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module b/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
index 08a169762..fbf11e5da 100644
--- a/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
+++ b/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
@@ -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']]);
diff --git a/core/modules/config/tests/config_test/config_test.hooks.inc b/core/modules/config/tests/config_test/config_test.hooks.inc
index 80f33818d..7608d067e 100644
--- a/core/modules/config/tests/config_test/config_test.hooks.inc
+++ b/core/modules/config/tests/config_test/config_test.hooks.inc
@@ -9,6 +9,8 @@
* config_test entity hooks themselves.
*/
+use Drupal\config_test\Entity\ConfigTest;
+
/**
* Implements hook_config_test_load().
*/
@@ -16,37 +18,69 @@ function config_test_config_test_load() {
$GLOBALS['hook_config_test']['load'] = __FUNCTION__;
}
+/**
+ * Implements hook_ENTITY_TYPE_create() for 'config_test'.
+ */
+function config_test_config_test_create(ConfigTest $config_test) {
+ if (\Drupal::state()->get('config_test.prepopulate')) {
+ $config_test->set('foo', 'baz');
+ }
+ _config_test_update_is_syncing_store('create', $config_test);
+}
+
/**
* Implements hook_config_test_presave().
*/
-function config_test_config_test_presave() {
+function config_test_config_test_presave(ConfigTest $config_test) {
$GLOBALS['hook_config_test']['presave'] = __FUNCTION__;
+ _config_test_update_is_syncing_store('presave', $config_test);
}
/**
* Implements hook_config_test_insert().
*/
-function config_test_config_test_insert() {
+function config_test_config_test_insert(ConfigTest $config_test) {
$GLOBALS['hook_config_test']['insert'] = __FUNCTION__;
+ _config_test_update_is_syncing_store('insert', $config_test);
}
/**
* Implements hook_config_test_update().
*/
-function config_test_config_test_update() {
+function config_test_config_test_update(ConfigTest $config_test) {
$GLOBALS['hook_config_test']['update'] = __FUNCTION__;
+ _config_test_update_is_syncing_store('update', $config_test);
}
/**
* Implements hook_config_test_predelete().
*/
-function config_test_config_test_predelete() {
+function config_test_config_test_predelete(ConfigTest $config_test) {
$GLOBALS['hook_config_test']['predelete'] = __FUNCTION__;
+ _config_test_update_is_syncing_store('predelete', $config_test);
}
/**
* Implements hook_config_test_delete().
*/
-function config_test_config_test_delete() {
+function config_test_config_test_delete(ConfigTest $config_test) {
$GLOBALS['hook_config_test']['delete'] = __FUNCTION__;
+ _config_test_update_is_syncing_store('delete', $config_test);
+}
+
+/**
+ * Helper function for testing hooks during configuration sync.
+ *
+ * @param string $hook
+ * The fired hook.
+ * @param \Drupal\config_test\Entity\ConfigTest $config_test
+ * The ConfigTest entity.
+ */
+function _config_test_update_is_syncing_store($hook, ConfigTest $config_test) {
+ $current_value = \Drupal::state()->get('config_test.store_isSyncing', FALSE);
+ if ($current_value !== FALSE) {
+ $current_value['global_state::' . $hook] = \Drupal::isConfigSyncing();
+ $current_value['entity_state::' . $hook] = $config_test->isSyncing();
+ \Drupal::state()->set('config_test.store_isSyncing', $current_value);
+ }
}
diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module
index 08aeac61e..500857542 100644
--- a/core/modules/config/tests/config_test/config_test.module
+++ b/core/modules/config/tests/config_test/config_test.module
@@ -5,8 +5,6 @@
* Provides Config module hook implementations for testing purposes.
*/
-use Drupal\config_test\Entity\ConfigTest;
-
require_once dirname(__FILE__) . '/config_test.hooks.inc';
/**
@@ -17,15 +15,6 @@ function config_test_cache_flush() {
$GLOBALS['hook_cache_flush'] = __FUNCTION__;
}
-/**
- * Implements hook_ENTITY_TYPE_create() for 'config_test'.
- */
-function config_test_config_test_create(ConfigTest $config_test) {
- if (\Drupal::state()->get('config_test.prepopulate')) {
- $config_test->set('foo', 'baz');
- }
-}
-
/**
* Implements hook_entity_type_alter().
*/
diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module
index 542dd4fd4..9f0803d0e 100644
--- a/core/modules/config_translation/config_translation.module
+++ b/core/modules/config_translation/config_translation.module
@@ -196,4 +196,3 @@ function config_translation_config_schema_info_alter(&$definitions) {
}
}
}
-
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
index f70fb7555..8bd3d71d8 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
@@ -121,7 +121,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
$edit = array(
'id' => $menu_name,
'description' => '',
- 'label' => $label,
+ 'label' => $label,
);
// Create the menu by posting the form.
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
@@ -147,7 +147,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
// Test if the link to translate the menu is NOT on the page.
$this->assertNoLinkByHref($translate_link);
- // Login as Admin again otherwise the rest will fail.
+ // Log in as Admin again otherwise the rest will fail.
$this->drupalLogin($this->adminUser);
// Test if the link to translate actually goes to the translate page.
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
index ee255dfc7..e7c58fd97 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
@@ -55,7 +55,7 @@ class ConfigTranslationOverviewTest extends WebTestBase {
'access contextual links',
'administer views',
);
- // Create and login user.
+ // Create and log in user.
$this->drupalLogin($this->drupalCreateUser($permissions));
// Add languages.
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
index 58b9c0001..908b925aa 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -104,7 +104,7 @@ class ConfigTranslationUiTest extends WebTestBase {
'translate interface',
]
);
- // Create and login user.
+ // Create and log in user.
$this->translatorUser = $this->drupalCreateUser($translator_permissions);
$this->adminUser = $this->drupalCreateUser($admin_permissions);
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php
index 0f31323ca..ab51a43ef 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php
@@ -42,7 +42,7 @@ class ConfigTranslationUiThemeTest extends WebTestBase {
'administer site configuration',
'translate configuration',
];
- // Create and login user.
+ // Create and log in user.
$this->adminUser = $this->drupalCreateUser($admin_permissions);
// Add languages.
diff --git a/core/modules/contact/src/Tests/ContactLanguageTest.php b/core/modules/contact/src/Tests/ContactLanguageTest.php
index 9f6408516..4623bda08 100644
--- a/core/modules/contact/src/Tests/ContactLanguageTest.php
+++ b/core/modules/contact/src/Tests/ContactLanguageTest.php
@@ -32,7 +32,7 @@ class ContactLanguageTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login administrative user.
+ // Create and log in administrative user.
$admin_user = $this->drupalCreateUser(array(
'access site-wide contact form',
'administer languages',
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index 09903198d..f65ab6faa 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -42,7 +42,7 @@ class ContactSitewideTest extends WebTestBase {
* Tests configuration options and the site-wide contact form.
*/
function testSiteWideContact() {
- // Create and login administrative user.
+ // Create and log in administrative user.
$admin_user = $this->drupalCreateUser(array(
'access site-wide contact form',
'administer contact forms',
@@ -296,7 +296,7 @@ class ContactSitewideTest extends WebTestBase {
* Tests auto-reply on the site-wide contact form.
*/
function testAutoReply() {
- // Create and login administrative user.
+ // Create and log in administrative user.
$admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users'));
$this->drupalLogin($admin_user);
diff --git a/core/modules/contact/src/Tests/ContactStorageTest.php b/core/modules/contact/src/Tests/ContactStorageTest.php
index 9e97d8505..0a5dbb56f 100644
--- a/core/modules/contact/src/Tests/ContactStorageTest.php
+++ b/core/modules/contact/src/Tests/ContactStorageTest.php
@@ -36,7 +36,7 @@ class ContactStorageTest extends ContactSitewideTest {
* Tests configuration options and the site-wide contact form.
*/
public function testContactStorage() {
- // Create and login administrative user.
+ // Create and log in administrative user.
$admin_user = $this->drupalCreateUser(array(
'access site-wide contact form',
'administer contact forms',
diff --git a/core/modules/contact/tests/drupal-7.contact.database.php b/core/modules/contact/tests/drupal-7.contact.database.php
index ed8e5bae5..494e430cf 100644
--- a/core/modules/contact/tests/drupal-7.contact.database.php
+++ b/core/modules/contact/tests/drupal-7.contact.database.php
@@ -25,7 +25,7 @@ db_insert('contact')->fields(array(
))
->values(array(
'category' => 'Upgrade test',
- 'recipients'=> 'test1@example.com,test2@example.com',
+ 'recipients' => 'test1@example.com,test2@example.com',
'reply' => 'Test reply',
'weight' => 1,
'selected' => 1,
diff --git a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
index 0ecfee574..e20dc436f 100644
--- a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
+++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
@@ -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();
diff --git a/core/modules/contact/tests/src/Kernel/Migrate/d6/MigrateContactSettingsTest.php b/core/modules/contact/tests/src/Kernel/Migrate/d6/MigrateContactSettingsTest.php
index 8830a674e..9efaae93e 100644
--- a/core/modules/contact/tests/src/Kernel/Migrate/d6/MigrateContactSettingsTest.php
+++ b/core/modules/contact/tests/src/Kernel/Migrate/d6/MigrateContactSettingsTest.php
@@ -32,7 +32,7 @@ class MigrateContactSettingsTest extends MigrateDrupal6TestBase {
*/
public function testContactSettings() {
$config = $this->config('contact.settings');
- $this->assertIdentical(true, $config->get('user_default_enabled'));
+ $this->assertIdentical(TRUE, $config->get('user_default_enabled'));
$this->assertIdentical(3, $config->get('flood.limit'));
$this->assertIdentical('some_other_category', $config->get('default_form'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
diff --git a/core/modules/contact/tests/src/Unit/MailHandlerTest.php b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
index 8504a6ab1..8423ee98d 100644
--- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php
+++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
@@ -364,7 +364,7 @@ class MailHandlerTest extends UnitTestCase {
$message->expects($this->once())
->method('copySender')
->willReturn($copy_sender);
- $recipient =$this->getMock('\Drupal\user\UserInterface');
+ $recipient = $this->getMock('\Drupal\user\UserInterface');
$recipient->expects($this->once())
->method('getEmail')
->willReturn('user2@drupal.org');
diff --git a/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php b/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php
index cf82626c7..fb4b76117 100644
--- a/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php
+++ b/core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php
@@ -63,7 +63,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
'entity_type_id' => $entity_type_id,
),
array(
- '_entity_access' => $entity_type_id . '.view',
+ '_entity_access' => $entity_type_id . '.view',
'_access_content_translation_overview' => $entity_type_id,
),
array(
@@ -89,7 +89,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
),
array(
- '_entity_access' => $entity_type_id . '.view',
+ '_entity_access' => $entity_type_id . '.view',
'_access_content_translation_manage' => 'create',
),
array(
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php
index d69e5b44d..e9fff8db1 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php
@@ -163,7 +163,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$language = ConfigurableLanguage::load($langcode);
$source_langcode = 'it';
$edit = array('source_langcode[source]' => $source_langcode);
- $entity_type_id = $entity->getEntityTypeId();
+ $entity_type_id = $entity->getEntityTypeId();
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
$entity->getEntityTypeId() => $entity->id(),
'source' => $default_langcode,
diff --git a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php
index 4fc0b43ff..680303db3 100644
--- a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php
+++ b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php
@@ -46,7 +46,7 @@ class ContextualUnitTest extends KernelTestBase {
$tests[] = array(
'links' => array(
'foo' => array(
- 'route_parameters'=> array(
+ 'route_parameters' => array(
'bar',
'key' => 'baz',
'qux',
diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module
index 2ad07a241..8682399de 100644
--- a/core/modules/datetime/datetime.module
+++ b/core/modules/datetime/datetime.module
@@ -36,7 +36,7 @@ function datetime_help($route_name, RouteMatchInterface $route_match) {
$output .= '- ' . t('Managing and displaying date fields') . '
';
$output .= '- ' . t('The settings and the display of the Date field can be configured separately. See the Field UI help for more information on how to manage fields and their display.', array(':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '
';
$output .= '- ' . t('Displaying dates') . '
';
- $output .= '- ' . t('Dates can be displayed using the Plain or the Default formatter. The Plain formatter displays the date in the ISO 8601 format. If you choose the Default formatter, you can choose a format from a predefined list that can be managed on the Date and time formats page.', array(':date_format_list'=> \Drupal::url('entity.date_format.collection'))) . '
';
+ $output .= '- ' . t('Dates can be displayed using the Plain or the Default formatter. The Plain formatter displays the date in the ISO 8601 format. If you choose the Default formatter, you can choose a format from a predefined list that can be managed on the Date and time formats page.', array(':date_format_list' => \Drupal::url('entity.date_format.collection'))) . '
';
$output .= '
';
return $output;
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
index cbeb73bc1..3fac2524c 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
@@ -41,13 +41,15 @@ class DateTimeDefaultFormatter extends DateTimeFormatterBase {
if ($item->date) {
/** @var \Drupal\Core\Datetime\DrupalDateTime $date */
$date = $item->date;
- // Create the ISO date in Universal Time.
- $iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
if ($this->getFieldSetting('datetime_type') == 'date') {
// A date without time will pick up the current time, use the default.
datetime_date_default_time($date);
}
+
+ // Create the ISO date in Universal Time.
+ $iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
+
$this->setTimeZone($date);
$output = $this->formatDate($date);
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
index ba18fc876..0a171de8e 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
@@ -95,12 +95,12 @@ class DateTimeFieldItemList extends FieldItemList {
// A default value should be in the format and timezone used for date
// storage.
$date = new DrupalDateTime($default_value[0]['default_date'], DATETIME_STORAGE_TIMEZONE);
- $storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT: DATETIME_DATETIME_STORAGE_FORMAT;
+ $storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT;
$value = $date->format($storage_format);
// We only provide a default value for the first item, as do all fields.
// Otherwise, there is no way to clear out unwanted values on multiple value
// fields.
- $default_value = array(
+ $default_value = array(
array(
'value' => $value,
'date' => $date,
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
index 16175347b..f07d56409 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
@@ -106,7 +106,7 @@ class DateTimeItem extends FieldItemBase {
// Just pick a date in the past year. No guidance is provided by this Field
// type.
- $timestamp = REQUEST_TIME - mt_rand(0, 86400*365);
+ $timestamp = REQUEST_TIME - mt_rand(0, 86400 * 365);
if ($type == DateTimeItem::DATETIME_TYPE_DATE) {
$values['value'] = gmdate(DATETIME_DATE_STORAGE_FORMAT, $timestamp);
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
index de5968a56..c88c5c834 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
@@ -76,7 +76,7 @@ class DateTimeDatelistWidget extends DateTimeWidgetBase {
$element['value'] = array(
'#type' => 'datelist',
'#date_increment' => $increment,
- '#date_part_order'=> $date_part_order,
+ '#date_part_order' => $date_part_order,
) + $element['value'];
return $element;
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
index 2887d37e9..89381ab7c 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
@@ -77,7 +77,7 @@ class DateTimeDefaultWidget extends DateTimeWidgetBase implements ContainerFacto
}
$element['value'] += array(
- '#date_date_format'=> $date_format,
+ '#date_date_format' => $date_format,
'#date_date_element' => $date_type,
'#date_date_callbacks' => array(),
'#date_time_format' => $time_format,
diff --git a/core/modules/datetime/src/Plugin/views/filter/Date.php b/core/modules/datetime/src/Plugin/views/filter/Date.php
index e53cb1c64..9fd47fdc7 100644
--- a/core/modules/datetime/src/Plugin/views/filter/Date.php
+++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
@@ -112,7 +112,7 @@ class Date extends NumericDate implements ContainerFactoryPluginInterface {
* Override parent method, which deals with dates as integers.
*/
protected function opSimple($field) {
- $origin = (!empty($this->value['type']) && $this->value['type'] == 'offset') ? $this->requestStack->getCurrentRequest()->server->get('REQUEST_TIME') : 0;
+ $origin = (!empty($this->value['type']) && $this->value['type'] == 'offset') ? $this->requestStack->getCurrentRequest()->server->get('REQUEST_TIME') : 0;
$value = intval(strtotime($this->value['value'], $origin));
// Convert to ISO. UTC is used since dates are stored in UTC.
diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
index 1fc1d6096..bd9e3af38 100644
--- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php
+++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
@@ -162,8 +162,9 @@ class DateTimeFieldTest extends WebTestBase {
case 'format_type':
// Verify that a date is displayed.
$expected = format_date($date->getTimestamp(), $new_value);
+ $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
$this->renderTestEntity($id);
- $this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
+ $this->assertFieldByXPath('//time[@datetime="' . $expected_iso . '"]', $expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', array('%value' => $new_value, '%expected' => $expected, '%expected_iso' => $expected_iso)));
break;
}
}
@@ -291,8 +292,9 @@ class DateTimeFieldTest extends WebTestBase {
case 'format_type':
// Verify that a date is displayed.
$expected = format_date($date->getTimestamp(), $new_value);
+ $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
$this->renderTestEntity($id);
- $this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
+ $this->assertFieldByXPath('//time[@datetime="' . $expected_iso . '"]', $expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', array('%value' => $new_value, '%expected' => $expected, '%expected_iso' => $expected_iso)));
break;
}
}
diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php
index 25d4a6038..4d5c16bc3 100644
--- a/core/modules/dblog/src/Tests/DbLogTest.php
+++ b/core/modules/dblog/src/Tests/DbLogTest.php
@@ -59,7 +59,7 @@ class DbLogTest extends WebTestBase {
* interfaces.
*/
function testDbLog() {
- // Login the admin user.
+ // Log in the admin user.
$this->drupalLogin($this->adminUser);
$row_limit = 100;
@@ -78,7 +78,7 @@ class DbLogTest extends WebTestBase {
}
}
- // Login the regular user.
+ // Log in the regular user.
$this->drupalLogin($this->webUser);
$this->verifyReports(403);
}
@@ -148,7 +148,9 @@ class DbLogTest extends WebTestBase {
private function generateLogEntries($count, $options = array()) {
global $base_root;
- // Make it just a little bit harder to pass the link part of the test.
+ // This long URL makes it just a little bit harder to pass the link part of
+ // the test with a mix of English words and a repeating series of random
+ // percent-encoded Chinese characters.
$link = urldecode('/content/xo%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A-lake-isabelle');
// Prepare the fields to be logged
@@ -302,9 +304,9 @@ class DbLogTest extends WebTestBase {
$this->assertTrue($user != NULL, format_string('User @name was loaded', array('@name' => $name)));
// pass_raw property is needed by drupalLogin.
$user->pass_raw = $pass;
- // Login user.
+ // Log in user.
$this->drupalLogin($user);
- // Logout user.
+ // Log out user.
$this->drupalLogout();
// Fetch the row IDs in watchdog that relate to the user.
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->id()));
@@ -314,7 +316,7 @@ class DbLogTest extends WebTestBase {
$count_before = (isset($ids)) ? count($ids) : 0;
$this->assertTrue($count_before > 0, format_string('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->getUsername())));
- // Login the admin user.
+ // Log in the admin user.
$this->drupalLogin($this->adminUser);
// Delete the user created at the start of this test.
// We need to POST here to invoke batch_process() in the internal browser.
@@ -329,9 +331,9 @@ class DbLogTest extends WebTestBase {
// Default display includes name and email address; if too long, the email
// address is replaced by three periods.
$this->assertLogMessage(t('New user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>')), 'DBLog event was recorded: [add user]');
- // Login user.
+ // Log in user.
$this->assertLogMessage(t('Session opened for %name.', array('%name' => $name)), 'DBLog event was recorded: [login user]');
- // Logout user.
+ // Log out user.
$this->assertLogMessage(t('Session closed for %name.', array('%name' => $name)), 'DBLog event was recorded: [logout user]');
// Delete user.
$message = t('Deleted user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>'));
@@ -374,7 +376,7 @@ class DbLogTest extends WebTestBase {
// Create user.
$perm = array('create ' . $type . ' content', 'edit own ' . $type . ' content', 'delete own ' . $type . ' content');
$user = $this->drupalCreateUser($perm);
- // Login user.
+ // Log in user.
$this->drupalLogin($user);
// Create a node using the form in order to generate an add content event
@@ -400,7 +402,7 @@ class DbLogTest extends WebTestBase {
$this->drupalGet('admin/reports/dblog');
$this->assertResponse(403);
- // Login the admin user.
+ // Log in the admin user.
$this->drupalLogin($this->adminUser);
// View the database log report.
$this->drupalGet('admin/reports/dblog');
@@ -499,7 +501,7 @@ class DbLogTest extends WebTestBase {
$this->container->get('logger.dblog')->log($log['severity'], $log['message'], $log);
// Make sure the table count has actually been incremented.
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('\Drupal\dblog\Logger\DbLog->log() added an entry to the dblog :count', array(':count' => $count)));
- // Login the admin user.
+ // Log in the admin user.
$this->drupalLogin($this->adminUser);
// Post in order to clear the database table.
$this->drupalPostForm('admin/reports/dblog', array(), t('Clear log messages'));
diff --git a/core/modules/editor/src/Tests/EditorAdminTest.php b/core/modules/editor/src/Tests/EditorAdminTest.php
index a89eb1092..dcbd368aa 100644
--- a/core/modules/editor/src/Tests/EditorAdminTest.php
+++ b/core/modules/editor/src/Tests/EditorAdminTest.php
@@ -103,7 +103,7 @@ class EditorAdminTest extends WebTestBase {
* Tests format disabling.
*/
public function testDisableFormatWithEditor() {
- $formats = ['monocerus' => 'Monocerus', 'tattoo' => 'Tattoo'];
+ $formats = ['monocerus' => 'Monocerus', 'tattoo' => 'Tattoo'];
// Install the node module.
$this->container->get('module_installer')->install(['node']);
@@ -130,7 +130,7 @@ class EditorAdminTest extends WebTestBase {
$node->body->format = 'monocerus';
$node->save();
- // Login as an user able to use both formats and edit nodes of created type.
+ // Log in as an user able to use both formats and edit nodes of created type.
$account = $this->drupalCreateUser($permissions);
$this->drupalLogin($account);
diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php b/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php
similarity index 98%
rename from core/modules/editor/src/Tests/QuickEditIntegrationTest.php
rename to core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php
index 75d965fd5..5e47c36c1 100644
--- a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
+++ b/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php
@@ -1,6 +1,6 @@
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.
@@ -213,7 +214,7 @@ function field_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundl
function field_entity_bundle_delete($entity_type_id, $bundle) {
$storage = \Drupal::entityManager()->getStorage('field_config');
// Get the fields on the bundle.
- $fields = $storage->loadByProperties(['entity_type' => $entity_type_id, 'bundle' => $bundle]);
+ $fields = $storage->loadByProperties(['entity_type' => $entity_type_id, 'bundle' => $bundle]);
// This deletes the data for the field as well as the field themselves. This
// function actually just marks the data and fields as deleted, leaving the
// garbage collection for a separate process, because it is not always
@@ -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')
);
diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php
index ba36e8348..d04454ed3 100644
--- a/core/modules/field/src/Entity/FieldStorageConfig.php
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php
@@ -222,6 +222,10 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
/**
* Constructs a FieldStorageConfig object.
*
+ * In most cases, Field entities are created via
+ * FieldStorageConfig::create($values)), where $values is the same parameter
+ * as in this constructor.
+ *
* @param array $values
* An array of field properties, keyed by property name. Most array
* elements will be used to set the corresponding properties on the class;
@@ -232,10 +236,6 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
* - entity_type: required.
* - type: required.
*
- * In most cases, Field entities are created via
- * FieldStorageConfig::create($values)), where $values is the same
- * parameter as in this constructor.
- *
* @see entity_create()
*/
public function __construct(array $values, $entity_type = 'field_storage_config') {
diff --git a/core/modules/field/src/Plugin/migrate/source/d6/Field.php b/core/modules/field/src/Plugin/migrate/source/d6/Field.php
index a1fd00805..cb108d700 100644
--- a/core/modules/field/src/Plugin/migrate/source/d6/Field.php
+++ b/core/modules/field/src/Plugin/migrate/source/d6/Field.php
@@ -79,7 +79,7 @@ class Field extends DrupalSqlBase {
['field_name' => $row->getSourceProperty('field_name')],
$this->t('Widget types @types are used in Drupal 6 field instances: widget type @selected_type applied to the Drupal 8 base field', [
'@types' => implode(', ', $widget_types),
- '@selected_type' => $widget_types[0],
+ '@selected_type' => $widget_types[0],
])
);
}
diff --git a/core/modules/field/src/Tests/FieldHelpTest.php b/core/modules/field/src/Tests/FieldHelpTest.php
index a9505ba07..110332040 100644
--- a/core/modules/field/src/Tests/FieldHelpTest.php
+++ b/core/modules/field/src/Tests/FieldHelpTest.php
@@ -37,7 +37,7 @@ class FieldHelpTest extends WebTestBase {
* Test the Field module's help page.
*/
public function testFieldHelp() {
- // Login the admin user.
+ // Log in the admin user.
$this->drupalLogin($this->adminUser);
// Visit the Help page and make sure no warnings or notices are thrown.
diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php
index a223d4573..33a644dbc 100644
--- a/core/modules/field/src/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/src/Tests/FieldUnitTestBase.php
@@ -1,10 +1,5 @@
select('key_value')
->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')
diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module
index 9c994d6f7..7eda28852 100644
--- a/core/modules/field/tests/modules/field_test/field_test.module
+++ b/core/modules/field/tests/modules/field_test/field_test.module
@@ -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' => [
diff --git a/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module b/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
index fa0e41812..9dc2b1936 100644
--- a/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
+++ b/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
@@ -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'),
@@ -46,4 +49,3 @@ function field_third_party_test_field_formatter_settings_summary_alter(&$summary
$summary[] = 'field_test_field_formatter_settings_summary_alter';
return $summary;
}
-
diff --git a/core/modules/field/tests/src/Kernel/DisplayApiTest.php b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
index d9a0a8765..9a85255dd 100644
--- a/core/modules/field/tests/src/Kernel/DisplayApiTest.php
+++ b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
@@ -104,7 +104,7 @@ class DisplayApiTest extends FieldKernelTestBase {
->setComponent($this->fieldName, $this->displayOptions['default'])
->save();
// Create a display for the teaser view mode.
- EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
+ EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
entity_get_display($field['entity_type'], $field['bundle'], 'teaser')
->setComponent($this->fieldName, $this->displayOptions['teaser'])
->save();
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
index a5bab7602..4894a118d 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
@@ -5,6 +5,7 @@ namespace Drupal\Tests\field\Kernel\EntityReference;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
@@ -204,6 +205,68 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
$this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
}
+ /**
+ * Tests the recursive rendering protection of the entity formatter.
+ */
+ public function testEntityFormatterRecursiveRendering() {
+ /** @var \Drupal\Core\Render\RendererInterface $renderer */
+ $renderer = $this->container->get('renderer');
+ $formatter = 'entity_reference_entity_view';
+ $view_builder = $this->entityManager->getViewBuilder($this->entityType);
+
+ // Set the default view mode to use the 'entity_reference_entity_view'
+ // formatter.
+ entity_get_display($this->entityType, $this->bundle, 'default')
+ ->setComponent($this->fieldName, [
+ 'type' => $formatter,
+ ])
+ ->save();
+
+ $referencing_entity_1 = entity_create($this->entityType, ['name' => $this->randomMachineName()]);
+ $referencing_entity_1->save();
+
+ // Create a self-reference.
+ $referencing_entity_1->{$this->fieldName}->entity = $referencing_entity_1;
+ $referencing_entity_1->save();
+
+ // Check that the recursive rendering stops after it reaches the specified
+ // limit.
+ $build = $view_builder->view($referencing_entity_1, 'default');
+ $output = $renderer->renderRoot($build);
+
+ // The title of entity_test entities is printed twice by default, so we have
+ // to multiply the formatter's recursive rendering protection limit by 2.
+ // Additionally, we have to take into account 2 additional occurrences of
+ // the entity title because we're rendering the full entity, not just the
+ // reference field.
+ $expected_occurrences = EntityReferenceEntityFormatter::RECURSIVE_RENDER_LIMIT * 2 + 2;
+ $actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
+ $this->assertEqual($actual_occurrences, $expected_occurrences);
+
+ // Repeat the process with another entity in order to check that the
+ // 'recursive_render_id' counter is generated properly.
+ $referencing_entity_2 = entity_create($this->entityType, ['name' => $this->randomMachineName()]);
+ $referencing_entity_2->save();
+ $referencing_entity_2->{$this->fieldName}->entity = $referencing_entity_2;
+ $referencing_entity_2->save();
+
+ $build = $view_builder->view($referencing_entity_2, 'default');
+ $output = $renderer->renderRoot($build);
+
+ $actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
+ $this->assertEqual($actual_occurrences, $expected_occurrences);
+
+ // Now render both entities at the same time and check again.
+ $build = $view_builder->viewMultiple([$referencing_entity_1, $referencing_entity_2], 'default');
+ $output = $renderer->renderRoot($build);
+
+ $actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
+ $this->assertEqual($actual_occurrences, $expected_occurrences);
+
+ $actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
+ $this->assertEqual($actual_occurrences, $expected_occurrences);
+ }
+
/**
* Tests the label formatter.
*/
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
index 7380491b5..edb3029ea 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
@@ -229,7 +229,7 @@ class EntityReferenceItemTest extends FieldKernelTestBase {
$this->assertEqual($vocabulary->label(), $new_name);
// Make sure the computed term reflects updates to the term id.
- $vocabulary2 = $vocabulary = Vocabulary::create([
+ $vocabulary2 = $vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(),
'vid' => Unicode::strtolower($this->randomMachineName()),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index b641952b7..1af4ac6e2 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -46,7 +46,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$values[$current_revision] = $current_values;
}
- $storage = $this->container->get('entity.manager')->getStorage($entity_type);
+ $storage = $this->container->get('entity.manager')->getStorage($entity_type);
$storage->resetCache();
$entity = $storage->load($entity_id);
// Confirm current revision loads the correct data.
@@ -54,7 +54,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, 'Current revision: expected number of values');
for ($delta = 0; $delta < $cardinality; $delta++) {
// The field value loaded matches the one inserted or updated.
- $this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value , $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
+ $this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value, $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
}
// Confirm each revision loads the correct data.
@@ -363,7 +363,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
// Verify no data gets loaded
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
$controller->resetCache();
- $entity= $controller->load($entity->id());
+ $entity = $controller->load($entity->id());
$this->assertTrue(empty($entity->{$this->fieldTestData->field_name}), 'No data for first field');
$this->assertTrue(empty($entity->{$field_name}), 'No data for second field');
diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
index 6f6a2856b..a61d64565 100644
--- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
@@ -95,7 +95,7 @@ class FieldCrudTest extends FieldKernelTestBase {
$this->assertIdentical($config['description'], '', 'Description defaults to empty string.');
// Check that default settings are set.
- $this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']) , 'Default field settings have been written.');
+ $this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']), 'Default field settings have been written.');
// Check that the denormalized 'field_type' was properly written.
$this->assertEqual($config['field_type'], $this->fieldStorageDefinition['type']);
diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
index 9bc99035f..e0ea68369 100644
--- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
@@ -74,7 +74,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
$this->assertIdentical($this->storage->countFieldData($field_storage), 0, 'There are 0 entities with field data.');
// Create 12 entities to ensure that the purging works as expected.
- for ($i=0; $i < 12; $i++) {
+ for ($i = 0; $i < 12; $i++) {
$entity = EntityTest::create();
$entity->field_int[] = mt_rand(1, 99);
$entity->field_int[] = mt_rand(1, 99);
@@ -135,7 +135,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
$this->assertIdentical($this->fieldTestData->field_storage_2->hasData(), TRUE, 'There are entities with field data.');
- $storage = $this->container->get('entity.manager')->getStorage($entity_type);
+ $storage = $this->container->get('entity.manager')->getStorage($entity_type);
$entity = $storage->loadRevision($first_revision);
$this->assertEqual(count($entity->{$this->fieldTestData->field_name_2}), $cardinality, format_string('Revision %revision_id: expected number of values.', array('%revision_id' => $first_revision)));
}
diff --git a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
index 90693c624..760607698 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportChangeTest.php
@@ -49,4 +49,3 @@ class FieldImportChangeTest extends FieldKernelTestBase {
$this->assertEqual($field->getLabel(), $new_label, 'field label updated');
}
}
-
diff --git a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
index 8e91a4a86..78a136e2a 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
@@ -116,4 +116,3 @@ class FieldImportCreateTest extends FieldKernelTestBase {
$this->assertTrue($field, 'Test import field 2b from sync exists');
}
}
-
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index bae3e23bd..220aa46e3 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -109,4 +109,3 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
$this->assertTrue(empty($deleted_storages), 'Fields are deleted');
}
}
-
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php
index 1f63e1472..3e7f6ce6f 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php
@@ -125,7 +125,7 @@ class FieldImportDeleteUninstallTest extends FieldKernelTestBase {
])->save();
// Create 12 entities to ensure that the purging works as expected.
- for ($i=0; $i < 12; $i++) {
+ for ($i = 0; $i < 12; $i++) {
$entity = EntityTest::create();
$value = '+0123456789';
$entity->field_test = $value;
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
index dbaf441d9..65d0fb459 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
@@ -109,9 +109,9 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase {
),
'settings' =>
array (
- 'display_summary' => true,
+ 'display_summary' => TRUE,
'text_processing' => 1,
- 'user_register_form' => false,
+ 'user_register_form' => FALSE,
),
'display' =>
array (
@@ -136,7 +136,7 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase {
'weight' => 0,
),
),
- 'required' => false,
+ 'required' => FALSE,
'description' => '',
)),
))
diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
index 2ac2692cc..3f687d4b9 100644
--- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
@@ -140,7 +140,7 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
$this->fieldTypePluginManager->expects($this->any())
->method('getDefinition')
->with('test_field')
- ->willReturn(['provider' => 'test_module', 'config_dependencies' =>['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
+ ->willReturn(['provider' => 'test_module', 'config_dependencies' => ['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
$this->fieldStorage->expects($this->once())
->method('getConfigDependencyName')
@@ -201,7 +201,7 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
$this->fieldTypePluginManager->expects($this->any())
->method('getDefinition')
->with('test_field')
- ->willReturn(['provider' => 'test_module', 'config_dependencies' =>['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
+ ->willReturn(['provider' => 'test_module', 'config_dependencies' => ['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
$field = new FieldConfig(array(
'field_name' => $this->fieldStorage->getName(),
diff --git a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php
index 361a080ed..1d4de245f 100644
--- a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php
+++ b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php
@@ -94,7 +94,7 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
public function buildRow(EntityInterface $field_storage) {
if ($field_storage->isLocked()) {
$row['class'] = array('menu-disabled');
- $row['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
+ $row['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
}
else {
$row['data']['id'] = $field_storage->getName();
diff --git a/core/modules/field_ui/src/Form/FieldConfigEditForm.php b/core/modules/field_ui/src/Form/FieldConfigEditForm.php
index 87b0c1948..827bf1b91 100644
--- a/core/modules/field_ui/src/Form/FieldConfigEditForm.php
+++ b/core/modules/field_ui/src/Form/FieldConfigEditForm.php
@@ -95,7 +95,7 @@ class FieldConfigEditForm extends EntityForm {
// Add handling for default value.
if ($element = $items->defaultValuesForm($form, $form_state)) {
- $element = array_merge($element , array(
+ $element = array_merge($element, array(
'#type' => 'details',
'#title' => $this->t('Default value'),
'#open' => TRUE,
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index 6644a7938..c37e1e0b2 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -78,7 +78,7 @@ class ManageFieldsTest extends WebTestBase {
// Create random field name with markup to test escaping.
$this->fieldLabel = '' . $this->randomMachineName(8) . '';
- $this->fieldNameInput = strtolower($this->randomMachineName(8));
+ $this->fieldNameInput = strtolower($this->randomMachineName(8));
$this->fieldName = 'field_'. $this->fieldNameInput;
// Create Basic page and Article node types.
diff --git a/core/modules/field_ui/tests/modules/field_ui_test/field_ui_test.module b/core/modules/field_ui/tests/modules/field_ui_test/field_ui_test.module
index 562168fac..5fb232b7c 100644
--- a/core/modules/field_ui/tests/modules/field_ui_test/field_ui_test.module
+++ b/core/modules/field_ui/tests/modules/field_ui_test/field_ui_test.module
@@ -38,7 +38,7 @@ function field_ui_test_form_entity_view_display_edit_form_alter(&$form, FormStat
'parent_wrapper' => array(
'parent' => array(
'#type' => 'select',
- '#options' => array('indent' => 'Indent'),
+ '#options' => array('indent' => 'Indent'),
'#empty_value' => '',
'#default_value' => '',
'#attributes' => array('class' => array('field-parent')),
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 0a9ff851e..3aa8e686e 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -202,7 +202,7 @@ class EntityDisplayTest extends KernelTestBase {
$display->setComponent($field_name);
$field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->getType());
$default_formatter = $field_type_info['default_formatter'];
- $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($default_formatter);
+ $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($default_formatter);
$expected = array(
'weight' => -4,
'label' => 'above',
@@ -249,7 +249,7 @@ class EntityDisplayTest extends KernelTestBase {
));
// Check that default options are correctly filled in.
- $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('text_default');
+ $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('text_default');
$expected = array(
'test_no_display' => NULL,
'test_display_configurable' => array(
@@ -337,7 +337,7 @@ class EntityDisplayTest extends KernelTestBase {
$field->save();
// Create default and teaser entity display.
- EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
+ EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
EntityViewDisplay::create(array(
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
index 660064f19..b66d29cd1 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
@@ -126,7 +126,7 @@ class EntityFormDisplayTest extends KernelTestBase {
));
// Check that default options are correctly filled in.
- $formatter_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings('text_textfield');
+ $formatter_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings('text_textfield');
$expected = array(
'test_no_display' => NULL,
'test_display_configurable' => array(
@@ -193,7 +193,7 @@ class EntityFormDisplayTest extends KernelTestBase {
$field->save();
// Create default and compact entity display.
- EntityFormMode::create(array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
+ EntityFormMode::create(array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
EntityFormDisplay::create(array(
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 310eb26c2..e1ab4214a 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -30,7 +30,7 @@ function file_help($route_name, RouteMatchInterface $route_match) {
case 'help.page.file':
$output = '';
$output .= '' . t('About') . '
';
- $output .= '' . t('The File module allows you to create fields that contain files. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the File module.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) :'#', ':file_documentation' => 'https://www.drupal.org/documentation/modules/file')) . '
';
+ $output .= '' . t('The File module allows you to create fields that contain files. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the File module.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', ':file_documentation' => 'https://www.drupal.org/documentation/modules/file')) . '
';
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Managing and displaying file fields') . '
';
diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php
index 2ba3988c9..1b0984bdb 100644
--- a/core/modules/file/src/Element/ManagedFile.php
+++ b/core/modules/file/src/Element/ManagedFile.php
@@ -2,12 +2,14 @@
namespace Drupal\file\Element;
-use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\FormElement;
+use Drupal\Core\Site\Settings;
use Drupal\Core\Url;
use Drupal\file\Entity\File;
use Symfony\Component\HttpFoundation\Request;
@@ -91,19 +93,32 @@ class ManagedFile extends FormElement {
$fids = [];
foreach ($input['fids'] as $fid) {
if ($file = File::load($fid)) {
+ $fids[] = $file->id();
// Temporary files that belong to other users should never be
- // allowed. Since file ownership can't be determined for anonymous
- // users, they are not allowed to reuse temporary files at all.
- if ($file->isTemporary() && (\Drupal::currentUser()->isAnonymous() || $file->getOwnerId() != \Drupal::currentUser()->id())) {
- $force_default = TRUE;
- break;
- }
- // If all checks pass, allow the files to be changed.
- else {
- $fids[] = $file->id();
+ // allowed.
+ if ($file->isTemporary()) {
+ if ($file->getOwnerId() != \Drupal::currentUser()->id()) {
+ $force_default = TRUE;
+ break;
+ }
+ // Since file ownership can't be determined for anonymous users,
+ // they are not allowed to reuse temporary files at all. But
+ // they do need to be able to reuse their own files from earlier
+ // submissions of the same form, so to allow that, check for the
+ // token added by $this->processManagedFile().
+ elseif (\Drupal::currentUser()->isAnonymous()) {
+ $token = NestedArray::getValue($form_state->getUserInput(), array_merge($element['#parents'], array('file_' . $file->id(), 'fid_token')));
+ if ($token !== Crypt::hmacBase64('file-' . $file->id(), \Drupal::service('private_key')->get() . Settings::getHashSalt())) {
+ $force_default = TRUE;
+ break;
+ }
+ }
}
}
}
+ if ($force_default) {
+ $fids = [];
+ }
}
}
}
@@ -309,6 +324,17 @@ class ManagedFile extends FormElement {
else {
$element['file_' . $delta]['filename'] = $file_link + ['#weight' => -10];
}
+ // Anonymous users who have uploaded a temporary file need a
+ // non-session-based token added so $this->valueCallback() can check
+ // that they have permission to use this file on subsequent submissions
+ // of the same form (for example, after an Ajax upload or form
+ // validation error).
+ if ($file->isTemporary() && \Drupal::currentUser()->isAnonymous()) {
+ $element['file_' . $delta]['fid_token'] = array(
+ '#type' => 'hidden',
+ '#value' => Crypt::hmacBase64('file-' . $delta, \Drupal::service('private_key')->get() . Settings::getHashSalt()),
+ );
+ }
}
}
diff --git a/core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php b/core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php
new file mode 100644
index 000000000..2286473c0
--- /dev/null
+++ b/core/modules/file/src/Tests/FileFieldAnonymousSubmissionTest.php
@@ -0,0 +1,169 @@
+ TRUE,
+ 'access content' => TRUE,
+ ));
+ }
+
+ /**
+ * Tests the basic node submission for an anonymous visitor.
+ */
+ public function testAnonymousNode() {
+ $bundle_label = 'Article';
+ $node_title = 'test page';
+
+ // Load the node form.
+ $this->drupalLogout();
+ $this->drupalGet('node/add/article');
+ $this->assertResponse(200, 'Loaded the article node form.');
+ $this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
+
+ $edit = array(
+ 'title[0][value]' => $node_title,
+ 'body[0][value]' => 'Test article',
+ );
+ $this->drupalPostForm(NULL, $edit, 'Save');
+ $this->assertResponse(200);
+ $t_args = array('@type' => $bundle_label, '%title' => $node_title);
+ $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+ $matches = array();
+ if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
+ $nid = end($matches);
+ $this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
+ $node = Node::load($nid);
+ $this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
+ }
+ }
+
+ /**
+ * Tests file submission for an anonymous visitor.
+ */
+ public function testAnonymousNodeWithFile() {
+ $bundle_label = 'Article';
+ $node_title = 'Test page';
+ $this->createFileField('field_image', 'node', 'article', array(), array('file_extensions' => 'txt png'));
+
+ // Load the node form.
+ $this->drupalLogout();
+ $this->drupalGet('node/add/article');
+ $this->assertResponse(200, 'Loaded the article node form.');
+ $this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
+
+ // Generate an image file.
+ $image = $this->getTestFile('image');
+
+ // Submit the form.
+ $edit = array(
+ 'title[0][value]' => $node_title,
+ 'body[0][value]' => 'Test article',
+ 'files[field_image_0]' => $this->container->get('file_system')->realpath($image->getFileUri()),
+ );
+ $this->drupalPostForm(NULL, $edit, 'Save');
+ $this->assertResponse(200);
+ $t_args = array('@type' => $bundle_label, '%title' => $node_title);
+ $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+ $matches = array();
+ if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
+ $nid = end($matches);
+ $this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
+ $node = Node::load($nid);
+ $this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
+ $this->assertFileExists(File::load($node->field_image->target_id), 'The image was uploaded successfully.');
+ }
+ }
+
+ /**
+ * Tests file submission for an anonymous visitor with a missing node title.
+ */
+ public function testAnonymousNodeWithFileWithoutTitle() {
+ $this->drupalLogout();
+ $this->doTestNodeWithFileWithoutTitle();
+ }
+
+ /**
+ * Tests file submission for an authenticated user with a missing node title.
+ */
+ public function testAuthenticatedNodeWithFileWithoutTitle() {
+ $admin_user = $this->drupalCreateUser(array(
+ 'bypass node access',
+ 'access content overview',
+ 'administer nodes',
+ ));
+ $this->drupalLogin($admin_user);
+ $this->doTestNodeWithFileWithoutTitle();
+ }
+
+ /**
+ * Helper method to test file submissions with missing node titles.
+ */
+ protected function doTestNodeWithFileWithoutTitle() {
+ $bundle_label = 'Article';
+ $node_title = 'Test page';
+ $this->createFileField('field_image', 'node', 'article', array(), array('file_extensions' => 'txt png'));
+
+ // Load the node form.
+ $this->drupalGet('node/add/article');
+ $this->assertResponse(200, 'Loaded the article node form.');
+ $this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
+
+ // Generate an image file.
+ $image = $this->getTestFile('image');
+
+ // Submit the form but exclude the title field.
+ $edit = array(
+ 'body[0][value]' => 'Test article',
+ 'files[field_image_0]' => $this->container->get('file_system')->realpath($image->getFileUri()),
+ );
+ if (!$this->loggedInUser) {
+ $label = 'Save';
+ }
+ else {
+ $label = 'Save and publish';
+ }
+ $this->drupalPostForm(NULL, $edit, $label);
+ $this->assertResponse(200);
+ $t_args = array('@type' => $bundle_label, '%title' => $node_title);
+ $this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+ $this->assertText('Title field is required.');
+
+ // Submit the form again but this time with the missing title field. This
+ // should still work.
+ $edit = array(
+ 'title[0][value]' => $node_title,
+ );
+ $this->drupalPostForm(NULL, $edit, $label);
+
+ // Confirm the final submission actually worked.
+ $t_args = array('@type' => $bundle_label, '%title' => $node_title);
+ $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+ $matches = array();
+ if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
+ $nid = end($matches);
+ $this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
+ $node = Node::load($nid);
+ $this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
+ $this->assertFileExists(File::load($node->field_image->target_id), 'The image was uploaded successfully.');
+ }
+ }
+
+}
diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/src/Tests/FileListingTest.php
index 7828bd03b..78a760249 100644
--- a/core/modules/file/src/Tests/FileListingTest.php
+++ b/core/modules/file/src/Tests/FileListingTest.php
@@ -65,7 +65,7 @@ class FileListingTest extends FileFieldTestBase {
$this->drupalGet('admin/content/files');
$this->assertResponse(403);
- // Login with user with right permissions and test listing.
+ // Log in with user with right permissions and test listing.
$this->drupalLogin($this->adminUser);
for ($i = 0; $i < 5; $i++) {
diff --git a/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php b/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php
index ae3cf59c4..26fb1114f 100644
--- a/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php
+++ b/core/modules/file/src/Tests/FileOnTranslatedEntityTest.php
@@ -36,7 +36,7 @@ class FileOnTranslatedEntityTest extends FileFieldTestBase {
$this->fieldName = strtolower($this->randomMachineName());
$this->createFileField($this->fieldName, 'node', 'page');
- // Create and login user.
+ // Create and log in user.
$permissions = array(
'access administration pages',
'administer content translation',
diff --git a/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php b/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php
index 6734d54d7..15039edcb 100644
--- a/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php
+++ b/core/modules/file/src/Tests/PrivateFileOnTranslatedEntityTest.php
@@ -37,7 +37,7 @@ class PrivateFileOnTranslatedEntityTest extends FileFieldTestBase {
$this->fieldName = strtolower($this->randomMachineName());
$this->createFileField($this->fieldName, 'node', 'page', array('uri_scheme' => 'private'));
- // Create and login user.
+ // Create and log in user.
$permissions = array(
'access administration pages',
'administer content translation',
diff --git a/core/modules/file/tests/src/Kernel/Migrate/EntityFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/EntityFileTest.php
index 08e9fcb29..90d968dc6 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/EntityFileTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/EntityFileTest.php
@@ -249,7 +249,7 @@ class TestEntityFile extends EntityFile {
public $storage;
public function __construct($configuration = []) {
- $configuration += array(
+ $configuration += array(
'source_base_path' => '',
'source_path_property' => 'filepath',
'destination_path_property' => 'uri',
diff --git a/core/modules/filter/config/install/filter.format.plain_text.yml b/core/modules/filter/config/install/filter.format.plain_text.yml
index 4abd6552b..4b69f7334 100644
--- a/core/modules/filter/config/install/filter.format.plain_text.yml
+++ b/core/modules/filter/config/install/filter.format.plain_text.yml
@@ -31,4 +31,3 @@ filters:
status: true
weight: 0
settings: { }
-langcode: en
diff --git a/core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php b/core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php
index 212ecbc02..093277356 100644
--- a/core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php
+++ b/core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php
@@ -90,5 +90,3 @@ class FilterFormat extends DrupalSqlBase {
}
}
-
-
diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
index 49dde8ae1..0f9feff4f 100644
--- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
@@ -207,7 +207,7 @@ class FilterAPITest extends EntityKernelTestBase {
// 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 @@ class FilterAPITest extends EntityKernelTestBase {
*/
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 @@ class FilterAPITest extends EntityKernelTestBase {
// 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.
diff --git a/core/modules/filter/tests/src/Kernel/FilterUnitTest.php b/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
index c4744bbd5..860f6723d 100644
--- a/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterUnitTest.php
@@ -861,17 +861,15 @@ www.example.com with a newline in comments -->
* An associative array, whereas each key is an arbitrary input string and
* each value is again an associative array whose keys are filter output
* strings and whose values are Booleans indicating whether the output is
- * expected or not.
- *
- * For example:
- * @code
- * $tests = array(
- * 'Input string' => array(
- * 'Input string
' => TRUE,
- * 'Input string
FALSE,
- * ),
- * );
- * @endcode
+ * expected or not. For example:
+ * @code
+ * $tests = array(
+ * 'Input string' => array(
+ * 'Input string
' => TRUE,
+ * 'Input string
FALSE,
+ * ),
+ * );
+ * @endcode
*/
function assertFilteredString($filter, $tests) {
foreach ($tests as $source => $tasks) {
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 342ed7b99..42d5349f3 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -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;
@@ -22,7 +23,7 @@ function forum_help($route_name, RouteMatchInterface $route_match) {
$output = '';
$output .= '' . t('About') . '
';
$output .= '' . t('The Forum module lets you create threaded discussion forums with functionality similar to other message board systems. In a forum, users post topics and threads in nested hierarchies, allowing discussions to be categorized and grouped.') . '
';
- $output .= '' . t('The Forum module adds and uses a content type called Forum topic. For background information on content types, see the Node module help page.', array(':node_help'=>\Drupal::url('help.page', array('name' => 'node')))) . '
';
+ $output .= '' . t('The Forum module adds and uses a content type called Forum topic. For background information on content types, see the Node module help page.', array(':node_help' => \Drupal::url('help.page', array('name' => 'node')))) . '
';
$output .= '' . t('A forum is represented by a hierarchical structure, consisting of:');
$output .= '
';
$output .= '- ' . t('Forums (for example, Recipes for cooking vegetables)') . '
';
@@ -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', []);
}
diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php
index c5a31fc9d..04e5ff46c 100644
--- a/core/modules/forum/src/Tests/ForumTest.php
+++ b/core/modules/forum/src/Tests/ForumTest.php
@@ -153,7 +153,7 @@ class ForumTest extends WebTestBase {
$this->generateForumTopics();
- // Login an unprivileged user to view the forum topics and generate an
+ // Log in an unprivileged user to view the forum topics and generate an
// active forum topics list.
$this->drupalLogin($this->webUser);
// Verify that this user is shown a message that they may not post content.
@@ -180,7 +180,7 @@ class ForumTest extends WebTestBase {
$this->drupalGet('forum/' . $this->forum['tid']);
$this->assertLink(t('Add new Forum topic'));
- // Login a user with permission to edit any forum content.
+ // Log in a user with permission to edit any forum content.
$this->drupalLogin($this->editAnyTopicsUser);
// Verify that this user can edit forum content authored by another user.
$this->verifyForums($own_topics_user_node, TRUE);
@@ -281,7 +281,7 @@ class ForumTest extends WebTestBase {
* The logged-in user.
*/
private function doAdminTests($user) {
- // Login the user.
+ // Log in the user.
$this->drupalLogin($user);
// Add forum to the Tools menu.
@@ -467,7 +467,7 @@ class ForumTest extends WebTestBase {
* User has 'access administration pages' privilege.
*/
private function doBasicTests($user, $admin) {
- // Login the user.
+ // Log in the user.
$this->drupalLogin($user);
// Attempt to create forum topic under a container.
$this->createForumTopic($this->forumContainer, TRUE);
@@ -481,7 +481,7 @@ class ForumTest extends WebTestBase {
* Tests a forum with a new post displays properly.
*/
function testForumWithNewPost() {
- // Login as the first user.
+ // Log in as the first user.
$this->drupalLogin($this->adminUser);
// Create a forum container.
$this->forumContainer = $this->createForum('container');
@@ -490,7 +490,7 @@ class ForumTest extends WebTestBase {
// Create a topic.
$node = $this->createForumTopic($this->forum, FALSE);
- // Login as a second user.
+ // Log in as a second user.
$this->drupalLogin($this->postCommentUser);
// Post a reply to the topic.
$edit = array();
@@ -504,7 +504,7 @@ class ForumTest extends WebTestBase {
$this->assertResponse(200);
$this->assertFieldByName('comment_body[0][value]');
- // Login as the first user.
+ // Log in as the first user.
$this->drupalLogin($this->adminUser);
// Check that forum renders properly.
$this->drupalGet("forum/{$this->forum['tid']}");
diff --git a/core/modules/forum/src/Tests/ForumValidationTest.php b/core/modules/forum/tests/src/Kernel/ForumValidationTest.php
similarity index 91%
rename from core/modules/forum/src/Tests/ForumValidationTest.php
rename to core/modules/forum/tests/src/Kernel/ForumValidationTest.php
index 112502586..9b9661b5a 100644
--- a/core/modules/forum/src/Tests/ForumValidationTest.php
+++ b/core/modules/forum/tests/src/Kernel/ForumValidationTest.php
@@ -1,17 +1,17 @@
'/relations',
'name' => 'site',
- 'templated' => true,
+ 'templated' => TRUE,
),
),
'self' => array(
diff --git a/core/modules/help/src/Controller/HelpController.php b/core/modules/help/src/Controller/HelpController.php
index 9db1fe2f7..6c3f06142 100644
--- a/core/modules/help/src/Controller/HelpController.php
+++ b/core/modules/help/src/Controller/HelpController.php
@@ -114,7 +114,7 @@ class HelpController extends ControllerBase {
public function helpPage($name) {
$build = array();
if ($this->moduleHandler()->implementsHook($name, 'help')) {
- $module_name = $this->moduleHandler()->getName($name);
+ $module_name = $this->moduleHandler()->getName($name);
$build['#title'] = $module_name;
$info = system_get_info('module', $name);
diff --git a/core/modules/help/src/Plugin/Block/HelpBlock.php b/core/modules/help/src/Plugin/Block/HelpBlock.php
index cf6467eff..17dd88e95 100644
--- a/core/modules/help/src/Plugin/Block/HelpBlock.php
+++ b/core/modules/help/src/Plugin/Block/HelpBlock.php
@@ -88,14 +88,19 @@ class HelpBlock extends BlockBase implements ContainerFactoryPluginInterface {
return [];
}
- $help = $this->moduleHandler->invokeAll('help', array($this->routeMatch->getRouteName(), $this->routeMatch));
+ $implementations = $this->moduleHandler->getImplementations('help');
$build = [];
-
- // Remove any empty strings from $help.
- foreach (array_filter($help) as $item) {
- // Convert strings to #markup render arrays so that they will XSS admin
- // filtered.
- $build[] = is_array($item) ? $item : ['#markup' => $item];
+ $args = [
+ $this->routeMatch->getRouteName(),
+ $this->routeMatch,
+ ];
+ foreach ($implementations as $module) {
+ // Don't add empty strings to $build array.
+ if ($help = $this->moduleHandler->invoke($module, 'help', $args)) {
+ // Convert strings to #markup render arrays so that they will XSS admin
+ // filtered.
+ $build[] = is_array($help) ? $help : ['#markup' => $help];
+ }
}
return $build;
}
diff --git a/core/modules/help/src/Tests/HelpBlockTest.php b/core/modules/help/src/Tests/HelpBlockTest.php
index 3a7a1723b..f1ba62295 100644
--- a/core/modules/help/src/Tests/HelpBlockTest.php
+++ b/core/modules/help/src/Tests/HelpBlockTest.php
@@ -14,7 +14,7 @@ class HelpBlockTest extends WebTestBase {
/**
* {@inheritdoc}
*/
- public static $modules = ['help', 'help_page_test', 'block'];
+ public static $modules = ['help', 'help_page_test', 'block', 'more_help_page_test'];
/**
* The help block instance.
@@ -39,6 +39,12 @@ class HelpBlockTest extends WebTestBase {
$this->drupalGet('help_page_test/no_help');
// The help block should not appear when there is no help.
$this->assertNoText($this->helpBlock->label());
+
+ // Ensure that if two hook_help() implementations both return a render array
+ // the output is as expected.
+ $this->drupalGet('help_page_test/test_array');
+ $this->assertText('Help text from more_help_page_test_help module.');
+ $this->assertText('Help text from help_page_test_help module.');
}
}
diff --git a/core/modules/help/src/Tests/HelpTest.php b/core/modules/help/src/Tests/HelpTest.php
index 2407307fa..6cb399198 100644
--- a/core/modules/help/src/Tests/HelpTest.php
+++ b/core/modules/help/src/Tests/HelpTest.php
@@ -51,12 +51,12 @@ class HelpTest extends WebTestBase {
* Logs in users, tests help pages.
*/
public function testHelp() {
- // Login the root user to ensure as many admin links appear as possible on
+ // Log in the root user to ensure as many admin links appear as possible on
// the module overview pages.
$this->drupalLogin($this->rootUser);
$this->verifyHelp();
- // Login the regular user.
+ // Log in the regular user.
$this->drupalLogin($this->anyUser);
$this->verifyHelp(403);
diff --git a/core/modules/help/tests/modules/help_page_test/help_page_test.module b/core/modules/help/tests/modules/help_page_test/help_page_test.module
index 2ad72255a..67bcac33a 100644
--- a/core/modules/help/tests/modules/help_page_test/help_page_test.module
+++ b/core/modules/help/tests/modules/help_page_test/help_page_test.module
@@ -19,6 +19,8 @@ function help_page_test_help($route_name, RouteMatchInterface $route_match) {
return t('Read the online documentation for the Help Page Test module.', [':url' => 'http://www.example.com']);
case 'help_page_test.has_help':
return t('I have help!');
+ case 'help_page_test.test_array':
+ return ['#markup' => 'Help text from help_page_test_help module.'];
}
// Ensure that hook_help() can return an empty string and not cause the block
diff --git a/core/modules/help/tests/modules/help_page_test/help_page_test.routing.yml b/core/modules/help/tests/modules/help_page_test/help_page_test.routing.yml
index 7450e5886..54cbf26a9 100644
--- a/core/modules/help/tests/modules/help_page_test/help_page_test.routing.yml
+++ b/core/modules/help/tests/modules/help_page_test/help_page_test.routing.yml
@@ -11,3 +11,10 @@ help_page_test.no_help:
_controller: '\Drupal\help_page_test\HelpPageTestController::noHelp'
requirements:
_access: 'TRUE'
+
+help_page_test.test_array:
+ path: '/help_page_test/test_array'
+ defaults:
+ _controller: '\Drupal\help_page_test\HelpPageTestController::testArray'
+ requirements:
+ _access: 'TRUE'
diff --git a/core/modules/help/tests/modules/help_page_test/src/HelpPageTestController.php b/core/modules/help/tests/modules/help_page_test/src/HelpPageTestController.php
index 02c4e65fc..da499d6f1 100644
--- a/core/modules/help/tests/modules/help_page_test/src/HelpPageTestController.php
+++ b/core/modules/help/tests/modules/help_page_test/src/HelpPageTestController.php
@@ -27,4 +27,14 @@ class HelpPageTestController {
return ['#markup' => 'A route without help.'];
}
+ /**
+ * Provides a route which has multiple array returns from hook_help().
+ *
+ * @return array
+ * A render array.
+ */
+ public function testArray() {
+ return ['#markup' => 'A route which has multiple array returns from hook_help().'];
+ }
+
}
diff --git a/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.info.yml b/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.info.yml
new file mode 100644
index 000000000..cc15ce4b3
--- /dev/null
+++ b/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.info.yml
@@ -0,0 +1,7 @@
+name: 'More Help Page Test'
+type: module
+description: 'Module to test the help page.'
+package: Testing
+version: VERSION
+core: 8.x
+hidden: true
diff --git a/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.module b/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.module
new file mode 100644
index 000000000..60eb4fc83
--- /dev/null
+++ b/core/modules/help/tests/modules/more_help_page_test/more_help_page_test.module
@@ -0,0 +1,20 @@
+ 'Help text from more_help_page_test_help module.'];
+ }
+}
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 79a28d6eb..baaec2edd 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -28,7 +28,7 @@ function history_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.history':
$output = '' . t('About') . '
';
- $output .= '' . t('The History module keeps track of which content a user has read. It marks content as new or updated depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered read. The History module does not have a user interface but it provides a filter to Views to show new or updated content. For more information, see the online documentation for the History module.', array(':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', array ('name' => 'views')): '#', ':url' => 'https://www.drupal.org/documentation/modules/history')) . '
';
+ $output .= '' . t('The History module keeps track of which content a user has read. It marks content as new or updated depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered read. The History module does not have a user interface but it provides a filter to Views to show new or updated content. For more information, see the online documentation for the History module.', array(':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', array ('name' => 'views')) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history')) . '
';
return $output;
}
}
diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
index ce77f83de..e6b0548f0 100644
--- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
@@ -81,7 +81,7 @@ class HistoryUserTimestamp extends Node {
$last_read = $this->getValue($values);
$changed = $this->getValue($values, 'changed');
- $last_comment = \Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0;
+ $last_comment = \Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0;
if (!$last_read && $changed > HISTORY_READ_LIMIT) {
$mark = MARK_NEW;
diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
index ac21f63eb..fb6559326 100644
--- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
+++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
@@ -317,7 +317,7 @@ class ImageItem extends FileItem {
$image = \Drupal::service('image.factory')->get($this->entity->getFileUri());
if ($image->isValid()) {
$this->width = $image->getWidth();
- $this->height =$image->getHeight();
+ $this->height = $image->getHeight();
}
}
}
@@ -366,7 +366,7 @@ class ImageItem extends FileItem {
'target_id' => $file->id(),
'alt' => $random->sentences(4),
'title' => $random->sentences(4),
- 'width' =>$width,
+ 'width' => $width,
'height' => $height,
);
return $values;
diff --git a/core/modules/image/src/Tests/ImageFieldWidgetTest.php b/core/modules/image/src/Tests/ImageFieldWidgetTest.php
index da17417a6..ea2332dd3 100644
--- a/core/modules/image/src/Tests/ImageFieldWidgetTest.php
+++ b/core/modules/image/src/Tests/ImageFieldWidgetTest.php
@@ -29,4 +29,3 @@ class ImageFieldWidgetTest extends ImageFieldTestBase {
}
}
-
diff --git a/core/modules/image/src/Tests/ImageOnTranslatedEntityTest.php b/core/modules/image/src/Tests/ImageOnTranslatedEntityTest.php
index 01b339b2e..436139ee1 100644
--- a/core/modules/image/src/Tests/ImageOnTranslatedEntityTest.php
+++ b/core/modules/image/src/Tests/ImageOnTranslatedEntityTest.php
@@ -36,7 +36,7 @@ class ImageOnTranslatedEntityTest extends ImageFieldTestBase {
$this->fieldName = strtolower($this->randomMachineName());
$this->createImageField($this->fieldName, 'basicpage', [], ['title_field' => 1]);
- // Create and login user.
+ // Create and log in user.
$permissions = array(
'access administration pages',
'administer content translation',
diff --git a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php
index ec11f8c04..0903218e0 100644
--- a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php
+++ b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php
@@ -33,8 +33,8 @@ class MigrateImageStylesTest extends MigrateDrupal7TestBase {
*/
public function testImageStylesMigration() {
$this->assertEntity('custom_image_style_1', "Custom image style 1", ['image_scale_and_crop', 'image_desaturate'], [['width' => 55, 'height' => 55], []]);
- $this->assertEntity('custom_image_style_2', "Custom image style 2", ['image_resize', 'image_rotate'], [['width' => 55, 'height' => 100], ['degrees' => 45, 'bgcolor' => '#FFFFFF', 'random' => false]]);
- $this->assertEntity('custom_image_style_3', "Custom image style 3", ['image_scale', 'image_crop'], [['width' => 150, 'height' => NULL, 'upscale' => false], ['width' => 50, 'height' => 50, 'anchor' => 'left-top']]);
+ $this->assertEntity('custom_image_style_2', "Custom image style 2", ['image_resize', 'image_rotate'], [['width' => 55, 'height' => 100], ['degrees' => 45, 'bgcolor' => '#FFFFFF', 'random' => FALSE]]);
+ $this->assertEntity('custom_image_style_3', "Custom image style 3", ['image_scale', 'image_crop'], [['width' => 150, 'height' => NULL, 'upscale' => FALSE], ['width' => 50, 'height' => 50, 'anchor' => 'left-top']]);
}
/**
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 99ebc3b98..c7873b895 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -33,7 +33,7 @@ function language_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Adding languages') . '
';
- $output .= '- ' . t('You can add languages on the Languages page by selecting Add language and choosing a language from the drop-down menu. This language is then displayed in the languages list, where it can be configured further. If the Interface translation module is enabled, and the translation server is set as a translation source, then the interface translation for this language is automatically downloaded as well.' , array(':language_list' => \Drupal::url('entity.configurable_language.collection'), ':interface' => (\Drupal::moduleHandler()->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#')) . '
';
+ $output .= '- ' . t('You can add languages on the Languages page by selecting Add language and choosing a language from the drop-down menu. This language is then displayed in the languages list, where it can be configured further. If the Interface translation module is enabled, and the translation server is set as a translation source, then the interface translation for this language is automatically downloaded as well.', array(':language_list' => \Drupal::url('entity.configurable_language.collection'), ':interface' => (\Drupal::moduleHandler()->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#')) . '
';
$output .= '- ' . t('Adding custom languages') . '
';
$output .= '- ' . t('You can add a language that is not provided in the drop-down list by choosing Custom language at the end of the list. You then have to configure its language code, name, and direction in the form provided.') . '
';
$output .= '- ' . t('Configuring content languages') . '
';
diff --git a/core/modules/language/src/ContentLanguageSettingsInterface.php b/core/modules/language/src/ContentLanguageSettingsInterface.php
index c03d885ff..3bb3d5d25 100644
--- a/core/modules/language/src/ContentLanguageSettingsInterface.php
+++ b/core/modules/language/src/ContentLanguageSettingsInterface.php
@@ -76,4 +76,3 @@ interface ContentLanguageSettingsInterface extends ConfigEntityInterface {
public function isDefaultConfiguration();
}
-
diff --git a/core/modules/language/src/Form/LanguageFormBase.php b/core/modules/language/src/Form/LanguageFormBase.php
index 5472bd6fc..00771621b 100644
--- a/core/modules/language/src/Form/LanguageFormBase.php
+++ b/core/modules/language/src/Form/LanguageFormBase.php
@@ -24,7 +24,7 @@ abstract class LanguageFormBase extends EntityForm {
/**
* Constructs a ContentEntityForm object.
*
- * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
+ * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
* The configurable language manager.
*/
public function __construct(ConfigurableLanguageManagerInterface $language_manager) {
diff --git a/core/modules/language/src/Form/NegotiationBrowserForm.php b/core/modules/language/src/Form/NegotiationBrowserForm.php
index 67b07e53b..1e38a9b70 100644
--- a/core/modules/language/src/Form/NegotiationBrowserForm.php
+++ b/core/modules/language/src/Form/NegotiationBrowserForm.php
@@ -212,4 +212,3 @@ class NegotiationBrowserForm extends ConfigFormBase {
return $config->get('map');
}
}
-
diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
index 061eeb57b..a1d4da410 100644
--- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
+++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php
@@ -144,7 +144,7 @@ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements In
}
}
}
- elseif ($config['source'] == LanguageNegotiationUrl::CONFIG_DOMAIN) {
+ elseif ($config['source'] == LanguageNegotiationUrl::CONFIG_DOMAIN) {
if (is_object($options['language']) && !empty($config['domains'][$options['language']->getId()])) {
// Save the original base URL. If it contains a port, we need to
diff --git a/core/modules/language/src/Tests/EntityTypeWithoutLanguageFormTest.php b/core/modules/language/src/Tests/EntityTypeWithoutLanguageFormTest.php
index 6a2745f14..20a3532ec 100644
--- a/core/modules/language/src/Tests/EntityTypeWithoutLanguageFormTest.php
+++ b/core/modules/language/src/Tests/EntityTypeWithoutLanguageFormTest.php
@@ -30,7 +30,7 @@ class EntityTypeWithoutLanguageFormTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login administrative user.
+ // Create and log in administrative user.
$admin_user = $this->drupalCreateUser(array(
'administer languages',
));
diff --git a/core/modules/language/src/Tests/LanguagePathMonolingualTest.php b/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
index cb564ee26..1f79604f1 100644
--- a/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
+++ b/core/modules/language/src/Tests/LanguagePathMonolingualTest.php
@@ -21,7 +21,7 @@ class LanguagePathMonolingualTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$web_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'administer site configuration'));
$this->drupalLogin($web_user);
diff --git a/core/modules/language/src/Tests/LanguageSwitchingTest.php b/core/modules/language/src/Tests/LanguageSwitchingTest.php
index 464e5b5b1..c076e6f1e 100644
--- a/core/modules/language/src/Tests/LanguageSwitchingTest.php
+++ b/core/modules/language/src/Tests/LanguageSwitchingTest.php
@@ -25,7 +25,7 @@ class LanguageSwitchingTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$admin_user = $this->drupalCreateUser(array('administer blocks', 'administer languages', 'access administration pages'));
$this->drupalLogin($admin_user);
}
diff --git a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
index 6709c69fb..5cd80dc4a 100644
--- a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
+++ b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
@@ -33,7 +33,7 @@ class LanguageUrlRewritingTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$this->webUser = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
$this->drupalLogin($this->webUser);
diff --git a/core/modules/language/src/Tests/Condition/LanguageConditionTest.php b/core/modules/language/tests/src/Kernel/Condition/LanguageConditionTest.php
similarity index 97%
rename from core/modules/language/src/Tests/Condition/LanguageConditionTest.php
rename to core/modules/language/tests/src/Kernel/Condition/LanguageConditionTest.php
index dcdf5e0cc..92b2a04f2 100644
--- a/core/modules/language/src/Tests/Condition/LanguageConditionTest.php
+++ b/core/modules/language/tests/src/Kernel/Condition/LanguageConditionTest.php
@@ -1,9 +1,9 @@
config('language.negotiation');
$config->set('url.prefixes', ['en' => 'en', 'es' => 'es', 'fr' => 'fr'])
->save();
- $this->kernel->rebuildContainer();
+
+ \Drupal::service('kernel')->rebuildContainer();
$this->createTranslatableEntity();
}
diff --git a/core/modules/language/src/Tests/LanguageConfigOverrideInstallTest.php b/core/modules/language/tests/src/Kernel/LanguageConfigOverrideInstallTest.php
similarity index 93%
rename from core/modules/language/src/Tests/LanguageConfigOverrideInstallTest.php
rename to core/modules/language/tests/src/Kernel/LanguageConfigOverrideInstallTest.php
index e30bf508e..c01187c9e 100644
--- a/core/modules/language/src/Tests/LanguageConfigOverrideInstallTest.php
+++ b/core/modules/language/tests/src/Kernel/LanguageConfigOverrideInstallTest.php
@@ -1,9 +1,9 @@
'test_entity_type',
'target_bundle' => 'test_bundle',
), 'language_content_settings');
- $alterableConfig->setLanguageAlterable(true);
+ $alterableConfig->setLanguageAlterable(TRUE);
$nonAlterableConfig = new ContentLanguageSettings(array(
'target_entity_type_id' => 'test_entity_type',
'target_bundle' => 'test_fixed_language_bundle',
), 'language_content_settings');
- $nonAlterableConfig->setLanguageAlterable(false);
+ $nonAlterableConfig->setLanguageAlterable(FALSE);
$defaultConfig = new ContentLanguageSettings(array(
'target_entity_type_id' => 'test_entity_type',
@@ -192,9 +192,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
), 'language_content_settings');
return [
- [$alterableConfig, true],
- [$nonAlterableConfig, false],
- [$defaultConfig, false],
+ [$alterableConfig, TRUE],
+ [$nonAlterableConfig, FALSE],
+ [$defaultConfig, FALSE],
];
}
@@ -208,11 +208,11 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
}
public function providerIsDefaultConfiguration() {
- $alteredLanguage= new ContentLanguageSettings(array(
+ $alteredLanguage = new ContentLanguageSettings(array(
'target_entity_type_id' => 'test_entity_type',
'target_bundle' => 'test_bundle',
), 'language_content_settings');
- $alteredLanguage->setLanguageAlterable(true);
+ $alteredLanguage->setLanguageAlterable(TRUE);
$alteredDefaultLangcode = new ContentLanguageSettings(array(
'target_entity_type_id' => 'test_entity_type',
@@ -226,9 +226,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
), 'language_content_settings');
return [
- [$alteredLanguage, false],
- [$alteredDefaultLangcode, false],
- [$defaultConfig, true],
+ [$alteredLanguage, FALSE],
+ [$alteredDefaultLangcode, FALSE],
+ [$defaultConfig, TRUE],
];
}
@@ -271,11 +271,11 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
}
public function providerLoadByEntityTypeBundle() {
- $alteredLanguage= new ContentLanguageSettings(array(
+ $alteredLanguage = new ContentLanguageSettings(array(
'target_entity_type_id' => 'test_entity_type',
'target_bundle' => 'test_bundle',
), 'language_content_settings');
- $alteredLanguage->setLanguageAlterable(true);
+ $alteredLanguage->setLanguageAlterable(TRUE);
$langcode = $this->randomMachineName();
$alteredDefaultLangcode = new ContentLanguageSettings(array(
@@ -290,10 +290,10 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
), 'language_content_settings');
return [
- ['test_entity_type.test_bundle', $alteredLanguage, LanguageInterface::LANGCODE_SITE_DEFAULT, true],
- ['test_entity_type.test_fixed_language_bundle', $alteredDefaultLangcode, $langcode, false],
- ['test_entity_type.test_default_language_bundle', $defaultConfig, LanguageInterface::LANGCODE_SITE_DEFAULT, false],
- ['test_entity_type.null_bundle', NULL, LanguageInterface::LANGCODE_SITE_DEFAULT, false],
+ ['test_entity_type.test_bundle', $alteredLanguage, LanguageInterface::LANGCODE_SITE_DEFAULT, TRUE],
+ ['test_entity_type.test_fixed_language_bundle', $alteredDefaultLangcode, $langcode, FALSE],
+ ['test_entity_type.test_default_language_bundle', $defaultConfig, LanguageInterface::LANGCODE_SITE_DEFAULT, FALSE],
+ ['test_entity_type.null_bundle', NULL, LanguageInterface::LANGCODE_SITE_DEFAULT, FALSE],
];
}
diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
index 4ea672d27..7d2d0eeab 100644
--- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
+++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
@@ -242,6 +242,7 @@ class LinkFormatter extends FormatterBase implements ContainerFactoryPluginInter
$settings = $this->getSettings();
$options = $item->options;
+ $options += $url->getOptions();
// Add optional 'rel' attribute to link options.
if (!empty($settings['rel'])) {
diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
index 4f0e221c6..4849d32b8 100644
--- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
+++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php
@@ -86,4 +86,3 @@ class LinkSeparateFormatter extends LinkFormatter {
return $element;
}
}
-
diff --git a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
index 01cf553c7..3fe76a67b 100644
--- a/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
+++ b/core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraint.php
@@ -75,4 +75,3 @@ class LinkTypeConstraint extends Constraint implements ConstraintValidatorInterf
}
}
}
-
diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php
index 639f519b0..477382bcc 100644
--- a/core/modules/link/src/Tests/LinkFieldTest.php
+++ b/core/modules/link/src/Tests/LinkFieldTest.php
@@ -123,7 +123,7 @@ class LinkFieldTest extends WebTestBase {
// https://www.drupal.org/node/2421941
'' => '<front>',
'#example' => '<front>#example',
- '?example=llama' =>'<front>?example=llama',
+ '?example=llama' => '<front>?example=llama',
// Query string and fragment.
'?example=llama' => '?example=llama',
@@ -344,7 +344,7 @@ class LinkFieldTest extends WebTestBase {
'field_name' => $field_name,
'entity_type' => 'entity_test',
'type' => 'link',
- 'cardinality' => 2,
+ 'cardinality' => 3,
));
$this->fieldStorage->save();
FieldConfig::create([
@@ -369,23 +369,28 @@ class LinkFieldTest extends WebTestBase {
->setComponent($field_name, $display_options)
->save();
- // Create an entity with two link field values:
+ // Create an entity with three link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and link text.
+ // - The third field item uses a fragment-only URL with text.
// For consistency in assertion code below, the URL is assigned to the title
// variable for the first field.
$this->drupalGet('entity_test/add');
$url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com';
$url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org';
+ $url3 = '#net';
$title1 = $url1;
// Intentionally contains an ampersand that needs sanitization on output.
$title2 = 'A very long & strange example title that could break the nice layout of the site';
+ $title3 = 'Fragment only';
$edit = array(
"{$field_name}[0][uri]" => $url1,
// Note that $title1 is not submitted.
"{$field_name}[0][title]" => '',
"{$field_name}[1][uri]" => $url2,
"{$field_name}[1][title]" => $title2,
+ "{$field_name}[2][uri]" => $url3,
+ "{$field_name}[2][title]" => $title3,
);
// Assert label is shown.
$this->assertText('Read more about this entity');
@@ -433,18 +438,24 @@ class LinkFieldTest extends WebTestBase {
$url = $url2;
$title = isset($new_value) ? Unicode::truncate($title2, $new_value, FALSE, TRUE) : $title2;
$this->assertRaw('' . Html::escape($title) . '');
+
+ $url = $url3;
+ $title = isset($new_value) ? Unicode::truncate($title3, $new_value, FALSE, TRUE) : $title3;
+ $this->assertRaw('' . Html::escape($title) . '');
break;
case 'rel':
$rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
$this->assertRaw('' . Html::escape($title1) . '');
$this->assertRaw('' . Html::escape($title2) . '');
+ $this->assertRaw('' . Html::escape($title3) . '');
break;
case 'target':
$target = isset($new_value) ? ' target="' . $new_value . '"' : '';
$this->assertRaw('' . Html::escape($title1) . '');
$this->assertRaw('' . Html::escape($title2) . '');
+ $this->assertRaw('' . Html::escape($title3) . '');
break;
case 'url_only':
@@ -452,17 +463,21 @@ class LinkFieldTest extends WebTestBase {
if (!$new_value['url_only']) {
$this->assertRaw('' . Html::escape($title1) . '');
$this->assertRaw('' . Html::escape($title2) . '');
+ $this->assertRaw('' . Html::escape($title3) . '');
}
else {
if (empty($new_value['url_plain'])) {
$this->assertRaw('' . Html::escape($url1) . '');
$this->assertRaw('' . Html::escape($url2) . '');
+ $this->assertRaw('' . Html::escape($url3) . '');
}
else {
$this->assertNoRaw('' . Html::escape($url1) . '');
$this->assertNoRaw('' . Html::escape($url2) . '');
+ $this->assertNoRaw('' . Html::escape($url3) . '');
$this->assertEscaped($url1);
$this->assertEscaped($url2);
+ $this->assertEscaped($url3);
}
}
break;
@@ -484,7 +499,7 @@ class LinkFieldTest extends WebTestBase {
'field_name' => $field_name,
'entity_type' => 'entity_test',
'type' => 'link',
- 'cardinality' => 2,
+ 'cardinality' => 3,
));
$this->fieldStorage->save();
FieldConfig::create([
@@ -508,20 +523,25 @@ class LinkFieldTest extends WebTestBase {
->setComponent($field_name, $display_options)
->save();
- // Create an entity with two link field values:
+ // Create an entity with three link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and link text.
+ // - The third field item uses a fragment-only URL with text.
// For consistency in assertion code below, the URL is assigned to the title
// variable for the first field.
$this->drupalGet('entity_test/add');
$url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com';
$url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org';
+ $url3 = '#net';
// Intentionally contains an ampersand that needs sanitization on output.
$title2 = 'A very long & strange example title that could break the nice layout of the site';
+ $title3 = 'Fragment only';
$edit = array(
"{$field_name}[0][uri]" => $url1,
"{$field_name}[1][uri]" => $url2,
"{$field_name}[1][title]" => $title2,
+ "{$field_name}[2][uri]" => $url3,
+ "{$field_name}[2][title]" => $title3,
);
$this->drupalPostForm(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)|', $this->url, $match);
@@ -560,18 +580,29 @@ class LinkFieldTest extends WebTestBase {
$expected .= '';
$expected .= '';
$this->assertRaw($expected);
+
+ $url = $url3;
+ $url_title = isset($new_value) ? Unicode::truncate($url, $new_value, FALSE, TRUE) : $url;
+ $title = isset($new_value) ? Unicode::truncate($title3, $new_value, FALSE, TRUE) : $title3;
+ $expected = '';
+ $expected .= '
' . Html::escape($title) . '
';
+ $expected .= '
';
+ $expected .= '
';
+ $this->assertRaw($expected);
break;
case 'rel':
$rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
$this->assertRaw('');
$this->assertRaw('');
+ $this->assertRaw('');
break;
case 'target':
$target = isset($new_value) ? ' target="' . $new_value . '"' : '';
$this->assertRaw('');
$this->assertRaw('');
+ $this->assertRaw('');
break;
}
}
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 72e8cfe47..1181b50f2 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -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);
}
}
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 74b76ecf3..aecad6c45 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -1042,7 +1042,7 @@ function locale_string_is_safe($string) {
// inject javascript. When \Drupal\Component\Utility\Xss::filter() removes
// part of tokens, it causes the string to not be translatable when it should
// be translatable.
- // @see \Drupal\locale\Tests\LocaleStringIsSafeTest::testLocaleStringIsSafe()
+ // @see \Drupal\Tests\locale\Kernel\LocaleStringIsSafeTest::testLocaleStringIsSafe()
//
// We can recognize tokens since they are wrapped with brackets and are only
// composed of alphanumeric characters, colon, underscore, and dashes. We can
diff --git a/core/modules/locale/src/LocaleDefaultConfigStorage.php b/core/modules/locale/src/LocaleDefaultConfigStorage.php
index f899f5517..29697a107 100644
--- a/core/modules/locale/src/LocaleDefaultConfigStorage.php
+++ b/core/modules/locale/src/LocaleDefaultConfigStorage.php
@@ -157,4 +157,3 @@ class LocaleDefaultConfigStorage {
}
}
-
diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php
index 6f86abadb..67faa8192 100644
--- a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php
+++ b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php
@@ -60,7 +60,7 @@ class LocaleConfigTranslationImportTest extends WebTestBase {
$this->drupalPostForm('admin/reports/translations', array(), t('Update translations'));
// Check if configuration translations have been imported.
- $override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'system.maintenance');
+ $override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'system.maintenance');
$this->assertEqual($override->get('message'), 'Ons is tans besig met onderhoud op @site. Wees asseblief geduldig, ons sal binnekort weer terug wees.');
}
diff --git a/core/modules/locale/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php
index d39bd3a4b..51ab6b0ad 100644
--- a/core/modules/locale/src/Tests/LocaleContentTest.php
+++ b/core/modules/locale/src/Tests/LocaleContentTest.php
@@ -134,7 +134,7 @@ class LocaleContentTest extends WebTestBase {
// User to create a node.
$web_user = $this->drupalCreateUser(array("create {$type->id()} content", "edit own {$type->id()} content"));
- // Login as admin.
+ // Log in as admin.
$this->drupalLogin($admin_user);
// Install Arabic language.
@@ -157,7 +157,7 @@ class LocaleContentTest extends WebTestBase {
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->label())));
$this->drupalLogout();
- // Login as web user to add new node.
+ // Log in as web user to add new node.
$this->drupalLogin($web_user);
// Create three nodes: English, Arabic and Spanish.
diff --git a/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml b/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml
index f6cf7b900..958ce1b9c 100644
--- a/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml
+++ b/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml
@@ -7,7 +7,7 @@ locale_test.no_translation:
test:
type: string
label: 'Test'
- # See \Drupal\locale\Tests\LocaleConfigSubscriberTest
+ # See \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest
translatable: true
locale_test.translation:
@@ -17,5 +17,5 @@ locale_test.translation:
test:
type: string
label: 'Test'
- # See \Drupal\locale\Tests\LocaleConfigSubscriberTest
+ # See \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest
translatable: true
diff --git a/core/modules/locale/src/Tests/LocaleConfigManagerTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigManagerTest.php
similarity index 98%
rename from core/modules/locale/src/Tests/LocaleConfigManagerTest.php
rename to core/modules/locale/tests/src/Kernel/LocaleConfigManagerTest.php
index 4a2fdf8be..c1ce1b780 100644
--- a/core/modules/locale/src/Tests/LocaleConfigManagerTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleConfigManagerTest.php
@@ -1,10 +1,10 @@
setParameter('language.default_values', $language);
}
/**
diff --git a/core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
similarity index 98%
rename from core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php
rename to core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
index 68265e91a..013a9ea21 100644
--- a/core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
@@ -1,12 +1,12 @@
setupLanguages();
- $this->enableModules(['locale_test']);
$this->installConfig(['locale_test']);
// Simulate this hook invoked which would happen if in a non-kernel test
// or normal environment.
@@ -68,7 +67,7 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
// @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');
diff --git a/core/modules/locale/src/Tests/LocaleConfigurableLanguageManagerTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php
similarity index 95%
rename from core/modules/locale/src/Tests/LocaleConfigurableLanguageManagerTest.php
rename to core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php
index 0e266d305..e88f49cb5 100644
--- a/core/modules/locale/src/Tests/LocaleConfigurableLanguageManagerTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php
@@ -1,10 +1,10 @@
getDefinition('path_processor_alias');
$definition
diff --git a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
index 948ccbf41..72865ea01 100644
--- a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
@@ -48,7 +48,7 @@ class MenuLanguageTest extends MenuWebTestBase {
$edit = array(
'id' => $menu_name,
'description' => '',
- 'label' => $label,
+ 'label' => $label,
'langcode' => 'aa',
);
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index 95d9007fe..74c09af0e 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -77,7 +77,7 @@ class MenuTest extends MenuWebTestBase {
* Tests menu functionality using the admin and user interfaces.
*/
function testMenu() {
- // Login the user.
+ // Log in the user.
$this->drupalLogin($this->adminUser);
$this->items = array();
@@ -96,7 +96,7 @@ class MenuTest extends MenuWebTestBase {
$after_count = $menu_link_manager->countMenuLinks(NULL);
$this->assertIdentical($before_count, $after_count, 'MenuLinkManager::rebuild() does not add more links');
// Do standard user tests.
- // Login the user.
+ // Log in the user.
$this->drupalLogin($this->authenticatedUser);
$this->verifyAccess(403);
@@ -106,7 +106,7 @@ class MenuTest extends MenuWebTestBase {
$this->verifyMenuLink($item, $node);
}
- // Login the administrator.
+ // Log in the administrator.
$this->drupalLogin($this->adminUser);
// Verify delete link exists and reset link does not exist.
@@ -185,7 +185,7 @@ class MenuTest extends MenuWebTestBase {
$edit = array(
'id' => $menu_name,
'description' => '',
- 'label' => $label,
+ 'label' => $label,
);
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
@@ -576,7 +576,7 @@ class MenuTest extends MenuWebTestBase {
// Get server-rendered contextual links.
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks()
$post = array('ids[0]' => $id);
- $response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page')));
+ $response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page')));
$this->assertResponse(200);
$json = Json::decode($response);
$this->assertIdentical($json[$id], '');
@@ -613,7 +613,7 @@ class MenuTest extends MenuWebTestBase {
'description[0][value]' => '',
'enabled[value]' => 1,
'expanded[value]' => $expanded,
- 'menu_parent' => $menu_name . ':' . $parent,
+ 'menu_parent' => $menu_name . ':' . $parent,
'weight[0][value]' => $weight,
);
@@ -649,7 +649,7 @@ class MenuTest extends MenuWebTestBase {
* Tests that parent options are limited by depth when adding menu links.
*/
function checkInvalidParentMenuLinks() {
- $last_link = null;
+ $last_link = NULL;
$created_links = array();
// Get the max depth of the tree.
@@ -870,7 +870,7 @@ class MenuTest extends MenuWebTestBase {
$this->assertResponse(200);
// Do standard user tests.
- // Login the user.
+ // Log in the user.
$this->drupalLogin($this->authenticatedUser);
$this->drupalGetAjax('admin/structure/menu/parents');
$this->assertResponse(403);
diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index 7275920aa..89eb0e4b2 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -469,7 +469,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
if ($pct_memory > $threshold) {
$this->message->display(
$this->t('Memory usage is @usage (@pct% of limit @limit), reclaiming memory.',
- array('@pct' => round($pct_memory*100),
+ array('@pct' => round($pct_memory * 100),
'@usage' => $this->formatSize($usage),
'@limit' => $this->formatSize($this->memoryLimit))),
'warning');
@@ -480,7 +480,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
if ($pct_memory > (0.90 * $threshold)) {
$this->message->display(
$this->t('Memory usage is now @usage (@pct% of limit @limit), not enough reclaimed, starting new batch',
- array('@pct' => round($pct_memory*100),
+ array('@pct' => round($pct_memory * 100),
'@usage' => $this->formatSize($usage),
'@limit' => $this->formatSize($this->memoryLimit))),
'warning');
@@ -489,7 +489,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
else {
$this->message->display(
$this->t('Memory usage is now @usage (@pct% of limit @limit), reclaimed enough, continuing',
- array('@pct' => round($pct_memory*100),
+ array('@pct' => round($pct_memory * 100),
'@usage' => $this->formatSize($usage),
'@limit' => $this->formatSize($this->memoryLimit))),
'warning');
@@ -523,7 +523,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
drupal_static_reset();
// Entity storage can blow up with caches so clear them out.
- $manager = \Drupal::entityManager();
+ $manager = \Drupal::entityManager();
foreach ($manager->getDefinitions() as $id => $definition) {
$manager->getStorage($id)->resetCache();
}
diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php
index 2f1154d69..9b22e359f 100644
--- a/core/modules/migrate/src/Plugin/Migration.php
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -416,7 +416,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
*/
public function getDestinationPlugin($stub_being_requested = FALSE) {
if ($stub_being_requested && !empty($this->destination['no_stub'])) {
- throw new MigrateSkipRowException;
+ throw new MigrateSkipRowException();
}
if (!isset($this->destinationPlugin)) {
$this->destinationPlugin = $this->destinationPluginManager->createInstance($this->destination['plugin'], $this->destination, $this);
diff --git a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
index c7a0472ca..0cb7c68a8 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php
@@ -97,7 +97,7 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin
}
}
}
- throw new MigrateSkipRowException;
+ throw new MigrateSkipRowException();
}
}
diff --git a/core/modules/migrate/src/Plugin/migrate/process/StaticMap.php b/core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
index cdef6ce6b..aa74736e0 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
@@ -35,7 +35,7 @@ class StaticMap extends ProcessPluginBase {
}
$new_value = NestedArray::getValue($this->configuration['map'], $new_value, $key_exists);
if (!$key_exists) {
- if (isset($this->configuration['default_value'])) {
+ if (array_key_exists('default_value', $this->configuration)) {
if (!empty($this->configuration['bypass'])) {
throw new MigrateException('Setting both default_value and bypass is invalid.');
}
diff --git a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
index d53934adb..27aad89b7 100644
--- a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
@@ -22,7 +22,7 @@ class DedupeEntityTest extends MigrateProcessTestCase {
/**
* The mock entity query factory.
*
- * @var \Drupal\Core\Entity\Query\QueryFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Drupal\Core\Entity\Query\QueryFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityQueryFactory;
diff --git a/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php b/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
index ee3a62bc2..59db2e578 100644
--- a/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
@@ -65,6 +65,17 @@ class StaticMapTest extends MigrateProcessTestCase {
$this->assertSame($value, 'test');
}
+ /**
+ * Tests when the source is invalid but there's a default value of NULL.
+ */
+ public function testMapWithInvalidSourceWithANullDefaultValue() {
+ $configuration['map']['foo']['bar'] = 'baz';
+ $configuration['default_value'] = NULL;
+ $this->plugin = new StaticMap($configuration, 'map', []);
+ $value = $this->plugin->transform(array('bar'), $this->migrateExecutable, $this->row, 'destinationproperty');
+ $this->assertNull($value);
+ }
+
/**
* Tests when the source is invalid and bypass is enabled.
*
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index 11689c3b6..e347423dc 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -208,15 +208,15 @@ function hook_node_access_records(\Drupal\node\NodeInterface $node) {
*
* A module may deny all access to a node by setting $grants to an empty array.
*
+ * The preferred use of this hook is in a module that bridges multiple node
+ * access modules with a configurable behavior, as shown in the example with the
+ * 'is_preview' field.
+ *
* @param array $grants
* The $grants array returned by hook_node_access_records().
* @param \Drupal\node\NodeInterface $node
* The node for which the grants were acquired.
*
- * The preferred use of this hook is in a module that bridges multiple node
- * access modules with a configurable behavior, as shown in the example with the
- * 'is_preview' field.
- *
* @see hook_node_access_records()
* @see hook_node_grants()
* @see hook_node_grants_alter()
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index ebfd07ff9..fa9d3e9a3 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -742,7 +742,7 @@ function node_get_recent($number = 10) {
// If the user is able to view their own unpublished nodes, allow them
// to see these in addition to published nodes. Check that they actually
// have some unpublished nodes to view before adding the condition.
- $access_query = \Drupal::entityQuery('node')
+ $access_query = \Drupal::entityQuery('node')
->condition('uid', $account->id())
->condition('status', NODE_NOT_PUBLISHED);
if ($account->hasPermission('view own unpublished content') && ($own_unpublished = $access_query->execute())) {
@@ -1172,7 +1172,7 @@ function node_access_rebuild($batch_mode = FALSE) {
// user does not have access. And unless the current user has the bypass
// node access permission, no nodes are accessible since the grants have
// just been deleted.
- $entity_query->accessCheck(false);
+ $entity_query->accessCheck(FALSE);
$nids = $entity_query->execute();
foreach ($nids as $nid) {
$node_storage->resetCache(array($nid));
@@ -1227,7 +1227,7 @@ function _node_access_rebuild_batch_operation(&$context) {
// user does not have access. And unless the current user has the bypass
// node access permission, no nodes are accessible since the grants have
// just been deleted.
- ->accessCheck(false)
+ ->accessCheck(FALSE)
->range(0, $limit)
->execute();
$node_storage->resetCache($nids);
diff --git a/core/modules/node/node.views_execution.inc b/core/modules/node/node.views_execution.inc
index 701f439a4..193e47994 100644
--- a/core/modules/node/node.views_execution.inc
+++ b/core/modules/node/node.views_execution.inc
@@ -17,7 +17,7 @@ function node_views_query_substitutions(ViewExecutable $view) {
return array(
'***ADMINISTER_NODES***' => intval($account->hasPermission('administer nodes')),
'***VIEW_OWN_UNPUBLISHED_NODES***' => intval($account->hasPermission('view own unpublished content')),
- '***BYPASS_NODE_ACCESS***' => intval($account->hasPermission('bypass node access')),
+ '***BYPASS_NODE_ACCESS***' => intval($account->hasPermission('bypass node access')),
);
}
diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php
index 3cd2e6986..edb568231 100644
--- a/core/modules/node/src/Controller/NodeController.php
+++ b/core/modules/node/src/Controller/NodeController.php
@@ -168,7 +168,7 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
$header = array($this->t('Revision'), $this->t('Operations'));
$revert_permission = (($account->hasPermission("revert $type revisions") || $account->hasPermission('revert all revisions') || $account->hasPermission('administer nodes')) && $node->access('update'));
- $delete_permission = (($account->hasPermission("delete $type revisions") || $account->hasPermission('delete all revisions') || $account->hasPermission('administer nodes')) && $node->access('delete'));
+ $delete_permission = (($account->hasPermission("delete $type revisions") || $account->hasPermission('delete all revisions') || $account->hasPermission('administer nodes')) && $node->access('delete'));
$rows = array();
diff --git a/core/modules/node/src/NodeViewBuilder.php b/core/modules/node/src/NodeViewBuilder.php
index bd5e9a155..f4243b2e6 100644
--- a/core/modules/node/src/NodeViewBuilder.php
+++ b/core/modules/node/src/NodeViewBuilder.php
@@ -147,7 +147,7 @@ class NodeViewBuilder extends EntityViewBuilder {
parent::alterBuild($build, $entity, $display, $view_mode);
if ($entity->id()) {
$build['#contextual_links']['node'] = array(
- 'route_parameters' =>array('node' => $entity->id()),
+ 'route_parameters' => array('node' => $entity->id()),
'metadata' => array('changed' => $entity->getChangedTime()),
);
}
diff --git a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php
index 6bcda18d0..7c4412d0c 100644
--- a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php
+++ b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php
@@ -117,7 +117,7 @@ class AssignOwnerNode extends ConfigurableActionBase implements ContainerFactory
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
- $exists = (bool) $this->connection->queryRange('SELECT 1 FROM {users_field_data} WHERE uid = :uid AND default_langcode = 1', 0, 1, array(':name' => $form_state->getValue('owner_uid')))->fetchField();
+ $exists = (bool) $this->connection->queryRange('SELECT 1 FROM {users_field_data} WHERE uid = :uid AND default_langcode = 1', 0, 1, array(':uid' => $form_state->getValue('owner_uid')))->fetchField();
if (!$exists) {
$form_state->setErrorByName('owner_uid', t('Enter a valid username.'));
}
diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index 3bf7ced2e..1a1f0529d 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -525,7 +525,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
$used_advanced = !empty($parameters[self::ADVANCED_FORM]);
if ($used_advanced) {
$f = isset($parameters['f']) ? (array) $parameters['f'] : array();
- $defaults = $this->parseAdvancedDefaults($f, $keys);
+ $defaults = $this->parseAdvancedDefaults($f, $keys);
}
else {
$defaults = array('keys' => $keys);
diff --git a/core/modules/node/src/Tests/NodeActionsConfigurationTest.php b/core/modules/node/src/Tests/NodeActionsConfigurationTest.php
new file mode 100644
index 000000000..7a732c6c5
--- /dev/null
+++ b/core/modules/node/src/Tests/NodeActionsConfigurationTest.php
@@ -0,0 +1,84 @@
+drupalCreateUser(['administer actions']);
+ $this->drupalLogin($user);
+
+ // Make a POST request to admin/config/system/actions.
+ $edit = [];
+ $edit['action'] = Crypt::hashBase64('node_assign_owner_action');
+ $this->drupalPostForm('admin/config/system/actions', $edit, t('Create'));
+ $this->assertResponse(200);
+
+ // Make a POST request to the individual action configuration page.
+ $edit = [];
+ $action_label = $this->randomMachineName();
+ $edit['label'] = $action_label;
+ $edit['id'] = strtolower($action_label);
+ $edit['owner_uid'] = $user->id();
+ $this->drupalPostForm('admin/config/system/actions/add/' . Crypt::hashBase64('node_assign_owner_action'), $edit, t('Save'));
+ $this->assertResponse(200);
+
+ // Make sure that the new action was saved properly.
+ $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully saved.');
+ $this->assertText($action_label, 'The label of the node_assign_owner_action action appears on the actions administration page after saving.');
+
+ // Make another POST request to the action edit page.
+ $this->clickLink(t('Configure'));
+ preg_match('|admin/config/system/actions/configure/(.+)|', $this->getUrl(), $matches);
+ $aid = $matches[1];
+ $edit = [];
+ $new_action_label = $this->randomMachineName();
+ $edit['label'] = $new_action_label;
+ $edit['owner_uid'] = $user->id();
+ $this->drupalPostForm(NULL, $edit, t('Save'));
+ $this->assertResponse(200);
+
+ // Make sure that the action updated properly.
+ $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully updated.');
+ $this->assertNoText($action_label, 'The old label for the node_assign_owner_action action does not appear on the actions administration page after updating.');
+ $this->assertText($new_action_label, 'The new label for the node_assign_owner_action action appears on the actions administration page after updating.');
+
+ // Make sure that deletions work properly.
+ $this->drupalGet('admin/config/system/actions');
+ $this->clickLink(t('Delete'));
+ $this->assertResponse(200);
+ $edit = [];
+ $this->drupalPostForm("admin/config/system/actions/configure/$aid/delete", $edit, t('Delete'));
+ $this->assertResponse(200);
+
+ // Make sure that the action was actually deleted.
+ $this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'The delete confirmation message appears after deleting the node_assign_owner_action action.');
+ $this->drupalGet('admin/config/system/actions');
+ $this->assertResponse(200);
+ $this->assertNoText($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.');
+
+ $action = Action::load($aid);
+ $this->assertFalse($action, 'The node_assign_owner_action action is not available after being deleted.');
+ }
+
+}
diff --git a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
index a73185f9f..9579045a6 100644
--- a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
+++ b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
@@ -123,7 +123,7 @@ class NodeBlockFunctionalTest extends NodeTestBase {
'region' => 'sidebar_first',
'visibility[node_type][bundles][article]' => 'article',
];
- $theme = \Drupal::service('theme_handler')->getDefault();
+ $theme = \Drupal::service('theme_handler')->getDefault();
$this->drupalPostForm("admin/structure/block/add/system_powered_by_block/$theme", $edit, t('Save block'));
$block = Block::load($edit['id']);
diff --git a/core/modules/node/src/Tests/NodeEditFormTest.php b/core/modules/node/src/Tests/NodeEditFormTest.php
index a4ec4b330..659567dc8 100644
--- a/core/modules/node/src/Tests/NodeEditFormTest.php
+++ b/core/modules/node/src/Tests/NodeEditFormTest.php
@@ -91,7 +91,7 @@ class NodeEditFormTest extends NodeTestBase {
$this->assertText($edit[$title_key], 'Title displayed.');
$this->assertText($edit[$body_key], 'Body displayed.');
- // Login as a second administrator user.
+ // Log in as a second administrator user.
$second_web_user = $this->drupalCreateUser(array('administer nodes', 'edit any page content'));
$this->drupalLogin($second_web_user);
// Edit the same node, creating a new revision.
diff --git a/core/modules/node/src/Tests/NodeFormButtonsTest.php b/core/modules/node/src/Tests/NodeFormButtonsTest.php
index badd2766b..bf555d66f 100644
--- a/core/modules/node/src/Tests/NodeFormButtonsTest.php
+++ b/core/modules/node/src/Tests/NodeFormButtonsTest.php
@@ -39,7 +39,7 @@ class NodeFormButtonsTest extends NodeTestBase {
*/
function testNodeFormButtons() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
- // Login as administrative user.
+ // Log in as administrative user.
$this->drupalLogin($this->adminUser);
// Verify the buttons on a node add form.
@@ -91,7 +91,7 @@ class NodeFormButtonsTest extends NodeTestBase {
$node_2 = $node_storage->load(2);
$this->assertTrue($node_2->isPublished(), 'Node is published');
- // Login as an administrator and unpublish the node that just
+ // Log in as an administrator and unpublish the node that just
// was created by the normal user.
$this->drupalLogout();
$this->drupalLogin($this->adminUser);
@@ -100,7 +100,7 @@ class NodeFormButtonsTest extends NodeTestBase {
$node_2 = $node_storage->load(2);
$this->assertFalse($node_2->isPublished(), 'Node is unpublished');
- // Login again as the normal user, save the node and verify
+ // Log in again as the normal user, save the node and verify
// it's still unpublished.
$this->drupalLogout();
$this->drupalLogin($this->webUser);
diff --git a/core/modules/node/src/Tests/NodeRevisionsAllTest.php b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
index 5474530f3..f7b81bcbe 100644
--- a/core/modules/node/src/Tests/NodeRevisionsAllTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
@@ -74,7 +74,7 @@ class NodeRevisionsAllTest extends NodeTestBase {
// Get last node for simple checks.
$node = $nodes[3];
- // Create and login user.
+ // Create and log in user.
$content_admin = $this->drupalCreateUser(
array(
'view all revisions',
diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php
index b4871b7c6..b4dce569b 100644
--- a/core/modules/node/src/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/src/Tests/NodeTranslationUITest.php
@@ -25,7 +25,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
'theme',
'route',
'timezone',
- 'url.path',
+ 'url.path.parent',
'url.query_args:_wrapper_format',
'user'
];
diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php
index 65ac7e9dd..0d2d8deab 100644
--- a/core/modules/node/src/Tests/NodeTypeTest.php
+++ b/core/modules/node/src/Tests/NodeTypeTest.php
@@ -49,7 +49,7 @@ class NodeTypeTest extends NodeTestBase {
$type_exists = (bool) NodeType::load($type->id());
$this->assertTrue($type_exists, 'The new content type has been created in the database.');
- // Login a test user.
+ // Log in a test user.
$web_user = $this->drupalCreateUser(array('create ' . $type->label() . ' content'));
$this->drupalLogin($web_user);
diff --git a/core/modules/node/src/Tests/NodeTypeTranslationTest.php b/core/modules/node/src/Tests/NodeTypeTranslationTest.php
index a19bf7496..f86ccc450 100644
--- a/core/modules/node/src/Tests/NodeTypeTranslationTest.php
+++ b/core/modules/node/src/Tests/NodeTypeTranslationTest.php
@@ -58,7 +58,7 @@ class NodeTypeTranslationTest extends WebTestBase {
'translate configuration',
);
- // Create and login user.
+ // Create and log in user.
$this->adminUser = $this->drupalCreateUser($admin_permissions);
// Add languages.
diff --git a/core/modules/node/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php
index 5ff36cbf8..b27c416cb 100644
--- a/core/modules/node/src/Tests/Views/FrontPageTest.php
+++ b/core/modules/node/src/Tests/Views/FrontPageTest.php
@@ -172,7 +172,7 @@ class FrontPageTest extends ViewTestBase {
// When a user with sufficient permissions is logged in, views_ui adds
// contextual links to the homepage view. This verifies there are no errors.
\Drupal::service('module_installer')->install(array('views_ui'));
- // Login root user with sufficient permissions.
+ // Log in root user with sufficient permissions.
$this->drupalLogin($this->rootUser);
// Test frontpage view.
$this->drupalGet('node');
diff --git a/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php b/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
index cc687bcc1..109cdc4dd 100644
--- a/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
+++ b/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
@@ -59,4 +59,3 @@ class NodeRevisionWizardTest extends WizardTestBase {
}
}
-
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index e7e353dfc..c7ada1e54 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -5,9 +5,16 @@
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
- Only "getter" methods (method names starting with "get", "has", or "is")
- and a few common methods such as "id" and "label" are available. Calling
- other methods (such as node.delete) will result in an exception.
+ * Only method names starting with "get", "has", or "is" and a few common
+ * methods such as "id", "label", and "bundle" are available. For example:
+ * - node.getCreatedTime() will return the node creation timestamp.
+ * - node.hasField('field_example') returns TRUE if the node bundle includes
+ * field_example. (This does not indicate the presence of a value in this
+ * field.)
+ * - node.isPublished() will return whether the node is published or not.
+ * Calling other methods, such as node.delete(), will result in an exception.
+ * See \Drupal\node\Entity\Node for a full list of public properties and
+ * methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index e195ea899..56b53a92b 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -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') {
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index aa7d4dd69..ab1777ea1 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -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) {
diff --git a/core/modules/node/src/Tests/Config/NodeImportChangeTest.php b/core/modules/node/tests/src/Kernel/Config/NodeImportChangeTest.php
similarity index 95%
rename from core/modules/node/src/Tests/Config/NodeImportChangeTest.php
rename to core/modules/node/tests/src/Kernel/Config/NodeImportChangeTest.php
index ebbd237a0..edb9ae08d 100644
--- a/core/modules/node/src/Tests/Config/NodeImportChangeTest.php
+++ b/core/modules/node/tests/src/Kernel/Config/NodeImportChangeTest.php
@@ -1,9 +1,9 @@
container->get('config.storage.sync');
$this->copyConfig($active, $sync);
// Manually add new node type.
- $src_dir = drupal_get_path('module', 'node_test_config') . '/sync';
- $target_dir = $this->configDirectories[CONFIG_SYNC_DIRECTORY];
+ $src_dir = __DIR__ . '/../../../modules/node_test_config/sync';
+ $target_dir = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
$this->assertTrue(file_unmanaged_copy("$src_dir/$node_type_config_name.yml", "$target_dir/$node_type_config_name.yml"));
// Import the content of the sync directory.
diff --git a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php b/core/modules/node/tests/src/Kernel/NodeBodyFieldStorageTest.php
similarity index 96%
rename from core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
rename to core/modules/node/tests/src/Kernel/NodeBodyFieldStorageTest.php
index 0d3f3670c..6c1faf370 100644
--- a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeBodyFieldStorageTest.php
@@ -1,11 +1,11 @@
'ponies']);
$owner = $node->getOwner();
- $this->assertTrue($owner instanceof \Drupal\user\UserInterface);
+ $this->assertTrue($owner instanceof UserInterface);
$this->assertEqual($owner->id(), $this->user->id());
}
diff --git a/core/modules/node/src/Tests/NodeListBuilderTest.php b/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php
similarity index 92%
rename from core/modules/node/src/Tests/NodeListBuilderTest.php
rename to core/modules/node/tests/src/Kernel/NodeListBuilderTest.php
index f0d614e76..0a0f145dd 100644
--- a/core/modules/node/src/Tests/NodeListBuilderTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php
@@ -1,9 +1,9 @@
' . t('Speeding up your site') . '';
$output .= '- ' . t('Pages requested by anonymous users are stored the first time they are requested and then are reused. Depending on your site configuration and the amount of your web traffic tied to anonymous visitors, the caching system may significantly increase the speed of your site.') . '
';
$output .= '- ' . t('Pages are usually identical for all anonymous users, while they can be personalized for each authenticated user. This is why entire pages can be cached for anonymous users, whereas they will have to be rebuilt for every authenticated user.') . '
';
- $output .= '- ' . t('To speed up your site for authenticated users, see the Dynamic Page Cache module.', [':dynamic_page_cache-help' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? Url::fromRoute('help.page', ['name' => 'dynamic_page_cache'])->toString() : '#']) . '
';
+ $output .= '' . t('To speed up your site for authenticated users, see the Dynamic Page Cache module.', [':dynamic_page_cache-help' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? Url::fromRoute('help.page', ['name' => 'dynamic_page_cache'])->toString() : '#']) . '';
$output .= '' . t('Configuring the internal page cache') . '';
$output .= '' . t('On the Performance page, you can configure how long browsers and proxies may cache pages; that setting is also respected by the Internal Page Cache module. There is no other configuration.', array(':cache-settings' => \Drupal::url('system.performance_settings'))) . '';
$output .= '';
diff --git a/core/modules/page_cache/tests/modules/page_cache_form_test.install b/core/modules/page_cache/tests/modules/page_cache_form_test.install
index ecd7db803..72e3d70b4 100644
--- a/core/modules/page_cache/tests/modules/page_cache_form_test.install
+++ b/core/modules/page_cache/tests/modules/page_cache_form_test.install
@@ -2,7 +2,6 @@
/**
* @file
- *
* Install hooks for page_cache_form_test.
*/
diff --git a/core/modules/path/src/Tests/PathAdminTest.php b/core/modules/path/src/Tests/PathAdminTest.php
index 67ff83e9a..906ce6433 100644
--- a/core/modules/path/src/Tests/PathAdminTest.php
+++ b/core/modules/path/src/Tests/PathAdminTest.php
@@ -19,7 +19,7 @@ class PathAdminTest extends PathTestBase {
protected function setUp() {
parent::setUp();
- // Create test user and login.
+ // Create test user and log in.
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases'));
$this->drupalLogin($web_user);
}
diff --git a/core/modules/path/src/Tests/PathAliasTest.php b/core/modules/path/src/Tests/PathAliasTest.php
index 4e4ff67d2..e6b17385b 100644
--- a/core/modules/path/src/Tests/PathAliasTest.php
+++ b/core/modules/path/src/Tests/PathAliasTest.php
@@ -24,7 +24,7 @@ class PathAliasTest extends PathTestBase {
protected function setUp() {
parent::setUp();
- // Create test user and login.
+ // Create test user and log in.
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases'));
$this->drupalLogin($web_user);
}
diff --git a/core/modules/path/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php
index 60d676ad9..028d3593d 100644
--- a/core/modules/path/src/Tests/PathLanguageTest.php
+++ b/core/modules/path/src/Tests/PathLanguageTest.php
@@ -38,7 +38,7 @@ class PathLanguageTest extends PathTestBase {
'edit any page content',
'translate any entity',
);
- // Create and login user.
+ // Create and log in user.
$this->webUser = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->webUser);
diff --git a/core/modules/path/src/Tests/PathLanguageUiTest.php b/core/modules/path/src/Tests/PathLanguageUiTest.php
index 185a04d10..9ff0ea2ee 100644
--- a/core/modules/path/src/Tests/PathLanguageUiTest.php
+++ b/core/modules/path/src/Tests/PathLanguageUiTest.php
@@ -19,7 +19,7 @@ class PathLanguageUiTest extends PathTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'access administration pages'));
$this->drupalLogin($web_user);
@@ -41,7 +41,7 @@ class PathLanguageUiTest extends PathTestBase {
$name = $this->randomMachineName(8);
$edit = array();
$edit['source'] = '/admin/config/search/path';
- $edit['alias'] ='/' . $name;
+ $edit['alias'] = '/' . $name;
$this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
$this->drupalGet($name);
diff --git a/core/modules/path/src/Tests/PathNodeFormTest.php b/core/modules/path/src/Tests/PathNodeFormTest.php
index 3f0e3d786..79b43a773 100644
--- a/core/modules/path/src/Tests/PathNodeFormTest.php
+++ b/core/modules/path/src/Tests/PathNodeFormTest.php
@@ -19,7 +19,7 @@ class PathNodeFormTest extends PathTestBase {
protected function setUp() {
parent::setUp();
- // Create test user and login.
+ // Create test user and log in.
$web_user = $this->drupalCreateUser(array('create page content', 'create url aliases'));
$this->drupalLogin($web_user);
}
diff --git a/core/modules/path/src/Tests/PathTaxonomyTermTest.php b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
index cc637e2d8..faeceabc7 100644
--- a/core/modules/path/src/Tests/PathTaxonomyTermTest.php
+++ b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
@@ -28,7 +28,7 @@ class PathTaxonomyTermTest extends PathTestBase {
]);
$vocabulary->save();
- // Create and login user.
+ // Create and log in user.
$web_user = $this->drupalCreateUser(array('administer url aliases', 'administer taxonomy', 'access administration pages'));
$this->drupalLogin($web_user);
}
diff --git a/core/modules/quickedit/tests/modules/quickedit_test.module b/core/modules/quickedit/tests/modules/quickedit_test.module
index 39c4f041c..cd12fc972 100644
--- a/core/modules/quickedit/tests/modules/quickedit_test.module
+++ b/core/modules/quickedit/tests/modules/quickedit_test.module
@@ -18,4 +18,3 @@ function quickedit_test_quickedit_render_field(EntityInterface $entity, $field_n
'#suffix' => '',
);
}
-
diff --git a/core/modules/quickedit/src/Tests/EditorSelectionTest.php b/core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
similarity index 99%
rename from core/modules/quickedit/src/Tests/EditorSelectionTest.php
rename to core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
index c21c64c71..18a86f8ee 100644
--- a/core/modules/quickedit/src/Tests/EditorSelectionTest.php
+++ b/core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
@@ -1,6 +1,6 @@
bundle();
$mapping = rdf_get_mapping('node', $bundle);
$bundle_mapping = $mapping->getPreparedBundleMapping('node', $bundle);
- $variables['attributes']['about'] = empty($variables['url']) ? NULL: $variables['url'];
+ $variables['attributes']['about'] = empty($variables['url']) ? NULL : $variables['url'];
$variables['attributes']['typeof'] = empty($bundle_mapping['types']) ? NULL : $bundle_mapping['types'];
// Adds RDFa markup for the node title as metadata because wrapping the title
diff --git a/core/modules/rdf/src/Tests/CrudTest.php b/core/modules/rdf/tests/src/Kernel/CrudTest.php
similarity index 97%
rename from core/modules/rdf/src/Tests/CrudTest.php
rename to core/modules/rdf/tests/src/Kernel/CrudTest.php
index 5eb52de13..39dddc4be 100644
--- a/core/modules/rdf/src/Tests/CrudTest.php
+++ b/core/modules/rdf/tests/src/Kernel/CrudTest.php
@@ -1,8 +1,8 @@
assertFormatterRdfa(array('type'=>'datetime_default'), 'http://schema.org/dateCreated', array('value' => $this->testValue . 'Z', 'type' => 'literal', 'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime'));
+ $this->assertFormatterRdfa(array('type' => 'datetime_default'), 'http://schema.org/dateCreated', array('value' => $this->testValue . 'Z', 'type' => 'literal', 'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime'));
}
}
diff --git a/core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php
index 7d69c1958..88f9a7c6a 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php
@@ -43,8 +43,8 @@ class EmailFieldRdfaTest extends FieldRdfaTestBase {
*/
public function testAllFormatters() {
// Test the plain formatter.
- $this->assertFormatterRdfa(array('type'=>'string'), 'http://schema.org/email', array('value' => $this->testValue));
+ $this->assertFormatterRdfa(array('type' => 'string'), 'http://schema.org/email', array('value' => $this->testValue));
// Test the mailto formatter.
- $this->assertFormatterRdfa(array('type'=>'email_mailto'), 'http://schema.org/email', array('value' => $this->testValue));
+ $this->assertFormatterRdfa(array('type' => 'email_mailto'), 'http://schema.org/email', array('value' => $this->testValue));
}
}
diff --git a/core/modules/rdf/tests/src/Kernel/Field/FieldRdfaDatatypeCallbackTest.php b/core/modules/rdf/tests/src/Kernel/Field/FieldRdfaDatatypeCallbackTest.php
index 460476550..1e1a809f6 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/FieldRdfaDatatypeCallbackTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/FieldRdfaDatatypeCallbackTest.php
@@ -51,8 +51,7 @@ class FieldRdfaDatatypeCallbackTest extends FieldRdfaTestBase {
*/
public function testDefaultFormatter() {
// Expected value is the output of the datatype callback, not the raw value.
- $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/interactionCount', array('value' => 'foo' . $this->testValue));
+ $this->assertFormatterRdfa(array('type' => 'text_default'), 'http://schema.org/interactionCount', array('value' => 'foo' . $this->testValue));
}
}
-
diff --git a/core/modules/rdf/tests/src/Kernel/Field/LinkFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/LinkFieldRdfaTest.php
index 29b193330..d4e1cf0fb 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/LinkFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/LinkFieldRdfaTest.php
@@ -85,7 +85,7 @@ class LinkFieldRdfaTest extends FieldRdfaTestBase {
// Set up the expected result.
$expected_rdf = array(
- 'value' => $this->uri . '/',
+ 'value' => $this->uri . '/',
'type' => 'uri',
);
diff --git a/core/modules/rdf/tests/src/Kernel/Field/StringFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/StringFieldRdfaTest.php
index 61745721a..6f0f9d3f8 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/StringFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/StringFieldRdfaTest.php
@@ -52,6 +52,6 @@ class StringFieldRdfaTest extends FieldRdfaTestBase {
*/
public function testStringFormatters() {
// Tests the string formatter.
- $this->assertFormatterRdfa(array('type'=>'string'), 'http://schema.org/text', array('value' => $this->testValue));
+ $this->assertFormatterRdfa(array('type' => 'string'), 'http://schema.org/text', array('value' => $this->testValue));
}
}
diff --git a/core/modules/rdf/tests/src/Kernel/Field/TextFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/TextFieldRdfaTest.php
index 594b1b7f4..c50cc1647 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/TextFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/TextFieldRdfaTest.php
@@ -63,10 +63,10 @@ class TextFieldRdfaTest extends FieldRdfaTestBase {
$formatted_value = strip_tags($this->entity->{$this->fieldName}->processed);
// Tests the default formatter.
- $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/text', array('value' => $formatted_value));
+ $this->assertFormatterRdfa(array('type' => 'text_default'), 'http://schema.org/text', array('value' => $formatted_value));
// Tests the summary formatter.
- $this->assertFormatterRdfa(array('type'=>'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $formatted_value));
+ $this->assertFormatterRdfa(array('type' => 'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $formatted_value));
// Tests the trimmed formatter.
- $this->assertFormatterRdfa(array('type'=>'text_trimmed'), 'http://schema.org/text', array('value' => $formatted_value));
+ $this->assertFormatterRdfa(array('type' => 'text_trimmed'), 'http://schema.org/text', array('value' => $formatted_value));
}
}
diff --git a/core/modules/rdf/src/Tests/RdfaAttributesTest.php b/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
similarity index 97%
rename from core/modules/rdf/src/Tests/RdfaAttributesTest.php
rename to core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
index b7467036a..42a4dc448 100644
--- a/core/modules/rdf/src/Tests/RdfaAttributesTest.php
+++ b/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
@@ -1,8 +1,8 @@
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));
diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
index aa01d156b..d5d46f3b9 100644
--- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
+++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php
@@ -126,9 +126,11 @@ class RequestHandlerTest extends KernelTestBase {
}
+/**
+ * Stub class where we can prophesize methods.
+ */
class StubRequestHandlerResourcePlugin extends ResourceBase {
- /** stub methods so they can be prophesied. */
function get() {}
function patch() {}
}
diff --git a/core/modules/rest/src/Tests/RestLinkManagerTest.php b/core/modules/rest/tests/src/Kernel/RestLinkManagerTest.php
similarity index 97%
rename from core/modules/rest/src/Tests/RestLinkManagerTest.php
rename to core/modules/rest/tests/src/Kernel/RestLinkManagerTest.php
index 2d9e6c812..fc7c41d4a 100644
--- a/core/modules/rest/src/Tests/RestLinkManagerTest.php
+++ b/core/modules/rest/tests/src/Kernel/RestLinkManagerTest.php
@@ -1,8 +1,9 @@
$word), array('target' => 'replica'))->fetchField();
// Apply Zipf's law to equalize the probability distribution.
- $total = log10(1 + 1/(max(1, $total)));
+ $total = log10(1 + 1 / (max(1, $total)));
db_merge('search_total')
->key('word', $word)
->fields(array('count' => $total))
diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc
index 409ce2d6f..a161a9bfa 100644
--- a/core/modules/search/search.pages.inc
+++ b/core/modules/search/search.pages.inc
@@ -65,4 +65,3 @@ function template_preprocess_search_result(&$variables) {
'#context' => array('info' => $info),
);
}
-
diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php
index edfc99646..13db8502c 100644
--- a/core/modules/search/src/SearchQuery.php
+++ b/core/modules/search/src/SearchQuery.php
@@ -224,9 +224,9 @@ class SearchQuery extends SelectExtender {
protected function parseSearchExpression() {
// Matches words optionally prefixed by a - sign. A word in this case is
// something between two spaces, optionally quoted.
- preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression , $keywords, PREG_SET_ORDER);
+ preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->searchExpression, $keywords, PREG_SET_ORDER);
- if (count($keywords) == 0) {
+ if (count($keywords) == 0) {
return;
}
diff --git a/core/modules/search/src/Tests/SearchAdvancedSearchFormTest.php b/core/modules/search/src/Tests/SearchAdvancedSearchFormTest.php
index f975485ec..9bd13bdc1 100644
--- a/core/modules/search/src/Tests/SearchAdvancedSearchFormTest.php
+++ b/core/modules/search/src/Tests/SearchAdvancedSearchFormTest.php
@@ -18,7 +18,7 @@ class SearchAdvancedSearchFormTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes'));
$this->drupalLogin($test_user);
diff --git a/core/modules/search/src/Tests/SearchBlockTest.php b/core/modules/search/src/Tests/SearchBlockTest.php
index c66806ba7..7d42a85a4 100644
--- a/core/modules/search/src/Tests/SearchBlockTest.php
+++ b/core/modules/search/src/Tests/SearchBlockTest.php
@@ -19,7 +19,7 @@ class SearchBlockTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
$this->drupalLogin($admin_user);
}
diff --git a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
index a578d3517..3e19fb263 100644
--- a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
@@ -48,7 +48,7 @@ class SearchCommentCountToggleTest extends SearchTestBase {
// Create searching user.
$this->searchingUser = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments', 'skip comment approval'));
- // Login with sufficient privileges.
+ // Log in with sufficient privileges.
$this->drupalLogin($this->searchingUser);
// Add a comment field.
diff --git a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
index 1db5f7982..7279ade7a 100644
--- a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
@@ -35,7 +35,7 @@ class SearchConfigSettingsFormTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- // Login as a user that can create and search content.
+ // Log in as a user that can create and search content.
$this->searchUser = $this->drupalCreateUser(array('search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks', 'access site reports'));
$this->drupalLogin($this->searchUser);
diff --git a/core/modules/search/src/Tests/SearchExactTest.php b/core/modules/search/src/Tests/SearchExactTest.php
index ae2cf1343..eaf3edb1f 100644
--- a/core/modules/search/src/Tests/SearchExactTest.php
+++ b/core/modules/search/src/Tests/SearchExactTest.php
@@ -12,7 +12,7 @@ class SearchExactTest extends SearchTestBase {
* Tests that the correct number of pager links are found for both keywords and phrases.
*/
function testExactQuery() {
- // Login with sufficient privileges.
+ // Log in with sufficient privileges.
$user = $this->drupalCreateUser(array('create page content', 'search content'));
$this->drupalLogin($user);
diff --git a/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
index fc052bce4..731d0ea4d 100644
--- a/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
+++ b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
@@ -34,7 +34,7 @@ class SearchKeywordsConditionsTest extends SearchTestBase {
// Create searching user.
$this->searchingUser = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
- // Login with sufficient privileges.
+ // Log in with sufficient privileges.
$this->drupalLogin($this->searchingUser);
}
diff --git a/core/modules/search/src/Tests/SearchLanguageTest.php b/core/modules/search/src/Tests/SearchLanguageTest.php
index cf849a8aa..f359a99f5 100644
--- a/core/modules/search/src/Tests/SearchLanguageTest.php
+++ b/core/modules/search/src/Tests/SearchLanguageTest.php
@@ -29,7 +29,7 @@ class SearchLanguageTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes', 'administer languages', 'access administration pages', 'administer site configuration'));
$this->drupalLogin($test_user);
@@ -117,10 +117,10 @@ class SearchLanguageTest extends SearchTestBase {
// Check for Spanish results.
$this->assertLink('Second node this is the Spanish title', 0, 'Second node Spanish title found in search results');
$this->assertLink('Third node es', 0, 'Third node Spanish found in search results');
- // Ensure that results doesn't contain other language nodes.
- $this->assertNoLink('First node en', 'Search results does not contain first English node');
- $this->assertNoLink('Second node en', 'Search results does not contain second English node');
- $this->assertNoLink('Third node en', 'Search results does not contain third English node');
+ // Ensure that results don't contain other language nodes.
+ $this->assertNoLink('First node en', 'Search results do not contain first English node');
+ $this->assertNoLink('Second node en', 'Search results do not contain second English node');
+ $this->assertNoLink('Third node en', 'Search results do not contain third English node');
// Change the default language and delete English.
$path = 'admin/config/regional/language';
diff --git a/core/modules/search/src/Tests/SearchPageCacheTagsTest.php b/core/modules/search/src/Tests/SearchPageCacheTagsTest.php
index df092ebca..3a7bc67e7 100644
--- a/core/modules/search/src/Tests/SearchPageCacheTagsTest.php
+++ b/core/modules/search/src/Tests/SearchPageCacheTagsTest.php
@@ -164,7 +164,7 @@ class SearchPageCacheTagsTest extends SearchTestBase {
$this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex();
search_update_totals();
- // Login with searching user again.
+ // Log in with searching user again.
$this->drupalLogin($this->searchingUser);
// Default search cache tags.
diff --git a/core/modules/search/src/Tests/SearchPageOverrideTest.php b/core/modules/search/src/Tests/SearchPageOverrideTest.php
index 885f7cca3..040172025 100644
--- a/core/modules/search/src/Tests/SearchPageOverrideTest.php
+++ b/core/modules/search/src/Tests/SearchPageOverrideTest.php
@@ -29,7 +29,7 @@ class SearchPageOverrideTest extends SearchTestBase {
protected function setUp() {
parent::setUp();
- // Login as a user that can create and search content.
+ // Log in as a user that can create and search content.
$this->searchUser = $this->drupalCreateUser(array('search content', 'administer search'));
$this->drupalLogin($this->searchUser);
}
diff --git a/core/modules/search/src/Tests/SearchQueryAlterTest.php b/core/modules/search/src/Tests/SearchQueryAlterTest.php
index af6512798..2b058168f 100644
--- a/core/modules/search/src/Tests/SearchQueryAlterTest.php
+++ b/core/modules/search/src/Tests/SearchQueryAlterTest.php
@@ -19,7 +19,7 @@ class SearchQueryAlterTest extends SearchTestBase {
* Tests that the query alter works.
*/
function testQueryAlter() {
- // Login with sufficient privileges.
+ // Log in with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('create page content', 'search content')));
// Create a node and an article with the same keyword. The query alter
diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php
index ee5aa1523..ff8299cf0 100644
--- a/core/modules/search/src/Tests/SearchRankingTest.php
+++ b/core/modules/search/src/Tests/SearchRankingTest.php
@@ -36,7 +36,7 @@ class SearchRankingTest extends SearchTestBase {
// Create a plugin instance.
$this->nodeSearch = entity_load('search_page', 'node_search');
- // Login with sufficient privileges.
+ // Log in with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('post comments', 'skip comment approval', 'create page content', 'administer search')));
}
diff --git a/core/modules/search/src/Tests/SearchSimplifyTest.php b/core/modules/search/src/Tests/SearchSimplifyTest.php
index 628752627..2dc9ff658 100644
--- a/core/modules/search/src/Tests/SearchSimplifyTest.php
+++ b/core/modules/search/src/Tests/SearchSimplifyTest.php
@@ -24,7 +24,7 @@ class SearchSimplifyTest extends SearchTestBase {
$basestrings = explode(chr(10), $input);
$strings = array();
foreach ($basestrings as $key => $string) {
- if ($key %2) {
+ if ($key % 2) {
// Even line - should simplify down to a space.
$simplified = search_simplify($string);
$this->assertIdentical($simplified, ' ', "Line $key is excluded from the index");
diff --git a/core/modules/search/src/Tests/SearchExcerptTest.php b/core/modules/search/tests/src/Kernel/SearchExcerptTest.php
similarity index 99%
rename from core/modules/search/src/Tests/SearchExcerptTest.php
rename to core/modules/search/tests/src/Kernel/SearchExcerptTest.php
index 665aec51a..85c09174a 100644
--- a/core/modules/search/src/Tests/SearchExcerptTest.php
+++ b/core/modules/search/tests/src/Kernel/SearchExcerptTest.php
@@ -1,8 +1,8 @@
array(
array('value' => TRUE),
),
+ 'non_rev_field' => array(),
'field_test_text' => array(
array(
'value' => $this->values['field_test_text']['value'],
@@ -190,6 +191,7 @@ class EntitySerializationTest extends NormalizerTestBase {
'user_id' => '' . $this->user->id() . '' . $this->user->getEntityTypeId() . '' . $this->user->uuid() . '' . $this->user->url() . '',
'revision_id' => '' . $this->entity->getRevisionId() . '',
'default_langcode' => '1',
+ 'non_rev_field' => '',
'field_test_text' => '' . $this->values['field_test_text']['value'] . '' . $this->values['field_test_text']['format'] . '',
);
// Sort it in the same order as normalised.
diff --git a/core/modules/serialization/src/Tests/SerializationTest.php b/core/modules/serialization/tests/src/Kernel/SerializationTest.php
similarity index 94%
rename from core/modules/serialization/src/Tests/SerializationTest.php
rename to core/modules/serialization/tests/src/Kernel/SerializationTest.php
index ea7dbf7d3..cd8ba9681 100644
--- a/core/modules/serialization/src/Tests/SerializationTest.php
+++ b/core/modules/serialization/tests/src/Kernel/SerializationTest.php
@@ -1,8 +1,8 @@
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);
diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index a0854eaf2..b0e887e7a 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -91,7 +91,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
$this->assertEqual($entity->link->options, $loaded->link->options);
}
- // Login as non admin user, to check that access is checked when creating
+ // Log in as non admin user, to check that access is checked when creating
// shortcuts.
$this->drupalLogin($this->shortcutUser);
$title = $this->randomMachineName();
diff --git a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
index fe1c3f4e3..545821771 100644
--- a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
@@ -111,7 +111,7 @@ class ShortcutTranslationUITest extends ContentTranslationUITestBase {
$this->assertFalse(
$entity instanceof EntityChangedInterface,
- format_string('%entity is not implementing EntityChangedInterface.' , array('%entity' => $this->entityTypeId))
+ format_string('%entity is not implementing EntityChangedInterface.', array('%entity' => $this->entityTypeId))
);
}
diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install
index e5eb9a305..c1422e6e7 100644
--- a/core/modules/simpletest/simpletest.install
+++ b/core/modules/simpletest/simpletest.install
@@ -51,7 +51,7 @@ function simpletest_requirements($phase) {
}
$site_directory = 'sites/simpletest';
- if (!drupal_verify_install_file(\Drupal::root() . '/' . $site_directory, FILE_EXIST|FILE_READABLE|FILE_WRITABLE|FILE_EXECUTABLE, 'dir')) {
+ if (!drupal_verify_install_file(\Drupal::root() . '/' . $site_directory, FILE_EXIST | FILE_READABLE | FILE_WRITABLE | FILE_EXECUTABLE, 'dir')) {
$requirements['simpletest_site_directory'] = array(
'title' => t('Simpletest site directory'),
'value' => is_dir(\Drupal::root() . '/' . $site_directory) ? t('Not writable') : t('Missing'),
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 771425961..8f9740149 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -519,7 +519,7 @@ EOD;
// Write directly to active storage to avoid early instantiation of
// the event dispatcher which can prevent modules from registering events.
- $active_storage = \Drupal::service('config.storage');
+ $active_storage = \Drupal::service('config.storage');
$extensions = $active_storage->read('core.extension');
foreach ($modules as $module) {
diff --git a/core/modules/simpletest/src/RandomGeneratorTrait.php b/core/modules/simpletest/src/RandomGeneratorTrait.php
index 2d8b6357b..d702c5fc5 100644
--- a/core/modules/simpletest/src/RandomGeneratorTrait.php
+++ b/core/modules/simpletest/src/RandomGeneratorTrait.php
@@ -2,125 +2,16 @@
namespace Drupal\simpletest;
-use Drupal\Component\Utility\Random;
+use Drupal\Tests\RandomGeneratorTrait as BaseGeneratorTrait;
/**
* Provides random generator utility methods.
+ *
+ * @deprecated in Drupal 8.1.1, will be removed before Drupal 9.0.0.
+ * The trait was moved to another namespace.
+ *
+ * @see \Drupal\Tests
*/
trait RandomGeneratorTrait {
-
- /**
- * The random generator.
- *
- * @var \Drupal\Component\Utility\Random
- */
- protected $randomGenerator;
-
- /**
- * Generates a pseudo-random string of ASCII characters of codes 32 to 126.
- *
- * Do not use this method when special characters are not possible (e.g., in
- * machine or file names that have already been validated); instead, use
- * \Drupal\simpletest\TestBase::randomMachineName(). If $length is greater
- * than 3 the random string will include at least one ampersand ('&') and
- * at least one greater than ('>') character to ensure coverage for special
- * characters and avoid the introduction of random test failures.
- *
- * @param int $length
- * Length of random string to generate.
- *
- * @return string
- * Pseudo-randomly generated unique string including special characters.
- *
- * @see \Drupal\Component\Utility\Random::string()
- */
- public function randomString($length = 8) {
- if ($length < 4) {
- return $this->getRandomGenerator()->string($length, TRUE, array($this, 'randomStringValidate'));
- }
-
- // To prevent the introduction of random test failures, ensure that the
- // returned string contains a character that needs to be escaped in HTML by
- // injecting an ampersand into it.
- $replacement_pos = floor($length / 2);
- // Remove 2 from the length to account for the ampersand and greater than
- // characters.
- $string = $this->getRandomGenerator()->string($length - 2, TRUE, array($this, 'randomStringValidate'));
- return substr_replace($string, '>&', $replacement_pos, 0);
- }
-
- /**
- * Callback for random string validation.
- *
- * @see \Drupal\Component\Utility\Random::string()
- *
- * @param string $string
- * The random string to validate.
- *
- * @return bool
- * TRUE if the random string is valid, FALSE if not.
- */
- public function randomStringValidate($string) {
- // Consecutive spaces causes issues for
- // \Drupal\simpletest\WebTestBase::assertLink().
- if (preg_match('/\s{2,}/', $string)) {
- return FALSE;
- }
-
- // Starting or ending with a space means that length might not be what is
- // expected.
- if (preg_match('/^\s|\s$/', $string)) {
- return FALSE;
- }
-
- return TRUE;
- }
-
- /**
- * Generates a unique random string containing letters and numbers.
- *
- * Do not use this method when testing unvalidated user input. Instead, use
- * \Drupal\simpletest\TestBase::randomString().
- *
- * @param int $length
- * Length of random string to generate.
- *
- * @return string
- * Randomly generated unique string.
- *
- * @see \Drupal\Component\Utility\Random::name()
- */
- protected function randomMachineName($length = 8) {
- return $this->getRandomGenerator()->name($length, TRUE);
- }
-
- /**
- * Generates a random PHP object.
- *
- * @param int $size
- * The number of random keys to add to the object.
- *
- * @return \stdClass
- * The generated object, with the specified number of random keys. Each key
- * has a random string value.
- *
- * @see \Drupal\Component\Utility\Random::object()
- */
- public function randomObject($size = 4) {
- return $this->getRandomGenerator()->object($size);
- }
-
- /**
- * Gets the random generator for the utility methods.
- *
- * @return \Drupal\Component\Utility\Random
- * The random generator.
- */
- protected function getRandomGenerator() {
- if (!is_object($this->randomGenerator)) {
- $this->randomGenerator = new Random();
- }
- return $this->randomGenerator;
- }
-
+ use BaseGeneratorTrait;
}
diff --git a/core/modules/simpletest/src/SessionTestTrait.php b/core/modules/simpletest/src/SessionTestTrait.php
index 042956e38..333559384 100644
--- a/core/modules/simpletest/src/SessionTestTrait.php
+++ b/core/modules/simpletest/src/SessionTestTrait.php
@@ -2,39 +2,18 @@
namespace Drupal\simpletest;
-use Symfony\Component\HttpFoundation\Request;
+use Drupal\Tests\SessionTestTrait as BaseSessionTestTrait;
/**
* Provides methods to generate and get session name in tests.
+ *
+ * @deprecated in Drupal 8.1.1 will be removed before 9.0.0.
+ * This was moved to another namespace.
+ *
+ * @see \Drupal\Tests
*/
trait SessionTestTrait {
- /**
- * The name of the session cookie.
- *
- * @var string
- */
- protected $sessionName;
-
- /**
- * Generates a session cookie name.
- *
- * @param string $data
- * The data to generate session name.
- */
- protected function generateSessionName($data) {
- $prefix = (Request::createFromGlobals()->isSecure() ? 'SSESS' : 'SESS');
- $this->sessionName = $prefix . substr(hash('sha256', $data), 0, 32);
- }
-
- /**
- * Returns the session name in use on the child site.
- *
- * @return string
- * The name of the session cookie.
- */
- protected function getSessionName() {
- return $this->sessionName;
- }
+ use BaseSessionTestTrait;
}
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index 03d308d0f..9bc2c5bed 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -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;
@@ -13,6 +14,8 @@ use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\Core\Utility\Error;
+use Drupal\Tests\RandomGeneratorTrait;
+use Drupal\Tests\SessionTestTrait;
/**
* Base class for Drupal tests.
@@ -950,7 +953,7 @@ abstract class TestBase {
}
$message = '
ID #' . $this->verboseId . ' (Previous | Next)
' . $message;
- $verbose_filename = $this->verboseClassName . '-' . $this->verboseId . '-' . $this->testId . '.html';
+ $verbose_filename = $this->verboseClassName . '-' . $this->verboseId . '-' . $this->testId . '.html';
if (file_put_contents($this->verboseDirectory . '/' . $verbose_filename, $message)) {
$url = $this->verboseDirectoryUrl . '/' . $verbose_filename;
// Not using \Drupal\Core\Utility\LinkGeneratorInterface::generate()
@@ -1017,7 +1020,7 @@ abstract class TestBase {
// 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
diff --git a/core/modules/simpletest/src/Tests/MailCaptureTest.php b/core/modules/simpletest/src/Tests/MailCaptureTest.php
index e5b2ab7e5..cf36c5dfe 100644
--- a/core/modules/simpletest/src/Tests/MailCaptureTest.php
+++ b/core/modules/simpletest/src/Tests/MailCaptureTest.php
@@ -20,7 +20,7 @@ class MailCaptureTest extends WebTestBase {
$body = $this->randomString(128);
$message = array(
'id' => 'drupal_mail_test',
- 'headers' => array('Content-type'=> 'text/html'),
+ 'headers' => array('Content-type' => 'text/html'),
'subject' => $subject,
'to' => 'foobar@example.com',
'body' => $body,
@@ -47,7 +47,7 @@ class MailCaptureTest extends WebTestBase {
for ($index = 0; $index < 5; $index++) {
$message = array(
'id' => 'drupal_mail_test_' . $index,
- 'headers' => array('Content-type'=> 'text/html'),
+ 'headers' => array('Content-type' => 'text/html'),
'subject' => $this->randomString(64),
'to' => $this->randomMachineName(32) . '@example.com',
'body' => $this->randomString(512),
diff --git a/core/modules/simpletest/src/WebAssert.php b/core/modules/simpletest/src/WebAssert.php
index 063473b8b..04b519203 100644
--- a/core/modules/simpletest/src/WebAssert.php
+++ b/core/modules/simpletest/src/WebAssert.php
@@ -2,66 +2,15 @@
namespace Drupal\simpletest;
-use Behat\Mink\WebAssert as MinkWebAssert;
-use Behat\Mink\Element\TraversableElement;
-use Behat\Mink\Exception\ElementNotFoundException;
+use Drupal\Tests\WebAssert as BaseWebAssert;
/**
* Defines a class with methods for asserting presence of elements during tests.
+ *
+ * @deprecated in Drupal 8.1.1 will be removed before 9.0.0.
+ * This was moved to another namespace.
+ *
+ * @see \Drupal\Tests
*/
-class WebAssert extends MinkWebAssert {
-
- /**
- * Checks that specific button exists on the current page.
- *
- * @param string $button
- * One of id|name|label|value for the button.
- * @param \Behat\Mink\Element\TraversableElement $container
- * (optional) The document to check against. Defaults to the current page.
- *
- * @return \Behat\Mink\Element\NodeElement
- * The matching element.
- *
- * @throws \Behat\Mink\Exception\ElementNotFoundException
- * When the element doesn't exist.
- */
- public function buttonExists($button, TraversableElement $container = NULL) {
- $container = $container ?: $this->session->getPage();
- $node = $container->findButton($button);
-
- if ($node === NULL) {
- throw new ElementNotFoundException($this->session, 'button', 'id|name|label|value', $button);
- }
-
- return $node;
- }
-
- /**
- * Checks that specific select field exists on the current page.
- *
- * @param string $select
- * One of id|name|label|value for the select field.
- * @param \Behat\Mink\Element\TraversableElement $container
- * (optional) The document to check against. Defaults to the current page.
- *
- * @return \Behat\Mink\Element\NodeElement
- * The matching element
- *
- * @throws \Behat\Mink\Exception\ElementNotFoundException
- * When the element doesn't exist.
- */
- public function selectExists($select, TraversableElement $container = NULL) {
- $container = $container ?: $this->session->getPage();
- $node = $container->find('named', array(
- 'select',
- $this->session->getSelectorsHandler()->xpathLiteral($select),
- ));
-
- if ($node === NULL) {
- throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
- }
-
- return $node;
- }
-
+class WebAssert extends BaseWebAssert {
}
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 197e1a904..627df2931 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -27,6 +27,7 @@ use Drupal\Core\Test\AssertMailTrait;
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 @@ abstract class WebTestBase extends TestBase {
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'] = [
@@ -1507,7 +1508,7 @@ abstract class WebTestBase extends TestBase {
* $edit = array(...);
* $this->drupalPostForm(NULL, $edit, t('Save'));
* @endcode
- * @param $edit
+ * @param $edit
* Field data in an associative array. Changes the current input fields
* (where possible) to the values indicated.
*
@@ -2310,7 +2311,6 @@ abstract class WebTestBase extends TestBase {
/**
* Follows a link by partial name.
*
- *
* If the link is discovered and clicked, the test passes. Fail otherwise.
*
* @param string|\Drupal\Component\Render\MarkupInterface $label
diff --git a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
index c86a9e619..73210c5c0 100644
--- a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
+++ b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
@@ -20,4 +20,3 @@ class SimpletestPhpunitRunCommandTestWillDie extends UnitTestCase {
$this->assertTrue(TRUE, 'Assertion to ensure test pass');
}
}
-
diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
index 0e3d2a497..4a3d25241 100644
--- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
+++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
@@ -19,7 +19,7 @@ class SimpletestPhpunitRunCommandTest extends UnitTestCase {
include_once __DIR__ .'/../../fixtures/simpletest_phpunit_run_command_test.php';
$app_root = __DIR__ . '/../../../../../..';
include_once "$app_root/core/modules/simpletest/simpletest.module";
- $container = new ContainerBuilder;
+ $container = new ContainerBuilder();
$container->set('app.root', $app_root);
$file_system = $this->prophesize('Drupal\Core\File\FileSystemInterface');
$file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir());
diff --git a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
index b96ea797c..9a69d78af 100644
--- a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
+++ b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
@@ -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 @@ class TestInfoParsingTest extends UnitTestCase {
* 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 @@ EOT;
* @group field
*/
EOT;
- $info = \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
+ $info = TestDiscovery::getTestInfo($classname, $doc_comment);
$this->assertEmpty($info['description']);
}
diff --git a/core/modules/statistics/src/StatisticsSettingsForm.php b/core/modules/statistics/src/StatisticsSettingsForm.php
index 66e5a97b1..5bd150c4e 100644
--- a/core/modules/statistics/src/StatisticsSettingsForm.php
+++ b/core/modules/statistics/src/StatisticsSettingsForm.php
@@ -97,4 +97,3 @@ class StatisticsSettingsForm extends ConfigFormBase {
parent::submitForm($form, $form_state);
}
}
-
diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php
index fe1b9fd72..a79af5f0f 100644
--- a/core/modules/statistics/statistics.php
+++ b/core/modules/statistics/statistics.php
@@ -35,4 +35,3 @@ if ($views) {
->execute();
}
}
-
diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php
index 3a3e2736e..cc1914c83 100644
--- a/core/modules/system/src/Controller/DbUpdateController.php
+++ b/core/modules/system/src/Controller/DbUpdateController.php
@@ -324,7 +324,7 @@ class DbUpdateController extends ControllerBase {
$text = $this->t('This update will been skipped due to the following missing dependencies:') . '' . implode(', ', $data['missing_dependencies']) . '';
}
else {
- $text = $this->t("This update will be skipped due to an error in the module's code.");
+ $text = $this->t("This update will be skipped due to an error in the module's code.");
}
$build['start'][$module_update_key]['#items'][$data['number']] .= '' . $text . '
';
}
@@ -374,6 +374,7 @@ class DbUpdateController extends ControllerBase {
'#attributes' => array('class' => array('button', 'button--primary')),
'#weight' => 5,
'#url' => $url,
+ '#access' => $url->access($this->currentUser()),
);
}
diff --git a/core/modules/system/src/Form/DateFormatFormBase.php b/core/modules/system/src/Form/DateFormatFormBase.php
index 9094f3c38..adb24fa42 100644
--- a/core/modules/system/src/Form/DateFormatFormBase.php
+++ b/core/modules/system/src/Form/DateFormatFormBase.php
@@ -91,7 +91,7 @@ abstract class DateFormatFormBase extends EntityForm {
'#default_value' => $this->entity->id(),
'#machine_name' => array(
'exists' => array($this, 'exists'),
- 'replace_pattern' =>'([^a-z0-9_]+)|(^custom$)',
+ 'replace_pattern' => '([^a-z0-9_]+)|(^custom$)',
'error' => $this->t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'),
),
);
diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php
index 0cd54f352..94fc37135 100644
--- a/core/modules/system/src/Form/ModulesListForm.php
+++ b/core/modules/system/src/Form/ModulesListForm.php
@@ -216,7 +216,7 @@ class ModulesListForm extends FormBase {
'#type' => 'link',
'#title' => $this->t('Help'),
'#url' => Url::fromRoute('help.page', ['name' => $module->getName()]),
- '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
+ '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
);
}
diff --git a/core/modules/system/src/Form/ModulesUninstallConfirmForm.php b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
index b317cb20d..f4a482307 100644
--- a/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
+++ b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
@@ -143,7 +143,7 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase {
);
// List the dependent entities.
- $this->addDependencyListsToForm($form, 'module', $this->modules , $this->configManager, $this->entityManager);
+ $this->addDependencyListsToForm($form, 'module', $this->modules, $this->configManager, $this->entityManager);
return parent::buildForm($form, $form_state);
}
diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php
index c2b8389d8..617270bf5 100644
--- a/core/modules/system/src/Form/ModulesUninstallForm.php
+++ b/core/modules/system/src/Form/ModulesUninstallForm.php
@@ -182,7 +182,7 @@ class ModulesUninstallForm extends FormBase {
$account = $this->currentUser()->id();
// Store the values for 6 hours. This expiration time is also used in
// the form cache.
- $this->keyValueExpirable->setWithExpire($account, $uninstall, 6*60*60);
+ $this->keyValueExpirable->setWithExpire($account, $uninstall, 6 * 60 * 60);
// Redirect to the confirm form.
$form_state->setRedirect('system.modules_uninstall_confirm');
diff --git a/core/modules/system/src/Form/RegionalForm.php b/core/modules/system/src/Form/RegionalForm.php
index d879724d2..9472a4cb7 100644
--- a/core/modules/system/src/Form/RegionalForm.php
+++ b/core/modules/system/src/Form/RegionalForm.php
@@ -109,7 +109,7 @@ class RegionalForm extends ConfigFormBase {
'#default_value' => $configurable_timezones,
);
- $form['timezone']['configurable_timezones_wrapper'] = array(
+ $form['timezone']['configurable_timezones_wrapper'] = array(
'#type' => 'container',
'#states' => array(
// Hide the user configured timezone settings when users are forced to use
diff --git a/core/modules/system/src/PathBasedBreadcrumbBuilder.php b/core/modules/system/src/PathBasedBreadcrumbBuilder.php
index 060f1b1a5..dcfc0732f 100644
--- a/core/modules/system/src/PathBasedBreadcrumbBuilder.php
+++ b/core/modules/system/src/PathBasedBreadcrumbBuilder.php
@@ -136,9 +136,9 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
// /user is just a redirect, so skip it.
// @todo Find a better way to deal with /user.
$exclude['/user'] = TRUE;
- // Because this breadcrumb builder is entirely path-based, vary by the
- // 'url.path' cache context.
- $breadcrumb->addCacheContexts(['url.path']);
+ // Add the url.path.parent cache context. This code ignores the last path
+ // part so the result only depends on the path parents.
+ $breadcrumb->addCacheContexts(['url.path.parent']);
while (count($path_elements) > 1) {
array_pop($path_elements);
// Copy the path elements for up-casting.
diff --git a/core/modules/system/src/Plugin/Condition/RequestPath.php b/core/modules/system/src/Plugin/Condition/RequestPath.php
index 50077f9bf..1fb6f2b02 100644
--- a/core/modules/system/src/Plugin/Condition/RequestPath.php
+++ b/core/modules/system/src/Plugin/Condition/RequestPath.php
@@ -147,7 +147,9 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
$request = $this->requestStack->getCurrentRequest();
// Compare the lowercase path alias (if any) and internal path.
- $path = rtrim($this->currentPath->getPath($request), '/');
+ $path = $this->currentPath->getPath($request);
+ // Do not trim a trailing slash if that is the complete path.
+ $path = $path === '/' ? $path : rtrim($path, '/');
$path_alias = Unicode::strtolower($this->aliasManager->getAliasByPath($path));
return $this->pathMatcher->matchPath($path_alias, $pages) || (($path != $path_alias) && $this->pathMatcher->matchPath($path, $pages));
diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php
index fdde6d0c8..80b465067 100644
--- a/core/modules/system/src/Tests/Ajax/DialogTest.php
+++ b/core/modules/system/src/Tests/Ajax/DialogTest.php
@@ -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 @@ class DialogTest extends AjaxTestBase {
$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',
diff --git a/core/modules/system/src/Tests/Ajax/MultiFormTest.php b/core/modules/system/src/Tests/Ajax/MultiFormTest.php
index f81fca2bb..3a8ef1f2a 100644
--- a/core/modules/system/src/Tests/Ajax/MultiFormTest.php
+++ b/core/modules/system/src/Tests/Ajax/MultiFormTest.php
@@ -43,7 +43,7 @@ class MultiFormTest extends AjaxTestBase {
->setComponent($field_name, array('type' => 'text_textfield'))
->save();
- // Login a user who can create 'page' nodes.
+ // Log in a user who can create 'page' nodes.
$this->drupalLogin ($this->drupalCreateUser(array('create page content')));
}
@@ -88,7 +88,7 @@ class MultiFormTest extends AjaxTestBase {
$form = $this->xpath($form_xpath)[$offset];
$field = $form->xpath('.' . $field_xpath);
- $this->assertEqual(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i+2, 'Found the correct number of field items after an AJAX submission.');
+ $this->assertEqual(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i + 2, 'Found the correct number of field items after an AJAX submission.');
$this->assertFieldsByValue($field[0]->xpath('.' . $button_xpath_suffix), NULL, 'Found the "add more" button after an AJAX submission.');
$this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other');
}
diff --git a/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
index b42c2965b..d021f28c8 100644
--- a/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
+++ b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
@@ -4,7 +4,7 @@ namespace Drupal\system\Tests\Asset;
use Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException;
use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
/**
* Tests the library discovery and library discovery parser.
diff --git a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
index fdff0c5da..ebceb890b 100644
--- a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
@@ -89,7 +89,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
* @return \Drupal\Core\Cache\CacheBackendInterface
* Cache backend to test.
*/
- protected function getCacheBackend($bin = null) {
+ protected function getCacheBackend($bin = NULL) {
if (!isset($bin)) {
$bin = $this->getTestBin();
}
diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
index b54aaa726..8074669a4 100644
--- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
+++ b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
@@ -280,7 +280,7 @@ class AttachedAssetsTest extends KernelTestBase {
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_js = $this->renderer->renderPlain($js_render_array);
- $this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0 , 'JavaScript version identifiers correctly appended to URLs');
+ $this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0, 'JavaScript version identifiers correctly appended to URLs');
}
/**
diff --git a/core/modules/system/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php
index 5841c8296..fde7fa683 100644
--- a/core/modules/system/src/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/src/Tests/Common/RenderWebTest.php
@@ -31,7 +31,7 @@ class RenderWebTest extends WebTestBase {
$this->assertTitle('Test active link class | Drupal');
$this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT);
- $this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]);
+ $this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]);
$this->assertIdentical('application/json', $this->drupalGetHeader('Content-Type'));
$json = Json::decode($this->getRawContent());
$this->assertEqual(['content', 'title'], array_keys($json));
@@ -127,7 +127,7 @@ class RenderWebTest extends WebTestBase {
),
);
$this->assertRenderedElement($element, '//a[@href=:href and contains(., :title)]', array(
- ':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(),
+ ':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(),
':title' => $element['#title'],
));
diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
index c59a74a82..e02917de7 100644
--- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
@@ -327,7 +327,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$referencing_entity_url = $this->referencingEntity->urlInfo('canonical');
$non_referencing_entity_url = $this->nonReferencingEntity->urlInfo('canonical');
$listing_url = Url::fromRoute('entity.entity_test.collection_referencing_entities', [
- 'entity_reference_field_name' => $entity_type . '_reference',
+ 'entity_reference_field_name' => $entity_type . '_reference',
'referenced_entity_type' => $entity_type,
'referenced_entity_id' => $this->entity->id(),
]);
@@ -346,7 +346,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$page_cache_tags = Cache::mergeTags(['rendered'], ['config:user.role.anonymous']);
// If the block module is used, the Block page display variant is used,
// which adds the block config entity type's list cache tags.
- $page_cache_tags = Cache::mergeTags($page_cache_tags, \Drupal::moduleHandler()->moduleExists('block') ? ['config:block_list']: []);
+ $page_cache_tags = Cache::mergeTags($page_cache_tags, \Drupal::moduleHandler()->moduleExists('block') ? ['config:block_list'] : []);
$page_cache_tags_referencing_entity = in_array('user.permissions', $this->getAccessCacheContextsForEntity($this->referencingEntity)) ? ['config:user.role.anonymous'] : [];
diff --git a/core/modules/system/src/Tests/Entity/EntityListBuilderTest.php b/core/modules/system/src/Tests/Entity/EntityListBuilderTest.php
index f2067a2b6..2a849b29c 100644
--- a/core/modules/system/src/Tests/Entity/EntityListBuilderTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityListBuilderTest.php
@@ -24,7 +24,7 @@ class EntityListBuilderTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$this->webUser = $this->drupalCreateUser(array(
'administer entity_test content',
));
diff --git a/core/modules/system/src/Tests/Entity/EntityOperationsTest.php b/core/modules/system/src/Tests/Entity/EntityOperationsTest.php
index e1738fd8a..3e4c69f81 100644
--- a/core/modules/system/src/Tests/Entity/EntityOperationsTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityOperationsTest.php
@@ -21,7 +21,7 @@ class EntityOperationsTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$this->drupalLogin($this->drupalCreateUser(array('administer permissions')));
}
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
index 0ecced0a0..86bc703ce 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
@@ -332,6 +332,25 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
),
);
$this->assertReferenceable($selection_options, $referenceable_tests, 'User handler (does not include anonymous)');
+
+ // Check that the Anonymous user is not included in the results when no
+ // label matching is done, for example when using the 'options_select'
+ // widget.
+ $referenceable_tests = array(
+ array(
+ 'arguments' => array(
+ array(NULL),
+ ),
+ 'result' => array(
+ 'user' => array(
+ $users['admin']->id() => $user_labels['admin'],
+ $users['non_admin']->id() => $user_labels['non_admin'],
+ $users['blocked']->id() => $user_labels['blocked'],
+ ),
+ ),
+ ),
+ );
+ $this->assertReferenceable($selection_options, $referenceable_tests, 'User handler (does not include anonymous)');
}
/**
diff --git a/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
index c3cb5c5d9..f7420b4ac 100644
--- a/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
@@ -29,7 +29,7 @@ class EntityRevisionsTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login user.
+ // Create and log in user.
$this->webUser = $this->drupalCreateUser(array(
'administer entity_test content',
'view test entity',
diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php
new file mode 100644
index 000000000..38174f5e7
--- /dev/null
+++ b/core/modules/system/src/Tests/Installer/InstallerExistingConfigDirectoryTest.php
@@ -0,0 +1,33 @@
+settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) array(
+ 'value' => $this->siteDirectory . '/config',
+ 'required' => TRUE,
+ );
+ parent::setUp();
+ }
+
+ /**
+ * Verifies that installation succeeded.
+ */
+ public function testInstaller() {
+ $this->assertUrl('user/1');
+ $this->assertResponse(200);
+ }
+
+}
diff --git a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
index a06c88672..7b8af6217 100644
--- a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
@@ -4,7 +4,7 @@ namespace Drupal\system\Tests\KeyValueStore;
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\Core\Entity\EntityStorageException;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
use Drupal\entity_test\Entity\EntityTestLabel;
/**
diff --git a/core/modules/system/src/Tests/Module/ClassLoaderTest.php b/core/modules/system/src/Tests/Module/ClassLoaderTest.php
index ab89ba940..5d654fd51 100644
--- a/core/modules/system/src/Tests/Module/ClassLoaderTest.php
+++ b/core/modules/system/src/Tests/Module/ClassLoaderTest.php
@@ -26,7 +26,7 @@ class ClassLoaderTest extends WebTestBase {
\Drupal::service('module_installer')->install(array('module_test', 'module_autoload_test'), FALSE);
$this->resetAll();
// Check twice to test an unprimed and primed system_list() cache.
- for ($i=0; $i<2; $i++) {
+ for ($i = 0; $i < 2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertText($this->expected, 'Autoloader loads classes from an enabled module.');
}
@@ -42,7 +42,7 @@ class ClassLoaderTest extends WebTestBase {
$this->container->get('module_installer')->uninstall(array('module_autoload_test'), FALSE);
$this->resetAll();
// Check twice to test an unprimed and primed system_list() cache.
- for ($i=0; $i<2; $i++) {
+ for ($i = 0; $i < 2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
}
diff --git a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php b/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php
index 1ffbaac1a..dbdb3ac06 100644
--- a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php
+++ b/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php
@@ -127,5 +127,14 @@ class RequestPathTest extends KernelTestBase {
$this->assertFalse($condition->evaluate(), 'The system_path /my/pass/page4 fails for a missing path.');
+ // Test a path of '/'.
+ $this->aliasManager->addAlias('/', '/my/pass/page3');
+ $this->currentPath->setPath('/', $request);
+ $this->requestStack->pop();
+ $this->requestStack->push($request);
+
+ $this->assertTrue($condition->evaluate(), 'The system_path my/pass/page3 passes for wildcard paths.');
+ $this->assertEqual($condition->summary(), 'Return true on the following pages: /my/pass/*', 'The condition summary matches for a wildcard path');
+
}
}
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
index 95705d473..d3d44879b 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
+++ b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
@@ -82,4 +82,3 @@ abstract class DiscoveryTestBase extends KernelTestBase {
}
}
-
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php b/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php
index 958899b7e..869ac1843 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php
+++ b/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php
@@ -43,4 +43,3 @@ class StaticDiscoveryTest extends DiscoveryTestBase {
$this->emptyDiscovery = $discovery;
}
}
-
diff --git a/core/modules/system/src/Tests/Render/AjaxPageStateTest.php b/core/modules/system/src/Tests/Render/AjaxPageStateTest.php
index c4ddaffb2..4ea8ddcb1 100644
--- a/core/modules/system/src/Tests/Render/AjaxPageStateTest.php
+++ b/core/modules/system/src/Tests/Render/AjaxPageStateTest.php
@@ -24,7 +24,7 @@ class AjaxPageStateTest extends WebTestBase {
$this->adminUser = $this->drupalCreateUser(array_keys(\Drupal::service('user.permissions')
->getPermissions()));
- // Login so there are more libraries to test with otherwise only html5shiv
+ // Log in so there are more libraries to test with otherwise only html5shiv
// is the only one in the source we can easily test for.
$this->drupalLogin($this->adminUser);
}
diff --git a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php b/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
index 42f86a85a..102aa1a5e 100644
--- a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
+++ b/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
@@ -44,7 +44,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testCreate() {
$connection = Database::getConnection();
- $dumper= new MatcherDumper($connection, $this->state);
+ $dumper = new MatcherDumper($connection, $this->state);
$class_name = 'Drupal\Core\Routing\MatcherDumper';
$this->assertTrue($dumper instanceof $class_name, 'Dumper created successfully');
@@ -55,7 +55,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testAddRoutes() {
$connection = Database::getConnection();
- $dumper= new MatcherDumper($connection, $this->state);
+ $dumper = new MatcherDumper($connection, $this->state);
$route = new Route('test');
$collection = new RouteCollection();
@@ -76,7 +76,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testAddAdditionalRoutes() {
$connection = Database::getConnection();
- $dumper= new MatcherDumper($connection, $this->state);
+ $dumper = new MatcherDumper($connection, $this->state);
$route = new Route('test');
$collection = new RouteCollection();
diff --git a/core/modules/system/src/Tests/Routing/MockAliasManager.php b/core/modules/system/src/Tests/Routing/MockAliasManager.php
index 4a615bfc3..f2c9a0b02 100644
--- a/core/modules/system/src/Tests/Routing/MockAliasManager.php
+++ b/core/modules/system/src/Tests/Routing/MockAliasManager.php
@@ -76,6 +76,10 @@ class MockAliasManager implements AliasManagerInterface {
* @return
*/
public function getAliasByPath($path, $langcode = NULL) {
+ if ($path[0] !== '/') {
+ throw new \InvalidArgumentException(sprintf('Source path %s has to start with a slash.', $path));
+ }
+
$langcode = $langcode ?: $this->defaultLanguage;
$this->lookedUp[$path] = 1;
return $this->aliases[$path][$langcode];
diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php
index 6c0c6ee13..f9c52ed61 100644
--- a/core/modules/system/src/Tests/Session/SessionTest.php
+++ b/core/modules/system/src/Tests/Session/SessionTest.php
@@ -50,7 +50,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
- $this->assertTrue(!empty($matches[1]) , 'Found session ID before logging in.');
+ $this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
@@ -67,7 +67,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
- $this->assertTrue(!empty($matches[1]) , 'Found session ID after logging in.');
+ $this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
$this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
}
diff --git a/core/modules/system/src/Tests/System/AccessDeniedTest.php b/core/modules/system/src/Tests/System/AccessDeniedTest.php
index ab0264b90..81f9fad18 100644
--- a/core/modules/system/src/Tests/System/AccessDeniedTest.php
+++ b/core/modules/system/src/Tests/System/AccessDeniedTest.php
@@ -56,7 +56,7 @@ class AccessDeniedTest extends WebTestBase {
'site_403' => 'user/' . $this->adminUser->id(),
];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
- $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_403']]));
+ $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_403']]));
// Use a custom 403 page.
$edit = [
diff --git a/core/modules/system/src/Tests/System/DateTimeTest.php b/core/modules/system/src/Tests/System/DateTimeTest.php
index ca998fe5e..f1202cc0b 100644
--- a/core/modules/system/src/Tests/System/DateTimeTest.php
+++ b/core/modules/system/src/Tests/System/DateTimeTest.php
@@ -19,13 +19,20 @@ class DateTimeTest extends WebTestBase {
*
* @var array
*/
- public static $modules = ['block', 'node', 'language'];
+ public static $modules = ['block', 'node', 'language', 'field', 'field_ui', 'datetime', 'options'];
protected function setUp() {
parent::setUp();
// Create admin user and log in admin user.
- $this->drupalLogin ($this->drupalCreateUser(array('administer site configuration')));
+ $this->drupalLogin ($this->drupalCreateUser(array(
+ 'administer site configuration',
+ 'administer content types',
+ 'administer nodes',
+ 'administer node fields',
+ 'administer node form display',
+ 'administer node display',
+ )));
$this->drupalPlaceBlock('local_actions_block');
}
@@ -157,4 +164,64 @@ class DateTimeTest extends WebTestBase {
$this->assertEscaped('' . date("Y") . '');
}
+ /**
+ * Test handling case with invalid data in selectors (like February, 31st).
+ */
+ function testEnteringDateTimeViaSelectors() {
+
+ $this->drupalCreateContentType(array('type' => 'page_with_date', 'name' => 'Page with date'));
+
+ $this->drupalGet('admin/structure/types/manage/page_with_date');
+ $this->assertResponse(200, 'Content type created.');
+
+ $this->drupalGet('admin/structure/types/manage/page_with_date/fields/add-field');
+ $edit = array(
+ 'new_storage_type' => 'datetime',
+ 'label' => 'dt',
+ 'field_name' => 'dt',
+ );
+ $this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/add-field', $edit, t('Save and continue'));
+ $this->assertText(t('These settings apply to the'), 'New datetime field created, now configuring');
+
+ $this->drupalGet('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage');
+ $edit = array(
+ 'settings[datetime_type]' => 'datetime',
+ 'cardinality' => 'number',
+ 'cardinality_number' => '1',
+ );
+ $this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage', $edit, t('Save field settings'));
+
+ $this->drupalGet('admin/structure/types/manage/page_with_date/fields');
+ $this->assertText('field_dt', 'New field is in place');
+
+ $this->drupalGet('admin/structure/types/manage/page_with_date/form-display');
+ $edit = array(
+ 'fields[field_dt][type]' => 'datetime_datelist',
+ );
+ $this->drupalPostForm('admin/structure/types/manage/page_with_date/form-display', $edit, t('Save'));
+ $this->drupalLogout();
+
+ // Now log in as a regular editor.
+ $this->drupalLogin($this->drupalCreateUser(array('create page_with_date content')));
+
+ $this->drupalGet('node/add/page_with_date');
+ $edit = array(
+ 'title[0][value]' => 'sample doc',
+ 'field_dt[0][value][year]' => '2016',
+ 'field_dt[0][value][month]' => '2',
+ 'field_dt[0][value][day]' => '31',
+ 'field_dt[0][value][hour]' => '1',
+ 'field_dt[0][value][minute]' => '30',
+ );
+ $this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
+ $this->assertText(t('Selected combination of day and month is not valid.'), 'Inorrect date failed validation');
+
+ $edit['field_dt[0][value][day]'] = '29';
+ $this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
+ $this->assertNoText(t('Selected combination of day and month is not valid.'), 'Correct date passed validation.');
+
+ $this->drupalGet('node/1');
+ $this->assertText(t('Mon, 02/29/2016 - 01:30'), 'Node successfully created with valid date.');
+ }
+
}
diff --git a/core/modules/system/src/Tests/System/FloodTest.php b/core/modules/system/src/Tests/System/FloodTest.php
index 59f4852ef..a3a336831 100644
--- a/core/modules/system/src/Tests/System/FloodTest.php
+++ b/core/modules/system/src/Tests/System/FloodTest.php
@@ -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 @@ class FloodTest extends WebTestBase {
$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 @@ class FloodTest extends WebTestBase {
$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.
diff --git a/core/modules/system/src/Tests/System/FrontPageTest.php b/core/modules/system/src/Tests/System/FrontPageTest.php
index 8550ac9fc..39295f844 100644
--- a/core/modules/system/src/Tests/System/FrontPageTest.php
+++ b/core/modules/system/src/Tests/System/FrontPageTest.php
@@ -70,7 +70,7 @@ class FrontPageTest extends WebTestBase {
// Change the front page to a path without a starting slash.
$edit = ['site_frontpage' => $this->nodePath];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
- $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_frontpage']]));
+ $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_frontpage']]));
// Change the front page to a valid path.
$edit['site_frontpage'] = '/' . $this->nodePath;
diff --git a/core/modules/system/src/Tests/System/MainContentFallbackTest.php b/core/modules/system/src/Tests/System/MainContentFallbackTest.php
index f0ea0400b..9c88d96b9 100644
--- a/core/modules/system/src/Tests/System/MainContentFallbackTest.php
+++ b/core/modules/system/src/Tests/System/MainContentFallbackTest.php
@@ -24,7 +24,7 @@ class MainContentFallbackTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- // Create and login admin user.
+ // Create and log in admin user.
$this->adminUser = $this->drupalCreateUser(array(
'access administration pages',
'administer site configuration',
diff --git a/core/modules/system/src/Tests/System/PageNotFoundTest.php b/core/modules/system/src/Tests/System/PageNotFoundTest.php
index 5e12ac63b..f289f0e40 100644
--- a/core/modules/system/src/Tests/System/PageNotFoundTest.php
+++ b/core/modules/system/src/Tests/System/PageNotFoundTest.php
@@ -44,7 +44,7 @@ class PageNotFoundTest extends WebTestBase {
'site_404' => 'user/' . $this->adminUser->id(),
];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
- $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_404']]));
+ $this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_404']]));
// Use a custom 404 page.
$edit = array(
diff --git a/core/modules/system/src/Tests/System/SitesDirectoryHardeningTest.php b/core/modules/system/src/Tests/System/SitesDirectoryHardeningTest.php
index aef36a265..f989d2236 100644
--- a/core/modules/system/src/Tests/System/SitesDirectoryHardeningTest.php
+++ b/core/modules/system/src/Tests/System/SitesDirectoryHardeningTest.php
@@ -29,13 +29,13 @@ class SitesDirectoryHardeningTest extends WebTestBase {
// We intentionally don't check for settings.local.php as that file is
// not created by Drupal.
- $this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file.', array('@file' => $settings_file)));
+ $this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file.', array('@file' => $settings_file)));
$this->makeWritable($site_path);
$this->checkSystemRequirements();
$this->assertTrue(drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir'), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $site_path)));
- $this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $settings_file)));
+ $this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $settings_file)));
}
/**
diff --git a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
index f90862135..ef3c4697d 100644
--- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
+++ b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
@@ -128,4 +128,3 @@ class TwigEnvironmentTest extends KernelTestBase {
}
}
-
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
index 2f225338f..9903240b0 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
@@ -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 @@ class TypedDataTest extends KernelTestBase {
$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 @@ class TypedDataTest extends KernelTestBase {
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 @@ class TypedDataTest extends KernelTestBase {
// 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 @@ class TypedDataTest extends KernelTestBase {
// 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 @@ class TypedDataTest extends KernelTestBase {
// 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 @@ class TypedDataTest extends KernelTestBase {
// 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 @@ class TypedDataTest extends KernelTestBase {
// Timestamp type.
$value = REQUEST_TIME;
$typed_data = $this->createTypedData(array('type' => 'timestamp'), $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, 'Timestamp value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = REQUEST_TIME + 1;
@@ -176,7 +184,7 @@ class TypedDataTest extends KernelTestBase {
// DurationIso8601 type.
$value = 'PT20S';
$typed_data = $this->createTypedData(array('type' => 'duration_iso8601'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
+ $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue('P40D');
@@ -200,7 +208,7 @@ class TypedDataTest extends KernelTestBase {
// Time span type.
$value = 20;
$typed_data = $this->createTypedData(array('type' => 'timespan'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
+ $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'Time span value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(60 * 60 * 4);
@@ -223,7 +231,7 @@ class TypedDataTest extends KernelTestBase {
// URI type.
$uri = 'http://example.com/foo/';
$typed_data = $this->createTypedData(array('type' => 'uri'), $uri);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\UriInterface, 'Typed data object is an instance of UriInterface.');
+ $this->assertTrue($typed_data instanceof UriInterface, 'Typed data object is an instance of UriInterface.');
$this->assertTrue($typed_data->getValue() === $uri, 'URI value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue($uri . 'bar.txt');
@@ -251,7 +259,7 @@ class TypedDataTest extends KernelTestBase {
// Email type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'email'), $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->assertIdentical($typed_data->getValue(), $value, 'Email value was fetched.');
$new_value = 'test@example.com';
$typed_data->setValue($new_value);
@@ -266,7 +274,7 @@ class TypedDataTest extends KernelTestBase {
// Binary type.
$typed_data = $this->createTypedData(array('type' => 'binary'), $files[0]->getFileUri());
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
+ $this->assertTrue($typed_data instanceof BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
$this->assertTrue(is_resource($typed_data->getValue()), 'Binary value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
// Try setting by URI.
@@ -441,7 +449,7 @@ class TypedDataTest extends KernelTestBase {
// Test iterating.
$count = 0;
foreach ($typed_data as $item) {
- $this->assertTrue($item instanceof \Drupal\Core\TypedData\TypedDataInterface);
+ $this->assertTrue($item instanceof TypedDataInterface);
$count++;
}
$this->assertEqual($count, 3);
diff --git a/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php b/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
index fe16644ee..ee47a81d5 100644
--- a/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
+++ b/core/modules/system/src/Tests/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
@@ -51,7 +51,7 @@ class LocalActionsAndTasksConvertedIntoBlocksUpdateTest extends UpdatePathTestBa
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
- // We finished updating so we can login the user now.
+ // We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
$page = Node::create([
diff --git a/core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php b/core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
index 99f85fe6f..6a81566ea 100644
--- a/core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
@@ -50,7 +50,7 @@ class PageTitleConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
- // We finished updating so we can login the user now.
+ // We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
$page = Node::create([
diff --git a/core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php b/core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
index 797c808be..b61cf20d4 100644
--- a/core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/src/Tests/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
@@ -45,7 +45,7 @@ class SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest extends UpdatePathTes
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
- // We finished updating so we can login the user now.
+ // We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
// Local actions are visible on the content listing page.
diff --git a/core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php b/core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
index c77d3d8d3..c60c2b0dc 100644
--- a/core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/src/Tests/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
@@ -45,7 +45,7 @@ class SiteBrandingConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
- // We finished updating so we can login the user now.
+ // We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
// Site branding is visible on the home page.
diff --git a/core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingFilledTest.php b/core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingFilledTest.php
index 0cd3da816..147c8c048 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingFilledTest.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingFilledTest.php
@@ -14,7 +14,7 @@ class UpdatePathWithBrokenRoutingFilledTest extends UpdatePathWithBrokenRoutingT
*/
protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
- $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
+ $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
}
}
diff --git a/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/core/modules/system/src/Tests/Update/UpdateScriptTest.php
index 7b5638d48..3f4edffc0 100644
--- a/core/modules/system/src/Tests/Update/UpdateScriptTest.php
+++ b/core/modules/system/src/Tests/Update/UpdateScriptTest.php
@@ -56,20 +56,38 @@ class UpdateScriptTest extends WebTestBase {
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(403);
+ // Check that a link to the update page is not accessible to regular users.
+ $this->drupalGet('/update-script-test/database-updates-menu-item');
+ $this->assertNoLink('Run database updates');
+
// Try accessing update.php as an anonymous user.
$this->drupalLogout();
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(403);
+ // Check that a link to the update page is not accessible to anonymous
+ // users.
+ $this->drupalGet('/update-script-test/database-updates-menu-item');
+ $this->assertNoLink('Run database updates');
+
// Access the update page with the proper permission.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(200);
+ // Check that a link to the update page is accessible to users with proper
+ // permissions.
+ $this->drupalGet('/update-script-test/database-updates-menu-item');
+ $this->assertLink('Run database updates');
+
// Access the update page as user 1.
$this->drupalLogin($this->rootUser);
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(200);
+
+ // Check that a link to the update page is accessible to user 1.
+ $this->drupalGet('/update-script-test/database-updates-menu-item');
+ $this->assertLink('Run database updates');
}
/**
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 704b2dc7e..f9c49c765 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -385,4 +385,3 @@ function template_preprocess_system_themes_page(&$variables) {
}
$variables['theme_groups'] = $groups;
}
-
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index a02a22374..c7168919d 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -384,7 +384,7 @@ function system_requirements($phase) {
}
foreach (array('settings.php', 'settings.local.php', 'services.yml') as $conf_file) {
$full_path = $site_path . '/' . $conf_file;
- if (file_exists($full_path) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($full_path, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE))) {
+ if (file_exists($full_path) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($full_path, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE))) {
$conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", array('%file' => $full_path));
}
}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 3033a110e..787225220 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1254,7 +1254,7 @@ function system_get_module_admin_tasks($module, array $info) {
$access_manager = \Drupal::service('access_manager');
if ($access_manager->checkNamedRoute('user.admin_permissions', array(), \Drupal::currentUser())) {
/** @var \Drupal\Core\Url $url */
- $url = new \Drupal\Core\Url('user.admin_permissions');
+ $url = new Url('user.admin_permissions');
$url->setOption('fragment', 'module-' . $module);
$admin_tasks["user.admin_permissions.$module"] = array(
'title' => t('Configure @module permissions', array('@module' => $info['name'])),
diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml
index ed111f8c9..5f75f2f28 100644
--- a/core/modules/system/system.routing.yml
+++ b/core/modules/system/system.routing.yml
@@ -465,7 +465,7 @@ system.db_update:
defaults:
op: 'info'
requirements:
- _access: 'TRUE'
+ _access_system_update: 'TRUE'
options:
default_url_options:
path_processing: FALSE
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.block-content-uninstall.php b/core/modules/system/tests/fixtures/update/drupal-8.block-content-uninstall.php
index 71939bad6..7c2ca9470 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.block-content-uninstall.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.block-content-uninstall.php
@@ -147,4 +147,3 @@ $connection->delete('router')
$connection->delete('router')
->condition('name', 'entity.block_content_type.%', 'LIKE')
->execute();
-
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
index 23b67e55a..34474bf62 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
@@ -6,19 +6,20 @@
* upgrade path of https://www.drupal.org/node/2354889.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// A custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
// A custom block without any visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
// A custom block with visibility settings that contain a non-existing context
// mapping.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.broken_routing.php b/core/modules/system/tests/fixtures/update/drupal-8.broken_routing.php
index 7a83e870e..604321ddc 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.broken_routing.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.broken_routing.php
@@ -20,4 +20,3 @@ $connection->update('config')
$connection->insert('key_value')
->fields(['collection' => 'system.schema', 'name' => 'update_script_test', 'value' => serialize(8000)])
->execute();
-
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php b/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
index 986362f26..33861a0f9 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php b/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
index ae3e77720..b259ccc9b 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2476947.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php b/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
index 474a08526..f19c07c7d 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php b/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
index 576762d08..c632060af 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2005546.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-enabled.php b/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-enabled.php
index 375b50ddb..a6243a138 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-enabled.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-enabled.php
@@ -37,4 +37,3 @@ $connection->update('config')
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
-
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-failing-enabled.php b/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-failing-enabled.php
index f19a1f108..ab37f83af 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-failing-enabled.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.update-test-postupdate-failing-enabled.php
@@ -36,4 +36,3 @@ $connection->update('config')
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
-
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php b/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
index 2d8da457f..fe72370b3 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
@@ -6,6 +6,7 @@
* upgrade path of https://www.drupal.org/node/2455125.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
@@ -13,7 +14,7 @@ $connection = Database::getConnection();
// Structure of a view with timestamp fields.
$views_configs = [];
-$views_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
+$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php b/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
index 87b635502..b245f74e8 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
@@ -5,7 +5,9 @@
* Test fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$config = $connection;
$connection->merge('config')
diff --git a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
index 3e470884d..ecde048bc 100644
--- a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
+++ b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
@@ -5,8 +5,22 @@
* Simpletest mock module for Ajax forms testing.
*/
-use Drupal\Core\Ajax;
+use Drupal\Core\Ajax\AddCssCommand;
+use Drupal\Core\Ajax\AfterCommand;
use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\AlertCommand;
+use Drupal\Core\Ajax\AppendCommand;
+use Drupal\Core\Ajax\BeforeCommand;
+use Drupal\Core\Ajax\ChangedCommand;
+use Drupal\Core\Ajax\CssCommand;
+use Drupal\Core\Ajax\DataCommand;
+use Drupal\Core\Ajax\HtmlCommand;
+use Drupal\Core\Ajax\InsertCommand;
+use Drupal\Core\Ajax\InvokeCommand;
+use Drupal\Core\Ajax\PrependCommand;
+use Drupal\Core\Ajax\RemoveCommand;
+use Drupal\Core\Ajax\RestripeCommand;
+use Drupal\Core\Ajax\SettingsCommand;
use Drupal\Core\Form\FormStateInterface;
/**
@@ -16,7 +30,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
$selector = '#after_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AfterCommand($selector, "This will be placed after"));
+ $response->addCommand(new AfterCommand($selector, "This will be placed after"));
return $response;
}
@@ -25,7 +39,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
*/
function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AlertCommand('Alert'));
+ $response->addCommand(new AlertCommand('Alert'));
return $response;
}
@@ -35,7 +49,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterf
function ajax_forms_test_advanced_commands_append_callback($form, FormStateInterface $form_state) {
$selector = '#append_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AppendCommand($selector, "Appended text"));
+ $response->addCommand(new AppendCommand($selector, "Appended text"));
return $response;
}
@@ -45,7 +59,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, FormStateInter
function ajax_forms_test_advanced_commands_before_callback($form, FormStateInterface $form_state) {
$selector = '#before_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\BeforeCommand($selector, "Before text"));
+ $response->addCommand(new BeforeCommand($selector, "Before text"));
return $response;
}
@@ -54,7 +68,7 @@ function ajax_forms_test_advanced_commands_before_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\ChangedCommand('#changed_div'));
+ $response->addCommand(new ChangedCommand('#changed_div'));
return $response;
}
@@ -63,7 +77,7 @@ function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\ChangedCommand('#changed_div', '#changed_div_mark_this'));
+ $response->addCommand(new ChangedCommand('#changed_div', '#changed_div_mark_this'));
return $response;
}
@@ -75,7 +89,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
$color = 'blue';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\CssCommand($selector, array('background-color' => $color)));
+ $response->addCommand(new CssCommand($selector, array('background-color' => $color)));
return $response;
}
@@ -85,7 +99,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterface $form_state) {
$selector = '#data_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\DataCommand($selector, 'testkey', 'testvalue'));
+ $response->addCommand(new DataCommand($selector, 'testkey', 'testvalue'));
return $response;
}
@@ -94,7 +108,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\InvokeCommand('#invoke_div', 'addClass', array('error')));
+ $response->addCommand(new InvokeCommand('#invoke_div', 'addClass', array('error')));
return $response;
}
@@ -103,7 +117,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\HtmlCommand('#html_div', 'replacement text'));
+ $response->addCommand(new HtmlCommand('#html_div', 'replacement text'));
return $response;
}
@@ -112,7 +126,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\InsertCommand('#insert_div', 'insert replacement text'));
+ $response->addCommand(new InsertCommand('#insert_div', 'insert replacement text'));
return $response;
}
@@ -121,7 +135,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\PrependCommand('#prepend_div', "prepended text"));
+ $response->addCommand(new PrependCommand('#prepend_div', "prepended text"));
return $response;
}
@@ -130,7 +144,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\RemoveCommand('#remove_text'));
+ $response->addCommand(new RemoveCommand('#remove_text'));
return $response;
}
@@ -139,7 +153,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\RestripeCommand('#restripe_table'));
+ $response->addCommand(new RestripeCommand('#restripe_table'));
return $response;
}
@@ -149,7 +163,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInt
function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInterface $form_state) {
$setting['ajax_forms_test']['foo'] = 42;
$response = new AjaxResponse();
- $response->addCommand(new Ajax\SettingsCommand($setting));
+ $response->addCommand(new SettingsCommand($setting));
return $response;
}
@@ -158,7 +172,7 @@ function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInt
*/
function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AddCssCommand('my/file.css'));
+ $response->addCommand(new AddCssCommand('my/file.css'));
return $response;
}
diff --git a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php b/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
index e47f010bf..c5724e045 100644
--- a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
+++ b/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
@@ -4,7 +4,7 @@ namespace Drupal\condition_test\Tests;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
use Drupal\user\Entity\User;
/**
diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module
index 460480a0d..1eaa103fa 100644
--- a/core/modules/system/tests/modules/database_test/database_test.module
+++ b/core/modules/system/tests/modules/database_test/database_test.module
@@ -47,4 +47,3 @@ function database_test_query_alter(AlterableInterface $query) {
function database_test_query_database_test_alter_remove_range_alter(AlterableInterface $query) {
$query->range();
}
-
diff --git a/core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php b/core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php
index 5e84cb7e8..96125548b 100644
--- a/core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php
+++ b/core/modules/system/tests/modules/database_test/src/Form/DatabaseTestForm.php
@@ -52,7 +52,7 @@ class DatabaseTestForm extends FormBase {
$options[$account->id()] = array(
'title' => array('data' => array('#title' => $account->getUsername())),
'username' => $account->getUsername(),
- 'status' => $account->isActive() ? t('active') : t('blocked'),
+ 'status' => $account->isActive() ? t('active') : t('blocked'),
);
}
diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php
index bd46423ff..b299d9011 100644
--- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php
+++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php
@@ -63,6 +63,13 @@ class EntityTestRev extends EntityTest {
$fields['name']->setRevisionable(TRUE);
$fields['user_id']->setRevisionable(TRUE);
+ $fields['non_rev_field'] = BaseFieldDefinition::create('string')
+ ->setLabel(t('Non Revisionable Field'))
+ ->setDescription(t('A non-revisionable test field.'))
+ ->setRevisionable(FALSE)
+ ->setCardinality(1)
+ ->setReadOnly(TRUE);
+
return $fields;
}
diff --git a/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module b/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
index bdea7ba2a..2b050ea93 100644
--- a/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
+++ b/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
@@ -5,12 +5,13 @@
* Contains hook implementations for Entity Operation Test Module.
*/
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Implements hook_entity_operation().
*/
-function entity_test_operation_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) {
+function entity_test_operation_entity_operation(EntityInterface $entity) {
return [
'test' => [
'title' => t('Front page'),
diff --git a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php
index 5b77e209f..03ae3664d 100644
--- a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php
+++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php
@@ -46,7 +46,7 @@ class ErrorTestController extends ControllerBase {
// This will generate a notice.
$monkey_love = $bananas;
// This will generate a warning.
- $awesomely_big = 1/0;
+ $awesomely_big = 1 / 0;
// This will generate a user error. Use & to check for double escaping.
trigger_error("Drupal & awesome", E_USER_WARNING);
return [];
diff --git a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
index 040674fe1..5bdb22a35 100644
--- a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
+++ b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
@@ -2,6 +2,8 @@
namespace Drupal\module_test\Controller;
+use Drupal\module_autoload_test\SomeClass;
+
/**
* Controller routines for module_test routes.
*/
@@ -38,7 +40,7 @@ class ModuleTestController {
public function testClassLoading() {
$markup = NULL;
if (class_exists('Drupal\module_autoload_test\SomeClass')) {
- $obj = new \Drupal\module_autoload_test\SomeClass();
+ $obj = new SomeClass();
$markup = $obj->testMethod();
}
return ['#markup' => $markup];
diff --git a/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/FruitInterface.php b/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/FruitInterface.php
index 8b7c97079..62e0c38ae 100644
--- a/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/FruitInterface.php
+++ b/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/FruitInterface.php
@@ -6,4 +6,3 @@ namespace Drupal\plugin_test\Plugin\plugin_test\fruit;
* Provides an interface for test plugins.
*/
interface FruitInterface { }
-
diff --git a/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/mock_block/MockMenuBlock.php b/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/mock_block/MockMenuBlock.php
index 50405f941..2a5183542 100644
--- a/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/mock_block/MockMenuBlock.php
+++ b/core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/mock_block/MockMenuBlock.php
@@ -36,10 +36,10 @@ class MockMenuBlock {
// nesting level. For depth=2, this returns:
// ''.
$content = '';
- for ($i=0; $i < $this->depth; $i++) {
- $content .= '- ' . implode('.', array_fill(0, $i+1, '1'));
+ for ($i = 0; $i < $this->depth; $i++) {
+ $content .= '
- ' . implode('.', array_fill(0, $i + 1, '1'));
}
- for ($i=0; $i < $this->depth; $i++) {
+ for ($i = 0; $i < $this->depth; $i++) {
$content .= '
';
}
return $content;
diff --git a/core/modules/system/tests/modules/system_test/src/Controller/PageCacheAcceptHeaderController.php b/core/modules/system/tests/modules/system_test/src/Controller/PageCacheAcceptHeaderController.php
index 9997fb09f..a15e6815d 100644
--- a/core/modules/system/tests/modules/system_test/src/Controller/PageCacheAcceptHeaderController.php
+++ b/core/modules/system/tests/modules/system_test/src/Controller/PageCacheAcceptHeaderController.php
@@ -28,4 +28,3 @@ class PageCacheAcceptHeaderController {
}
}
}
-
diff --git a/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php b/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php
index 63500417c..9e716002a 100644
--- a/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php
+++ b/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php
@@ -14,7 +14,7 @@ class MockFileTransfer {
* A new Drupal\system_test\MockFileTransfer object.
*/
public static function factory() {
- return new MockFileTransfer;
+ return new MockFileTransfer();
}
/**
diff --git a/core/modules/system/tests/modules/theme_test/src/ThemeTestController.php b/core/modules/system/tests/modules/theme_test/src/ThemeTestController.php
index c68de2b8c..639f1b743 100644
--- a/core/modules/system/tests/modules/theme_test/src/ThemeTestController.php
+++ b/core/modules/system/tests/modules/theme_test/src/ThemeTestController.php
@@ -81,7 +81,7 @@ class ThemeTestController extends ControllerBase {
* Content in theme_test_output GLOBAL.
*/
public function testRequestListener() {
- return ['#markup' => $GLOBALS['theme_test_output']];
+ return ['#markup' => $GLOBALS['theme_test_output']];
}
/**
diff --git a/core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php b/core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php
index b36b3f45a..68c8b64e5 100644
--- a/core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php
+++ b/core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php
@@ -17,4 +17,3 @@ class TrustedHostsTestController {
}
}
-
diff --git a/core/modules/system/tests/modules/twig_extension_test/twig_extension_test.module b/core/modules/system/tests/modules/twig_extension_test/twig_extension_test.module
index 1c2729bee..f55e619a7 100644
--- a/core/modules/system/tests/modules/twig_extension_test/twig_extension_test.module
+++ b/core/modules/system/tests/modules/twig_extension_test/twig_extension_test.module
@@ -20,4 +20,3 @@ function twig_extension_test_theme($existing, $type, $theme, $path) {
),
);
}
-
diff --git a/core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php b/core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php
new file mode 100644
index 000000000..b72ab1b91
--- /dev/null
+++ b/core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php
@@ -0,0 +1,31 @@
+getBaseUrl());
+ $url = (new Url('system.db_update'))->setOption('base_url', $base_url);
+ $build['main'] = array(
+ '#type' => 'link',
+ '#title' => $this->t('Run database updates'),
+ '#url' => $url,
+ '#access' => $url->access($this->currentUser()),
+ );
+
+ return $build;
+ }
+
+}
diff --git a/core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml b/core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml
new file mode 100644
index 000000000..68823de20
--- /dev/null
+++ b/core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml
@@ -0,0 +1,6 @@
+update_script_test.database_updates_menu_item:
+ path: '/update-script-test/database-updates-menu-item'
+ defaults:
+ _controller: '\Drupal\update_script_test\Controller\UpdateScriptTestController::databaseUpdatesMenuItem'
+ requirements:
+ _access: 'TRUE'
diff --git a/core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php b/core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php
index cddad74ce..54e1ddf61 100644
--- a/core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php
+++ b/core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php
@@ -64,6 +64,6 @@ function update_test_postupdate_post_update_test_batch(&$sandbox = NULL) {
$execution[] = __FUNCTION__ . '-' . $sandbox['current_step'];
\Drupal::state()->set('post_update_test_execution', $execution);
- $sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
+ $sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
return 'Test post update batches';
}
diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
index d691beb77..9beac7a86 100644
--- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\system\Kernel\Extension;
+use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use \Drupal\Core\Extension\ModuleUninstallValidatorException;
use Drupal\entity_test\Entity\EntityTest;
@@ -121,7 +122,7 @@ class ModuleHandlerTest extends KernelTestBase {
$result = $this->moduleInstaller()->install(array('color'));
$this->fail(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}
- catch (\Drupal\Core\Extension\MissingDependencyException $e) {
+ catch (MissingDependencyException $e) {
$this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}
diff --git a/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php
similarity index 98%
rename from core/modules/system/src/Tests/System/TokenReplaceUnitTest.php
rename to core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php
index 049d89eb3..ea39f6981 100644
--- a/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php
+++ b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php
@@ -1,6 +1,6 @@
builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([], $breadcrumb->getLinks());
- $this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -159,7 +159,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url(''))], $breadcrumb->getLinks());
- $this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -194,7 +194,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url('')), 1 => new Link('Example', new Url('example'))], $breadcrumb->getLinks());
- $this->assertEquals(['url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -245,7 +245,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
new Link('Example', new Url('example')),
new Link('Bar', new Url('example_bar')),
], $breadcrumb->getLinks());
- $this->assertEquals(['bar', 'url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['bar', 'url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals(['example'], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -272,7 +272,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
// No path matched, though at least the frontpage is displayed.
$this->assertEquals([0 => new Link('Home', new Url(''))], $breadcrumb->getLinks());
- $this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -316,7 +316,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
// No path matched, though at least the frontpage is displayed.
$this->assertEquals([0 => new Link('Home', new Url(''))], $breadcrumb->getLinks());
- $this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@@ -364,7 +364,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url('')), 1 => new Link('Admin', new Url('user_page'))], $breadcrumb->getLinks());
- $this->assertEquals(['url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
+ $this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
diff --git a/core/modules/system/tests/src/Unit/Installer/InstallTranslationFilePatternTest.php b/core/modules/system/tests/src/Unit/Installer/InstallTranslationFilePatternTest.php
index b657fbbfc..fd2b88495 100644
--- a/core/modules/system/tests/src/Unit/Installer/InstallTranslationFilePatternTest.php
+++ b/core/modules/system/tests/src/Unit/Installer/InstallTranslationFilePatternTest.php
@@ -29,7 +29,7 @@ class InstallTranslationFilePatternTest extends UnitTestCase {
parent::setUp();
$this->fileTranslation = new FileTranslation('filename');
$method = new \ReflectionMethod('\Drupal\Core\StringTranslation\Translator\FileTranslation', 'getTranslationFilesPattern');
- $method->setAccessible(true);
+ $method->setAccessible(TRUE);
$this->filePatternMethod = $method;
}
diff --git a/core/modules/system/tests/src/Unit/SystemRequirementsTest.php b/core/modules/system/tests/src/Unit/SystemRequirementsTest.php
index abd79ca55..4a7f9c708 100644
--- a/core/modules/system/tests/src/Unit/SystemRequirementsTest.php
+++ b/core/modules/system/tests/src/Unit/SystemRequirementsTest.php
@@ -6,12 +6,13 @@ use Drupal\system\SystemRequirements;
use Drupal\Tests\UnitTestCase;
/**
- * @coversDefaultClass Drupal\system\SystemRequirements
+ * @coversDefaultClass \Drupal\system\SystemRequirements
* @group system
*/
class SystemRequirementsTest extends UnitTestCase {
/**
+ * @covers ::phpVersionWithPdoDisallowMultipleStatements
* @dataProvider providerTestPhpVersionWithPdoDisallowMultipleStatements
*/
public function testPhpVersionWithPdoDisallowMultipleStatements($version, $expected) {
diff --git a/core/modules/system/tests/themes/test_subsubtheme/test_subsubtheme.theme b/core/modules/system/tests/themes/test_subsubtheme/test_subsubtheme.theme
index 5819e2099..04628c804 100644
--- a/core/modules/system/tests/themes/test_subsubtheme/test_subsubtheme.theme
+++ b/core/modules/system/tests/themes/test_subsubtheme/test_subsubtheme.theme
@@ -10,4 +10,3 @@
*/
function test_subsubtheme_preprocess_theme_test_template_test(&$variables) {
}
-
diff --git a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
index 700dc19c8..3b1c2368d 100644
--- a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
+++ b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
@@ -49,7 +49,7 @@ class TermSelection extends DefaultSelection {
*/
public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
if ($match || $limit) {
- return parent::getReferenceableEntities($match , $match_operator, $limit);
+ return parent::getReferenceableEntities($match, $match_operator, $limit);
}
$options = array();
diff --git a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php b/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php
index fdc2ad451..257303388 100644
--- a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php
+++ b/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php
@@ -68,7 +68,7 @@ class Vocabulary extends DrupalSqlBase {
->execute()
->fetchCol();
$row->setSourceProperty('node_types', $node_types);
- $row->setSourceProperty('cardinality', ($row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1) ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);
+ $row->setSourceProperty('cardinality', ($row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1) ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);
return parent::prepareRow($row);
}
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index 2d0eb8336..8ebc90973 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -391,8 +391,7 @@ class TaxonomyIndexTid extends ManyToOne {
$vocabulary = $this->vocabularyStorage->load($this->options['vid']);
$dependencies[$vocabulary->getConfigDependencyKey()][] = $vocabulary->getConfigDependencyName();
- foreach ($this->options['value'] as $tid) {
- $term = $this->termStorage->load($tid);
+ foreach ($this->termStorage->loadMultiple($this->options['value']) as $term) {
$dependencies[$term->getConfigDependencyKey()][] = $term->getConfigDependencyName();
}
diff --git a/core/modules/taxonomy/src/TermStorageSchema.php b/core/modules/taxonomy/src/TermStorageSchema.php
index ad52cef79..5534821ef 100644
--- a/core/modules/taxonomy/src/TermStorageSchema.php
+++ b/core/modules/taxonomy/src/TermStorageSchema.php
@@ -86,7 +86,7 @@ class TermStorageSchema extends SqlContentEntityStorageSchema {
'description' => 'The Unix timestamp when the node was created.',
'type' => 'int',
'not null' => TRUE,
- 'default'=> 0,
+ 'default' => 0,
),
),
'primary key' => array('nid', 'tid'),
diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php
index 1af323b6d..00bc5899b 100644
--- a/core/modules/taxonomy/src/TermViewsData.php
+++ b/core/modules/taxonomy/src/TermViewsData.php
@@ -58,7 +58,7 @@ class TermViewsData extends EntityViewsData {
'relationship field' => 'tid',
'outer field' => 'taxonomy_term_field_data.tid',
'argument table' => 'taxonomy_term_field_data',
- 'argument field' => 'tid',
+ 'argument field' => 'tid',
'base' => 'node_field_data',
'field' => 'nid',
'relationship' => 'node_field_data:term_node_tid'
diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php
index 33408c72a..fa206e859 100644
--- a/core/modules/taxonomy/src/Tests/TermTest.php
+++ b/core/modules/taxonomy/src/Tests/TermTest.php
@@ -161,7 +161,7 @@ class TermTest extends TaxonomyTestBase {
for ($x = 1; $x <= 17; $x++) {
$this->assertNoText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' not found on Page 3');
}
- for ($x =18; $x <= 25; $x++) {
+ for ($x = 18; $x <= 25; $x++) {
$this->assertText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 3');
}
}
diff --git a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
index 8202cdee6..2a55a6d3a 100644
--- a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
@@ -144,4 +144,3 @@ class TokenReplaceTest extends TaxonomyTestBase {
}
}
}
-
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php
new file mode 100644
index 000000000..9935aa964
--- /dev/null
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php
@@ -0,0 +1,156 @@
+ 'tags',
+ 'name' => 'Tags',
+ ])->save();
+
+ // This will get a term ID of 3.
+ $term = Term::create([
+ 'vid' => 'tags',
+ 'name' => 'muh',
+ ]);
+ $term->save();
+ // This will get a term ID of 4.
+ $this->terms[$term->id()] = $term;
+ $term = Term::create([
+ 'vid' => 'tags',
+ 'name' => 'muh',
+ ]);
+ $term->save();
+ $this->terms[$term->id()] = $term;
+
+ ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
+ }
+
+ /**
+ * Tests dependencies are not added for terms that do not exist.
+ */
+ public function testConfigDependency() {
+ /** @var \Drupal\views\Entity\View $view */
+ $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
+
+ // Dependencies are sorted.
+ $content_dependencies = [
+ $this->terms[3]->getConfigDependencyName(),
+ $this->terms[4]->getConfigDependencyName(),
+ ];
+ sort($content_dependencies);
+
+ $this->assertEqual([
+ 'config' => [
+ 'taxonomy.vocabulary.tags',
+ ],
+ 'content' => $content_dependencies,
+ 'module' => [
+ 'node',
+ 'taxonomy',
+ 'user',
+ ],
+ ], $view->calculateDependencies()->getDependencies());
+
+ $this->terms[3]->delete();
+
+ $this->assertEqual([
+ 'config' => [
+ 'taxonomy.vocabulary.tags',
+ ],
+ 'content' => [
+ $this->terms[4]->getConfigDependencyName(),
+ ],
+ 'module' => [
+ 'node',
+ 'taxonomy',
+ 'user',
+ ],
+ ], $view->calculateDependencies()->getDependencies());
+ }
+
+ /**
+ * Tests post update function fixes dependencies.
+ *
+ * @see views_post_update_taxonomy_index_tid()
+ */
+ public function testPostUpdateFunction() {
+ /** @var \Drupal\views\Entity\View $view */
+ $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
+
+ // Dependencies are sorted.
+ $content_dependencies = [
+ $this->terms[3]->getConfigDependencyName(),
+ $this->terms[4]->getConfigDependencyName(),
+ ];
+ sort($content_dependencies);
+
+ $this->assertEqual([
+ 'config' => [
+ 'taxonomy.vocabulary.tags',
+ ],
+ 'content' => $content_dependencies,
+ 'module' => [
+ 'node',
+ 'taxonomy',
+ 'user',
+ ],
+ ], $view->calculateDependencies()->getDependencies());
+
+ $this->terms[3]->delete();
+
+ \Drupal::moduleHandler()->loadInclude('views', 'post_update.php');
+ views_post_update_taxonomy_index_tid();
+
+ $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
+ $this->assertEqual([
+ 'config' => [
+ 'taxonomy.vocabulary.tags',
+ ],
+ 'content' => [
+ $this->terms[4]->getConfigDependencyName(),
+ ],
+ 'module' => [
+ 'node',
+ 'taxonomy',
+ 'user',
+ ],
+ ], $view->getDependencies());
+ }
+
+}
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
index 5e40666a6..dc5755993 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
@@ -55,11 +55,13 @@ abstract class TaxonomyTestBase extends ViewTestBase {
/**
* {@inheritdoc}
*/
- protected function setUp() {
- parent::setUp();
+ protected function setUp($import_test_views = TRUE) {
+ parent::setUp($import_test_views);
$this->mockStandardInstall();
- ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
+ if ($import_test_views) {
+ ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
+ }
$this->term1 = $this->createTerm();
$this->term2 = $this->createTerm();
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index a73f6fc4d..be4f7fa43 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -46,11 +46,11 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Managing vocabularies') . '
';
- $output .= '- ' . t('Users who have the Administer vocabularies and terms permission can add and edit vocabularies from the Taxonomy administration page. Vocabularies can be deleted from their Edit vocabulary page. Users with the Taxonomy term: Administer fields permission may add additional fields for terms in that vocabulary using the Field UI module.' , array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'), ':field_ui' => $field_ui_url)) . '
';
+ $output .= '- ' . t('Users who have the Administer vocabularies and terms permission can add and edit vocabularies from the Taxonomy administration page. Vocabularies can be deleted from their Edit vocabulary page. Users with the Taxonomy term: Administer fields permission may add additional fields for terms in that vocabulary using the Field UI module.', array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'), ':field_ui' => $field_ui_url)) . '
';
$output .= '- ' . t('Managing terms') . '
';
- $output .= '- ' . t('Users who have the Administer vocabularies and terms permission or the Edit terms permission for a particular vocabulary can add, edit, and organize the terms in a vocabulary from a vocabulary\'s term listing page, which can be accessed by going to the Taxonomy administration page and clicking List terms in the Operations column. Users must have the Administer vocabularies and terms permission or the Delete terms permission for a particular vocabulary to delete terms.' , array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'))) . '
';
+ $output .= '- ' . t('Users who have the Administer vocabularies and terms permission or the Edit terms permission for a particular vocabulary can add, edit, and organize the terms in a vocabulary from a vocabulary\'s term listing page, which can be accessed by going to the Taxonomy administration page and clicking List terms in the Operations column. Users must have the Administer vocabularies and terms permission or the Delete terms permission for a particular vocabulary to delete terms.', array(':taxonomy_admin' => \Drupal::url('entity.taxonomy_vocabulary.collection'))) . '
';
$output .= '- ' . t('Classifying entity content') . '
';
- $output .= '- ' . t('A user with the Administer fields permission for a certain entity type may add Taxonomy term reference fields to the entity type, which will allow entities to be classified using taxonomy terms. See the Entity Reference help for more information about reference fields. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them.' , array(':field_ui' => $field_ui_url, ':field' => \Drupal::url('help.page', array('name' => 'field')), ':entity_reference' => \Drupal::url('help.page', array('name' => 'entity_reference')))) . '
';
+ $output .= '- ' . t('A user with the Administer fields permission for a certain entity type may add Taxonomy term reference fields to the entity type, which will allow entities to be classified using taxonomy terms. See the Entity Reference help for more information about reference fields. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them.', array(':field_ui' => $field_ui_url, ':field' => \Drupal::url('help.page', array('name' => 'field')), ':entity_reference' => \Drupal::url('help.page', array('name' => 'entity_reference')))) . '
';
$output .= '- ' . t('Adding new terms during content creation') . '
';
$output .= '- ' . t('Allowing users to add new terms gradually builds a vocabulary as content is added and edited. Users can add new terms if either of the two Autocomplete widgets is chosen for the Taxonomy term reference field in the Manage form display page for the field. You will also need to enable the Create referenced entities if they don\'t already exist option, and restrict the field to one vocabulary.') . '
';
$output .= '- ' . t('Configuring displays and form displays') . '
';
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
index 442ca090d..dbe8781ce 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
+++ b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
@@ -5,9 +5,11 @@
* Provides hook implementations for testing purposes.
*/
+use Drupal\taxonomy\VocabularyInterface;
+
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
*/
-function taxonomy_crud_taxonomy_vocabulary_presave(\Drupal\taxonomy\VocabularyInterface $vocabulary) {
+function taxonomy_crud_taxonomy_vocabulary_presave(VocabularyInterface $vocabulary) {
$vocabulary->setThirdPartySetting('taxonomy_crud', 'foo', 'bar');
}
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid__non_existing_dependency.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid__non_existing_dependency.yml
new file mode 100644
index 000000000..46c4a339f
--- /dev/null
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid__non_existing_dependency.yml
@@ -0,0 +1,187 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ - taxonomy
+ - user
+id: test_filter_taxonomy_index_tid__non_existing_dependency
+label: test_filter_taxonomy_index_tid__non_existing_dependency
+module: views
+description: ''
+tag: ''
+base_table: node_field_data
+base_field: nid
+core: 8.x
+display:
+ default:
+ display_plugin: default
+ id: default
+ display_title: Master
+ position: 1
+ display_options:
+ access:
+ type: perm
+ options:
+ perm: 'access content'
+ cache:
+ type: tag
+ options: { }
+ query:
+ type: views_query
+ options:
+ disable_sql_rewrite: false
+ distinct: false
+ replica: false
+ query_comment: ''
+ query_tags: { }
+ exposed_form:
+ type: basic
+ options:
+ submit_button: Apply
+ reset_button: false
+ reset_button_label: Reset
+ exposed_sorts_label: 'Sort by'
+ expose_sort_order: true
+ sort_asc_label: Asc
+ sort_desc_label: Desc
+ pager:
+ type: full
+ options:
+ items_per_page: 10
+ offset: 0
+ id: 0
+ total_pages: null
+ expose:
+ items_per_page: false
+ items_per_page_label: 'Items per page'
+ items_per_page_options: '5, 10, 25, 50'
+ items_per_page_options_all: false
+ items_per_page_options_all_label: '- All -'
+ offset: false
+ offset_label: Offset
+ tags:
+ previous: '‹ Previous'
+ next: 'Next ›'
+ first: '« First'
+ last: 'Last »'
+ quantity: 9
+ style:
+ type: default
+ options:
+ grouping: { }
+ row_class: ''
+ default_row_class: true
+ uses_fields: false
+ row:
+ type: fields
+ options:
+ inline: { }
+ separator: ''
+ hide_empty: false
+ default_field_elements: true
+ fields:
+ title:
+ id: title
+ table: node_field_data
+ field: title
+ label: ''
+ alter:
+ alter_text: false
+ make_link: false
+ absolute: false
+ trim: false
+ word_boundary: false
+ ellipsis: false
+ strip_tags: false
+ html: false
+ hide_empty: false
+ empty_zero: false
+ relationship: none
+ group_type: group
+ admin_label: ''
+ exclude: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: true
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_alter_empty: true
+ plugin_id: field
+ entity_type: node
+ entity_field: title
+ filters:
+ status:
+ value: true
+ table: node_field_data
+ field: status
+ id: status
+ expose:
+ operator: '0'
+ group: 1
+ plugin_id: boolean
+ entity_type: node
+ entity_field: status
+ tid:
+ id: tid
+ table: taxonomy_index
+ field: tid
+ relationship: none
+ group_type: group
+ admin_label: ''
+ operator: or
+ value:
+ - 3
+ - 4
+ group: 1
+ exposed: false
+ expose:
+ operator_id: '0'
+ label: ''
+ description: ''
+ use_operator: false
+ operator: ''
+ identifier: ''
+ required: false
+ remember: false
+ multiple: false
+ remember_roles:
+ authenticated: authenticated
+ reduce: false
+ is_grouped: false
+ group_info:
+ label: ''
+ description: ''
+ identifier: ''
+ optional: true
+ widget: select
+ multiple: false
+ remember: false
+ default_group: All
+ default_group_multiple: { }
+ group_items: { }
+ reduce_duplicates: false
+ type: select
+ limit: true
+ vid: tags
+ hierarchy: true
+ error_message: true
+ plugin_id: taxonomy_index_tid
+ sorts: { }
+ header: { }
+ footer: { }
+ empty: { }
+ relationships: { }
+ arguments: { }
+ page_1:
+ display_plugin: page
+ id: page_1
+ display_title: Page
+ position: 2
+ display_options:
+ display_extenders: { }
+ path: test-filter-taxonomy-index-tid
diff --git a/core/modules/taxonomy/src/Tests/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
similarity index 97%
rename from core/modules/taxonomy/src/Tests/TermKernelTest.php
rename to core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
index 35b9463fa..39720520d 100644
--- a/core/modules/taxonomy/src/Tests/TermKernelTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
@@ -1,9 +1,10 @@
' . t('About') . '';
- $output .= '' . t('The Text module allows you to create short and long text fields with optional summaries. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the Text module.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) :'#', ':text_documentation' => 'https://www.drupal.org/documentation/modules/text')) . '
';
+ $output .= '' . t('The Text module allows you to create short and long text fields with optional summaries. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the Text module.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', ':text_documentation' => 'https://www.drupal.org/documentation/modules/text')) . '
';
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Managing and displaying text fields') . '
';
diff --git a/core/modules/toolbar/src/Element/Toolbar.php b/core/modules/toolbar/src/Element/Toolbar.php
index c9daf89e5..48e4ddc40 100644
--- a/core/modules/toolbar/src/Element/Toolbar.php
+++ b/core/modules/toolbar/src/Element/Toolbar.php
@@ -68,7 +68,7 @@ class Toolbar extends RenderElement {
// toolbar presentation.
$breakpoints = static::breakpointManager()->getBreakpointsByGroup('toolbar');
if (!empty($breakpoints)) {
- $media_queries = array();
+ $media_queries = array();
foreach ($breakpoints as $id => $breakpoint) {
$media_queries[$id] = $breakpoint->getMediaQuery();
}
diff --git a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
index f44c22409..c3b3d9abc 100644
--- a/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
+++ b/core/modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php
@@ -23,30 +23,29 @@ class ToolbarIntegrationTest extends JavascriptTestBase {
$admin_user = $this->drupalCreateUser([
'access toolbar',
'administer site configuration',
- 'access content overview'
+ 'access content overview',
]);
$this->drupalLogin($admin_user);
$this->drupalGet('');
+ $page = $this->getSession()->getPage();
// Test that it is possible to toggle the toolbar tray.
- $this->assertElementVisible('#toolbar-link-system-admin_content', 'Toolbar tray is open by default.');
- $this->click('#toolbar-item-administration');
- $this->assertElementNotVisible('#toolbar-link-system-admin_content', 'Toolbar tray is closed after clicking the "Manage" button.');
- $this->click('#toolbar-item-administration');
- $this->assertElementVisible('#toolbar-link-system-admin_content', 'Toolbar tray is visible again after clicking the "Manage" button a second time.');
+ $content = $page->findLink('Content');
+ $this->assertTrue($content->isVisible(), 'Toolbar tray is open by default.');
+ $page->clickLink('Manage');
+ $this->assertFalse($content->isVisible(), 'Toolbar tray is closed after clicking the "Manage" link.');
+ $page->clickLink('Manage');
+ $this->assertTrue($content->isVisible(), 'Toolbar tray is visible again after clicking the "Manage" button a second time.');
// Test toggling the toolbar tray between horizontal and vertical.
- $this->assertElementVisible('#toolbar-item-administration-tray.toolbar-tray-horizontal', 'Toolbar tray is horizontally oriented by default.');
- $this->assertElementNotPresent('#toolbar-item-administration-tray.toolbar-tray-vertical', 'Toolbar tray is not vertically oriented by default.');
+ $tray = $page->findById('toolbar-item-administration-tray');
+ $this->assertFalse($tray->hasClass('toolbar-tray-vertical'), 'Toolbar tray is not vertically oriented by default.');
+ $page->pressButton('Vertical orientation');
+ $this->assertTrue($tray->hasClass('toolbar-tray-vertical'), 'After toggling the orientation the toolbar tray is now displayed vertically.');
- $this->click('#toolbar-item-administration-tray button.toolbar-icon-toggle-vertical');
- $this->assertJsCondition('jQuery("#toolbar-item-administration-tray").hasClass("toolbar-tray-vertical")');
- $this->assertElementVisible('#toolbar-item-administration-tray.toolbar-tray-vertical', 'After toggling the orientation the toolbar tray is now displayed vertically.');
-
- $this->click('#toolbar-item-administration-tray button.toolbar-icon-toggle-horizontal');
- $this->assertJsCondition('jQuery("#toolbar-item-administration-tray").hasClass("toolbar-tray-horizontal")');
- $this->assertElementVisible('#toolbar-item-administration-tray.toolbar-tray-horizontal', 'After toggling the orientation a second time the toolbar tray is displayed horizontally again.');
+ $page->pressButton('Horizontal orientation');
+ $this->assertTrue($tray->hasClass('toolbar-tray-horizontal'), 'After toggling the orientation a second time the toolbar tray is displayed horizontally again.');
}
}
diff --git a/core/modules/tour/src/Tests/TourTest.php b/core/modules/tour/src/Tests/TourTest.php
index 81b226a77..910eb6e13 100644
--- a/core/modules/tour/src/Tests/TourTest.php
+++ b/core/modules/tour/src/Tests/TourTest.php
@@ -66,7 +66,7 @@ class TourTest extends TourTestBasic {
$elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./p//a[@href=:href and contains(., :text)]]', array(
':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1',
':data_id' => 'tour-test-1',
- ':href' => \Drupal::url('', [], ['absolute' => TRUE]),
+ ':href' => \Drupal::url('', [], ['absolute' => TRUE]),
':text' => 'Drupal',
));
$this->assertEqual(count($elements), 1, 'Found Token replacement.');
diff --git a/core/modules/tour/src/Tests/TourPluginTest.php b/core/modules/tour/tests/src/Kernel/TourPluginTest.php
similarity index 90%
rename from core/modules/tour/src/Tests/TourPluginTest.php
rename to core/modules/tour/tests/src/Kernel/TourPluginTest.php
index edefe8ed4..9278e2e54 100644
--- a/core/modules/tour/src/Tests/TourPluginTest.php
+++ b/core/modules/tour/tests/src/Kernel/TourPluginTest.php
@@ -1,8 +1,8 @@
'link',
- '#url' => Url::fromRoute('system.db_update'),
+ '#url' => $url,
'#title' => t('Run database updates'),
// Since this is being called outsite of the primary front controller,
// the base_url needs to be set explicitly to ensure that links are
@@ -260,6 +261,7 @@ function update_authorize_update_batch_finished($success, $results) {
'absolute' => TRUE,
'base_url' => $GLOBALS['base_url'],
],
+ '#access' => $url->access(\Drupal::currentUser())
];
// Unset the variable since it is no longer needed.
diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc
index 1b111e510..a710dd9f7 100644
--- a/core/modules/update/update.fetch.inc
+++ b/core/modules/update/update.fetch.inc
@@ -48,4 +48,3 @@ function _update_cron_notify() {
}
}
}
-
diff --git a/core/modules/update/update.module b/core/modules/update/update.module
index 98f756911..01db0a79c 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -79,7 +79,7 @@ function update_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Checking for available updates') . '
';
- $output .= '- ' . t('The Available updates report displays core, contributed modules, and themes for which there are new releases available for download. On the report page, you can also check manually for updates. You can configure the frequency of update checks, which are performed during cron runs, and whether notifications are sent on the Update Manager settings page.', array(':update-report' => \Drupal::url('update.status'), ':update-settings' => \Drupal::url('update.settings'))) . '
';
+ $output .= '- ' . t('The Available updates report displays core, contributed modules, and themes for which there are new releases available for download. On the report page, you can also check manually for updates. You can configure the frequency of update checks, which are performed during cron runs, and whether notifications are sent on the Update Manager settings page.', array(':update-report' => \Drupal::url('update.status'), ':update-settings' => \Drupal::url('update.settings'))) . '
';
// Only explain the Update manager if it has not been disabled.
if (_update_manager_access()) {
$output .= '- ' . t('Performing updates through the Update page') . '
';
diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
index c1b461d28..5f198d9ba 100644
--- a/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -43,7 +43,7 @@ function template_preprocess_update_report(&$variables) {
foreach ($data as $project) {
$project_status = array(
- '#theme' => 'update_project_status',
+ '#theme' => 'update_project_status',
'#project' => $project,
);
diff --git a/core/modules/user/src/AccountSettingsForm.php b/core/modules/user/src/AccountSettingsForm.php
index be55a8c73..1e5cd4980 100644
--- a/core/modules/user/src/AccountSettingsForm.php
+++ b/core/modules/user/src/AccountSettingsForm.php
@@ -214,7 +214,7 @@ class AccountSettingsForm extends ConfigFormBase {
$form['email_admin_created']['user_mail_register_admin_created_body'] = array(
'#type' => 'textarea',
'#title' => $this->t('Body'),
- '#default_value' => $mail_config->get('register_admin_created.body'),
+ '#default_value' => $mail_config->get('register_admin_created.body'),
'#rows' => 15,
);
diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php
index d45206c04..0eb2729c7 100644
--- a/core/modules/user/src/Controller/UserController.php
+++ b/core/modules/user/src/Controller/UserController.php
@@ -94,7 +94,7 @@ class UserController extends ControllerBase {
// A different user is already logged in on the computer.
else {
if ($reset_link_user = $this->userStorage->load($uid)) {
- drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please logout and try using the link again.',
+ drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please log out and try using the link again.',
array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), ':logout' => $this->url('user.logout'))), 'warning');
}
else {
diff --git a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
index ce8bf2312..3ba847bea 100644
--- a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
@@ -11,7 +11,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
/**
- * Maintenance mode subscriber to logout users.
+ * Maintenance mode subscriber to log out users.
*/
class MaintenanceModeSubscriber implements EventSubscriberInterface {
diff --git a/core/modules/user/src/Form/UserPasswordResetForm.php b/core/modules/user/src/Form/UserPasswordResetForm.php
index 87f2683d3..432941a70 100644
--- a/core/modules/user/src/Form/UserPasswordResetForm.php
+++ b/core/modules/user/src/Form/UserPasswordResetForm.php
@@ -115,4 +115,3 @@ class UserPasswordResetForm extends FormBase {
}
}
-
diff --git a/core/modules/user/src/PermissionHandlerInterface.php b/core/modules/user/src/PermissionHandlerInterface.php
index 6e92a5843..61526f339 100644
--- a/core/modules/user/src/PermissionHandlerInterface.php
+++ b/core/modules/user/src/PermissionHandlerInterface.php
@@ -50,4 +50,3 @@ interface PermissionHandlerInterface {
public function moduleProvidesPermissions($module_name);
}
-
diff --git a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
index fb0d71413..8dfba3963 100644
--- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
+++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
@@ -143,6 +143,13 @@ class UserSelection extends DefaultSelection {
*/
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
+ $handler_settings = $this->configuration['handler_settings'];
+
+ // Filter out the Anonymous user if the selection handler is configured to
+ // exclude it.
+ if (isset($handler_settings['include_anonymous']) && !$handler_settings['include_anonymous']) {
+ $query->condition('uid', 0, '<>');
+ }
// The user entity doesn't have a label column.
if (isset($match)) {
@@ -150,7 +157,6 @@ class UserSelection extends DefaultSelection {
}
// Filter by role.
- $handler_settings = $this->configuration['handler_settings'];
if (!empty($handler_settings['filter']['role'])) {
$query->condition('roles', $handler_settings['filter']['role'], 'IN');
}
diff --git a/core/modules/user/src/Plugin/views/access/Role.php b/core/modules/user/src/Plugin/views/access/Role.php
index 888023576..2e5b6b4b0 100644
--- a/core/modules/user/src/Plugin/views/access/Role.php
+++ b/core/modules/user/src/Plugin/views/access/Role.php
@@ -163,4 +163,3 @@ class Role extends AccessPluginBase implements CacheableDependencyInterface {
}
}
-
diff --git a/core/modules/user/src/Tests/UserAdminLanguageTest.php b/core/modules/user/src/Tests/UserAdminLanguageTest.php
index 68ebfad27..03baa044e 100644
--- a/core/modules/user/src/Tests/UserAdminLanguageTest.php
+++ b/core/modules/user/src/Tests/UserAdminLanguageTest.php
@@ -149,11 +149,11 @@ class UserAdminLanguageTest extends WebTestBase {
/**
* Sets the User interface negotiation detection method.
*
- * @param bool $admin_first
- * Whether the admin negotiation should be first.
- *
* Enables the "Account preference for administration pages" language
* detection method for the User interface language negotiation type.
+ *
+ * @param bool $admin_first
+ * Whether the admin negotiation should be first.
*/
function setLanguageNegotiation($admin_first = FALSE) {
$edit = array(
diff --git a/core/modules/user/src/Tests/UserLanguageCreationTest.php b/core/modules/user/src/Tests/UserLanguageCreationTest.php
index 3f03381b2..512420428 100644
--- a/core/modules/user/src/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/src/Tests/UserLanguageCreationTest.php
@@ -86,7 +86,7 @@ class UserLanguageCreationTest extends WebTestBase {
$this->drupalGet($user_edit);
$this->assertOptionSelected("edit-preferred-langcode", $langcode, 'Language selector is accessible and correct language is selected.');
- // Set pass_raw so we can login the new user.
+ // Set pass_raw so we can log in the new user.
$user->pass_raw = $this->randomMachineName(10);
$edit = array(
'pass[pass1]' => $user->pass_raw,
diff --git a/core/modules/user/src/Tests/UserLanguageTest.php b/core/modules/user/src/Tests/UserLanguageTest.php
index 47f1fa821..5b7b5668a 100644
--- a/core/modules/user/src/Tests/UserLanguageTest.php
+++ b/core/modules/user/src/Tests/UserLanguageTest.php
@@ -43,7 +43,7 @@ class UserLanguageTest extends WebTestBase {
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->drupalLogout();
- // Login as normal user and edit account settings.
+ // Log in as normal user and edit account settings.
$this->drupalLogin($web_user);
$path = 'user/' . $web_user->id() . '/edit';
$this->drupalGet($path);
diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php
index 31733db77..56f21e4d4 100644
--- a/core/modules/user/src/Tests/UserRegistrationTest.php
+++ b/core/modules/user/src/Tests/UserRegistrationTest.php
@@ -99,13 +99,13 @@ class UserRegistrationTest extends WebTestBase {
$this->drupalPostForm('user/register', $edit, t('Create new account'));
$this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
- // Try to login before administrator approval.
+ // Try to log in before administrator approval.
$auth = array(
'name' => $name,
'pass' => $pass,
);
$this->drupalPostForm('user/login', $auth, t('Log in'));
- $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot login yet.');
+ $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot log in yet.');
// Activate the new account.
$accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
@@ -118,7 +118,7 @@ class UserRegistrationTest extends WebTestBase {
$this->drupalPostForm('user/' . $new_user->id() . '/edit', $edit, t('Save'));
$this->drupalLogout();
- // Login after administrator approval.
+ // Log in after administrator approval.
$this->drupalPostForm('user/login', $auth, t('Log in'));
$this->assertText(t('Member for'), 'User can log in after administrator approval.');
}
diff --git a/core/modules/user/src/Tests/Views/BulkFormAccessTest.php b/core/modules/user/src/Tests/Views/BulkFormAccessTest.php
index a1920d0af..1102b8e58 100644
--- a/core/modules/user/src/Tests/Views/BulkFormAccessTest.php
+++ b/core/modules/user/src/Tests/Views/BulkFormAccessTest.php
@@ -36,7 +36,7 @@ class BulkFormAccessTest extends UserTestBase {
// Ensure this account is not blocked.
$this->assertFalse($no_edit_user->isBlocked(), 'The user is not blocked.');
- // Login as user admin.
+ // Log in as user admin.
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
@@ -47,7 +47,7 @@ class BulkFormAccessTest extends UserTestBase {
// Test blocking the account "no_edit".
$edit = array(
- 'user_bulk_form[' . ($no_edit_user->id() -1) . ']' => TRUE,
+ 'user_bulk_form[' . ($no_edit_user->id() - 1) . ']' => TRUE,
'action' => 'user_block_user_action',
);
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
@@ -68,7 +68,7 @@ class BulkFormAccessTest extends UserTestBase {
$this->assertTrue($normal_user->access('update', $admin_user));
$edit = array(
- 'user_bulk_form[' . ($normal_user->id() -1) . ']' => TRUE,
+ 'user_bulk_form[' . ($normal_user->id() - 1) . ']' => TRUE,
'action' => 'user_block_user_action',
);
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
@@ -76,11 +76,11 @@ class BulkFormAccessTest extends UserTestBase {
$normal_user = User::load($normal_user->id());
$this->assertTrue($normal_user->isBlocked(), 'The user is blocked.');
- // Login as user without the 'administer users' permission.
+ // Log in as user without the 'administer users' permission.
$this->drupalLogin($this->drupalCreateUser());
$edit = array(
- 'user_bulk_form[' . ($normal_user->id() -1) . ']' => TRUE,
+ 'user_bulk_form[' . ($normal_user->id() - 1) . ']' => TRUE,
'action' => 'user_unblock_user_action',
);
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
@@ -98,7 +98,7 @@ class BulkFormAccessTest extends UserTestBase {
$account = $this->drupalCreateUser(array(), 'no_delete');
$account2 = $this->drupalCreateUser(array(), 'may_delete');
- // Login as user admin.
+ // Log in as user admin.
$this->drupalLogin($this->drupalCreateUser(array('administer users')));
// Ensure that the account "no_delete" can not be deleted.
@@ -110,8 +110,8 @@ class BulkFormAccessTest extends UserTestBase {
// Test deleting the accounts "no_delete" and "may_delete".
$edit = array(
- 'user_bulk_form[' . ($account->id() -1) . ']' => TRUE,
- 'user_bulk_form[' . ($account2->id() -1) . ']' => TRUE,
+ 'user_bulk_form[' . ($account->id() - 1) . ']' => TRUE,
+ 'user_bulk_form[' . ($account2->id() - 1) . ']' => TRUE,
'action' => 'user_cancel_user_action',
);
$this->drupalPostForm('test-user-bulk-form', $edit, t('Apply'));
diff --git a/core/modules/user/src/Tests/Views/BulkFormTest.php b/core/modules/user/src/Tests/Views/BulkFormTest.php
index 0ee38c5a8..e80b31a68 100644
--- a/core/modules/user/src/Tests/Views/BulkFormTest.php
+++ b/core/modules/user/src/Tests/Views/BulkFormTest.php
@@ -31,7 +31,7 @@ class BulkFormTest extends UserTestBase {
* Tests the user bulk form.
*/
public function testBulkForm() {
- // Login as a user without 'administer users'.
+ // Log in as a user without 'administer users'.
$this->drupalLogin($this->drupalCreateUser(array('administer permissions')));
$user_storage = $this->container->get('entity.manager')->getStorage('user');
diff --git a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php b/core/modules/user/tests/src/Kernel/Condition/UserRoleConditionTest.php
similarity index 98%
rename from core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
rename to core/modules/user/tests/src/Kernel/Condition/UserRoleConditionTest.php
index acf18a161..6e553646e 100644
--- a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
+++ b/core/modules/user/tests/src/Kernel/Condition/UserRoleConditionTest.php
@@ -1,9 +1,9 @@
getComponent('profile_love_migrations');
$this->assertIdentical('boolean_checkbox', $component['type']);
- $this->assertIdentical(true, $component['settings']['display_label']);
+ $this->assertIdentical(TRUE, $component['settings']['display_label']);
}
}
diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php
index 4178c5adc..5b6e95d50 100644
--- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php
+++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php
@@ -34,7 +34,7 @@ class MigrateUserConfigsTest extends MigrateDrupal6TestBase {
$this->assertIdentical('Account details for [user:name] at [site:name] (approved)', $config->get('status_activated.subject'));
$this->assertIdentical("[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\n\nOnce you have set your own password, you will be able to log in to [site:login-url] in the future using:\n\nusername: [user:name]\n", $config->get('status_activated.body'));
$this->assertIdentical('Replacement login information for [user:name] at [site:name]', $config->get('password_reset.subject'));
- $this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password." , $config->get('password_reset.body'));
+ $this->assertIdentical("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\n\n[user:one-time-login-url]\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.", $config->get('password_reset.body'));
$this->assertIdentical('Account details for [user:name] at [site:name] (deleted)', $config->get('cancel_confirm.subject'));
$this->assertIdentical("[user:name],\n\nYour account on [site:name] has been deleted.", $config->get('cancel_confirm.body'));
$this->assertIdentical('An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject'));
diff --git a/core/modules/user/src/Tests/TempStoreDatabaseTest.php b/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
similarity index 98%
rename from core/modules/user/src/Tests/TempStoreDatabaseTest.php
rename to core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
index 48b109c5c..254524a97 100644
--- a/core/modules/user/src/Tests/TempStoreDatabaseTest.php
+++ b/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
@@ -1,9 +1,9 @@
' . t('Managing account settings') . '';
$output .= '- ' . t('The Account settings page allows you to manage settings for the displayed name of the Anonymous user role, personal contact forms, user registration settings, and account cancellation settings. On this page you can also manage settings for account personalization, and adapt the text for the email messages that users receive when they register or request a password recovery. You may also set which role is automatically assigned new permissions whenever a module is enabled (the Administrator role).', array(':accounts' => \Drupal::url('entity.user.admin_form'))) . '
';
$output .= '- ' . t('Managing user account fields') . '
';
- $output .= '- ' . t('Because User accounts are an entity type, you can extend them by adding fields through the Manage fields tab on the Account settings page. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website. For background information on entities and fields, see the Field module help page.', array(':field_help'=>(\Drupal::moduleHandler()->moduleExists('field')) ? \Drupal::url('help.page', array('name' => 'field')) : '#', ':accounts' => \Drupal::url('entity.user.admin_form'))) . '
';
+ $output .= '- ' . t('Because User accounts are an entity type, you can extend them by adding fields through the Manage fields tab on the Account settings page. By adding fields for e.g., a picture, a biography, or address, you can a create a custom profile for the users of the website. For background information on entities and fields, see the Field module help page.', array(':field_help' => (\Drupal::moduleHandler()->moduleExists('field')) ? \Drupal::url('help.page', array('name' => 'field')) : '#', ':accounts' => \Drupal::url('entity.user.admin_form'))) . '
';
$output .= '
';
return $output;
@@ -447,12 +447,12 @@ function user_template_preprocess_default_variables_alter(&$variables) {
*
* Default template: username.html.twig.
*
+ * Modules that make any changes to variables like 'name' or 'extra' must ensure
+ * that the final string is safe.
+ *
* @param array $variables
* An associative array containing:
* - account: The user account (\Drupal\Core\Session\AccountInterface).
- *
- * Modules that make any changes to variables like 'name' or 'extra' must ensure
- * that the final string is safe.
*/
function template_preprocess_username(&$variables) {
$account = $variables['account'] ?: new AnonymousUserSession();
@@ -564,7 +564,7 @@ function user_user_logout($account) {
}
/**
- * Generates a unique URL for a user to login and reset their password.
+ * Generates a unique URL for a user to log in and reset their password.
*
* @param \Drupal\user\UserInterface $account
* An object containing the user account.
diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php
index e41efa9d3..cc7b7be90 100644
--- a/core/modules/views/src/EntityViewsData.php
+++ b/core/modules/views/src/EntityViewsData.php
@@ -496,7 +496,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
$views_field['title'] = $this->t('Translation language');
}
if ($table == $this->entityType->getBaseTable() || $table == $this->entityType->getRevisionTable()) {
- $views_field['title'] = $this->t('Original language');
+ $views_field['title'] = $this->t('Original language');
}
}
}
diff --git a/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php b/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
index 5ae0cc00d..59ecde692 100644
--- a/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
+++ b/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
@@ -269,7 +269,6 @@ class ViewsEntitySchemaSubscriber implements EntityTypeListenerInterface, EventS
}
/**
- *
* Updates views if a data table is renamed.
*
* @param \Drupal\views\Entity\View[] $all_views
diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php
index b958cec5f..f6ddf041d 100644
--- a/core/modules/views/src/Plugin/ViewsHandlerManager.php
+++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php
@@ -101,7 +101,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin
}
// @todo This is crazy. Find a way to remove the override functionality.
- $plugin_id = $override ? : $definition['id'];
+ $plugin_id = $override ?: $definition['id'];
// Try to use the overridden handler.
$handler = $this->createInstance($plugin_id, $definition);
if ($override && method_exists($handler, 'broken') && $handler->broken()) {
diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php
index 2e5249bbf..fab36a0a1 100644
--- a/core/modules/views/src/Plugin/views/HandlerBase.php
+++ b/core/modules/views/src/Plugin/views/HandlerBase.php
@@ -259,7 +259,7 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface {
$form['admin_label'] = array(
'#type' => 'details',
- '#title' =>$this->t('Administrative title'),
+ '#title' => $this->t('Administrative title'),
'#weight' => 150,
);
$form['admin_label']['admin_label'] = array(
diff --git a/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
index 384ccd2a5..109af5095 100644
--- a/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
@@ -51,34 +51,32 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
}
/**
- * Retrieve the options when this is a new access
- * control plugin
+ * Retrieves the options when this is a new access control plugin.
*/
protected function defineOptions() { return array(); }
/**
- * Provide the default form for setting options.
+ * Provides the default form for setting options.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) { }
/**
- * Provide the default form form for validating options
+ * Provides the default form for validating options.
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) { }
/**
- * Provide the default form form for submitting options
+ * Provides the default form for submitting options.
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state, &$options = array()) { }
/**
- * Determine if the administrator has the privileges to use this plugin
+ * Determines if the administrator has the privileges to use this plugin.
*/
public function access() { return TRUE; }
/**
- * If we don't have access to the form but are showing it anyway, ensure that
- * the form is safe and cannot be changed from user input.
+ * Blocks user input when the form is shown but we don´t have access.
*
* This is only called by child objects if specified in the buildOptionsForm(),
* so it will not always be used.
@@ -91,10 +89,13 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
}
}
+ /**
+ * Performs validation for a given argument.
+ */
public function validateArgument($arg) { return TRUE; }
/**
- * Process the summary arguments for displaying.
+ * Processes the summary arguments for displaying.
*
* Some plugins alter the argument so it uses something else internally.
* For example the user validation set's the argument to the uid,
diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php
index 9ab56d801..fe37d919f 100644
--- a/core/modules/views/src/Plugin/views/display/Block.php
+++ b/core/modules/views/src/Plugin/views/display/Block.php
@@ -320,7 +320,7 @@ class Block extends DisplayPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
- * * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
+ * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
*/
public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_state) {
if ($items_per_page = $form_state->getValue(array('override', 'items_per_page'))) {
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index 12eeb7b18..2bfde5290 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -1524,7 +1524,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$access = $this->getOption('access');
- $form['access']['type'] = array(
+ $form['access']['type'] = array(
'#title' => $this->t('Access'),
'#title_display' => 'invisible',
'#type' => 'radios',
@@ -1561,7 +1561,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$cache = $this->getOption('cache');
- $form['cache']['type'] = array(
+ $form['cache']['type'] = array(
'#title' => $this->t('Caching'),
'#title_display' => 'invisible',
'#type' => 'radios',
@@ -1782,7 +1782,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$exposed_form = $this->getOption('exposed_form');
- $form['exposed_form']['type'] = array(
+ $form['exposed_form']['type'] = array(
'#title' => $this->t('Exposed form'),
'#title_display' => 'invisible',
'#type' => 'radios',
@@ -1818,7 +1818,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$pager = $this->getOption('pager');
- $form['pager']['type'] = array(
+ $form['pager']['type'] = array(
'#title' => $this->t('Pager'),
'#title_display' => 'invisible',
'#type' => 'radios',
@@ -2372,7 +2372,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
$build['#cache']['keys'][] = implode(',', $args);
}
- $build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
+ $build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
return $build;
diff --git a/core/modules/views/src/Plugin/views/display/Embed.php b/core/modules/views/src/Plugin/views/display/Embed.php
index 3ffc296f2..6abf9d660 100644
--- a/core/modules/views/src/Plugin/views/display/Embed.php
+++ b/core/modules/views/src/Plugin/views/display/Embed.php
@@ -20,6 +20,13 @@ namespace Drupal\views\Plugin\views\display;
*/
class Embed extends DisplayPluginBase {
- // This display plugin does nothing apart from exist.
+ /**
+ * {@inheritdoc}
+ */
+ public function buildRenderable(array $args = [], $cache = TRUE) {
+ $build = parent::buildRenderable($args, $cache);
+ $build['#embed'] = TRUE;
+ return $build;
+ }
}
diff --git a/core/modules/views/src/Plugin/views/display/PathPluginBase.php b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
index cc92492c3..da230c4ac 100644
--- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
@@ -304,7 +304,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
$path = implode('/', $bits);
$view_id = $this->view->storage->id();
$display_id = $this->display['id'];
- $view_id_display = "{$view_id}.{$display_id}";
+ $view_id_display = "{$view_id}.{$display_id}";
$menu_link_id = 'views.' . str_replace('/', '.', $view_id_display);
if ($path) {
diff --git a/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php b/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php
index a619d95de..ad15706e2 100644
--- a/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php
+++ b/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php
@@ -116,8 +116,9 @@ interface FieldHandlerInterface extends ViewsHandlerInterface {
* @param \Drupal\views\ResultRow $values
* An object containing all retrieved values.
*
- * @return \Drupal\Core\Entity\EntityInterface
- * Returns the entity matching the values.
+ * @return \Drupal\Core\Entity\EntityInterface|null
+ * Returns the entity matching the values or NULL if there is no matching
+ * entity.
*/
public function getEntity(ResultRow $values);
diff --git a/core/modules/views/src/Plugin/views/field/MultiItemsFieldHandlerInterface.php b/core/modules/views/src/Plugin/views/field/MultiItemsFieldHandlerInterface.php
index be515adb4..494954886 100644
--- a/core/modules/views/src/Plugin/views/field/MultiItemsFieldHandlerInterface.php
+++ b/core/modules/views/src/Plugin/views/field/MultiItemsFieldHandlerInterface.php
@@ -45,4 +45,3 @@ interface MultiItemsFieldHandlerInterface extends FieldHandlerInterface {
public function renderItems($items);
}
-
diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php
index 10a315866..d663f82fe 100644
--- a/core/modules/views/src/Plugin/views/filter/Combine.php
+++ b/core/modules/views/src/Plugin/views/filter/Combine.php
@@ -80,7 +80,7 @@ class Combine extends StringFilter {
$separated_fields = array();
foreach ($fields as $key => $field) {
$separated_fields[] = $field;
- if ($key < $count-1) {
+ if ($key < $count - 1) {
$separated_fields[] = "' '";
}
}
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index d55ae5648..54bb98157 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -789,6 +789,17 @@ class Sql extends QueryPluginBase {
* ensuring that all fields are fully qualified (TABLE.FIELD) and that
* the table already exists in the query.
*
+ * The $field, $value and $operator arguments can also be passed in with a
+ * single DatabaseCondition object, like this:
+ * @code
+ * $this->query->addWhere(
+ * $this->options['group'],
+ * db_or()
+ * ->condition($field, $value, 'NOT IN')
+ * ->condition($field, $value, 'IS NULL')
+ * );
+ * @endcode
+ *
* @param $group
* The WHERE group to add these to; groups are used to create AND/OR
* sections. Groups cannot be nested. Use 0 as the default group.
@@ -804,17 +815,6 @@ class Sql extends QueryPluginBase {
* complex options such as IN, LIKE, LIKE BINARY, or BETWEEN. Defaults to =.
* If $field is a string you have to use 'formula' here.
*
- * The $field, $value and $operator arguments can also be passed in with a
- * single DatabaseCondition object, like this:
- * @code
- * $this->query->addWhere(
- * $this->options['group'],
- * db_or()
- * ->condition($field, $value, 'NOT IN')
- * ->condition($field, $value, 'IS NULL')
- * );
- * @endcode
- *
* @see \Drupal\Core\Database\Query\ConditionInterface::condition()
* @see \Drupal\Core\Database\Query\Condition
*/
diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php
index 7f6cd16ac..648b17868 100644
--- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php
+++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php
@@ -678,6 +678,7 @@ abstract class StylePluginBase extends PluginBase {
$renderer = $this->getRenderer();
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
$cache_plugin = $this->view->display_handler->getPlugin('cache');
+ $max_age = $cache_plugin->getCacheMaxAge();
/** @var \Drupal\views\ResultRow $row */
foreach ($result as $index => $row) {
@@ -698,6 +699,7 @@ abstract class StylePluginBase extends PluginBase {
'#cache' => [
'keys' => $cache_plugin->getRowCacheKeys($row),
'tags' => $cache_plugin->getRowCacheTags($row),
+ 'max-age' => $max_age,
],
'#cache_properties' => $field_ids,
];
diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
index ec54e8c20..12c59e4ab 100644
--- a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
+++ b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php
@@ -59,13 +59,13 @@ class FieldEntityTranslationTest extends ViewTestBase {
$node = Node::create([
'type' => 'article',
'title' => 'example EN',
- 'sticky' => false,
+ 'sticky' => FALSE,
]);
$node->save();
$translation = $node->addTranslation('es');
$translation->title->value = 'example ES';
- $translation->sticky->value = true;
+ $translation->sticky->value = TRUE;
$translation->save();
$this->drupalGet('test_entity_field_renderers/entity_translation');
diff --git a/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php b/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
index 844143acc..33c3713c1 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
@@ -2,6 +2,7 @@
namespace Drupal\views\Tests\Plugin;
+use Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest as DisplayExtenderTestData;
use Drupal\views\Views;
/**
@@ -38,7 +39,7 @@ class DisplayExtenderTest extends PluginTestBase {
$this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
$display_extender = $view->display_handler->getExtenders()['display_extender_test'];
- $this->assertTrue($display_extender instanceof \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest, 'Make sure the right class got initialized.');
+ $this->assertTrue($display_extender instanceof DisplayExtenderTestData, 'Make sure the right class got initialized.');
$view->preExecute();
$this->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');
diff --git a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
index beeb8ce29..719d4da3b 100644
--- a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
+++ b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
@@ -116,7 +116,7 @@ class ExposedFormTest extends ViewTestBase {
$identifier = 'bad identifier';
$view->displayHandlers->get('default')->overrideOption('filters', array(
'type' => [
- 'exposed' => TRUE,
+ 'exposed' => TRUE,
'field' => 'type',
'id' => 'type',
'table' => 'node_field_data',
diff --git a/core/modules/views/src/Tests/ViewElementTest.php b/core/modules/views/src/Tests/ViewElementTest.php
index caf5bff11..2ec2e679a 100644
--- a/core/modules/views/src/Tests/ViewElementTest.php
+++ b/core/modules/views/src/Tests/ViewElementTest.php
@@ -18,29 +18,10 @@ class ViewElementTest extends ViewTestBase {
*/
public static $testViews = array('test_view_embed');
- /**
- * The raw render data array to use in tests.
- *
- * @var array
- */
- protected $render;
-
protected function setUp() {
parent::setUp();
$this->enableViewsTestModule();
-
- // Set up a render array to use. We need to copy this as drupal_render
- // passes by reference.
- $this->render = array(
- 'view' => array(
- '#type' => 'view',
- '#name' => 'test_view_embed',
- '#display_id' => 'default',
- '#arguments' => array(25),
- '#embed' => FALSE,
- ),
- );
}
/**
@@ -50,10 +31,11 @@ class ViewElementTest extends ViewTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$view = Views::getView('test_view_embed');
- $view->setDisplay();
- // Set the content as our rendered array.
- $render = $this->render;
+ // Get the render array, #embed must be FALSE since this is the default
+ // display.
+ $render = $view->buildRenderable();
+ $this->assertEqual($render['#embed'], FALSE);
$this->setRawContent($renderer->renderRoot($render));
$xpath = $this->xpath('//div[@class="views-element-container"]');
@@ -98,7 +80,8 @@ class ViewElementTest extends ViewTestBase {
$view->save();
// Test the render array again.
- $render = $this->render;
+ $view = Views::getView('test_view_embed');
+ $render = $view->buildRenderable(NULL, [25]);
$this->setRawContent($renderer->renderRoot($render));
// There should be 1 row in the results, 'John' arg 25.
$xpath = $this->xpath('//div[@class="view-content"]/div');
@@ -118,11 +101,10 @@ class ViewElementTest extends ViewTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$view = Views::getView('test_view_embed');
- $view->setDisplay('embed_1');
- // Set the content as our rendered array.
- $render = $this->render;
- $render['view']['#embed'] = TRUE;
+ // Get the render array, #embed must be TRUE since this is an embed display.
+ $render = $view->buildRenderable('embed_1');
+ $this->assertEqual($render['#embed'], TRUE);
$this->setRawContent($renderer->renderRoot($render));
$xpath = $this->xpath('//div[@class="views-element-container"]');
@@ -167,8 +149,8 @@ class ViewElementTest extends ViewTestBase {
$view->save();
// Test the render array again.
- $render = $this->render;
- $render['view']['#embed'] = TRUE;
+ $view = Views::getView('test_view_embed');
+ $render = $view->buildRenderable('embed_1', [25]);
$this->setRawContent($renderer->renderRoot($render));
// There should be 1 row in the results, 'John' arg 25.
$xpath = $this->xpath('//div[@class="view-content"]/div');
@@ -180,9 +162,8 @@ class ViewElementTest extends ViewTestBase {
$this->assertEqual(count($xpath), 1);
// Tests the render array with an exposed filter.
- $render = $this->render;
- $render['view']['#display_id'] = 'embed_2';
- $render['view']['#embed'] = TRUE;
+ $view = Views::getView('test_view_embed');
+ $render = $view->buildRenderable('embed_2');
$this->setRawContent($renderer->renderRoot($render));
// Ensure that the exposed form is rendered.
diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php
index 7a0d40216..bde26c1df 100644
--- a/core/modules/views/src/ViewExecutable.php
+++ b/core/modules/views/src/ViewExecutable.php
@@ -2062,7 +2062,7 @@ class ViewExecutable implements \Serializable {
$result = $this->displayHandlers->get($id)->validate();
if (!empty($result) && is_array($result)) {
- $errors[$id] = $result;
+ $errors[$id] = $result;
}
}
}
diff --git a/core/modules/views/src/ViewsDataHelper.php b/core/modules/views/src/ViewsDataHelper.php
index 55a034c2e..791cd37f4 100644
--- a/core/modules/views/src/ViewsDataHelper.php
+++ b/core/modules/views/src/ViewsDataHelper.php
@@ -190,4 +190,3 @@ class ViewsDataHelper {
}
}
-
diff --git a/core/modules/views/tests/fixtures/update/argument-placeholder.php b/core/modules/views/tests/fixtures/update/argument-placeholder.php
index 525299cdc..03181bbe5 100644
--- a/core/modules/views/tests/fixtures/update/argument-placeholder.php
+++ b/core/modules/views/tests/fixtures/update/argument-placeholder.php
@@ -5,12 +5,15 @@
* Text fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Component\Serialization\Yaml;
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_token_view',
- 'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
+ 'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
))
->execute();
diff --git a/core/modules/views/tests/fixtures/update/duplicate-field-handler.php b/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
index 69aa8e8e3..32e74fb7c 100644
--- a/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
+++ b/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
@@ -5,12 +5,15 @@
* Test fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Component\Serialization\Yaml;
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_duplicate_field_handlers',
- 'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
+ 'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
))
->execute();
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
new file mode 100644
index 000000000..601c93f83
--- /dev/null
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
@@ -0,0 +1,503 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - system.menu.tools
+ module:
+ - node
+id: test_row_render_cache_none
+label: 'Test no render cache'
+module: views
+description: ''
+tag: ''
+base_table: node_field_data
+base_field: nid
+core: 8.x
+display:
+ default:
+ display_plugin: default
+ id: default
+ display_title: Master
+ position: 0
+ display_options:
+ access:
+ type: none
+ options: { }
+ cache:
+ type: none
+ options: { }
+ query:
+ type: views_query
+ options:
+ disable_sql_rewrite: false
+ distinct: false
+ replica: false
+ query_comment: ''
+ query_tags: { }
+ exposed_form:
+ type: basic
+ options:
+ submit_button: Apply
+ reset_button: false
+ reset_button_label: Reset
+ exposed_sorts_label: 'Sort by'
+ expose_sort_order: true
+ sort_asc_label: Asc
+ sort_desc_label: Desc
+ pager:
+ type: full
+ options:
+ items_per_page: 10
+ offset: 0
+ id: 0
+ total_pages: null
+ expose:
+ items_per_page: false
+ items_per_page_label: 'Items per page'
+ items_per_page_options: '5, 10, 25, 50'
+ items_per_page_options_all: false
+ items_per_page_options_all_label: '- All -'
+ offset: false
+ offset_label: Offset
+ tags:
+ previous: '‹ Previous'
+ next: 'Next ›'
+ first: '« First'
+ last: 'Last »'
+ quantity: 9
+ style:
+ type: table
+ options:
+ grouping: { }
+ row_class: ''
+ default_row_class: true
+ override: true
+ sticky: false
+ caption: ''
+ summary: ''
+ description: ''
+ columns:
+ counter: counter
+ title: title
+ edit_node: edit_node
+ delete_node: delete_node
+ operations: operations
+ info:
+ counter:
+ sortable: false
+ default_sort_order: asc
+ align: ''
+ separator: ''
+ empty_column: false
+ responsive: ''
+ title:
+ sortable: true
+ default_sort_order: asc
+ align: ''
+ separator: ''
+ empty_column: false
+ responsive: ''
+ edit_node:
+ sortable: false
+ default_sort_order: asc
+ align: ''
+ separator: ''
+ empty_column: false
+ responsive: ''
+ delete_node:
+ sortable: false
+ default_sort_order: asc
+ align: ''
+ separator: ''
+ empty_column: false
+ responsive: ''
+ operations:
+ sortable: false
+ default_sort_order: asc
+ align: ''
+ separator: ''
+ empty_column: false
+ responsive: ''
+ default: '-1'
+ empty_table: false
+ row:
+ type: fields
+ options:
+ inline: { }
+ separator: ''
+ hide_empty: false
+ default_field_elements: true
+ fields:
+ nid:
+ id: nid
+ table: node_field_data
+ field: nid
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: ''
+ exclude: true
+ alter:
+ alter_text: false
+ text: ''
+ make_link: false
+ path: ''
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: true
+ ellipsis: true
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: false
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ click_sort_column: value
+ type: number_integer
+ settings:
+ thousand_separator: ''
+ prefix_suffix: true
+ group_column: value
+ group_columns: { }
+ group_rows: true
+ delta_limit: 0
+ delta_offset: 0
+ delta_reversed: false
+ delta_first_last: false
+ multi_type: separator
+ separator: ', '
+ field_api_classes: false
+ entity_type: node
+ entity_field: nid
+ plugin_id: field
+ counter:
+ id: counter
+ table: views
+ field: counter
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: Index
+ exclude: false
+ alter:
+ alter_text: true
+ text: '{{ nid }}: {{ counter }} (just in case: {{ nid }})'
+ make_link: false
+ path: ''
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: true
+ ellipsis: true
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: false
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ counter_start: 1
+ plugin_id: counter
+ title:
+ id: title
+ table: node_field_data
+ field: title
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: Title
+ exclude: false
+ alter:
+ alter_text: true
+ text: '{{ title }} {{ counter }}'
+ make_link: true
+ path: 'node/{{ nid }}'
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: false
+ ellipsis: false
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: true
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ click_sort_column: value
+ type: string
+ settings:
+ link_to_entity: false
+ group_column: value
+ group_columns: { }
+ group_rows: true
+ delta_limit: 0
+ delta_offset: 0
+ delta_reversed: false
+ delta_first_last: false
+ multi_type: separator
+ separator: ', '
+ field_api_classes: false
+ entity_type: node
+ entity_field: title
+ plugin_id: field
+ edit_node:
+ id: edit_node
+ table: node
+ field: edit_node
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: ''
+ exclude: false
+ alter:
+ alter_text: false
+ text: ''
+ make_link: false
+ path: ''
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: true
+ ellipsis: true
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: false
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ text: ''
+ entity_type: node
+ plugin_id: entity_link_edit
+ delete_node:
+ id: delete_node
+ table: node
+ field: delete_node
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: ''
+ exclude: false
+ alter:
+ alter_text: false
+ text: ''
+ make_link: false
+ path: ''
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: true
+ ellipsis: true
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: false
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ text: ''
+ entity_type: node
+ plugin_id: entity_link_delete
+ operations:
+ id: operations
+ table: node
+ field: operations
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: Operations
+ exclude: false
+ alter:
+ alter_text: false
+ text: ''
+ make_link: false
+ path: ''
+ absolute: false
+ external: false
+ replace_spaces: false
+ path_case: none
+ trim_whitespace: false
+ alt: ''
+ rel: ''
+ link_class: ''
+ prefix: ''
+ suffix: ''
+ target: ''
+ nl2br: false
+ max_length: 0
+ word_boundary: true
+ ellipsis: true
+ more_link: false
+ more_link_text: ''
+ more_link_path: ''
+ strip_tags: false
+ trim: false
+ preserve_tags: ''
+ html: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: true
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ destination: true
+ entity_type: node
+ plugin_id: entity_operations
+ filters:
+ status:
+ value: true
+ table: node_field_data
+ field: status
+ plugin_id: boolean
+ entity_type: node
+ entity_field: status
+ id: status
+ expose:
+ operator: ''
+ group: 1
+ sorts:
+ title:
+ id: title
+ table: node_field_data
+ field: title
+ relationship: none
+ group_type: group
+ admin_label: ''
+ order: ASC
+ exposed: false
+ expose:
+ label: ''
+ entity_type: node
+ entity_field: title
+ plugin_id: standard
+ header: { }
+ footer: { }
+ empty: { }
+ relationships: { }
+ arguments: { }
+ display_extenders: { }
+ cache_metadata:
+ contexts:
+ - 'languages:language_content'
+ - 'languages:language_interface'
+ - 'user.node_grants:view'
+ max-age: 0
diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.module b/core/modules/views/tests/modules/views_test_data/views_test_data.module
index f041651dc..bd917c7ee 100644
--- a/core/modules/views/tests/modules/views_test_data/views_test_data.module
+++ b/core/modules/views/tests/modules/views_test_data/views_test_data.module
@@ -5,6 +5,8 @@
* Helper module for Views tests.
*/
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Access callback for the generic handler test.
*
@@ -126,6 +128,6 @@ function views_test_data_test_pre_render_function($element) {
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
-function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, FormStateInterface $form_state, $form_id) {
drupal_set_message(t('Test base form ID with Views forms and arguments.'));
}
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
index 3c727301c..8c32dc638 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
@@ -163,7 +163,7 @@ class FieldFieldTest extends ViewsKernelTestBase {
'name' => 'base value',
'field_test' => 1,
'field_test_multiple' => [1, 3, 7],
- 'user_id' => $this->testUsers[0]->id(),
+ 'user_id' => $this->testUsers[0]->id(),
]);
$entity->save();
$original_entity = clone $entity;
diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
index 84f959b07..7a88066e8 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
@@ -215,4 +215,3 @@ class FilterBooleanOperatorTest extends ViewsKernelTestBase {
}
}
-
diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php
index 74159abd9..ddf3347f0 100644
--- a/core/modules/views/tests/src/Kernel/ModuleTest.php
+++ b/core/modules/views/tests/src/Kernel/ModuleTest.php
@@ -115,6 +115,8 @@ class ModuleTest extends ViewsKernelTestBase {
/**
* Defines an error handler which is used in the test.
*
+ * Because this is registered in set_error_handler(), it has to be public.
+ *
* @param int $error_level
* The level of the error raised.
* @param string $message
@@ -127,7 +129,6 @@ class ModuleTest extends ViewsKernelTestBase {
* An array that points to the active symbol table at the point the error
* occurred.
*
- * Because this is registered in set_error_handler(), it has to be public.
* @see set_error_handler()
*/
public function customErrorHandler($error_level, $message, $filename, $line, $context) {
@@ -229,7 +230,7 @@ class ModuleTest extends ViewsKernelTestBase {
$plugins = Views::fetchPluginNames('style');
$definitions = $this->container->get('plugin.manager.views.style')->getDefinitions();
$expected = array();
- foreach ($definitions as $id =>$definition) {
+ foreach ($definitions as $id => $definition) {
$expected[$id] = $definition['title'];
}
asort($expected);
diff --git a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php
index cfd5e3a81..ac85c77a9 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php
@@ -31,7 +31,7 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
*
* @var array
*/
- public static $testViews = array('test_row_render_cache');
+ public static $testViews = array('test_row_render_cache', 'test_row_render_cache_none');
/**
* An editor user account.
@@ -103,6 +103,34 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
$this->doTestRenderedOutput($this->editorUser);
}
+ /**
+ * Test that rows are not cached when the none cache plugin is used.
+ */
+ public function testNoCaching() {
+ $this->setCurrentUser($this->regularUser);
+ $view = Views::getView('test_row_render_cache_none');
+ $view->setDisplay();
+ $view->preview();
+
+ /** @var \Drupal\Core\Render\RenderCacheInterface $render_cache */
+ $render_cache = $this->container->get('render_cache');
+
+ /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
+ $cache_plugin = $view->display_handler->getPlugin('cache');
+
+ foreach ($view->result as $row) {
+ $keys = $cache_plugin->getRowCacheKeys($row);
+ $cache = [
+ '#cache' => [
+ 'keys' => $keys,
+ 'contexts' => ['languages:language_interface', 'theme', 'user.permissions'],
+ ],
+ ];
+ $element = $render_cache->get($cache);
+ $this->assertFalse($element);
+ }
+ }
+
/**
* Check whether the rendered output matches expectations.
*
@@ -161,7 +189,13 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
if ($check_cache) {
$keys = $cache_plugin->getRowCacheKeys($view->result[$index]);
$user_context = !$account->hasPermission('edit any test content') ? 'user' : 'user.permissions';
- $element = $render_cache->get(['#cache' => ['keys' => $keys, 'contexts' => ['languages:language_interface', 'theme', $user_context]]]);
+ $cache = [
+ '#cache' => [
+ 'keys' => $keys,
+ 'contexts' => ['languages:language_interface', 'theme', $user_context],
+ ],
+ ];
+ $element = $render_cache->get($cache);
$this->assertTrue($element);
}
diff --git a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php
index 9d4c139ed..a2bec23a0 100644
--- a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php
+++ b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php
@@ -94,7 +94,7 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase {
// Empty result (no entities yet).
$this->pass('Test without entities');
- $base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
+ $base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
$this->assertViewsCacheTags($view, $base_tags, $do_assert_views_caches, $base_tags);
$this->assertViewsCacheTagsFromStaticRenderArray($view, $base_tags, $do_assert_views_caches);
diff --git a/core/modules/views/src/Tests/TestViewsTest.php b/core/modules/views/tests/src/Kernel/TestViewsTest.php
similarity index 95%
rename from core/modules/views/src/Tests/TestViewsTest.php
rename to core/modules/views/tests/src/Kernel/TestViewsTest.php
index f0d8f8e96..f67b5e8d8 100644
--- a/core/modules/views/src/Tests/TestViewsTest.php
+++ b/core/modules/views/tests/src/Kernel/TestViewsTest.php
@@ -1,12 +1,12 @@
displayHandlers as $id => $display) {
$match = function($value) use ($display) {
- return strpos($value, $display->display['display_title']) !== false;
+ return strpos($value, $display->display['display_title']) !== FALSE;
};
$this->assertTrue(array_filter($validate[$id], $match), format_string('Error message found for @id display', array('@id' => $id)));
$count++;
diff --git a/core/modules/views/tests/src/Kernel/Wizard/WizardPluginBaseKernelTest.php b/core/modules/views/tests/src/Kernel/Wizard/WizardPluginBaseKernelTest.php
index 9cd4ac4e9..8a1fc9608 100644
--- a/core/modules/views/tests/src/Kernel/Wizard/WizardPluginBaseKernelTest.php
+++ b/core/modules/views/tests/src/Kernel/Wizard/WizardPluginBaseKernelTest.php
@@ -71,4 +71,3 @@ class WizardPluginBaseKernelTest extends ViewsKernelTestBase {
$this->assertEqual($view->get('langcode'), 'it');
}
}
-
diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
index d686c9774..332df31e2 100644
--- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
@@ -360,4 +360,3 @@ class ViewAjaxControllerTest extends UnitTestCase {
}
}
-
diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
index 90ba4f311..f9ca7d873 100644
--- a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php
@@ -214,7 +214,7 @@ class EntityTest extends UnitTestCase {
$options['bundles'] = array('test_bundle' => 1);
$argumentValidator->init($this->executable, $this->display, $options);
- $this->assertEquals(['config'=>['test_bundle']], $argumentValidator->calculateDependencies());
+ $this->assertEquals(['config' => ['test_bundle']], $argumentValidator->calculateDependencies());
}
/**
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index b70b55dc4..9672dc213 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -395,46 +395,46 @@ class FieldPluginBaseTest extends UnitTestCase {
// Simple path with default options.
$url = Url::fromRoute('test_route');
- $data[]= [$url, [], clone $url, '/test-path', clone $url, 'value'];
+ $data[] = [$url, [], clone $url, '/test-path', clone $url, 'value'];
// Simple url with parameters.
$url_parameters = Url::fromRoute('test_route', ['key' => 'value']);
- $data[]= [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, 'value'];
+ $data[] = [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, 'value'];
// Add a fragment.
$url = Url::fromRoute('test_route');
$url_with_fragment = Url::fromRoute('test_route');
$options = ['fragment' => 'test'] + $this->defaultUrlOptions;
$url_with_fragment->setOptions($options);
- $data[]= [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, 'value'];
+ $data[] = [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, 'value'];
// Rel attributes.
$url = Url::fromRoute('test_route');
$url_with_rel = Url::fromRoute('test_route');
$options = ['attributes' => ['rel' => 'up']] + $this->defaultUrlOptions;
$url_with_rel->setOptions($options);
- $data[]= [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, 'value'];
+ $data[] = [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, 'value'];
// Target attributes.
$url = Url::fromRoute('test_route');
$url_with_target = Url::fromRoute('test_route');
$options = ['attributes' => ['target' => '_blank']] + $this->defaultUrlOptions;
$url_with_target->setOptions($options);
- $data[]= [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, 'value'];
+ $data[] = [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, 'value'];
// Link attributes.
$url = Url::fromRoute('test_route');
$url_with_link_attributes = Url::fromRoute('test_route');
$options = ['attributes' => ['foo' => 'bar']] + $this->defaultUrlOptions;
$url_with_link_attributes->setOptions($options);
- $data[]= [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, 'value'];
+ $data[] = [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, 'value'];
// Manual specified query.
$url = Url::fromRoute('test_route');
$url_with_query = Url::fromRoute('test_route');
$options = ['query' => ['foo' => 'bar']] + $this->defaultUrlOptions;
$url_with_query->setOptions($options);
- $data[]= [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, 'value'];
+ $data[] = [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, 'value'];
// Query specified as part of the path.
$url = Url::fromRoute('test_route')->setOption('query', ['foo' => 'bar']);
@@ -510,7 +510,7 @@ class FieldPluginBaseTest extends UnitTestCase {
$field->field_alias = 'key';
$row = new ResultRow(['key' => 'value']);
- $build =[
+ $build = [
'#type' => 'inline_template',
'#template' => 'test-path/' . explode('/', $path)[1],
'#context' => ['foo' => 123],
diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php
index 737d47fc7..21ef9c3a7 100644
--- a/core/modules/views/tests/src/Unit/ViewsDataTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php
@@ -161,7 +161,7 @@ class ViewsDataTest extends UnitTestCase {
$this->assertCount(6, $base_tables, 'The correct amount of base tables were returned.');
$base_tables_keys = array_keys($base_tables);
for ($i = 1; $i < count($base_tables); ++$i) {
- $prev = $base_tables[$base_tables_keys[$i - 1]];
+ $prev = $base_tables[$base_tables_keys[$i - 1]];
$current = $base_tables[$base_tables_keys[$i]];
$this->assertTrue($prev['weight'] <= $current['weight'] && $prev['title'] <= $prev['title'], 'The tables are sorted as expected.');
}
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index c6632a504..928348161 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -29,7 +29,7 @@ function views_help($route_name, RouteMatchInterface $route_match) {
$output .= '' . t('About') . '
';
$output .= '' . t('The Views module provides a back end to fetch information from content, user accounts, taxonomy terms, and other entities from the database and present it to the user as a grid, HTML list, table, unformatted list, etc. The resulting displays are known generally as views.') . '
';
$output .= '' . t('For more information, see the online documentation for the Views module.', array(':views' => 'https://www.drupal.org/documentation/modules/views')) . '
';
- $output .= '' . t('In order to create and modify your own views using the administration and configuration user interface, you will need to enable either the Views UI module in core or a contributed module that provides a user interface for Views. See the Views UI module help page for more information.', array(':views-ui' => (\Drupal::moduleHandler()->moduleExists('views_ui')) ? \Drupal::url('help.page', array('name' => 'views_ui')) : '#')) . '
';
+ $output .= '' . t('In order to create and modify your own views using the administration and configuration user interface, you will need to enable either the Views UI module in core or a contributed module that provides a user interface for Views. See the Views UI module help page for more information.', array(':views-ui' => (\Drupal::moduleHandler()->moduleExists('views_ui')) ? \Drupal::url('help.page', array('name' => 'views_ui')) : '#')) . '
';
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Adding functionality to administrative pages') . '
';
diff --git a/core/modules/views/views.post_update.php b/core/modules/views/views.post_update.php
index 09a08f684..2d670c2af 100644
--- a/core/modules/views/views.post_update.php
+++ b/core/modules/views/views.post_update.php
@@ -159,3 +159,26 @@ function views_post_update_field_formatter_dependencies() {
/**
* @} End of "addtogroup updates-8.0.x".
*/
+
+/**
+ * @addtogroup updates-8.1.x
+ * @{
+ */
+
+/**
+ * Fix views with dependencies on taxonomy terms that don't exist.
+ */
+function views_post_update_taxonomy_index_tid() {
+ $views = View::loadMultiple();
+ array_walk($views, function(View $view) {
+ $old_dependencies = $view->getDependencies();
+ $new_dependencies = $view->calculateDependencies()->getDependencies();
+ if ($old_dependencies !== $new_dependencies) {
+ $view->save();
+ }
+ });
+}
+
+/**
+ * @} End of "addtogroup updates-8.1.x".
+ */
diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc
index dcca9865f..8e73dd6e4 100644
--- a/core/modules/views/views.views.inc
+++ b/core/modules/views/views.views.inc
@@ -426,7 +426,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
'group' => $group,
'title' => $label,
'title short' => $label,
- 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
+ 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
);
// Go through and create a list of aliases for all possible combinations of
@@ -545,7 +545,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
'group' => $group,
'title' => $title,
'title short' => $title_short,
- 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
+ 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
);
// Go through and create a list of aliases for all possible combinations of
@@ -702,7 +702,7 @@ function core_field_views_data(FieldStorageConfigInterface $field_storage) {
'title' => t('@label referenced from @field_name', $args),
'label' => t('@field_name: @label', $args),
'group' => $entity_type->getLabel(),
- 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $field_storage->getBundles()))),
+ 'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $field_storage->getBundles()))),
'id' => 'standard',
'base' => $target_base_table,
'entity type' => $target_entity_type_id,
diff --git a/core/modules/views_ui/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
index 576ea4305..b63c0242b 100644
--- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
@@ -160,7 +160,7 @@ class AddHandler extends ViewsFormBase {
}
else {
$form['options']['markup'] = array(
- '#markup' => '' . $this->t('There are no @types available to add.', array('@types' => $ltitle)) . '
',
+ '#markup' => '' . $this->t('There are no @types available to add.', array('@types' => $ltitle)) . '
',
);
}
// Add a div to show the selected items
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
index d38d832da..0c10fb1fa 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
@@ -53,7 +53,7 @@ class ConfigHandlerExtra extends ViewsFormBase {
$form = array(
'options' => array(
- '#tree' => true,
+ '#tree' => TRUE,
'#theme_wrappers' => array('container'),
'#attributes' => array('class' => array('scroll'), 'data-drupal-views-scroll' => TRUE),
),
diff --git a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
index 85a13bc85..e858a84f4 100644
--- a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
+++ b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
@@ -352,4 +352,3 @@ class RearrangeFilter extends ViewsFormBase {
}
}
-
diff --git a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
index 58344bf71..93bd04980 100644
--- a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
+++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
@@ -3,17 +3,20 @@
namespace Drupal\views_ui\Form\Ajax;
use Drupal\Component\Utility\Html;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CloseModalDialogCommand;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\RenderContext;
+use Drupal\views\Ajax\HighlightCommand;
+use Drupal\views\Ajax\ReplaceTitleCommand;
+use Drupal\views\Ajax\ShowButtonsCommand;
+use Drupal\views\Ajax\TriggerPreviewCommand;
use Drupal\views\ViewEntityInterface;
-use Drupal\views\Ajax;
-use Drupal\views_ui\Ajax as AjaxUI;
-use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\CloseModalDialogCommand;
+use Drupal\views_ui\Ajax\SetFormCommand;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
@@ -151,10 +154,10 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
else {
$response = new AjaxResponse();
$response->addCommand(new CloseModalDialogCommand());
- $response->addCommand(new Ajax\ShowButtonsCommand(!empty($view->changed)));
- $response->addCommand(new Ajax\TriggerPreviewCommand());
+ $response->addCommand(new ShowButtonsCommand(!empty($view->changed)));
+ $response->addCommand(new TriggerPreviewCommand());
if ($page_title = $form_state->get('page_title')) {
- $response->addCommand(new Ajax\ReplaceTitleCommand($page_title));
+ $response->addCommand(new ReplaceTitleCommand($page_title));
}
}
// If this form was for view-wide changes, there's no need to regenerate
@@ -248,10 +251,10 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
// Usually this happens at the same path, but custom paths may be
// specified in $form_state.
$form_url = $form_state->has('url') ? $form_state->get('url')->toString() : $this->url('');
- $response->addCommand(new AjaxUI\SetFormCommand($form_url));
+ $response->addCommand(new SetFormCommand($form_url));
if ($section = $form_state->get('#section')) {
- $response->addCommand(new Ajax\HighlightCommand('.' . Html::cleanCssIdentifier($section)));
+ $response->addCommand(new HighlightCommand('.' . Html::cleanCssIdentifier($section)));
}
return $response;
diff --git a/core/modules/views_ui/src/Tests/CachedDataUITest.php b/core/modules/views_ui/src/Tests/CachedDataUITest.php
index dbcb137f5..1f69b196d 100644
--- a/core/modules/views_ui/src/Tests/CachedDataUITest.php
+++ b/core/modules/views_ui/src/Tests/CachedDataUITest.php
@@ -44,7 +44,7 @@ class CachedDataUITest extends UITestBase {
// Test we are redirected to the view listing page.
$this->assertUrl('admin/structure/views', array(), 'Redirected back to the view listing page.');
- // Login with another user and make sure the view is locked and break.
+ // Log in with another user and make sure the view is locked and break.
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/title', array(), t('Apply'));
$this->drupalLogin($this->adminUser);
diff --git a/core/modules/views_ui/src/Tests/FieldUITest.php b/core/modules/views_ui/src/Tests/FieldUITest.php
index 698e35894..5b79da9b4 100644
--- a/core/modules/views_ui/src/Tests/FieldUITest.php
+++ b/core/modules/views_ui/src/Tests/FieldUITest.php
@@ -54,7 +54,7 @@ class FieldUITest extends UITestBase {
$this->assertEqual((string) $result[2], '{{ name }} == Name');
$result = $this->xpath('//details[@id="edit-options-more"]');
- $this->assertEqual(empty($result), true, "Container 'more' is empty and should not be displayed.");
+ $this->assertEqual(empty($result), TRUE, "Container 'more' is empty and should not be displayed.");
}
/**
diff --git a/core/modules/views_ui/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php
index a674fa991..1be86cc80 100644
--- a/core/modules/views_ui/src/Tests/PreviewTest.php
+++ b/core/modules/views_ui/src/Tests/PreviewTest.php
@@ -107,7 +107,7 @@ class PreviewTest extends UITestBase {
$this->assertText("SELECT views_test_data.name AS views_test_data_name\nFROM \n{views_test_data} views_test_data\nWHERE (( (views_test_data.id = '100' ) ))");
// Test that the statistics and query are rendered above the preview.
- $this->assertTrue(strpos($this->getRawContent(), 'views-query-info') < strpos($this->getRawContent(), 'view-test-preview') , 'Statistics shown above the preview.');
+ $this->assertTrue(strpos($this->getRawContent(), 'views-query-info') < strpos($this->getRawContent(), 'view-test-preview'), 'Statistics shown above the preview.');
// Test that statistics and query rendered below the preview.
$settings->set('ui.show.sql_query.where', 'below')->save();
diff --git a/core/modules/views_ui/src/Tests/RedirectTest.php b/core/modules/views_ui/src/Tests/RedirectTest.php
index eca894aa6..7a019597c 100644
--- a/core/modules/views_ui/src/Tests/RedirectTest.php
+++ b/core/modules/views_ui/src/Tests/RedirectTest.php
@@ -25,7 +25,7 @@ class RedirectTest extends UITestBase {
$random_destination = $this->randomMachineName();
$edit_path = "admin/structure/views/view/$view_name/edit";
- $this->drupalPostForm($edit_path, array(), t('Save') , array('query' => array('destination' => $random_destination)));
+ $this->drupalPostForm($edit_path, array(), t('Save'), array('query' => array('destination' => $random_destination)));
$this->assertUrl($random_destination, array(), 'Make sure the user got redirected to the expected page defined in the destination.');
// Setup a view with a certain page display path. If you change the path
diff --git a/core/modules/views_ui/src/Tests/TranslatedViewTest.php b/core/modules/views_ui/src/Tests/TranslatedViewTest.php
index 80c98c00b..beaf5f195 100644
--- a/core/modules/views_ui/src/Tests/TranslatedViewTest.php
+++ b/core/modules/views_ui/src/Tests/TranslatedViewTest.php
@@ -48,7 +48,7 @@ class TranslatedViewTest extends WebTestBase {
'translate interface',
];
- // Create and login user.
+ // Create and log in user.
$this->adminUser = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->adminUser);
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
new file mode 100644
index 000000000..fc98e87ff
--- /dev/null
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
@@ -0,0 +1,69 @@
+drupalCreateUser([
+ 'administer site configuration',
+ 'administer views',
+ 'administer nodes',
+ 'access content overview',
+ ]);
+
+ // Disable automatic live preview to make the sequence of calls clearer.
+ \Drupal::configFactory()->getEditable('views.settings')->set('ui.always_live_preview', FALSE)->save();
+ $this->drupalLogin($admin_user);
+
+ $this->drupalGet('admin/structure/views/view/content');
+ $page = $this->getSession()->getPage();
+
+ // Use the 'Add' link for fields to open a dialog. This will load the proper
+ // dialog libraries.
+ $add_link = $page->findById('views-add-field');
+ $this->assertTrue($add_link->isVisible(), 'Add fields button found.');
+ $add_link->click();
+ $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ // Close the dialog and open it again. No no libraries will be loaded, but a
+ // cache entry will be made for not loading any libraries.
+ $page->pressButton('Close');
+ $add_link->click();
+ $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ $page->pressButton('Close');
+
+ // Reload the page.
+ $this->drupalGet('admin/structure/views/view/content');
+ $page = $this->getSession()->getPage();
+
+ // Now use the 'Update preview' button to load libraries.
+ $preview = $page->findById('preview-submit');
+ // The first click will load all the libraries.
+ $preview->click();
+ $this->getSession()->wait(5000, "jQuery('.ajax-progress').length === 0");
+ // The second click will not load any new libraries.
+ $preview->click();
+ $this->getSession()->wait(5000, "jQuery('.ajax-progress').length === 0");
+ // Check to see if the dialogs still open.
+ $add_link = $page->findById('views-add-field');
+ $add_link->click();
+ $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ $page->pressButton('Close');
+ }
+
+}
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index 60fdc51a6..5240aa768 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -270,7 +270,7 @@ function views_ui_contextual_links_suppress($set = NULL) {
* @see views_ui_contextual_links_suppress_pop()
*/
function views_ui_contextual_links_suppress_push() {
- views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())+1);
+ views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) + 1);
}
/**
@@ -279,7 +279,7 @@ function views_ui_contextual_links_suppress_push() {
* @see views_ui_contextual_links_suppress_push()
*/
function views_ui_contextual_links_suppress_pop() {
- views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())-1);
+ views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) - 1);
}
/**
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index f9b165a11..3b5867894 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -8,6 +8,8 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element;
+use Drupal\Core\Render\Element\Checkboxes;
+use Drupal\Core\Render\Element\Radios;
use Drupal\Core\Url;
/**
@@ -88,8 +90,8 @@ function template_preprocess_views_ui_build_group_filter_form(&$variables) {
// Prepare default selectors.
$form_state = new FormState();
- $form['default_group'] = Element\Radios::processRadios($form['default_group'], $form_state, $form);
- $form['default_group_multiple'] = Element\Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
+ $form['default_group'] = Radios::processRadios($form['default_group'], $form_state, $form);
+ $form['default_group_multiple'] = Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
$form['default_group']['All']['#title'] = '';
$rows[] = array(
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index c2237457a..3d7ad63e9 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -12,13 +12,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -35,12 +88,15 @@
+
+
+
diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist
index 5d6146726..2b45c6429 100644
--- a/core/phpunit.xml.dist
+++ b/core/phpunit.xml.dist
@@ -19,12 +19,12 @@
-
-
+
-
+
+
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
index 41e5b79bc..9f0f016ea 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
@@ -41,6 +41,9 @@ abstract class JavascriptTestBase extends BrowserTestBase {
* The CSS selector identifying the element to check.
* @param string $message
* Optional message to show alongside the assertion.
+ *
+ * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use
+ * \Behat\Mink\Element\NodeElement::isVisible() instead.
*/
protected function assertElementVisible($css_selector, $message = '') {
$this->assertTrue($this->getSession()->getDriver()->isVisible(CssSelector::toXPath($css_selector)), $message);
@@ -53,6 +56,9 @@ abstract class JavascriptTestBase extends BrowserTestBase {
* The CSS selector identifying the element to check.
* @param string $message
* Optional message to show alongside the assertion.
+ *
+ * @deprecated in Drupal 8.1.x, will be removed before Drupal 8.3.x. Use
+ * \Behat\Mink\Element\NodeElement::isVisible() instead.
*/
protected function assertElementNotVisible($css_selector, $message = '') {
$this->assertFalse($this->getSession()->getDriver()->isVisible(CssSelector::toXPath($css_selector)), $message);
diff --git a/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
new file mode 100644
index 000000000..7dcafbff8
--- /dev/null
+++ b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
@@ -0,0 +1,57 @@
+placeBlock('system_breadcrumb_block', ['id' => 'breadcrumb']);
+
+ // Prime the cache first.
+ $this->drupalGet('/not-found-1');
+ $base_count = count($this->getBreadcrumbCacheEntries());
+
+ $this->drupalGet('/not-found-2');
+ $next_count = count($this->getBreadcrumbCacheEntries());
+ $this->assertEquals($base_count, $next_count);
+
+ $this->drupalGet('/not-found-3');
+ $next_count = count($this->getBreadcrumbCacheEntries());
+ $this->assertEquals($base_count, $next_count);
+ }
+
+ /**
+ * Gets the breadcrumb cache entries.
+ *
+ * @return array
+ * The breadcrumb cache entries.
+ */
+ protected function getBreadcrumbCacheEntries() {
+ $database = \Drupal::database();
+ $cache_entries = $database->select('cache_render')
+ ->fields('cache_render')
+ ->condition('cid', $database->escapeLike('entity_view:block:breadcrumb') . '%', 'LIKE')
+ ->execute()
+ ->fetchAllAssoc('cid');
+ return $cache_entries;
+ }
+
+}
diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
index 3d6c0b9ca..e3c2aeb08 100644
--- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
@@ -112,4 +112,3 @@ class DefaultConfigTest extends KernelTestBase {
}
}
-
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
index 1117f347a..945e994e3 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
@@ -686,4 +686,98 @@ class ConfigImporterTest extends KernelTestBase {
}
}
+ /**
+ * Tests the isSyncing flags.
+ */
+ public function testIsSyncingInHooks() {
+ $dynamic_name = 'config_test.dynamic.dotted.default';
+ $storage = $this->container->get('config.storage');
+
+ // Verify the default configuration values exist.
+ $config = $this->config($dynamic_name);
+ $this->assertSame('dotted.default', $config->get('id'));
+
+ // Delete the config so that create hooks will fire.
+ $storage->delete($dynamic_name);
+ \Drupal::state()->set('config_test.store_isSyncing', []);
+ $this->configImporter->reset()->import();
+
+ // The values of the syncing values should be stored in state by
+ // config_test_config_test_create().
+ $state = \Drupal::state()->get('config_test.store_isSyncing');
+ $this->assertTrue($state['global_state::create'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::create'], 'ConfigEntity::isSyncing() returns TRUE');
+ $this->assertTrue($state['global_state::presave'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::presave'], 'ConfigEntity::isSyncing() returns TRUE');
+ $this->assertTrue($state['global_state::insert'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::insert'], 'ConfigEntity::isSyncing() returns TRUE');
+
+ // Cause a config update so update hooks will fire.
+ $config = $this->config($dynamic_name);
+ $config->set('label', 'A new name')->save();
+ \Drupal::state()->set('config_test.store_isSyncing', []);
+ $this->configImporter->reset()->import();
+
+ // The values of the syncing values should be stored in state by
+ // config_test_config_test_create().
+ $state = \Drupal::state()->get('config_test.store_isSyncing');
+ $this->assertTrue($state['global_state::presave'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::presave'], 'ConfigEntity::isSyncing() returns TRUE');
+ $this->assertTrue($state['global_state::update'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::update'], 'ConfigEntity::isSyncing() returns TRUE');
+
+ // Cause a config delete so delete hooks will fire.
+ $sync = $this->container->get('config.storage.sync');
+ $sync->delete($dynamic_name);
+ \Drupal::state()->set('config_test.store_isSyncing', []);
+ $this->configImporter->reset()->import();
+
+ // The values of the syncing values should be stored in state by
+ // config_test_config_test_create().
+ $state = \Drupal::state()->get('config_test.store_isSyncing');
+ $this->assertTrue($state['global_state::predelete'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::predelete'], 'ConfigEntity::isSyncing() returns TRUE');
+ $this->assertTrue($state['global_state::delete'], '\Drupal::isConfigSyncing() returns TRUE');
+ $this->assertTrue($state['entity_state::delete'], 'ConfigEntity::isSyncing() returns TRUE');
+ }
+
+ /**
+ * Tests that the isConfigSyncing flag is cleanup after an invalid step.
+ */
+ public function testInvalidStep() {
+ $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE');
+ $context = [];
+ try {
+ $this->configImporter->doSyncStep('a_non_existent_step', $context);
+ $this->fail('Expected \InvalidArgumentException thrown');
+ }
+ catch (\InvalidArgumentException $e) {
+ $this->pass('Expected \InvalidArgumentException thrown');
+ }
+ $this->assertFalse(\Drupal::isConfigSyncing(), 'After an invalid step \Drupal::isConfigSyncing() returns FALSE');
+ }
+
+ /**
+ * Tests that the isConfigSyncing flag is set correctly during a custom step.
+ */
+ public function testCustomStep() {
+ $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE');
+ $context = [];
+ $this->configImporter->doSyncStep([self::class, 'customStep'], $context);
+ $this->assertTrue($context['is_syncing'], 'Inside a custom step \Drupal::isConfigSyncing() returns TRUE');
+ $this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \Drupal::isConfigSyncing() returns FALSE');
+ }
+
+ /**
+ * Helper meothd to test custom config installer steps.
+ *
+ * @param array $context
+ * Batch context.
+ * @param \Drupal\Core\Config\ConfigImporter $importer
+ * The config importer.
+ */
+ public static function customStep(array &$context, ConfigImporter $importer) {
+ $context['is_syncing'] = \Drupal::isConfigSyncing();
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php
index d863386a5..8d0760acf 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php
@@ -117,4 +117,3 @@ class ConfigLanguageOverrideTest extends KernelTestBase {
$this->assertEqual($override->get('value'), NULL);
}
}
-
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php
index 3510ee961..454e70be3 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php
@@ -23,7 +23,7 @@ class ConfigOverridesPriorityTest extends KernelTestBase {
public function testOverridePriorities() {
$GLOBALS['config_test_run_module_overrides'] = FALSE;
- $non_overridden_mail = 'site@example.com';
+ $non_overridden_mail = 'site@example.com';
$language_overridden_mail = 'french@example.com';
$language_overridden_name = 'French site name';
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
index 41bcab516..ae3abdd87 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
@@ -95,7 +95,7 @@ class ConfigSchemaTest extends KernelTestBase {
$expected['label'] = 'Maintenance mode';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['mapping']['message'] = array(
- 'label' => 'Message to display when in maintenance mode',
+ 'label' => 'Message to display when in maintenance mode',
'type' => 'text',
);
$expected['mapping']['langcode'] = array(
@@ -119,7 +119,7 @@ class ConfigSchemaTest extends KernelTestBase {
);
$expected['mapping']['_core']['type'] = '_core_config_info';
$expected['mapping']['label'] = array(
- 'label' => 'Label',
+ 'label' => 'Label',
'type' => 'label',
);
$expected['mapping']['irrelevant'] = array(
@@ -204,7 +204,7 @@ class ConfigSchemaTest extends KernelTestBase {
$effects = \Drupal::service('config.typed')->get('image.style.medium')->get('effects');
$definition = $effects->get('bddf0d06-42f9-4c75-a700-a33cafa25ea0')->get('data')->getDataDefinition()->toArray();
// This should be the schema for image.effect.image_scale, reuse previous one.
- $expected['type'] = 'image.effect.image_scale';
+ $expected['type'] = 'image.effect.image_scale';
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for the first effect of image.style.medium');
diff --git a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
index f9f7b004e..82996fa3f 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
@@ -103,7 +103,7 @@ class AlterTest extends DatabaseTestBase {
$record = $result->fetch();
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
}
/**
@@ -145,6 +145,6 @@ class AlterTest extends DatabaseTestBase {
$record = $query->execute()->fetch();
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
}
}
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
index 82881986a..fa0a7cd9b 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
@@ -427,7 +427,7 @@ class SchemaTest extends KernelTestBase {
// Now set up columns for the other types.
$types = array('int', 'float', 'numeric');
foreach ($types as $type) {
- $column_spec = array('type' => $type, 'unsigned'=> TRUE);
+ $column_spec = array('type' => $type, 'unsigned' => TRUE);
if ($type == 'numeric') {
$column_spec += array('precision' => 10, 'scale' => 0);
}
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
index 46cf8af5c..b5248631f 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
@@ -133,7 +133,7 @@ class SelectTest extends DatabaseTestBase {
// Ensure that we got the right record.
$record = $result->fetch();
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27*2, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$age_field, 27 * 2, 'Fetched age expression is correct.');
}
/**
@@ -154,8 +154,8 @@ class SelectTest extends DatabaseTestBase {
// Ensure that we got the right record.
$record = $result->fetch();
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_double_field, 27*2, 'Fetched double age expression is correct.');
- $this->assertEqual($record->$age_triple_field, 27*3, 'Fetched triple age expression is correct.');
+ $this->assertEqual($record->$age_double_field, 27 * 2, 'Fetched double age expression is correct.');
+ $this->assertEqual($record->$age_triple_field, 27 * 3, 'Fetched triple age expression is correct.');
}
/**
diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php
index 10912d9e1..49d8f8ecf 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php
@@ -137,7 +137,7 @@ class UpdateTest extends DatabaseTestBase {
->execute();
$this->assertIdentical($num_updated, 1, 'Updated 1 record.');
- $saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
+ $saved_name = db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
$this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.');
}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php
new file mode 100644
index 000000000..b0fdaa887
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php
@@ -0,0 +1,177 @@
+save();
+
+ $this->installEntitySchema('entity_test_mulrev');
+ $this->installEntitySchema('entity_test_rev');
+ $this->mulRev = $this->entityManager->getStorage('entity_test_mulrev');
+ $this->rev = $this->entityManager->getStorage('entity_test_rev');
+ }
+
+ /**
+ * Tests non-revisionable fields on revisionable and translatable entities.
+ */
+ public function testMulNonRevisionableField() {
+ $user1 = $this->createUser();
+ $user2 = $this->createUser();
+
+ // Create a test entity.
+ $entity = EntityTestMulRev::create(array(
+ 'name' => $this->randomString(),
+ 'user_id' => $user1->id(),
+ 'language' => 'en',
+ 'non_rev_field' => 'Huron',
+ ));
+ $entity->save();
+
+ // Create a test entity.
+ $entity2 = EntityTestMulRev::create(array(
+ 'name' => $this->randomString(),
+ 'user_id' => $user1->id(),
+ 'language' => 'en',
+ 'non_rev_field' => 'Michigan',
+ ));
+ $entity2->save();
+
+ $this->assertEquals('Huron', $entity->get('non_rev_field')->value, 'Huron found on entity 1');
+ $this->assertEquals('Michigan', $entity2->get('non_rev_field')->value, 'Michigan found on entity 2');
+
+ $entity->setNewRevision();
+ $entity->setOwner($user2);
+ $entity->save();
+ $entity2->setNewRevision();
+ $entity2->setOwner($user2);
+ $entity2->save();
+ $this->assertEquals($user2->id(), $entity->getOwner()->id(), 'User 2 found on entity 1');
+ $this->assertEquals($user2->id(), $entity2->getOwner()->id(), 'User 2 found on entity 2');
+
+ $entity->addTranslation('de');
+ $entity->save();
+ $entity2->addTranslation('de');
+ $entity2->save();
+
+ $expected_revision_ids = [
+ 4 => 2,
+ 3 => 1,
+ 2 => 2,
+ 1 => 1,
+ ];
+ $revision_ids = $this->mulRev->getQuery()
+ ->allRevisions()
+ ->sort('revision_id', 'DESC')
+ ->execute();
+ $this->assertEquals($expected_revision_ids, $revision_ids, 'Revision ids found');
+
+ $expected_non_rev_field_revision_ids = [
+ 3 => 1,
+ 1 => 1,
+ ];
+ $non_rev_field_revision_ids = $this->mulRev->getQuery()
+ ->allRevisions()
+ ->condition('non_rev_field', 'Huron')
+ ->sort('revision_id', 'DESC')
+ ->execute();
+ $this->assertEquals($expected_non_rev_field_revision_ids, $non_rev_field_revision_ids, 'Revision ids found');
+ }
+
+ /**
+ * Tests non-revisionable fields on revisionable entities.
+ */
+ public function testNonRevisionableField() {
+ $user1 = $this->createUser();
+ $user2 = $this->createUser();
+
+ // Create a test entity.
+ $entity = EntityTestRev::create(array(
+ 'name' => $this->randomString(),
+ 'user_id' => $user1->id(),
+ 'non_rev_field' => 'Superior',
+ ));
+ $entity->save();
+
+ // Create a test entity.
+ $entity2 = EntityTestRev::create(array(
+ 'name' => $this->randomString(),
+ 'user_id' => $user1->id(),
+ 'non_rev_field' => 'Ontario',
+ ));
+ $entity2->save();
+
+ $this->assertEquals('Superior', $entity->get('non_rev_field')->value, 'Superior found on entity 1');
+ $this->assertEquals('Ontario', $entity2->get('non_rev_field')->value, 'Ontario found on entity 2');
+
+ $entity->setNewRevision();
+ $entity->setOwner($user2);
+ $entity->save();
+ $entity2->setNewRevision();
+ $entity2->setOwner($user2);
+ $entity2->save();
+ $this->assertEquals($user2->id(), $entity->getOwner()->id(), 'User 2 found on entity 1');
+ $this->assertEquals($user2->id(), $entity2->getOwner()->id(), 'User 2 found on entity 2');
+
+ $expected_revision_ids = [
+ 4 => 2,
+ 3 => 1,
+ 2 => 2,
+ 1 => 1,
+ ];
+ $revision_ids = $this->rev->getQuery()
+ ->allRevisions()
+ ->sort('revision_id', 'DESC')
+ ->execute();
+ $this->assertEquals($expected_revision_ids, $revision_ids, 'Revision ids found');
+
+ $expected_non_rev_field_revision_ids = [
+ 3 => 1,
+ 1 => 1,
+ ];
+ $non_rev_field_revision_ids = $this->rev->getQuery()
+ ->allRevisions()
+ ->condition('non_rev_field', 'Superior')
+ ->sort('revision_id', 'DESC')
+ ->execute();
+ $this->assertEquals($expected_non_rev_field_revision_ids, $non_rev_field_revision_ids, 'Revision ids found');
+ }
+
+}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
index a100c7d10..73a7d898d 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
@@ -344,7 +344,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase {
$message = 'The new_bundle_field_shape column is not nullable.';
$values = array(
'bundle' => $entity->bundle(),
- 'deleted'=> 0,
+ 'deleted' => 0,
'entity_id' => $entity->id(),
'revision_id' => $entity->id(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index ec3f87a57..85320141a 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -3,12 +3,16 @@
namespace Drupal\KernelTests\Core\Entity;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\TypedData\EntityDataDefinition;
+use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
+use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\TypedData\ComplexDataDefinitionInterface;
+use Drupal\Core\TypedData\ComplexDataInterface;
use Drupal\Core\TypedData\DataDefinitionInterface;
+use Drupal\Core\TypedData\ListInterface;
use Drupal\Core\TypedData\Type\StringInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\node\Entity\Node;
@@ -420,7 +424,7 @@ class EntityFieldTest extends EntityKernelTestBase {
$this->assertEqual($value_definition->getDataType(), 'string');
// Test deriving metadata from references.
- $entity_definition = \Drupal\Core\Entity\TypedData\EntityDataDefinition::create($entity_type);
+ $entity_definition = EntityDataDefinition::create($entity_type);
$langcode_key = $this->entityManager->getDefinition($entity_type)->getKey('langcode');
$reference_definition = $entity_definition->getPropertyDefinition($langcode_key)
->getPropertyDefinition('language')
@@ -431,7 +435,7 @@ class EntityFieldTest extends EntityKernelTestBase {
->getPropertyDefinition('entity')
->getTargetDefinition();
- $this->assertTrue($reference_definition instanceof \Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
+ $this->assertTrue($reference_definition instanceof EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
$this->assertEqual($reference_definition->getEntityTypeId(), 'user', 'Referenced entity is of type "user".');
// Test propagating down.
@@ -583,12 +587,12 @@ class EntityFieldTest extends EntityKernelTestBase {
// Recurse until a certain depth is reached if possible.
if ($depth < 7) {
- if ($wrapper instanceof \Drupal\Core\TypedData\ListInterface) {
+ if ($wrapper instanceof ListInterface) {
foreach ($wrapper as $item) {
$this->getContainedStrings($item, $depth + 1, $strings);
}
}
- elseif ($wrapper instanceof \Drupal\Core\TypedData\ComplexDataInterface) {
+ elseif ($wrapper instanceof ComplexDataInterface) {
foreach ($wrapper as $property) {
$this->getContainedStrings($property, $depth + 1, $strings);
}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
index 4338aef46..0b7e12241 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
@@ -135,7 +135,7 @@ class EntityQueryAggregateTest extends EntityKernelTestBase {
$function_expected['min'] = array(array('id_min' => 1));
$function_expected['max'] = array(array('id_max' => 6));
$function_expected['sum'] = array(array('id_sum' => 21));
- $function_expected['avg'] = array(array('id_avg' => (21.0/6.0)));
+ $function_expected['avg'] = array(array('id_avg' => (21.0 / 6.0)));
// Apply a simple aggregation for different aggregation functions.
foreach ($function_expected as $aggregation_function => $expected) {
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index 0d4e5c499..2db824f2e 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -535,7 +535,7 @@ class EntityQueryTest extends EntityKernelTestBase {
protected function assertBundleOrder($order) {
// This loop is for bundle1 entities.
- for ($i = 1; $i <= 15; $i +=2) {
+ for ($i = 1; $i <= 15; $i += 2) {
$ok = TRUE;
$index1 = array_search($i, $this->queryResults);
$this->assertNotIdentical($index1, FALSE, "$i found at $index1.");
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
index 9bcfd351d..f51c8ea3d 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
@@ -4,9 +4,9 @@ namespace Drupal\KernelTests\Core\Entity\EntityReferenceSelection;
use Drupal\Component\Utility\Html;
use Drupal\field\Entity\FieldConfig;
+use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
-use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
@@ -14,7 +14,7 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group entity_reference
*/
-class EntityReferenceSelectionSortTest extends EntityUnitTestBase {
+class EntityReferenceSelectionSortTest extends EntityKernelTestBase {
/**
* Modules to enable.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
index b0930955f..1c3a31004 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
@@ -158,7 +158,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase {
// Test a view mode in default conditions: render caching is enabled for
// the entity type and the view mode.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
- $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'] , 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
+ $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'], 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).');
// Test that a view mode can opt out of render caching.
$build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'test');
@@ -185,7 +185,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase {
// Create and build a test entity.
$entity_test = $this->createTestEntity('entity_test');
- $view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
+ $view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full');
$renderer->renderRoot($view);
// Check that the weight is respected.
diff --git a/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php b/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php
index d8044a4e2..d7b24b497 100644
--- a/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php
@@ -16,7 +16,9 @@ class AliasStorageTest extends KernelTestBase {
*/
public static $modules = ['system'];
- /** @var \Drupal\Core\Path\AliasStorage */
+ /**
+ * @var \Drupal\Core\Path\AliasStorage
+ */
protected $storage;
/**
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index dffe81d71..6c41f07bf 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -16,10 +16,11 @@ use Drupal\Core\DependencyInjection\ServiceProviderInterface;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
use Drupal\Core\Extension\ExtensionDiscovery;
+use Drupal\Core\Language\Language;
use Drupal\Core\Site\Settings;
use Drupal\simpletest\AssertContentTrait;
use Drupal\simpletest\AssertHelperTrait;
-use Drupal\simpletest\RandomGeneratorTrait;
+use Drupal\Tests\RandomGeneratorTrait;
use Drupal\simpletest\TestServiceProvider;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Request;
@@ -136,10 +137,9 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
/**
* Modules to enable.
*
- * Test classes extending this class, and any classes in the hierarchy up to
- * this class, may specify individual lists of modules to enable by setting
- * this property. The values of all properties in all classes in the class
- * hierarchy are merged.
+ * The test runner will merge the $modules lists from this class, the class
+ * it extends, and so on up the class hierarchy. It is not necessary to
+ * include modules in your list that a parent class has already declared.
*
* @see \Drupal\Tests\KernelTestBase::enableModules()
* @see \Drupal\Tests\KernelTestBase::bootKernel()
@@ -604,6 +604,9 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
$container
->setAlias('keyvalue', 'keyvalue.memory');
+ // Set the default language on the minimal container.
+ $container->setParameter('language.default_values', Language::$defaultValues);
+
if ($this->strictConfigSchema) {
$container
->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Testing\ConfigSchemaChecker')
@@ -1205,7 +1208,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
/**
* {@inheritdoc}
*/
- public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) {
+ public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE) {
$expected = static::castSafeStrings($expected);
$actual = static::castSafeStrings($actual);
parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
diff --git a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php b/core/tests/Drupal/KernelTests/MissingDependentModuleUnitTest.php
similarity index 91%
rename from core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
rename to core/tests/Drupal/KernelTests/MissingDependentModuleUnitTest.php
index a9041f96f..7c22d1fa3 100644
--- a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
+++ b/core/tests/Drupal/KernelTests/MissingDependentModuleUnitTest.php
@@ -2,7 +2,7 @@
namespace Drupal\simpletest\Tests;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
/**
* This test should not load since it requires a module that is not found.
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 8d8ea2be8..19fc91322 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -20,9 +20,6 @@ use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
use Drupal\Core\Test\TestRunnerKernel;
use Drupal\Core\Url;
-use Drupal\simpletest\RandomGeneratorTrait;
-use Drupal\simpletest\SessionTestTrait;
-use Drupal\simpletest\WebAssert;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
use Drupal\user\UserInterface;
@@ -39,11 +36,6 @@ use Symfony\Component\HttpFoundation\Request;
* @ingroup testing
*/
abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
-
- /**
- * @todo Move these into Drupal\Tests namespace and leave deprecated stubs
- * in simpletest module. See https://www.drupal.org/node/2702281
- */
use RandomGeneratorTrait;
use SessionTestTrait;
@@ -342,7 +334,7 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
$driver = $reflector->newInstanceArgs($this->minkDefaultDriverArgs);
}
else {
- $driver = new $this->minkDefaultDriverClass();
+ $driver = new $this->minkDefaultDriverClass();
}
return $driver;
}
@@ -534,7 +526,7 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
* @param string $name
* (optional) Name of the session. Defaults to the active session.
*
- * @return \Drupal\simpletest\WebAssert
+ * @return \Drupal\Tests\WebAssert
* A new web-assert option for asserting the presence of elements with.
*/
public function assertSession($name = NULL) {
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
index 207689543..7536e4ace 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
@@ -441,7 +441,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
*/
public function testGetForInstantiationWithVariousArgumentLengths() {
$args = array();
- for ($i=0; $i < 12; $i++) {
+ for ($i = 0; $i < 12; $i++) {
$instantiation_service = $this->container->get('service_test_instantiation_'. $i);
$this->assertEquals($args, $instantiation_service->getArguments());
$args[] = 'arg_' . $i;
@@ -480,7 +480,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
*/
public function testGetForFactoryClass() {
$service = $this->container->get('service.provider');
- $factory_service= $this->container->get('factory_class');
+ $factory_service = $this->container->get('factory_class');
$this->assertInstanceOf(get_class($service), $factory_service);
$this->assertEquals('bar', $factory_service->getSomeParameter(), 'Correct parameter was passed via the factory class instantiation.');
@@ -892,7 +892,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
// Test multiple arguments.
$args = array();
- for ($i=0; $i < 12; $i++) {
+ for ($i = 0; $i < 12; $i++) {
$services['service_test_instantiation_' . $i] = array(
'class' => '\Drupal\Tests\Component\DependencyInjection\MockInstantiationService',
// Also test a collection that does not need resolving.
diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
index 0249f3295..11ce86f08 100644
--- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
+++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
@@ -113,11 +113,11 @@ class DrupalComponentTest extends UnitTestCase {
$file_uri = vfsStream::url('root/Test.php');
try {
- $pass = true;
+ $pass = TRUE;
$this->assertNoCoreUsage($file_uri);
}
catch (\PHPUnit_Framework_AssertionFailedError $e) {
- $pass = false;
+ $pass = FALSE;
}
$this->assertEquals($expected_pass, $pass, $expected_pass ?
'Test caused a false positive' :
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
index 7e18ae339..64d17eb25 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
@@ -37,7 +37,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
$this->secret = $this->randomMachineName();
$this->settings = array(
- 'directory' => $this->directory,
+ 'directory' => $this->directory,
'bin' => 'test',
'secret' => $this->secret,
);
@@ -69,7 +69,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
$php = new $this->storageClass($this->settings);
$name = 'simpletest.php';
$php->save($name, 'directory . '/test';
+ $expected_root_directory = $this->directory . '/test';
if (substr($name, -4) === '.php') {
$expected_directory = $expected_root_directory . '/' . substr($name, 0, -4);
}
diff --git a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
index 0a28acf7d..1fc805bfe 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
@@ -154,4 +154,3 @@ class DefaultFactoryTest extends UnitTestCase {
}
}
-
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
index 20a91d0d4..5218ec2a7 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
@@ -5,8 +5,8 @@ namespace Drupal\Tests\Component\Plugin\Discovery;
use Drupal\Tests\UnitTestCase;
/**
- * @coversDefaultClass Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait
- * @uses Drupal\Component\Plugin\Discovery\DiscoveryTrait
+ * @coversDefaultClass \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait
+ * @uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
* @group Plugin
*/
class DiscoveryCachedTraitTest extends UnitTestCase {
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
index 7a5761b81..9f747f91b 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
@@ -6,7 +6,7 @@ use Drupal\Tests\UnitTestCase;
/**
* @group Plugin
- * @coversDefaultClass Drupal\Component\Plugin\Discovery\DiscoveryTrait
+ * @coversDefaultClass \Drupal\Component\Plugin\Discovery\DiscoveryTrait
*/
class DiscoveryTraitTest extends UnitTestCase {
@@ -58,9 +58,9 @@ class DiscoveryTraitTest extends UnitTestCase {
/**
* @covers ::doGetDefinition
- * @expectedException Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @dataProvider providerDoGetDefinitionException
- * @uses Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function testDoGetDefinitionException($expected, $definitions, $plugin_id) {
// Mock the trait.
@@ -96,9 +96,9 @@ class DiscoveryTraitTest extends UnitTestCase {
/**
* @covers ::getDefinition
- * @expectedException Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @dataProvider providerDoGetDefinitionException
- * @uses Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function testGetDefinitionException($expected, $definitions, $plugin_id) {
// Since getDefinition is a wrapper around doGetDefinition(), we can re-use
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
index dc54eba2f..bdab19c7e 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@@ -6,7 +6,7 @@ use Drupal\Tests\UnitTestCase;
/**
* @group Plugin
- * @coversDefaultClass Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator
+ * @coversDefaultClass \Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator
*/
class StaticDiscoveryDecoratorTest extends UnitTestCase {
@@ -17,7 +17,7 @@ class StaticDiscoveryDecoratorTest extends UnitTestCase {
* \Callable in the mock object. The return value of this callback is
* never used.
*
- * @return mock
+ * @return \PHPUnit_Framework_MockObject_MockObject
* Mocked object with expectation of registerDefinitionsCallback() being
* called once.
*/
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
index d6cc8c65c..4bb3a98da 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
@@ -14,7 +14,7 @@ use Drupal\Tests\UnitTestCase;
/**
* @group Plugin
- * @coversDefaultClass Drupal\Component\Plugin\Factory\ReflectionFactory
+ * @coversDefaultClass \Drupal\Component\Plugin\Factory\ReflectionFactory
*/
class ReflectionFactoryTest extends UnitTestCase {
diff --git a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
index 1e4e8caa7..244736a61 100644
--- a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
+++ b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
@@ -50,7 +50,7 @@ class PlainTextOutputTest extends UnitTestCase {
$safe_string = $this->prophesize(MarkupInterface::class);
$safe_string->__toString()->willReturn('"this"');
$safe_string = $safe_string->reveal();
- $data['escaped-html-with-quotes-and-placeholders'] = [$expected, 'The @tag tag makes your text look like @result.', ['@tag' =>'', '@result' => $safe_string]];
+ $data['escaped-html-with-quotes-and-placeholders'] = [$expected, 'The @tag tag makes your text look like @result.', ['@tag' => '', '@result' => $safe_string]];
$safe_string = $this->prophesize(MarkupInterface::class);
$safe_string->__toString()->willReturn($string);
diff --git a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
index fe2bfe217..193906bf4 100644
--- a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
@@ -320,4 +320,4 @@ class HtmlTest extends UnitTestCase {
$result = Html::serialize($document);
$this->assertSame('', $result);
}
-}
\ No newline at end of file
+}
diff --git a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
index ba76c8d88..3e3262966 100644
--- a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
@@ -70,8 +70,8 @@ class NumberTest extends UnitTestCase {
// Valid float steps.
array(42, 10.5, TRUE),
- array(1, 1/3, TRUE),
- array(-100, 100/7, TRUE),
+ array(1, 1 / 3, TRUE),
+ array(-100, 100 / 7, TRUE),
array(1000, -10, TRUE),
// Valid and very small float steps.
@@ -83,7 +83,7 @@ class NumberTest extends UnitTestCase {
array(-10, 4, FALSE),
// Invalid float steps.
- array(6, 5/7, FALSE),
+ array(6, 5 / 7, FALSE),
array(10.3, 10.25, FALSE),
// Step mismatches very close to being valid.
@@ -102,12 +102,12 @@ class NumberTest extends UnitTestCase {
// Try obvious fits.
array(11.3, 10.3, 1, TRUE),
array(100, 10, 50, TRUE),
- array(-100, 90/7, -10, TRUE),
- array(2/7 + 5/9, 1/7, 5/9, TRUE),
+ array(-100, 90 / 7, -10, TRUE),
+ array(2 / 7 + 5 / 9, 1 / 7, 5 / 9, TRUE),
// Ensure a small offset is still invalid.
array(10.3, 10.3, 0.0001, FALSE),
- array(1/5, 1/7, 1/11, FALSE),
+ array(1 / 5, 1 / 7, 1 / 11, FALSE),
// Try negative values and offsets.
array(1000, 10, -5, FALSE),
diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
index 97106b4df..50d6a876b 100644
--- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php
+++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
@@ -77,6 +77,15 @@ class ComposerIntegrationTest extends UnitTestCase {
}
}
+ /**
+ * Tests composer.lock hash.
+ */
+ public function testComposerLockHash() {
+ $json = file_get_contents($this->root . '/composer.json');
+ $lock = json_decode(file_get_contents($this->root . '/composer.lock'), TRUE);
+ $this->assertSame(md5($json), $lock['hash']);
+ }
+
/**
* Tests core's composer.json replace section.
*
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
index 36e35069b..c4dd14721 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php
@@ -276,7 +276,7 @@ class CssOptimizerUnitTest extends UnitTestCase {
* Tests a CSS asset with 'type' => 'external'.
*/
function testTypeExternal() {
- $this->setExpectedException('Exception', 'Only file or inline CSS assets can be optimized.');
+ $this->setExpectedException('Exception', 'Only file CSS assets can be optimized.');
$css_asset = array(
'group' => -100,
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
index d3f1a8a08..a7a026a82 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php
@@ -61,7 +61,7 @@ class LibraryDependencyResolverTest extends UnitTestCase {
->method('getLibrariesByExtension')
->with('test')
->will($this->returnValue($this->libraryData));
- $this->libraryDependencyResolver= new LibraryDependencyResolver($this->libraryDiscovery);
+ $this->libraryDependencyResolver = new LibraryDependencyResolver($this->libraryDiscovery);
}
diff --git a/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php b/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php
index 20678cb6c..d2e0c1317 100644
--- a/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php
+++ b/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php
@@ -72,11 +72,11 @@ class PercentagesTest extends UnitTestCase {
// but for the last pass through, when 500 out of 501 items have been
// processed, we do not want to round up to 100%, since that would
// erroneously indicate that the processing is complete.
- array('total' => 1, 'current' => 100/501, '20'),
- array('total' => 1, 'current' => 200/501, '40'),
- array('total' => 1, 'current' => 300/501, '60'),
- array('total' => 1, 'current' => 400/501, '80'),
- array('total' => 1, 'current' => 500/501, '99.8'),
+ array('total' => 1, 'current' => 100 / 501, '20'),
+ array('total' => 1, 'current' => 200 / 501, '40'),
+ array('total' => 1, 'current' => 300 / 501, '60'),
+ array('total' => 1, 'current' => 400 / 501, '80'),
+ array('total' => 1, 'current' => 500 / 501, '99.8'),
);
}
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
index 6b233aa49..0bc9d7f1b 100644
--- a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
@@ -263,7 +263,7 @@ class BazCacheContext implements CalculatedCacheContextInterface {
* {@inheritdoc}
*/
public function getContext($parameter = NULL) {
- if (!is_string($parameter) || strlen($parameter) === 0) {
+ if (!is_string($parameter) || strlen($parameter) === 0) {
throw new \Exception();
}
return str_rot13($parameter);
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php
new file mode 100644
index 000000000..2c4473515
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php
@@ -0,0 +1,43 @@
+push($request);
+ $cache_context = new PathParentCacheContext($request_stack);
+ $this->assertSame($cache_context->getContext(), $context);
+ }
+
+ /**
+ * Provides a list of paths and expected cache contexts.
+ */
+ public function providerTestGetContext() {
+ return [
+ ['/some/path', 'some'],
+ ['/some/other-path', 'some'],
+ ['/some/other/path', 'some/other'],
+ ['/some/other/path?q=foo&b=bar', 'some/other'],
+ ['/some', ''],
+ ['/', ''],
+ ];
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
index 055a907bb..0448e2869 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
@@ -378,4 +378,3 @@ class ValidHandler implements HandlerInterface {
}
class InvalidHandler {
}
-
diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
index be04507e6..164da9d95 100644
--- a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\DrupalKernel;
+use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Drupal\Tests\UnitTestCase;
@@ -24,7 +25,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
),
));
- $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
+ $kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = array(
@@ -44,7 +45,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
*/
public function testDiscoverServiceNoContainerYamls() {
new Settings([]);
- $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
+ $kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = [
diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php
index 7d8a5b298..99208ee70 100644
--- a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php
@@ -37,12 +37,12 @@ namespace Drupal\Tests\Core\DrupalKernel {
$method = new \ReflectionMethod('Drupal\Core\DrupalKernel', 'setupTrustedHosts');
$method->setAccessible(TRUE);
- $valid_host = $method->invoke(null, $request, $trusted_host_patterns);
+ $valid_host = $method->invoke(NULL, $request, $trusted_host_patterns);
$this->assertSame($expected, $valid_host, $message);
// Reset the trusted hosts because it is statically stored on the request.
- $method->invoke(null, $request, []);
+ $method->invoke(NULL, $request, []);
// Reset the request factory because it is statically stored on the request.
Request::setFactory(NULL);
}
@@ -144,4 +144,4 @@ namespace {
return FALSE;
}
}
-}
\ No newline at end of file
+}
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
index 1ed9d3586..e38988e26 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
@@ -545,7 +545,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
- 'not null' => true,
+ 'not null' => TRUE,
),
),
'primary key' => array('id', 'langcode'),
@@ -712,7 +712,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
- 'not null' => true,
+ 'not null' => TRUE,
),
),
'primary key' => array('id', 'langcode'),
@@ -750,7 +750,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
- 'not null' => true,
+ 'not null' => TRUE,
),
),
'primary key' => array('revision_id', 'langcode'),
@@ -859,51 +859,51 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'bundle' => array(
'type' => 'varchar_ascii',
'length' => 128,
- 'not null' => true,
+ 'not null' => TRUE,
'default' => '',
'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
),
'deleted' => array(
'type' => 'int',
'size' => 'tiny',
- 'not null' => true,
+ 'not null' => TRUE,
'default' => 0,
'description' => 'A boolean indicating whether this data item has been deleted',
),
'entity_id' => array(
'type' => 'int',
- 'unsigned' => true,
- 'not null' => true,
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
'description' => 'The entity id this data is attached to',
),
'revision_id' => array(
'type' => 'int',
- 'unsigned' => true,
- 'not null' => true,
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
'description' => 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
),
'langcode' => array(
'type' => 'varchar_ascii',
'length' => 32,
- 'not null' => true,
+ 'not null' => TRUE,
'default' => '',
'description' => 'The language code for this data item.',
),
'delta' => array(
'type' => 'int',
- 'unsigned' => true,
- 'not null' => true,
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
'description' => 'The sequence number for this data item, used for multi-value fields',
),
$field_name . '_shape' => array(
'type' => 'varchar',
'length' => 32,
- 'not null' => false,
+ 'not null' => FALSE,
),
$field_name . '_color' => array(
'type' => 'varchar',
'length' => 32,
- 'not null' => false,
+ 'not null' => FALSE,
),
),
'primary key' => array('entity_id', 'deleted', 'delta', 'langcode'),
@@ -1004,51 +1004,51 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'bundle' => array(
'type' => 'varchar_ascii',
'length' => 128,
- 'not null' => true,
+ 'not null' => TRUE,
'default' => '',
'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
),
'deleted' => array(
'type' => 'int',
'size' => 'tiny',
- 'not null' => true,
+ 'not null' => TRUE,
'default' => 0,
'description' => 'A boolean indicating whether this data item has been deleted',
),
'entity_id' => array(
'type' => 'varchar_ascii',
'length' => 128,
- 'not null' => true,
+ 'not null' => TRUE,
'description' => 'The entity id this data is attached to',
),
'revision_id' => array(
'type' => 'varchar_ascii',
'length' => 128,
- 'not null' => true,
+ 'not null' => TRUE,
'description' => 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
),
'langcode' => array(
'type' => 'varchar_ascii',
'length' => 32,
- 'not null' => true,
+ 'not null' => TRUE,
'default' => '',
'description' => 'The language code for this data item.',
),
'delta' => array(
'type' => 'int',
- 'unsigned' => true,
- 'not null' => true,
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
'description' => 'The sequence number for this data item, used for multi-value fields',
),
$field_name . '_shape' => array(
'type' => 'varchar',
'length' => 32,
- 'not null' => false,
+ 'not null' => FALSE,
),
$field_name . '_color' => array(
'type' => 'varchar',
'length' => 32,
- 'not null' => false,
+ 'not null' => FALSE,
),
),
'primary key' => array('entity_id', 'deleted', 'delta', 'langcode'),
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
index 125eeddf5..5d3993d3b 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
@@ -31,7 +31,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {
/**
* The mocked config factory
*
- * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $configFactory;
@@ -162,4 +162,3 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {
}
}
-
diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
index 6fab8d7c3..14ebde3d1 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
@@ -238,7 +238,7 @@ class ModuleHandlerTest extends UnitTestCase {
* @covers ::loadAllIncludes
*/
public function testLoadAllIncludes() {
- $this->assertTrue(true);
+ $this->assertTrue(TRUE);
$module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
->setConstructorArgs(array(
$this->root,
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index 7bd51bce9..cb2e1ecc9 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -738,7 +738,7 @@ class FormBuilderTest extends FormTestBase {
*/
public function testValueCallableIsSafe($callback, $expected) {
$method = new \ReflectionMethod(FormBuilder::class, 'valueCallableIsSafe');
- $method->setAccessible(true);
+ $method->setAccessible(TRUE);
$is_safe = $method->invoke($this->formBuilder, $callback);
$this->assertSame($expected, $is_safe);
}
diff --git a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
index ddd92e165..fd88ea22d 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
@@ -113,7 +113,6 @@ abstract class FormTestBase extends UnitTestCase {
protected $elementInfo;
/**
- *
* The event dispatcher.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
index 39fd48a80..e172e05fe 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
@@ -203,7 +203,7 @@ class FormValidatorTest extends UnitTestCase {
array(
array(array('test1')),
array(
- '#is_button' => true,
+ '#is_button' => TRUE,
'#value' => 'baz',
'#name' => 'op',
'#parents' => array('submit'),
diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
index 6eebd806d..0aa86fc2d 100644
--- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
+++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
@@ -161,4 +161,3 @@ class NaughtyRecursiveLogger implements LoggerInterface {
$this->channel->log(rand(0, 7), $message, $context);
}
}
-
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
index c81309f62..65fb4172c 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
@@ -491,4 +491,3 @@ class LocalTaskManagerTest extends UnitTestCase {
}
}
-
diff --git a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
index 1af6afb9f..aa1f5d7d9 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
@@ -2,8 +2,8 @@
namespace Drupal\Tests\Core\PageCache;
+use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\PageCache\RequestPolicyInterface;
-use Drupal\Core\PageCache\RequestPolicy;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
@@ -29,7 +29,7 @@ class NoSessionOpenTest extends UnitTestCase {
protected function setUp() {
$this->sessionConfiguration = $this->getMock('Drupal\Core\Session\SessionConfigurationInterface');
- $this->policy = new RequestPolicy\NoSessionOpen($this->sessionConfiguration);
+ $this->policy = new NoSessionOpen($this->sessionConfiguration);
}
/**
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
index ded278e96..ebafab0c9 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\ParamConverter;
+use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Core\ParamConverter\EntityConverter;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Route;
@@ -116,7 +117,7 @@ class EntityConverterTest extends UnitTestCase {
$this->entityManager->expects($this->once())
->method('getStorage')
->with('invalid_id')
- ->willThrowException(new \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException('invalid_id'));
+ ->willThrowException(new InvalidPluginDefinitionException('invalid_id'));
$this->entityConverter->convert('id', ['type' => 'entity:invalid_id'], 'foo', ['foo' => 'id']);
}
diff --git a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
index cfaab2f86..569f394ba 100644
--- a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
@@ -252,7 +252,7 @@ class AliasManagerTest extends UnitTestCase {
* @covers ::writeCache
*/
public function testGetAliasByPathCachedMatch() {
- $path_part1 = $this->randomMachineName();
+ $path_part1 = $this->randomMachineName();
$path_part2 = $this->randomMachineName();
$path = '/' . $path_part1 . '/' . $path_part2;
$alias = $this->randomMachineName();
diff --git a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
index 1395cb25a..2bfb1c9ea 100644
--- a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php
@@ -444,4 +444,3 @@ class PathValidatorTest extends UnitTestCase {
}
}
-
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
index 95fad821b..7f084e4fb 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
@@ -10,7 +10,7 @@ use Drupal\Tests\UnitTestCase;
*
* @group Plugin
*
- * @coversDefaultClass Drupal\Core\Plugin\Context\ContextDefinition
+ * @coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition
*/
class ContextDefinitionTest extends UnitTestCase {
@@ -113,7 +113,7 @@ class ContextDefinitionTest extends UnitTestCase {
* @dataProvider providerGetDataDefinition
* @covers ::getDataDefinition
* @uses \Drupal
- * @uses Drupal\Component\Utility\SafeMarkup
+ * @uses \Drupal\Component\Utility\SafeMarkup
*/
public function testGetDataDefinitionInvalidType($is_multiple) {
// Since we're trying to make getDataDefinition() throw an exception in
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index 5b712eb8e..f7a5d981a 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -29,7 +29,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
/**
* Tests the getDerivativeFetcher method.
*
- * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher().
+ * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher().
*/
public function testGetDerivativeFetcher() {
$definitions = array();
diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
index 8dc52489a..7775cdef1 100644
--- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
@@ -401,12 +401,12 @@ class BubbleableMetadataTest extends UnitTestCase {
* @return array
*/
public function providerTestMergeAttachmentsFeedMerging() {
- $feed_a = [
+ $feed_a = [
'aggregator/rss',
'Feed title',
];
- $feed_b = [
+ $feed_b = [
'taxonomy/term/1/feed',
'RSS - foo',
];
@@ -533,12 +533,12 @@ class BubbleableMetadataTest extends UnitTestCase {
* @return array
*/
public function providerTestMergeAttachmentsHtmlHeadLinkMerging() {
- $rel = [
+ $rel = [
'rel' => 'rel',
'href' => 'http://rel.example.com',
];
- $shortlink = [
+ $shortlink = [
'rel' => 'shortlink',
'href' => 'http://shortlink.example.com',
];
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
index 5fd49a7ad..5df655be6 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
@@ -10,9 +10,12 @@ namespace Drupal\Tests\Core\Render;
use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Render\Markup;
+use Drupal\Core\Render\RenderContext;
/**
* @coversDefaultClass \Drupal\Core\Render\Renderer
+ * @covers \Drupal\Core\Render\RenderCache
+ * @covers \Drupal\Core\Render\PlaceholderingRenderCache
* @group Render
*/
class RendererPlaceholdersTest extends RendererTestBase {
@@ -781,6 +784,40 @@ class RendererPlaceholdersTest extends RendererTestBase {
$this->assertPlaceholderRenderCache(FALSE, [], []);
}
+ /**
+ * @covers ::render
+ * @covers ::doRender
+ * @covers \Drupal\Core\Render\RenderCache::get
+ * @covers \Drupal\Core\Render\PlaceholderingRenderCache::get
+ * @covers \Drupal\Core\Render\PlaceholderingRenderCache::set
+ * @covers ::replacePlaceholders
+ *
+ * @dataProvider providerPlaceholders
+ */
+ public function testPlaceholderingDisabledForPostRequests($test_element, $args) {
+ $this->setUpUnusedCache();
+ $this->setUpRequest('POST');
+
+ $element = $test_element;
+
+ // Render without replacing placeholders, to allow this test to see which
+ // #attached[placeholders] there are, if any.
+ $this->renderer->executeInRenderContext(new RenderContext(), function () use (&$element) {
+ return $this->renderer->render($element);
+ });
+ // Only test cases where the placeholders have been specified manually are
+ // allowed to have placeholders. This means that of the different situations
+ // listed in providerPlaceholders(), only type B can have attached
+ // placeholders. Everything else, whether:
+ // 1. manual placeholdering
+ // 2. automatic placeholdering via already-present cacheability metadata
+ // 3. automatic placeholdering via bubbled cacheability metadata
+ // All three of those should NOT result in placeholders.
+ if (!isset($test_element['#attached']['placeholders'])) {
+ $this->assertFalse(isset($element['#attached']['placeholders']), 'No placeholders created.');
+ }
+ }
+
/**
* Tests a placeholder that adds another placeholder.
*
@@ -998,7 +1035,7 @@ HTML;
$dom = Html::load($cached_element['#markup']);
$xpath = new \DOMXPath($dom);
$parent = $xpath->query('//details/summary[text()="Parent"]')->length;
- $child = $xpath->query('//details/div[@class="details-wrapper"]/details/summary[text()="Child"]')->length;
+ $child = $xpath->query('//details/div[@class="details-wrapper"]/details/summary[text()="Child"]')->length;
$subchild = $xpath->query('//details/div[@class="details-wrapper"]/details/div[@class="details-wrapper" and text()="Subchild"]')->length;
$this->assertTrue($parent && $child && $subchild, 'The correct data is cached: the stored #markup is not affected by placeholder #lazy_builder callbacks.');
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
index 6dcf46915..834d0a47b 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
@@ -106,7 +106,7 @@ class RendererTestBase extends UnitTestCase {
'auto_placeholder_conditions' => [
'max-age' => 0,
'contexts' => ['session', 'user'],
- 'tags' => ['current-temperature'],
+ 'tags' => ['current-temperature'],
],
];
diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php
index 2e35ca030..639768ddd 100644
--- a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php
+++ b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php
@@ -101,7 +101,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
$request->setRequestFormat('html')->shouldBeCalled();
// Some getContentType calls we don't really care about but have to mock.
- $request->get('ajax_iframe_upload', false)->shouldBeCalled();
+ $request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
@@ -126,7 +126,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
// Some calls we don't care about.
$request->setRequestFormat('html')->shouldBeCalled();
- $request->get('ajax_iframe_upload', false)->shouldBeCalled();
+ $request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
index fd0ead9e5..09ec9894d 100644
--- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -435,7 +435,7 @@ class AttributeTest extends UnitTestCase {
* The number of results that are found.
*/
protected function getXPathResultCount($query, $html) {
- $document = new \DOMDocument;
+ $document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);
diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
index 91e36bce6..5e3558e1b 100644
--- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
@@ -315,7 +315,6 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
}
/**
- *
* Builds some example type data object.
*
* @return \Drupal\Core\TypedData\TypedDataInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index 1b8f080b8..2571093e2 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -512,7 +512,7 @@ class UrlTest extends UnitTestCase {
$route_match = new RouteMatch('test_route', $route, ['foo' => (object) [1]], ['foo' => 1]);
$url = Url::fromRouteMatch($route_match);
$this->assertSame('test_route', $url->getRouteName());
- $this->assertEquals(['foo' => '1'] , $url->getRouteParameters());
+ $this->assertEquals(['foo' => '1'], $url->getRouteParameters());
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index 89cf62cea..97fb9d3b3 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -519,7 +519,7 @@ class LinkGeneratorTest extends UnitTestCase {
}
// Execute the query.
- $document = new \DOMDocument;
+ $document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);
@@ -538,7 +538,7 @@ class LinkGeneratorTest extends UnitTestCase {
* The number of results that are found.
*/
protected function assertNoXPathResults($query, $html) {
- $document = new \DOMDocument;
+ $document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);
diff --git a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
index 4c09f592f..12f36eac2 100644
--- a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
@@ -15,7 +15,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
/**
- * @coversDefaultClass Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator
+ * @coversDefaultClass \Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator
* @group validation
*/
class PrimitiveTypeConstraintValidatorTest extends UnitTestCase {
diff --git a/core/tests/Drupal/Tests/RandomGeneratorTrait.php b/core/tests/Drupal/Tests/RandomGeneratorTrait.php
new file mode 100644
index 000000000..4fdd89a88
--- /dev/null
+++ b/core/tests/Drupal/Tests/RandomGeneratorTrait.php
@@ -0,0 +1,126 @@
+') character to ensure coverage for special
+ * characters and avoid the introduction of random test failures.
+ *
+ * @param int $length
+ * Length of random string to generate.
+ *
+ * @return string
+ * Pseudo-randomly generated unique string including special characters.
+ *
+ * @see \Drupal\Component\Utility\Random::string()
+ */
+ public function randomString($length = 8) {
+ if ($length < 4) {
+ return $this->getRandomGenerator()->string($length, TRUE, array($this, 'randomStringValidate'));
+ }
+
+ // To prevent the introduction of random test failures, ensure that the
+ // returned string contains a character that needs to be escaped in HTML by
+ // injecting an ampersand into it.
+ $replacement_pos = floor($length / 2);
+ // Remove 2 from the length to account for the ampersand and greater than
+ // characters.
+ $string = $this->getRandomGenerator()->string($length - 2, TRUE, array($this, 'randomStringValidate'));
+ return substr_replace($string, '>&', $replacement_pos, 0);
+ }
+
+ /**
+ * Callback for random string validation.
+ *
+ * @see \Drupal\Component\Utility\Random::string()
+ *
+ * @param string $string
+ * The random string to validate.
+ *
+ * @return bool
+ * TRUE if the random string is valid, FALSE if not.
+ */
+ public function randomStringValidate($string) {
+ // Consecutive spaces causes issues for
+ // \Drupal\simpletest\WebTestBase::assertLink().
+ if (preg_match('/\s{2,}/', $string)) {
+ return FALSE;
+ }
+
+ // Starting or ending with a space means that length might not be what is
+ // expected.
+ if (preg_match('/^\s|\s$/', $string)) {
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * Generates a unique random string containing letters and numbers.
+ *
+ * Do not use this method when testing unvalidated user input. Instead, use
+ * \Drupal\simpletest\TestBase::randomString().
+ *
+ * @param int $length
+ * Length of random string to generate.
+ *
+ * @return string
+ * Randomly generated unique string.
+ *
+ * @see \Drupal\Component\Utility\Random::name()
+ */
+ protected function randomMachineName($length = 8) {
+ return $this->getRandomGenerator()->name($length, TRUE);
+ }
+
+ /**
+ * Generates a random PHP object.
+ *
+ * @param int $size
+ * The number of random keys to add to the object.
+ *
+ * @return \stdClass
+ * The generated object, with the specified number of random keys. Each key
+ * has a random string value.
+ *
+ * @see \Drupal\Component\Utility\Random::object()
+ */
+ public function randomObject($size = 4) {
+ return $this->getRandomGenerator()->object($size);
+ }
+
+ /**
+ * Gets the random generator for the utility methods.
+ *
+ * @return \Drupal\Component\Utility\Random
+ * The random generator.
+ */
+ protected function getRandomGenerator() {
+ if (!is_object($this->randomGenerator)) {
+ $this->randomGenerator = new Random();
+ }
+ return $this->randomGenerator;
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/SessionTestTrait.php b/core/tests/Drupal/Tests/SessionTestTrait.php
new file mode 100644
index 000000000..e71fdf256
--- /dev/null
+++ b/core/tests/Drupal/Tests/SessionTestTrait.php
@@ -0,0 +1,40 @@
+isSecure() ? 'SSESS' : 'SESS');
+ $this->sessionName = $prefix . substr(hash('sha256', $data), 0, 32);
+ }
+
+ /**
+ * Returns the session name in use on the child site.
+ *
+ * @return string
+ * The name of the session cookie.
+ */
+ protected function getSessionName() {
+ return $this->sessionName;
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
new file mode 100644
index 000000000..d863de2ea
--- /dev/null
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -0,0 +1,67 @@
+session->getPage();
+ $node = $container->findButton($button);
+
+ if ($node === NULL) {
+ throw new ElementNotFoundException($this->session, 'button', 'id|name|label|value', $button);
+ }
+
+ return $node;
+ }
+
+ /**
+ * Checks that specific select field exists on the current page.
+ *
+ * @param string $select
+ * One of id|name|label|value for the select field.
+ * @param \Behat\Mink\Element\TraversableElement $container
+ * (optional) The document to check against. Defaults to the current page.
+ *
+ * @return \Behat\Mink\Element\NodeElement
+ * The matching element
+ *
+ * @throws \Behat\Mink\Exception\ElementNotFoundException
+ * When the element doesn't exist.
+ */
+ public function selectExists($select, TraversableElement $container = NULL) {
+ $container = $container ?: $this->session->getPage();
+ $node = $container->find('named', array(
+ 'select',
+ $this->session->getSelectorsHandler()->xpathLiteral($select),
+ ));
+
+ if ($node === NULL) {
+ throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
+ }
+
+ return $node;
+ }
+
+}
diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php
index 12c4debcb..49e350aca 100644
--- a/core/tests/bootstrap.php
+++ b/core/tests/bootstrap.php
@@ -7,6 +7,8 @@
* @see phpunit.xml.dist
*/
+use Drupal\Component\Assertion\Handle;
+
/**
* Finds all valid extension directories recursively within a given directory.
*
@@ -141,5 +143,4 @@ date_default_timezone_set('Australia/Sydney');
// runtime assertions. By default this setting is on. Here we make a call to
// make PHP 5 and 7 handle assertion failures the same way, but this call does
// not turn runtime assertions on if they weren't on already.
-\Drupal\Component\Assertion\Handle::register();
-
+Handle::register();
diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index 3d3ca1297..b1b330826 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -5,6 +5,7 @@
* Functions to support theming in the Bartik theme.
*/
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Template\Attribute;
/**
@@ -113,7 +114,7 @@ function bartik_theme_suggestions_form_alter(array &$suggestions, array $variabl
/**
* Implements hook_form_alter() to add classes to the search form.
*/
-function bartik_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function bartik_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (in_array($form_id, ['search_block_form', 'search_form'])) {
$key = ($form_id == 'search_block_form') ? 'actions' : 'basic';
if (!isset($form[$key]['submit']['#attributes'])) {
diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig
index 5d509aa55..b257ad3cb 100644
--- a/core/themes/bartik/templates/node.html.twig
+++ b/core/themes/bartik/templates/node.html.twig
@@ -5,9 +5,16 @@
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
- Only "getter" methods (method names starting with "get", "has", or "is")
- and a few common methods such as "id" and "label" are available. Calling
- other methods (such as node.delete) will result in an exception.
+ * Only method names starting with "get", "has", or "is" and a few common
+ * methods such as "id", "label", and "bundle" are available. For example:
+ * - node.getCreatedTime() will return the node creation timestamp.
+ * - node.hasField('field_example') returns TRUE if the node bundle includes
+ * field_example. (This does not indicate the presence of a value in this
+ * field.)
+ * - node.isPublished() will return whether the node is published or not.
+ * Calling other methods, such as node.delete(), will result in an exception.
+ * See \Drupal\node\Entity\Node for a full list of public properties and
+ * methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
diff --git a/core/themes/classy/templates/content/node.html.twig b/core/themes/classy/templates/content/node.html.twig
index 5af7c25fa..7f99e796f 100644
--- a/core/themes/classy/templates/content/node.html.twig
+++ b/core/themes/classy/templates/content/node.html.twig
@@ -5,9 +5,16 @@
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
- Only "getter" methods (method names starting with "get", "has", or "is")
- and a few common methods such as "id" and "label" are available. Calling
- other methods (such as node.delete) will result in an exception.
+ * Only method names starting with "get", "has", or "is" and a few common
+ * methods such as "id", "label", and "bundle" are available. For example:
+ * - node.getCreatedTime() will return the node creation timestamp.
+ * - node.hasField('field_example') returns TRUE if the node bundle includes
+ * field_example. (This does not indicate the presence of a value in this
+ * field.)
+ * - node.isPublished() will return whether the node is published or not.
+ * Calling other methods, such as node.delete(), will result in an exception.
+ * See \Drupal\node\Entity\Node for a full list of public properties and
+ * methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
diff --git a/core/themes/stable/templates/content/node.html.twig b/core/themes/stable/templates/content/node.html.twig
index 68a92ea61..e9dcd0bc1 100644
--- a/core/themes/stable/templates/content/node.html.twig
+++ b/core/themes/stable/templates/content/node.html.twig
@@ -5,9 +5,16 @@
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
- Only "getter" methods (method names starting with "get", "has", or "is")
- and a few common methods such as "id" and "label" are available. Calling
- other methods (such as node.delete) will result in an exception.
+ * Only method names starting with "get", "has", or "is" and a few common
+ * methods such as "id", "label", and "bundle" are available. For example:
+ * - node.getCreatedTime() will return the node creation timestamp.
+ * - node.hasField('field_example') returns TRUE if the node bundle includes
+ * field_example. (This does not indicate the presence of a value in this
+ * field.)
+ * - node.isPublished() will return whether the node is published or not.
+ * Calling other methods, such as node.delete(), will result in an exception.
+ * See \Drupal\node\Entity\Node for a full list of public properties and
+ * methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 277767243..a1dc5016a 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array(
'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
+ 'Drupal' => $baseDir . '/core/lib/Drupal.php',
'Drupal\\Component\\Utility\\Timer' => $baseDir . '/core/lib/Drupal/Component/Utility/Timer.php',
'Drupal\\Component\\Utility\\Unicode' => $baseDir . '/core/lib/Drupal/Component/Utility/Unicode.php',
'Drupal\\Core\\Database\\Database' => $baseDir . '/core/lib/Drupal/Core/Database/Database.php',
diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php
index a169b7419..38c57fb76 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -16,5 +16,4 @@ return array(
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
- '454414594637b9dd94a19af83f56f1a2' => $baseDir . '/core/lib/Drupal.php',
);