Upgraded drupal core with security updates
authorjenny <jenny@fennel.follybridge>
Fri, 18 Aug 2017 12:52:03 +0000 (13:52 +0100)
committerjenny <jenny@fennel.follybridge>
Fri, 18 Aug 2017 12:52:03 +0000 (13:52 +0100)
277 files changed:
composer.lock
composer.phar
vendor/composer/installed.json
web/core/CHANGELOG.txt
web/core/INSTALL.txt
web/core/MAINTAINERS.txt
web/core/core.api.php
web/core/core.services.yml
web/core/includes/entity.inc
web/core/lib/Drupal.php
web/core/lib/Drupal/Component/Utility/SafeMarkup.php
web/core/lib/Drupal/Core/Block/BlockManager.php
web/core/lib/Drupal/Core/Cache/CacheCollector.php
web/core/lib/Drupal/Core/Database/Query/ConditionInterface.php
web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
web/core/lib/Drupal/Core/Entity/EntityManager.php
web/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
web/core/lib/Drupal/Core/Field/FieldConfigBase.php
web/core/lib/Drupal/Core/Form/BaseFormIdInterface.php
web/core/lib/Drupal/Core/Render/theme.api.php
web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php [moved from web/core/modules/aggregator/src/Tests/AddFeedTest.php with 98% similarity]
web/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php [moved from web/core/modules/aggregator/src/Tests/AggregatorAdminTest.php with 83% similarity]
web/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php [moved from web/core/modules/aggregator/src/Tests/AggregatorCronTest.php with 93% similarity]
web/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php [moved from web/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php with 91% similarity]
web/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php [moved from web/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php with 98% similarity]
web/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php [moved from web/core/modules/aggregator/src/Tests/FeedLanguageTest.php with 95% similarity]
web/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php [moved from web/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php with 98% similarity]
web/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php [moved from web/core/modules/aggregator/src/Tests/UpdateFeedTest.php with 97% similarity]
web/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
web/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php
web/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php [moved from web/core/modules/block_content/src/Tests/BlockContentCreationTest.php with 98% similarity]
web/core/modules/block_content/tests/src/Functional/BlockContentListTest.php [moved from web/core/modules/block_content/src/Tests/BlockContentListTest.php with 95% similarity]
web/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php [moved from web/core/modules/block_content/src/Tests/BlockContentListViewsTest.php with 91% similarity]
web/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php [moved from web/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php with 99% similarity]
web/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php [moved from web/core/modules/block_content/src/Tests/BlockContentValidationTest.php with 96% similarity]
web/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php [moved from web/core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php with 95% similarity]
web/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php [moved from web/core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php with 95% similarity]
web/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php [moved from web/core/modules/block_content/src/Tests/Views/BlockContentRedirectTest.php with 95% similarity]
web/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php [new file with mode: 0644]
web/core/modules/block_content/tests/src/Functional/Views/FieldTypeTest.php [moved from web/core/modules/block_content/src/Tests/Views/FieldTypeTest.php with 93% similarity]
web/core/modules/block_content/tests/src/Functional/Views/RevisionRelationshipsTest.php [moved from web/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php with 92% similarity]
web/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php [moved from web/core/modules/book/src/Tests/Views/BookRelationshipTest.php with 95% similarity]
web/core/modules/comment/src/Entity/Comment.php
web/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php
web/core/modules/config_translation/tests/src/Functional/ConfigTranslationFormTest.php [moved from web/core/modules/config_translation/src/Tests/ConfigTranslationFormTest.php with 92% similarity]
web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php [moved from web/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php with 90% similarity]
web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php [moved from web/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php with 86% similarity]
web/core/modules/config_translation/tests/src/Functional/ConfigTranslationViewListUiTest.php [moved from web/core/modules/config_translation/src/Tests/ConfigTranslationViewListUiTest.php with 86% similarity]
web/core/modules/contact/tests/src/Functional/Views/ContactFieldsTest.php [moved from web/core/modules/contact/src/Tests/Views/ContactFieldsTest.php with 88% similarity]
web/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php [moved from web/core/modules/contact/src/Tests/Views/ContactLinkTest.php with 94% similarity]
web/core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php
web/core/modules/content_moderation/tests/src/Kernel/InitialStateTest.php
web/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
web/core/modules/content_translation/tests/src/Functional/ContentTestTranslationUITest.php [moved from web/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php with 93% similarity]
web/core/modules/content_translation/tests/src/Functional/ContentTranslationDisableSettingTest.php [moved from web/core/modules/content_translation/src/Tests/ContentTranslationDisableSettingTest.php with 96% similarity]
web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php [moved from web/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php with 88% similarity]
web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php [moved from web/core/modules/content_translation/src/Tests/ContentTranslationLanguageChangeTest.php with 98% similarity]
web/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php [moved from web/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php with 98% similarity]
web/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php [moved from web/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php with 98% similarity]
web/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php [moved from web/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php with 86% similarity]
web/core/modules/content_translation/tests/src/Functional/Views/TranslationLinkTest.php [moved from web/core/modules/content_translation/src/Tests/Views/TranslationLinkTest.php with 92% similarity]
web/core/modules/field/tests/modules/field_test/field_test.module
web/core/modules/field/tests/src/Kernel/FieldCrudTest.php
web/core/modules/file/migration_templates/d7_file.yml
web/core/modules/file/migration_templates/d7_file_private.yml [new file with mode: 0644]
web/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php [new file with mode: 0644]
web/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
web/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php [new file with mode: 0644]
web/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php [moved from web/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php with 92% similarity]
web/core/modules/hal/src/LinkManager/RelationLinkManager.php
web/core/modules/hal/src/LinkManager/TypeLinkManager.php
web/core/modules/hal/tests/modules/hal_test/hal_test.module
web/core/modules/hal/tests/src/Functional/EntityResource/ImageStyle/ImageStyleHalJsonAnonTest.php
web/core/modules/hal/tests/src/Functional/EntityResource/ImageStyle/ImageStyleHalJsonBasicAuthTest.php
web/core/modules/hal/tests/src/Functional/EntityResource/ImageStyle/ImageStyleHalJsonCookieTest.php
web/core/modules/image/tests/src/Functional/ImageEffectsTest.php
web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d6/LanguageContentSettingsTest.php [new file with mode: 0644]
web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d7/LanguageContentSettingsTest.php [new file with mode: 0644]
web/core/modules/layout_discovery/layouts/threecol_33_34_33/threecol_33_34_33.css
web/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php [moved from web/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php with 98% similarity]
web/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php [moved from web/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php with 97% similarity]
web/core/modules/locale/tests/src/Functional/LocaleExportTest.php [moved from web/core/modules/locale/src/Tests/LocaleExportTest.php with 97% similarity]
web/core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php [moved from web/core/modules/locale/src/Tests/LocaleFileSystemFormTest.php with 91% similarity]
web/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php [moved from web/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php with 99% similarity]
web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php [moved from web/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php with 92% similarity]
web/core/modules/locale/tests/src/Functional/LocaleLibraryAlterTest.php [moved from web/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php with 85% similarity]
web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php [moved from web/core/modules/locale/src/Tests/LocalePluralFormatTest.php with 99% similarity]
web/core/modules/locale/tests/src/Functional/LocaleTranslateStringTourTest.php [moved from web/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php with 96% similarity]
web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php [moved from web/core/modules/locale/src/Tests/LocaleTranslationUiTest.php with 96% similarity]
web/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php [moved from web/core/modules/locale/src/Tests/LocaleUpdateBase.php with 98% similarity]
web/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php [moved from web/core/modules/locale/src/Tests/LocaleUpdateCronTest.php with 97% similarity]
web/core/modules/locale/tests/src/Functional/LocaleUpdateDevelopmentReleaseTest.php [moved from web/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php with 88% similarity]
web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php [moved from web/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php with 99% similarity]
web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php [moved from web/core/modules/locale/src/Tests/LocaleUpdateTest.php with 99% similarity]
web/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php
web/core/modules/migrate_drupal/src/Plugin/MigrateCckFieldPluginManagerInterface.php
web/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php [new file with mode: 0644]
web/core/modules/migrate_drupal/tests/fixtures/drupal6.php
web/core/modules/migrate_drupal/tests/fixtures/drupal7.php
web/core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
web/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
web/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php
web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php [moved from web/core/modules/migrate_drupal_ui/src/Tests/MigrateAccessTest.php with 82% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php [new file with mode: 0644]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php with 90% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/html-1.txt [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/html-1.txt with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/image-1.png [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/image-1.png with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/image-2.jpg [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/image-2.jpg with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/image-test.gif [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/image-test.gif with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/image-test.jpg [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/image-test.jpg with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/core/modules/simpletest/files/image-test.png [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/core/modules/simpletest/files/image-test.png with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/files/tmp/some-temp-file.jpg [moved from web/core/modules/migrate_drupal_ui/src/Tests/d6/files/tmp/some-temp-file.jpg with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php [moved from web/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php with 86% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/files/cube.jpeg [moved from web/core/modules/migrate_drupal_ui/src/Tests/d7/files/sites/default/files/cube.jpeg with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/files/ds9.txt [moved from web/core/modules/migrate_drupal_ui/src/Tests/d7/files/sites/default/files/ds9.txt with 100% similarity]
web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/private/Babylon5.txt [new file with mode: 0644]
web/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
web/core/modules/outside_in/css/outside_in.motion.css
web/core/modules/outside_in/css/outside_in.theme.css
web/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php
web/core/modules/outside_in/src/Block/BlockEntityOffCanvasForm.php
web/core/modules/outside_in/src/Tests/Ajax/OffCanvasDialogTest.php
web/core/modules/outside_in/templates/outside-in-page-wrapper.html.twig
web/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php
web/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
web/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
web/core/modules/outside_in/tests/src/Unit/Ajax/OpenOffCanvasDialogCommandTest.php
web/core/modules/rdf/tests/src/Functional/EntityReferenceFieldAttributesTest.php
web/core/modules/rdf/tests/src/Functional/TaxonomyAttributesTest.php
web/core/modules/rest/config/schema/rest.schema.yml
web/core/modules/rest/rest.api.php
web/core/modules/rest/src/LinkManager/ConfigurableLinkManagerInterface.php
web/core/modules/rest/src/LinkManager/LinkManager.php
web/core/modules/rest/src/LinkManager/LinkManagerBase.php
web/core/modules/rest/src/LinkManager/LinkManagerInterface.php
web/core/modules/rest/src/LinkManager/RelationLinkManager.php
web/core/modules/rest/src/LinkManager/RelationLinkManagerInterface.php
web/core/modules/rest/src/LinkManager/TypeLinkManager.php
web/core/modules/rest/src/LinkManager/TypeLinkManagerInterface.php
web/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
web/core/modules/rest/src/RestServiceProvider.php
web/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php
web/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php [moved from web/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php with 97% similarity]
web/core/modules/system/src/Tests/Database/DatabaseWebTestBase.php
web/core/modules/system/src/Tests/Database/FakeRecord.php
web/core/modules/system/src/Tests/Image/ToolkitTestBase.php
web/core/modules/system/tests/modules/entity_test/entity_test.module
web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoUuid.php [new file with mode: 0644]
web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUpdate.php [deleted file]
web/core/modules/system/tests/modules/entity_test_update/entity_test_update.module
web/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
web/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php [new file with mode: 0644]
web/core/modules/system/tests/src/Functional/Database/FakeRecord.php [new file with mode: 0644]
web/core/modules/system/tests/src/Functional/Database/SelectPagerDefaultTest.php [moved from web/core/modules/system/src/Tests/Database/SelectPagerDefaultTest.php with 89% similarity]
web/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php [moved from web/core/modules/system/src/Tests/Database/SelectTableSortDefaultTest.php with 85% similarity]
web/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php [moved from web/core/modules/system/src/Tests/Database/TemporaryQueryTest.php with 90% similarity]
web/core/modules/system/tests/src/Functional/DrupalKernel/ContainerRebuildWebTest.php [moved from web/core/modules/system/src/Tests/DrupalKernel/ContainerRebuildWebTest.php with 63% similarity]
web/core/modules/taxonomy/migration_templates/d6_taxonomy_term_translation.yml [new file with mode: 0644]
web/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary_translation.yml [new file with mode: 0644]
web/core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php
web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php [new file with mode: 0644]
web/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
web/core/modules/taxonomy/src/Tests/TaxonomyTestTrait.php
web/core/modules/taxonomy/src/Tests/TaxonomyTranslationTestTrait.php
web/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php [moved from web/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php with 94% similarity]
web/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php [moved from web/core/modules/taxonomy/src/Tests/TaxonomyQueryAlterTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php [moved from web/core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php
web/core/modules/taxonomy/tests/src/Functional/TaxonomyTestTrait.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Functional/TaxonomyTranslationTestTrait.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php
web/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php [moved from web/core/modules/taxonomy/src/Tests/TermTranslationUITest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php [moved from web/core/modules/taxonomy/src/Tests/ThemeTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/RelationshipNodeTermDataTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/RelationshipRepresentativeNodeTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/RelationshipRepresentativeNodeTest.php with 94% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyDefaultArgumentTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyDefaultArgumentTest.php with 98% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldAllTermsTest.php with 86% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldTidTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php with 94% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidFilterTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyParentUITest.php with 81% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyRelationshipTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermArgumentDepthTest.php with 89% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermFilterDepthTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TaxonomyVocabularyArgumentTest.php with 92% similarity]
web/core/modules/taxonomy/tests/src/Functional/Views/TermNameFieldTest.php [moved from web/core/modules/taxonomy/src/Tests/Views/TermNameFieldTest.php with 96% similarity]
web/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php [moved from web/core/modules/taxonomy/src/Tests/VocabularyUiTest.php with 97% similarity]
web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php
web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php [new file with mode: 0644]
web/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
web/core/modules/update/src/Tests/UpdateTestBase.php
web/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php [moved from web/core/modules/update/src/Tests/FileTransferAuthorizeFormTest.php with 92% similarity]
web/core/modules/update/tests/src/Functional/UpdateContribTest.php [moved from web/core/modules/update/src/Tests/UpdateContribTest.php with 99% similarity]
web/core/modules/update/tests/src/Functional/UpdateCoreTest.php [moved from web/core/modules/update/src/Tests/UpdateCoreTest.php with 98% similarity]
web/core/modules/update/tests/src/Functional/UpdateDeleteFileIfStaleTest.php [moved from web/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php with 96% similarity]
web/core/modules/update/tests/src/Functional/UpdateTestBase.php [new file with mode: 0644]
web/core/modules/update/tests/src/Functional/UpdateUploadTest.php [moved from web/core/modules/update/src/Tests/UpdateUploadTest.php with 96% similarity]
web/core/modules/user/src/UserData.php
web/core/modules/user/tests/src/Functional/AccessRoleUITest.php [moved from web/core/modules/user/src/Tests/Views/AccessRoleUITest.php with 88% similarity]
web/core/modules/user/tests/src/Functional/UserLoginHttpTest.php
web/core/modules/user/tests/src/Unit/Plugin/Action/AddRoleUserTest.php
web/core/modules/views/src/Controller/ViewAjaxController.php
web/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
web/core/modules/views/src/Plugin/views/style/DefaultStyle.php
web/core/modules/views/src/Plugin/views/style/Grid.php
web/core/modules/views/src/Plugin/views/style/HtmlList.php
web/core/modules/views/src/Plugin/views/style/Opml.php
web/core/modules/views/src/Plugin/views/style/Rss.php
web/core/modules/views/src/Plugin/views/style/StylePluginBase.php
web/core/modules/views/src/Plugin/views/style/Table.php
web/core/modules/views/src/Tests/ViewAjaxTest.php
web/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTemplateTest.php
web/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php
web/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php
web/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
web/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
web/core/modules/views_ui/src/Tests/PreviewTest.php
web/core/modules/views_ui/src/Tests/UITestBase.php
web/core/modules/views_ui/src/Tests/ViewEditTest.php
web/core/modules/views_ui/src/ViewEditForm.php
web/core/modules/views_ui/src/ViewUI.php
web/core/modules/views_ui/tests/src/Functional/AnalyzeTest.php [moved from web/core/modules/views_ui/src/Tests/AnalyzeTest.php with 70% similarity]
web/core/modules/views_ui/tests/src/Functional/AreaEntityUITest.php [moved from web/core/modules/views_ui/src/Tests/AreaEntityUITest.php with 93% similarity]
web/core/modules/views_ui/tests/src/Functional/ArgumentValidatorTest.php [moved from web/core/modules/views_ui/src/Tests/ArgumentValidatorTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php [moved from web/core/modules/views_ui/src/Tests/CachedDataUITest.php with 98% similarity]
web/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php [moved from web/core/modules/views_ui/src/Tests/CustomBooleanTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php [moved from web/core/modules/views_ui/src/Tests/DefaultViewsTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php [moved from web/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php with 95% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php [moved from web/core/modules/views_ui/src/Tests/DisplayCRUDTest.php with 99% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayExtenderUITest.php [moved from web/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php [moved from web/core/modules/views_ui/src/Tests/DisplayFeedTest.php with 92% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php [moved from web/core/modules/views_ui/src/Tests/DisplayPathTest.php with 94% similarity]
web/core/modules/views_ui/tests/src/Functional/DisplayTest.php [moved from web/core/modules/views_ui/src/Tests/DisplayTest.php with 77% similarity]
web/core/modules/views_ui/tests/src/Functional/DuplicateTest.php [moved from web/core/modules/views_ui/src/Tests/DuplicateTest.php with 84% similarity]
web/core/modules/views_ui/tests/src/Functional/FieldUITest.php [moved from web/core/modules/views_ui/src/Tests/FieldUITest.php with 87% similarity]
web/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php [moved from web/core/modules/views_ui/src/Tests/FilterBooleanWebTest.php with 89% similarity]
web/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php [moved from web/core/modules/views_ui/src/Tests/FilterNumericWebTest.php with 86% similarity]
web/core/modules/views_ui/tests/src/Functional/FilterUITest.php [moved from web/core/modules/views_ui/src/Tests/FilterUITest.php with 94% similarity]
web/core/modules/views_ui/tests/src/Functional/GroupByTest.php [moved from web/core/modules/views_ui/src/Tests/GroupByTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/HandlerTest.php [moved from web/core/modules/views_ui/src/Tests/HandlerTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/NewViewConfigSchemaTest.php [moved from web/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php with 90% similarity]
web/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php [moved from web/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/QueryTest.php [moved from web/core/modules/views_ui/src/Tests/QueryTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php [moved from web/core/modules/views_ui/src/Tests/RearrangeFieldsTest.php with 98% similarity]
web/core/modules/views_ui/tests/src/Functional/RedirectTest.php [moved from web/core/modules/views_ui/src/Tests/RedirectTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php [moved from web/core/modules/views_ui/src/Tests/ReportFieldsTest.php with 97% similarity]
web/core/modules/views_ui/tests/src/Functional/ReportTest.php [moved from web/core/modules/views_ui/src/Tests/ReportTest.php with 72% similarity]
web/core/modules/views_ui/tests/src/Functional/SettingsTest.php [moved from web/core/modules/views_ui/src/Tests/SettingsTest.php with 91% similarity]
web/core/modules/views_ui/tests/src/Functional/StorageTest.php [moved from web/core/modules/views_ui/src/Tests/StorageTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/StyleTableTest.php [moved from web/core/modules/views_ui/src/Tests/StyleTableTest.php with 95% similarity]
web/core/modules/views_ui/tests/src/Functional/StyleUITest.php [moved from web/core/modules/views_ui/src/Tests/StyleUITest.php with 98% similarity]
web/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php [moved from web/core/modules/views_ui/src/Tests/TokenizeAreaUITest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php [moved from web/core/modules/views_ui/src/Tests/TranslatedViewTest.php with 90% similarity]
web/core/modules/views_ui/tests/src/Functional/UITestBase.php [new file with mode: 0644]
web/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php [moved from web/core/modules/views_ui/src/Tests/UnsavedPreviewTest.php with 92% similarity]
web/core/modules/views_ui/tests/src/Functional/ViewsListTest.php [moved from web/core/modules/views_ui/src/Tests/ViewsListTest.php with 89% similarity]
web/core/modules/views_ui/tests/src/Functional/WizardTest.php [moved from web/core/modules/views_ui/src/Tests/WizardTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/Functional/XssTest.php [moved from web/core/modules/views_ui/src/Tests/XssTest.php with 96% similarity]
web/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php [new file with mode: 0644]
web/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
web/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php [moved from web/core/modules/system/src/Tests/Image/ToolkitSetupFormTest.php with 94% similarity]
web/core/tests/Drupal/FunctionalTests/Image/ToolkitTest.php [moved from web/core/modules/system/src/Tests/Image/ToolkitTest.php with 98% similarity]
web/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php [new file with mode: 0644]
web/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php
web/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
web/core/tests/Drupal/KernelTests/Core/Path/AliasTest.php
web/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
web/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php [new file with mode: 0644]
web/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
web/core/tests/Drupal/Tests/TestSuites/TestSuiteBaseTest.php

index 9ca54eb8191976b8f02f1c293a93fc9bdd1ec557..ec4a0f43c64311cbe478be938e746ee3c169ea36 100644 (file)
         },
         {
             "name": "drupal/core",
-            "version": "8.3.4",
+            "version": "8.3.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/drupal/core.git",
-                "reference": "f34eee7255142ab5416107972ef13d011f11e163"
+                "reference": "32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/drupal/core/zipball/f34eee7255142ab5416107972ef13d011f11e163",
-                "reference": "f34eee7255142ab5416107972ef13d011f11e163",
+                "url": "https://api.github.com/repos/drupal/core/zipball/32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff",
+                "reference": "32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff",
                 "shasum": ""
             },
             "require": {
                 "GPL-2.0+"
             ],
             "description": "Drupal is an open source content management platform powering millions of websites and applications.",
-            "time": "2017-06-21T18:13:27+00:00"
+            "time": "2017-08-16T17:10:35+00:00"
         },
         {
             "name": "drupal/crop",
             "homepage": "https://www.drupal.org/project/security_review",
             "support": {
                 "source": "http://cgit.drupalcode.org/security_review"
-            },
-            "time": "2016-10-20 15:43:48"
+            }
         },
         {
             "name": "drupal/simple_sitemap",
                 "standards",
                 "syntax"
             ],
-            "time": "2015-09-20 22:14:29"
+            "time": "2015-09-20T22:14:29+00:00"
         },
         {
             "name": "guzzlehttp/guzzle",
index e44722e933f8ebf9b4501f04b42c9accc594ab00..fc46f0e003d0490f016716111879b4952a9624ae 100755 (executable)
Binary files a/composer.phar and b/composer.phar differ
index 048ac50bbdbc8e5978caa229a34d29f0ac74bd7a..6e357d5ee83eb789582ecb43266dd795d2a31992 100644 (file)
             "source": "http://cgit.drupalcode.org/layouter"
         }
     },
-    {
-        "name": "drupal/core",
-        "version": "8.3.4",
-        "version_normalized": "8.3.4.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/drupal/core.git",
-            "reference": "f34eee7255142ab5416107972ef13d011f11e163"
-        },
-        "dist": {
-            "type": "zip",
-            "url": "https://api.github.com/repos/drupal/core/zipball/f34eee7255142ab5416107972ef13d011f11e163",
-            "reference": "f34eee7255142ab5416107972ef13d011f11e163",
-            "shasum": ""
-        },
-        "require": {
-            "asm89/stack-cors": "~1.0",
-            "composer/semver": "~1.0",
-            "doctrine/annotations": "1.2.*",
-            "doctrine/common": "^2.5",
-            "easyrdf/easyrdf": "0.9.*",
-            "egulias/email-validator": "1.2.*",
-            "guzzlehttp/guzzle": "^6.2.1",
-            "masterminds/html5": "~2.1",
-            "paragonie/random_compat": "^1.0|^2.0",
-            "php": ">=5.5.9",
-            "stack/builder": "1.0.*",
-            "symfony-cmf/routing": "~1.4",
-            "symfony/class-loader": "~2.8",
-            "symfony/console": "~2.8",
-            "symfony/dependency-injection": "~2.8",
-            "symfony/event-dispatcher": "~2.8",
-            "symfony/http-foundation": "~2.8",
-            "symfony/http-kernel": "~2.8",
-            "symfony/polyfill-iconv": "~1.0",
-            "symfony/process": "~2.8",
-            "symfony/psr-http-message-bridge": "^1.0",
-            "symfony/routing": "~2.8",
-            "symfony/serializer": "~2.8",
-            "symfony/translation": "~2.8",
-            "symfony/validator": "~2.8",
-            "symfony/yaml": "~2.8",
-            "twig/twig": "^1.23.1",
-            "zendframework/zend-diactoros": "~1.1",
-            "zendframework/zend-feed": "~2.4"
-        },
-        "conflict": {
-            "drush/drush": "<8.1.10"
-        },
-        "replace": {
-            "drupal/action": "self.version",
-            "drupal/aggregator": "self.version",
-            "drupal/automated_cron": "self.version",
-            "drupal/ban": "self.version",
-            "drupal/bartik": "self.version",
-            "drupal/basic_auth": "self.version",
-            "drupal/big_pipe": "self.version",
-            "drupal/block": "self.version",
-            "drupal/block_content": "self.version",
-            "drupal/block_place": "self.version",
-            "drupal/book": "self.version",
-            "drupal/breakpoint": "self.version",
-            "drupal/ckeditor": "self.version",
-            "drupal/classy": "self.version",
-            "drupal/color": "self.version",
-            "drupal/comment": "self.version",
-            "drupal/config": "self.version",
-            "drupal/config_translation": "self.version",
-            "drupal/contact": "self.version",
-            "drupal/content_moderation": "self.version",
-            "drupal/content_translation": "self.version",
-            "drupal/contextual": "self.version",
-            "drupal/core-annotation": "self.version",
-            "drupal/core-assertion": "self.version",
-            "drupal/core-bridge": "self.version",
-            "drupal/core-datetime": "self.version",
-            "drupal/core-dependency-injection": "self.version",
-            "drupal/core-diff": "self.version",
-            "drupal/core-discovery": "self.version",
-            "drupal/core-event-dispatcher": "self.version",
-            "drupal/core-file-cache": "self.version",
-            "drupal/core-filesystem": "self.version",
-            "drupal/core-gettext": "self.version",
-            "drupal/core-graph": "self.version",
-            "drupal/core-http-foundation": "self.version",
-            "drupal/core-php-storage": "self.version",
-            "drupal/core-plugin": "self.version",
-            "drupal/core-proxy-builder": "self.version",
-            "drupal/core-render": "self.version",
-            "drupal/core-serialization": "self.version",
-            "drupal/core-transliteration": "self.version",
-            "drupal/core-utility": "self.version",
-            "drupal/core-uuid": "self.version",
-            "drupal/datetime": "self.version",
-            "drupal/datetime_range": "self.version",
-            "drupal/dblog": "self.version",
-            "drupal/dynamic_page_cache": "self.version",
-            "drupal/editor": "self.version",
-            "drupal/entity_reference": "self.version",
-            "drupal/field": "self.version",
-            "drupal/field_layout": "self.version",
-            "drupal/field_ui": "self.version",
-            "drupal/file": "self.version",
-            "drupal/filter": "self.version",
-            "drupal/forum": "self.version",
-            "drupal/hal": "self.version",
-            "drupal/help": "self.version",
-            "drupal/history": "self.version",
-            "drupal/image": "self.version",
-            "drupal/inline_form_errors": "self.version",
-            "drupal/language": "self.version",
-            "drupal/layout_discovery": "self.version",
-            "drupal/link": "self.version",
-            "drupal/locale": "self.version",
-            "drupal/menu_link_content": "self.version",
-            "drupal/menu_ui": "self.version",
-            "drupal/migrate": "self.version",
-            "drupal/migrate_drupal": "self.version",
-            "drupal/migrate_drupal_ui": "self.version",
-            "drupal/minimal": "self.version",
-            "drupal/node": "self.version",
-            "drupal/options": "self.version",
-            "drupal/outside_in": "self.version",
-            "drupal/page_cache": "self.version",
-            "drupal/path": "self.version",
-            "drupal/quickedit": "self.version",
-            "drupal/rdf": "self.version",
-            "drupal/responsive_image": "self.version",
-            "drupal/rest": "self.version",
-            "drupal/search": "self.version",
-            "drupal/serialization": "self.version",
-            "drupal/seven": "self.version",
-            "drupal/shortcut": "self.version",
-            "drupal/simpletest": "self.version",
-            "drupal/standard": "self.version",
-            "drupal/stark": "self.version",
-            "drupal/statistics": "self.version",
-            "drupal/syslog": "self.version",
-            "drupal/system": "self.version",
-            "drupal/taxonomy": "self.version",
-            "drupal/telephone": "self.version",
-            "drupal/text": "self.version",
-            "drupal/toolbar": "self.version",
-            "drupal/tour": "self.version",
-            "drupal/tracker": "self.version",
-            "drupal/update": "self.version",
-            "drupal/user": "self.version",
-            "drupal/views": "self.version",
-            "drupal/views_ui": "self.version",
-            "drupal/workflows": "self.version"
-        },
-        "require-dev": {
-            "behat/mink": "1.7.x-dev",
-            "behat/mink-goutte-driver": "~1.2",
-            "drupal/coder": "8.2.12",
-            "jcalderonzumba/gastonjs": "~1.0.2",
-            "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
-            "mikey179/vfsstream": "~1.2",
-            "phpunit/phpunit": ">=4.8.28 <5",
-            "symfony/browser-kit": ">=2.8.13 <3.0",
-            "symfony/css-selector": "~2.8"
-        },
-        "time": "2017-06-21T18:13:27+00:00",
-        "type": "drupal-core",
-        "installation-source": "dist",
-        "autoload": {
-            "psr-4": {
-                "Drupal\\Core\\": "lib/Drupal/Core",
-                "Drupal\\Component\\": "lib/Drupal/Component",
-                "Drupal\\Driver\\": "../drivers/lib/Drupal/Driver"
-            },
-            "classmap": [
-                "lib/Drupal.php",
-                "lib/Drupal/Component/Utility/Timer.php",
-                "lib/Drupal/Component/Utility/Unicode.php",
-                "lib/Drupal/Core/Database/Database.php",
-                "lib/Drupal/Core/DrupalKernel.php",
-                "lib/Drupal/Core/DrupalKernelInterface.php",
-                "lib/Drupal/Core/Site/Settings.php"
-            ]
-        },
-        "notification-url": "https://packagist.org/downloads/",
-        "license": [
-            "GPL-2.0+"
-        ],
-        "description": "Drupal is an open source content management platform powering millions of websites and applications."
-    },
     {
         "name": "drupal-composer/drupal-scaffold",
         "version": "2.3.0",
             }
         ],
         "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it"
+    },
+    {
+        "name": "drupal/core",
+        "version": "8.3.7",
+        "version_normalized": "8.3.7.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/drupal/core.git",
+            "reference": "32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff"
+        },
+        "dist": {
+            "type": "zip",
+            "url": "https://api.github.com/repos/drupal/core/zipball/32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff",
+            "reference": "32f66ed9cc593f8e9ab0eaaaeff4cadbd859d5ff",
+            "shasum": ""
+        },
+        "require": {
+            "asm89/stack-cors": "~1.0",
+            "composer/semver": "~1.0",
+            "doctrine/annotations": "1.2.*",
+            "doctrine/common": "^2.5",
+            "easyrdf/easyrdf": "0.9.*",
+            "egulias/email-validator": "1.2.*",
+            "guzzlehttp/guzzle": "^6.2.1",
+            "masterminds/html5": "~2.1",
+            "paragonie/random_compat": "^1.0|^2.0",
+            "php": ">=5.5.9",
+            "stack/builder": "1.0.*",
+            "symfony-cmf/routing": "~1.4",
+            "symfony/class-loader": "~2.8",
+            "symfony/console": "~2.8",
+            "symfony/dependency-injection": "~2.8",
+            "symfony/event-dispatcher": "~2.8",
+            "symfony/http-foundation": "~2.8",
+            "symfony/http-kernel": "~2.8",
+            "symfony/polyfill-iconv": "~1.0",
+            "symfony/process": "~2.8",
+            "symfony/psr-http-message-bridge": "^1.0",
+            "symfony/routing": "~2.8",
+            "symfony/serializer": "~2.8",
+            "symfony/translation": "~2.8",
+            "symfony/validator": "~2.8",
+            "symfony/yaml": "~2.8",
+            "twig/twig": "^1.23.1",
+            "zendframework/zend-diactoros": "~1.1",
+            "zendframework/zend-feed": "~2.4"
+        },
+        "conflict": {
+            "drush/drush": "<8.1.10"
+        },
+        "replace": {
+            "drupal/action": "self.version",
+            "drupal/aggregator": "self.version",
+            "drupal/automated_cron": "self.version",
+            "drupal/ban": "self.version",
+            "drupal/bartik": "self.version",
+            "drupal/basic_auth": "self.version",
+            "drupal/big_pipe": "self.version",
+            "drupal/block": "self.version",
+            "drupal/block_content": "self.version",
+            "drupal/block_place": "self.version",
+            "drupal/book": "self.version",
+            "drupal/breakpoint": "self.version",
+            "drupal/ckeditor": "self.version",
+            "drupal/classy": "self.version",
+            "drupal/color": "self.version",
+            "drupal/comment": "self.version",
+            "drupal/config": "self.version",
+            "drupal/config_translation": "self.version",
+            "drupal/contact": "self.version",
+            "drupal/content_moderation": "self.version",
+            "drupal/content_translation": "self.version",
+            "drupal/contextual": "self.version",
+            "drupal/core-annotation": "self.version",
+            "drupal/core-assertion": "self.version",
+            "drupal/core-bridge": "self.version",
+            "drupal/core-datetime": "self.version",
+            "drupal/core-dependency-injection": "self.version",
+            "drupal/core-diff": "self.version",
+            "drupal/core-discovery": "self.version",
+            "drupal/core-event-dispatcher": "self.version",
+            "drupal/core-file-cache": "self.version",
+            "drupal/core-filesystem": "self.version",
+            "drupal/core-gettext": "self.version",
+            "drupal/core-graph": "self.version",
+            "drupal/core-http-foundation": "self.version",
+            "drupal/core-php-storage": "self.version",
+            "drupal/core-plugin": "self.version",
+            "drupal/core-proxy-builder": "self.version",
+            "drupal/core-render": "self.version",
+            "drupal/core-serialization": "self.version",
+            "drupal/core-transliteration": "self.version",
+            "drupal/core-utility": "self.version",
+            "drupal/core-uuid": "self.version",
+            "drupal/datetime": "self.version",
+            "drupal/datetime_range": "self.version",
+            "drupal/dblog": "self.version",
+            "drupal/dynamic_page_cache": "self.version",
+            "drupal/editor": "self.version",
+            "drupal/entity_reference": "self.version",
+            "drupal/field": "self.version",
+            "drupal/field_layout": "self.version",
+            "drupal/field_ui": "self.version",
+            "drupal/file": "self.version",
+            "drupal/filter": "self.version",
+            "drupal/forum": "self.version",
+            "drupal/hal": "self.version",
+            "drupal/help": "self.version",
+            "drupal/history": "self.version",
+            "drupal/image": "self.version",
+            "drupal/inline_form_errors": "self.version",
+            "drupal/language": "self.version",
+            "drupal/layout_discovery": "self.version",
+            "drupal/link": "self.version",
+            "drupal/locale": "self.version",
+            "drupal/menu_link_content": "self.version",
+            "drupal/menu_ui": "self.version",
+            "drupal/migrate": "self.version",
+            "drupal/migrate_drupal": "self.version",
+            "drupal/migrate_drupal_ui": "self.version",
+            "drupal/minimal": "self.version",
+            "drupal/node": "self.version",
+            "drupal/options": "self.version",
+            "drupal/outside_in": "self.version",
+            "drupal/page_cache": "self.version",
+            "drupal/path": "self.version",
+            "drupal/quickedit": "self.version",
+            "drupal/rdf": "self.version",
+            "drupal/responsive_image": "self.version",
+            "drupal/rest": "self.version",
+            "drupal/search": "self.version",
+            "drupal/serialization": "self.version",
+            "drupal/seven": "self.version",
+            "drupal/shortcut": "self.version",
+            "drupal/simpletest": "self.version",
+            "drupal/standard": "self.version",
+            "drupal/stark": "self.version",
+            "drupal/statistics": "self.version",
+            "drupal/syslog": "self.version",
+            "drupal/system": "self.version",
+            "drupal/taxonomy": "self.version",
+            "drupal/telephone": "self.version",
+            "drupal/text": "self.version",
+            "drupal/toolbar": "self.version",
+            "drupal/tour": "self.version",
+            "drupal/tracker": "self.version",
+            "drupal/update": "self.version",
+            "drupal/user": "self.version",
+            "drupal/views": "self.version",
+            "drupal/views_ui": "self.version",
+            "drupal/workflows": "self.version"
+        },
+        "require-dev": {
+            "behat/mink": "1.7.x-dev",
+            "behat/mink-goutte-driver": "~1.2",
+            "drupal/coder": "8.2.12",
+            "jcalderonzumba/gastonjs": "~1.0.2",
+            "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
+            "mikey179/vfsstream": "~1.2",
+            "phpunit/phpunit": ">=4.8.28 <5",
+            "symfony/browser-kit": ">=2.8.13 <3.0",
+            "symfony/css-selector": "~2.8"
+        },
+        "time": "2017-08-16T17:10:35+00:00",
+        "type": "drupal-core",
+        "installation-source": "dist",
+        "autoload": {
+            "psr-4": {
+                "Drupal\\Core\\": "lib/Drupal/Core",
+                "Drupal\\Component\\": "lib/Drupal/Component",
+                "Drupal\\Driver\\": "../drivers/lib/Drupal/Driver"
+            },
+            "classmap": [
+                "lib/Drupal.php",
+                "lib/Drupal/Component/Utility/Timer.php",
+                "lib/Drupal/Component/Utility/Unicode.php",
+                "lib/Drupal/Core/Database/Database.php",
+                "lib/Drupal/Core/DrupalKernel.php",
+                "lib/Drupal/Core/DrupalKernelInterface.php",
+                "lib/Drupal/Core/Site/Settings.php"
+            ]
+        },
+        "notification-url": "https://packagist.org/downloads/",
+        "license": [
+            "GPL-2.0+"
+        ],
+        "description": "Drupal is an open source content management platform powering millions of websites and applications."
     }
 ]
index eab9019968275d313697d6d82732f70a243e5961..1cfd863cf52ce6ab6d7ec539c5be93c329f66e19 100644 (file)
@@ -1,3 +1,7 @@
+Drupal 8.3.7, 2017-08-16
+------------------------
+- Fixed security issues. See SA-CORE-2017-004.
+
 Drupal 8.3.4, 2017-06-21
 ------------------------
 - Fixed security issues. See SA-CORE-2017-003.
index 74ceed95d124a9dd61a7052990c716bc5076be00..5d5525b1af08c673422000b7cbac99cafd73eac5 100644 (file)
@@ -88,7 +88,7 @@ INSTALLATION
    directory within your web server's document root or your public HTML
    directory, continue with this command:
 
-     mv drupal-x.y.z/* drupal-x.y.z/.htaccess drupal-x.y.z/.csslintrc drupal-x.y.z/.editorconfig drupal-x.y.z/.eslintignore drupal-x.y.z/.eslintrc drupal-x.y.z/.gitattributes /path/to/your/installation
+     mv drupal-x.y.z/* drupal-x.y.z/.htaccess drupal-x.y.z/.csslintrc drupal-x.y.z/.editorconfig drupal-x.y.z/.eslintignore drupal-x.y.z/.eslintrc.json drupal-x.y.z/.gitattributes /path/to/your/installation
 
    You can also download the latest version of Drupal using Git on the command
    line and set up a repository by following the instructions at
index 9e9431638d2dd7a5474af49be7fc4a35c5fff56a..4e5f4e6197a0ee00aee0252f01d91800c75931e5 100644 (file)
@@ -36,6 +36,8 @@ Provisional membership:
   (Framework Manager - Frontend)
 - Gábor Hojtsy 'Gábor Hojtsy' https://www.drupal.org/u/gábor-hojtsy
   (Product Manager)
+- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
+  (Framework Manager)
 - Roy Scholten 'yoroy' https://www.drupal.org/u/yoroy
   (Product Manager)
 
@@ -168,10 +170,8 @@ CSS
 - John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin
 
 Database API
-- Larry Garfield 'Crell' https://www.drupal.org/u/crell
 
   MySQL DB driver
-  - Larry Garfield 'Crell' https://www.drupal.org/u/crell
   - David Strauss 'David Strauss' https://www.drupal.org/u/david-strauss
 
   PostgreSQL DB driver
@@ -272,6 +272,17 @@ Mail
 Markup
 - ?
 
+Menu
+- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
+- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
+
+Menu Link Content
+- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
+- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
+
+Menu UI
+- ?
+
 Migrate
 - Adam Globus-Hoenich 'phenaproxima' https://www.drupal.org/u/phenaproxima
 - Ben Dougherty 'benjy' https://www.drupal.org/u/benjy
@@ -285,17 +296,6 @@ Migrate (Drupal)
 - Mike Ryan 'mikeryan' https://www.drupal.org/u/mikeryan
 - Vicki Spagnolo 'quietone' https://www.drupal.org/u/quietone
 
-Menu
-- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
-- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
-
-Menu Link Content
-- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
-- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
-
-Menu UI
-- ?
-
 Node
 - Tim Millwood 'timmillwood' https://www.drupal.org/u/timmillwood
 
@@ -337,10 +337,9 @@ Render API
 - Moshe Weitzman 'moshe weitzman' https://www.drupal.org/u/moshe-weitzman
 
 Request Processing
-- Larry Garfield 'Crell' https://www.drupal.org/u/crell
+- ?
 
 REST
-- Larry Garfield 'Crell' https://www.drupal.org/u/crell
 - Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
 
 Responsive Image
@@ -349,7 +348,6 @@ Responsive Image
 - Jelle Sebreghts 'Jelle_S' https://www.drupal.org/u/jelle_s
 
 Routing
-- Larry Garfield 'Crell' https://www.drupal.org/u/crell
 - Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
 
 Search
@@ -432,6 +430,9 @@ Views
 - Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
 - Len Swaneveld 'Lendude' https://www.drupal.org/u/lendude
 
+Workflows
+- Sam Becker 'Sam152' https://www.drupal.org/u/sam152
+
 Topic maintainers
 -----------------
 
index 7c4ebf40b11162d1513be64d7763ccfb974fc248..161ddb9146cf71fab28619561742a1fb094fd1f5 100644 (file)
@@ -2530,8 +2530,8 @@ function hook_validation_constraint_alter(array &$definitions) {
  *
  * @section sec_dispatch Dispatching events
  * To dispatch an event, call the
- * \Symfony\Component\EventDispatcher\EventDispatchInterface::dispatch() method
- * on the 'event_dispatcher' service (see the
+ * \Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()
+ * method on the 'event_dispatcher' service (see the
  * @link container Services topic @endlink for more information about how to
  * interact with services). The first argument is the unique event name, which
  * you should normally define as a constant in a separate static class (see
index 2527845c752b8f751cf869cd90e076308734a8f4..bd2f2c1e70ab31050f31c10c9e5654f0a3ce56bd 100644 (file)
@@ -316,6 +316,7 @@ services:
       - { name: backend_overridable }
   # @deprecated in Drupal 8.0.x and will be removed before 9.0.0. Use
   #   config.storage.sync instead.
+  # @see https://www.drupal.org/node/2574957
   config.storage.staging:
     class: Drupal\Core\Config\FileStorage
     factory: Drupal\Core\Config\FileStorageFactory::getSync
index 45eaa3d8e40050237d047f3bb8ccb97d3e084c46..c69c588f0e2950463396b3b5936cbdf4bbd6c5a7 100644 (file)
@@ -531,24 +531,24 @@ function entity_get_display($entity_type, $bundle, $view_mode) {
  *
  * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
  *   If the entity form display is available in configuration use:
- * @code
- *   \Drupal::entityTypeManager()
- *     ->getStorage('entity_form_display')
- *     ->load($entity_type . '.' . $bundle . '.' . $form_mode);
- * @endcode
+ *   @code
+ *     \Drupal::entityTypeManager()
+ *       ->getStorage('entity_form_display')
+ *       ->load($entity_type . '.' . $bundle . '.' . $form_mode);
+ *   @endcode
  *   When the entity form display is not available in configuration, you can
  *   create a new EntityFormDisplay object using:
- * @code
- * $values = array(
- *  'targetEntityType' => $entity_type,
- *  'bundle' => $bundle,
- *  'mode' => $form_mode,
- *  'status' => TRUE,
- * );
- * \Drupal::entityTypeManager()
- *   ->getStorage('entity_form_display')
- *   ->create($values);
- * @endcode
+ *   @code
+ *   $values = array(
+ *    'targetEntityType' => $entity_type,
+ *    'bundle' => $bundle,
+ *    'mode' => $form_mode,
+ *    'status' => TRUE,
+ *   );
+ *   \Drupal::entityTypeManager()
+ *     ->getStorage('entity_form_display')
+ *     ->create($values);
+ *   @endcode
  *
  * @see \Drupal\Core\Entity\EntityStorageInterface::create()
  * @see \Drupal\Core\Entity\EntityStorageInterface::load()
index 9371f1e5f1c98d300780ffb4bbbffa60430d8c4e..db54df3d51785e14245d2dd9e990670e87ce30ff 100644 (file)
@@ -81,7 +81,7 @@ class Drupal {
   /**
    * The current system version.
    */
-  const VERSION = '8.3.4';
+  const VERSION = '8.3.7';
 
   /**
    * Core API compatibility.
index be35d96b4232a0e45ff76d713c7313557035006d..b2d00a3090154c6e4b0637b689672f4afda2a02e 100644 (file)
@@ -13,6 +13,8 @@ use Drupal\Component\Render\MarkupInterface;
  *   @link sanitization sanitization functions @endlink or the @link theme_render theme and render systems @endlink
  *   so that the output can can be themed, escaped, and altered properly.
  *
+ * @see https://www.drupal.org/node/2549395
+ *
  * @see TwigExtension::escapeFilter()
  * @see twig_render_template()
  * @see sanitization
@@ -34,6 +36,8 @@ class SafeMarkup {
    * @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
    *   Instead, you should just check if a variable is an instance of
    *   \Drupal\Component\Render\MarkupInterface.
+   *
+   * @see https://www.drupal.org/node/2549395
    */
   public static function isSafe($string, $strategy = 'html') {
     return $string instanceof MarkupInterface;
@@ -58,6 +62,7 @@ class SafeMarkup {
    *   possible, \Drupal\Component\Utility\Html::escape() can be used in places
    *   where explicit escaping is needed.
    *
+   * @see https://www.drupal.org/node/2549395
    * @see drupal_validate_utf8()
    */
   public static function checkPlain($text) {
@@ -84,6 +89,8 @@ class SafeMarkup {
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
    *   Use \Drupal\Component\Render\FormattableMarkup.
+   *
+   * @see https://www.drupal.org/node/2549395
    */
   public static function format($string, array $args) {
     return new FormattableMarkup($string, $args);
index a837340a3c24c60bf2687694254b988181b6979f..30b52b612566e34ceab848513110697284912a71 100644 (file)
@@ -20,7 +20,6 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
 
   use CategorizingPluginManagerTrait {
     getSortedDefinitions as traitGetSortedDefinitions;
-    getGroupedDefinitions as traitGetGroupedDefinitions;
   }
   use ContextAwarePluginManagerTrait;
 
@@ -54,23 +53,13 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
    * {@inheritdoc}
    */
   public function getSortedDefinitions(array $definitions = NULL) {
-    // Sort the plugins first by category, then by label.
+    // Sort the plugins first by category, then by admin label.
     $definitions = $this->traitGetSortedDefinitions($definitions, 'admin_label');
     // Do not display the 'broken' plugin in the UI.
     unset($definitions['broken']);
     return $definitions;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function getGroupedDefinitions(array $definitions = NULL) {
-    $definitions = $this->traitGetGroupedDefinitions($definitions, 'admin_label');
-    // Do not display the 'broken' plugin in the UI.
-    unset($definitions[$this->t('Block')]['broken']);
-    return $definitions;
-  }
-
   /**
    * {@inheritdoc}
    */
index acbbf006a05aa57e189e245c74091ff14675f116..b0c9f45b1923ab2e78fd511288614c1f4ff567f1 100644 (file)
@@ -246,6 +246,18 @@ abstract class CacheCollector implements CacheCollectorInterface, DestructableIn
         }
         $data = array_merge($cache->data, $data);
       }
+      elseif ($this->cacheCreated) {
+        // Getting here indicates that there was a cache entry at the
+        // beginning of the request, but now it's gone (some other process
+        // must have cleared it). We back out to prevent corrupting the cache
+        // with incomplete data, since we won't be able to properly merge
+        // the existing cache data from earlier with the new data.
+        // A future request will properly hydrate the cache from scratch.
+        if ($lock) {
+          $this->lock->release($lock_name);
+        }
+        return;
+      }
       // Remove keys marked for deletion.
       foreach ($this->keysToRemove as $delete_key) {
         unset($data[$delete_key]);
index aa5090a89a3f5aa3b1457b37f52f26c3c12751f4..221f0e2b49c80d94e03bc6dbad333455f7ecf124 100644 (file)
@@ -197,7 +197,7 @@ interface ConditionInterface {
    *
    * @param $conjunction
    *   - AND (default): this is the equivalent of andConditionGroup().
-   *   - OR: this is the equivalent of andConditionGroup().
+   *   - OR: this is the equivalent of orConditionGroup().
    *
    * @return \Drupal\Core\Database\Query\ConditionInterface
    *   An object holding a group of conditions.
index 3b16d1cddbc30021f65a7e433f4132a13bfe899b..ac364115ebd6a2dd1637bea9f77a8bb7e1e583fb 100644 (file)
@@ -66,7 +66,19 @@ class EntityAccessControlHandler extends EntityHandlerBase implements EntityAcce
       $operation = 'view';
     }
 
-    if (($return = $this->getCache($entity->uuid(), $operation, $langcode, $account)) !== NULL) {
+    // If an entity does not have a UUID, either from not being set or from not
+    // having them, use the 'entity type:ID' pattern as the cache $cid.
+    $cid = $entity->uuid() ?: $entity->getEntityTypeId() . ':' . $entity->id();
+
+    // If the entity is revisionable, then append the revision ID to allow
+    // individual revisions to have specific access control and be cached
+    // separately.
+    if ($entity instanceof RevisionableInterface) {
+      /** @var $entity \Drupal\Core\Entity\RevisionableInterface */
+      $cid .= ':' . $entity->getRevisionId();
+    }
+
+    if (($return = $this->getCache($cid, $operation, $langcode, $account)) !== NULL) {
       // Cache hit, no work necessary.
       return $return_as_object ? $return : $return->isAllowed();
     }
@@ -92,7 +104,7 @@ class EntityAccessControlHandler extends EntityHandlerBase implements EntityAcce
     if (!$return->isForbidden()) {
       $return = $return->orIf($this->checkAccess($entity, $operation, $account));
     }
-    $result = $this->setCache($return, $entity->uuid(), $operation, $langcode, $account);
+    $result = $this->setCache($return, $cid, $operation, $langcode, $account);
     return $return_as_object ? $result : $result->isAllowed();
   }
 
index fa2ddf8c7922e2a3ddfecf4e9a9f62ac3306ad4f..6f2ce7672ebed9183db9b3fc1921f1dd1ccc9602 100644 (file)
@@ -25,6 +25,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::clearCachedDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function clearCachedDefinitions() {
     $this->container->get('entity_type.manager')->clearCachedDefinitions();
@@ -41,6 +45,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinition()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
     return $this->container->get('entity_type.manager')->getDefinition($entity_type_id, $exception_on_invalid);
@@ -50,6 +58,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::hasHandler()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function hasHandler($entity_type, $handler_type) {
     return $this->container->get('entity_type.manager')->hasHandler($entity_type, $handler_type);
@@ -59,6 +71,9 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getStorage($entity_type) {
     return $this->container->get('entity_type.manager')->getStorage($entity_type);
@@ -68,6 +83,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getListBuilder()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getListBuilder($entity_type) {
     return $this->container->get('entity_type.manager')->getListBuilder($entity_type);
@@ -77,6 +96,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getFormObject()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFormObject($entity_type, $operation) {
     return $this->container->get('entity_type.manager')->getFormObject($entity_type, $operation);
@@ -86,6 +109,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getRouteProviders()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getRouteProviders($entity_type) {
     return $this->container->get('entity_type.manager')->getRouteProviders($entity_type);
@@ -95,6 +122,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getViewBuilder($entity_type) {
     return $this->container->get('entity_type.manager')->getViewBuilder($entity_type);
@@ -104,6 +135,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getAccessControlHandler()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getAccessControlHandler($entity_type) {
     return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type);
@@ -113,6 +148,9 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getHandler() instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getHandler($entity_type, $handler_type) {
     return $this->container->get('entity_type.manager')->getHandler($entity_type, $handler_type);
@@ -122,6 +160,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::createHandlerInstance()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
     return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition);
@@ -131,6 +173,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::getBaseFieldDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getBaseFieldDefinitions($entity_type_id) {
     return $this->container->get('entity_field.manager')->getBaseFieldDefinitions($entity_type_id);
@@ -140,6 +186,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFieldDefinitions($entity_type_id, $bundle) {
     return $this->container->get('entity_field.manager')->getFieldDefinitions($entity_type_id, $bundle);
@@ -149,6 +199,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldStorageDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFieldStorageDefinitions($entity_type_id) {
     return $this->container->get('entity_field.manager')->getFieldStorageDefinitions($entity_type_id);
@@ -158,6 +212,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::setFieldMap()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function setFieldMap(array $field_map) {
     return $this->container->get('entity_field.manager')->setFieldMap($field_map);
@@ -167,6 +225,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldMap()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFieldMap() {
     return $this->container->get('entity_field.manager')->getFieldMap();
@@ -176,6 +238,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldMapByFieldType()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFieldMapByFieldType($field_type) {
     return $this->container->get('entity_field.manager')->getFieldMapByFieldType($field_type);
@@ -185,6 +251,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionCreate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition) {
     $this->container->get('field_definition.listener')->onFieldDefinitionCreate($field_definition);
@@ -194,6 +264,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionUpdate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) {
     $this->container->get('field_definition.listener')->onFieldDefinitionUpdate($field_definition, $original);
@@ -203,6 +277,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldDefinitionListenerInterface::onFieldDefinitionDelete()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) {
     $this->container->get('field_definition.listener')->onFieldDefinitionDelete($field_definition);
@@ -212,6 +290,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityFieldManagerInterface::clearCachedFieldDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function clearCachedFieldDefinitions() {
     $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();
@@ -221,6 +303,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeBundleManagerInterface::clearCachedBundles()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function clearCachedBundles() {
     $this->container->get('entity_type.bundle.info')->clearCachedBundles();
@@ -230,6 +316,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeBundleManagerInterface::getBundleInfo()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getBundleInfo($entity_type) {
     return $this->container->get('entity_type.bundle.info')->getBundleInfo($entity_type);
@@ -239,6 +329,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeBundleManagerInterface::getAllBundleInfo()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getAllBundleInfo() {
     return $this->container->get('entity_type.bundle.info')->getAllBundleInfo();
@@ -255,6 +349,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeLabels()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getEntityTypeLabels($group = FALSE) {
     return $this->container->get('entity_type.repository')->getEntityTypeLabels($group);
@@ -264,6 +362,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityRepositoryInterface::getTranslationFromContext()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = []) {
     return $this->container->get('entity.repository')->getTranslationFromContext($entity, $langcode, $context);
@@ -273,6 +375,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllViewModes()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getAllViewModes() {
     return $this->container->get('entity_display.repository')->getAllViewModes();
@@ -282,6 +388,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModes()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getViewModes($entity_type_id) {
     return $this->container->get('entity_display.repository')->getViewModes($entity_type_id);
@@ -291,6 +401,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllFormModes()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getAllFormModes() {
     return $this->container->get('entity_display.repository')->getAllFormModes();
@@ -300,6 +414,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModes()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFormModes($entity_type_id) {
     return $this->container->get('entity_display.repository')->getFormModes($entity_type_id);
@@ -309,6 +427,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModeOptions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getViewModeOptions($entity_type_id) {
     return $this->container->get('entity_display.repository')->getViewModeOptions($entity_type_id);
@@ -318,6 +440,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModeOptions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFormModeOptions($entity_type_id) {
     return $this->container->get('entity_display.repository')->getFormModeOptions($entity_type_id);
@@ -327,6 +453,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getViewModeOptionsByBundle()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getViewModeOptionsByBundle($entity_type_id, $bundle) {
     return $this->container->get('entity_display.repository')->getViewModeOptionsByBundle($entity_type_id, $bundle);
@@ -336,6 +466,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModeOptionsByBundle()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getFormModeOptionsByBundle($entity_type_id, $bundle) {
     return $this->container->get('entity_display.repository')->getFormModeOptionsByBundle($entity_type_id, $bundle);
@@ -345,6 +479,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityDisplayRepositoryInterface::clearDisplayModeInfo()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function clearDisplayModeInfo() {
     $this->container->get('entity_display.repository')->clearDisplayModeInfo();
@@ -354,6 +492,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityRepositoryInterface::loadEntityByUuid()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function loadEntityByUuid($entity_type_id, $uuid) {
     return $this->container->get('entity.repository')->loadEntityByUuid($entity_type_id, $uuid);
@@ -363,6 +505,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityRepositoryInterface::loadEntityByConfigTarget()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function loadEntityByConfigTarget($entity_type_id, $target) {
     return $this->container->get('entity.repository')->loadEntityByConfigTarget($entity_type_id, $target);
@@ -372,6 +518,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeFromClass()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getEntityTypeFromClass($class_name) {
     return $this->container->get('entity_type.repository')->getEntityTypeFromClass($class_name);
@@ -388,6 +538,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeUpdate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
     $this->container->get('entity_type.listener')->onEntityTypeUpdate($entity_type, $original);
@@ -397,6 +551,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeDelete()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onEntityTypeDelete(EntityTypeInterface $entity_type) {
     $this->container->get('entity_type.listener')->onEntityTypeDelete($entity_type);
@@ -406,6 +564,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionCreate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) {
     $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionCreate($storage_definition);
@@ -415,6 +577,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionUpdate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
     $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionUpdate($storage_definition, $original);
@@ -424,6 +590,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Field\FieldStorageDefinitionListenerInterface::onFieldStorageDefinitionDelete()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {
     $this->container->get('field_storage_definition.listener')->onFieldStorageDefinitionDelete($storage_definition);
@@ -433,6 +603,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityBundleListenerInterface::onBundleCreate()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onBundleCreate($bundle, $entity_type_id) {
     $this->container->get('entity_bundle.listener')->onBundleCreate($bundle, $entity_type_id);
@@ -442,6 +616,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityBundleListenerInterface::onBundleDelete()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function onBundleDelete($bundle, $entity_type_id) {
     $this->container->get('entity_bundle.listener')->onBundleDelete($bundle, $entity_type_id);
@@ -451,6 +629,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getLastInstalledDefinition($entity_type_id) {
     return $this->container->get('entity.last_installed_schema.repository')->getLastInstalledDefinition($entity_type_id);
@@ -471,6 +653,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getLastInstalledFieldStorageDefinitions($entity_type_id) {
     return $this->container->get('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions($entity_type_id);
@@ -480,6 +666,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getDefinitions() {
     return $this->container->get('entity_type.manager')->getDefinitions();
@@ -489,6 +679,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::hasDefinition()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function hasDefinition($plugin_id) {
     return $this->container->get('entity_type.manager')->hasDefinition($plugin_id);
@@ -498,6 +692,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::createInstance()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function createInstance($plugin_id, array $configuration = []) {
     return $this->container->get('entity_type.manager')->createInstance($plugin_id, $configuration);
@@ -507,6 +705,10 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
    * {@inheritdoc}
    *
    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *   Use \Drupal\Core\Entity\EntityTypeManagerInterface::getInstance()
+   *   instead.
+   *
+   * @see https://www.drupal.org/node/2549139
    */
   public function getInstance(array $options) {
     return $this->container->get('entity_type.manager')->getInstance($options);
index 6b2738c779300ea16a44022e08bbbf30d815cc29..03d3f66c7ba246c9f0f941c9970769198b198639 100644 (file)
@@ -144,7 +144,7 @@ interface ModuleHandlerInterface {
    *   // Load node.admin.inc from the node module.
    *   $this->loadInclude('node', 'inc', 'node.admin');
    *   // Load content_types.inc from the node module.
-   *   $this->loadInclude('node', 'inc', ''content_types');
+   *   $this->loadInclude('node', 'inc', 'content_types');
    * @endcode
    *
    * @param string $module
index 76366bfe21c56ec332eb46fba5698b9762523680..e53e84b6c89ba1a2979a8dea65771604b04bb209 100644 (file)
@@ -180,6 +180,14 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
    */
   protected $constraints = [];
 
+  /**
+   * Array of property constraint options keyed by property ID. The values are
+   * associative array of constraint options keyed by constraint plugin ID.
+   *
+   * @var array[]
+   */
+  protected $propertyConstraints = [];
+
   /**
    * {@inheritdoc}
    */
@@ -515,7 +523,20 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
     if (!isset($this->itemDefinition)) {
       $this->itemDefinition = FieldItemDataDefinition::create($this)
         ->setSettings($this->getSettings());
+
+      // Add any custom property constraints, overwriting as required.
+      $item_constraints = $this->itemDefinition->getConstraint('ComplexData') ?: [];
+      foreach ($this->propertyConstraints as $name => $constraints) {
+        if (isset($item_constraints[$name])) {
+          $item_constraints[$name] = $constraints + $item_constraints[$name];
+        }
+        else {
+          $item_constraints[$name] = $constraints;
+        }
+        $this->itemDefinition->addConstraint('ComplexData', $item_constraints);
+      }
     }
+
     return $this->itemDefinition;
   }
 
@@ -546,9 +567,12 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
    * {@inheritdoc}
    */
   public function setPropertyConstraints($name, array $constraints) {
-    $item_constraints = $this->getItemDefinition()->getConstraints();
-    $item_constraints['ComplexData'][$name] = $constraints;
-    $this->getItemDefinition()->setConstraints($item_constraints);
+    $this->propertyConstraints[$name] = $constraints;
+
+    // Reset the field item definition so the next time it is instantiated it
+    // will receive the new constraints.
+    $this->itemDefinition = NULL;
+
     return $this;
   }
 
@@ -556,15 +580,14 @@ abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigIn
    * {@inheritdoc}
    */
   public function addPropertyConstraints($name, array $constraints) {
-    $item_constraints = $this->getItemDefinition()->getConstraint('ComplexData') ?: [];
-    if (isset($item_constraints[$name])) {
-      // Add the new property constraints, overwriting as required.
-      $item_constraints[$name] = $constraints + $item_constraints[$name];
-    }
-    else {
-      $item_constraints[$name] = $constraints;
+    foreach ($constraints as $constraint_name => $options) {
+      $this->propertyConstraints[$name][$constraint_name] = $options;
     }
-    $this->getItemDefinition()->addConstraint('ComplexData', $item_constraints);
+
+    // Reset the field item definition so the next time it is instantiated it
+    // will receive the new constraints.
+    $this->itemDefinition = NULL;
+
     return $this;
   }
 
index de0c99828622ce7c97fce41c3926b05001672813..6c9bb5901cda8e88ae8ecdb878948af8b09bc8c3 100644 (file)
@@ -5,7 +5,7 @@ namespace Drupal\Core\Form;
 /**
  * Provides an interface for a Form that has a base form ID.
  *
- * This will become the $form_state->getBaseInfo()['base_form_id'] used to
+ * This will become the $form_state->getBuildInfo()['base_form_id'] used to
  * generate the name of hook_form_BASE_FORM_ID_alter().
  */
 interface BaseFormIdInterface extends FormInterface {
index 6e78d527a7f0fae8669321b04a03459773bc1198..db7a16165b80477641c3a61c178ba5fe1d1c47d0 100644 (file)
@@ -627,7 +627,7 @@ function hook_preprocess_HOOK(&$variables) {
 function hook_theme_suggestions_HOOK(array $variables) {
   $suggestions = [];
 
-  $suggestions[] = 'node__' . $variables['elements']['#langcode'];
+  $suggestions[] = 'hookname__' . $variables['elements']['#langcode'];
 
   return $suggestions;
 }
similarity index 98%
rename from web/core/modules/aggregator/src/Tests/AddFeedTest.php
rename to web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
index 4dfeb955720aefdcbb6336b3a1e816cd4c75dd7f..e4f63ea73105c326eaeb6d819ce72c59b66b9070 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 /**
  * Add feed test.
similarity index 83%
rename from web/core/modules/aggregator/src/Tests/AggregatorAdminTest.php
rename to web/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
index 01898b6cf09dca27b44be1b849e28e7d1719d251..4b278d6247199fbda196dd9c900608ff33054bca 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 /**
  * Tests aggregator admin pages.
@@ -67,18 +67,22 @@ class AggregatorAdminTest extends AggregatorTestBase {
     // Check if the amount of feeds in the overview matches the amount created.
     $this->assertEqual(1, count($result), 'Created feed is found in the overview');
     // Check if the fields in the table match with what's expected.
-    $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a);
+    $link = $this->xpath('//table/tbody/tr//td[1]/a');
+    $this->assertEquals($feed->label(), $link[0]->getText());
     $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
-    $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]);
+    $td = $this->xpath('//table/tbody/tr//td[2]');
+    $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
 
     // Update the items of the first feed.
     $feed->refreshItems();
     $this->drupalGet('admin/config/services/aggregator');
     $result = $this->xpath('//table/tbody/tr');
     // Check if the fields in the table match with what's expected.
-    $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a);
+    $link = $this->xpath('//table/tbody/tr//td[1]/a');
+    $this->assertEquals($feed->label(), $link[0]->getText());
     $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
-    $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]);
+    $td = $this->xpath('//table/tbody/tr//td[2]');
+    $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
   }
 
 }
similarity index 93%
rename from web/core/modules/aggregator/src/Tests/AggregatorCronTest.php
rename to web/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php
index 9ebb2d25c00c36563b9913f7dffcb8240e8b6ef7..bb7c90ae32f238f02fe266ee3270e064755eb64d 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
+
+use Drupal\Tests\Traits\Core\CronRunTrait;
 
 /**
  * Update feeds on cron.
@@ -8,6 +10,9 @@ namespace Drupal\aggregator\Tests;
  * @group aggregator
  */
 class AggregatorCronTest extends AggregatorTestBase {
+
+  use CronRunTrait;
+
   /**
    * Adds feeds and updates them via cron process.
    */
similarity index 91%
rename from web/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
rename to web/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
index de7e401058b23eb403ab9afc19fe3fdb15c829fb..37e6470847f5f5c5f490c57f57cb8b0d4735d6f6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\views\Entity\View;
@@ -132,10 +132,14 @@ class AggregatorRenderingTest extends AggregatorTestBase {
 
     // Check the opml aggregator page.
     $this->drupalGet('aggregator/opml');
-    $outline = $this->xpath('//outline[1]');
-    $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.');
-    $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.');
-    $this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.');
+    $content = $this->getSession()->getPage()->getContent();
+    // We can't use Mink xpath queries here because it only supports HTML pages,
+    // but we are dealing with XML here.
+    $xml = simplexml_load_string($content);
+    $attributes = $xml->xpath('//outline[1]')[0]->attributes();
+    $this->assertEquals('rss', $attributes->type);
+    $this->assertEquals($feed->label(), $attributes->text);
+    $this->assertEquals($feed->getUrl(), $attributes->xmlUrl);
 
     // Check for the presence of a pager.
     $this->drupalGet('aggregator/sources/' . $feed->id());
similarity index 98%
rename from web/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php
rename to web/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
index 46366b4957d74a5e08dc8ded505d5d94a907a692..e057be6e613bee28705190ce4be5eae1103b2458 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 /**
  * Tests the display of a feed on the Aggregator list page.
similarity index 95%
rename from web/core/modules/aggregator/src/Tests/FeedLanguageTest.php
rename to web/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php
index 98d04fa5c1319e5a9ba25460311fd4135f65f704..7e3d672c06c1f27464e204dae155b62839e4ab4f 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
+use Drupal\Tests\Traits\Core\CronRunTrait;
 
 /**
  * Tests aggregator feeds in multiple languages.
@@ -11,6 +12,8 @@ use Drupal\language\Entity\ConfigurableLanguage;
  */
 class FeedLanguageTest extends AggregatorTestBase {
 
+  use CronRunTrait;
+
   /**
    * Modules to install.
    *
similarity index 98%
rename from web/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php
rename to web/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
index 67e96f17269cca612af6f495d8815bbb991dba1e..b850ca9ed8eb6769504ceaae00b4ea248206dcd1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 use Drupal\aggregator\Entity\Feed;
 
 /**
similarity index 97%
rename from web/core/modules/aggregator/src/Tests/UpdateFeedTest.php
rename to web/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
index d2308744c2425d535eafec1ab2aa1bad8b54f335..a81e0aefd1f906d04b0373441a5eb0f2cd3dc066 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
 
 /**
  * Update feed test.
index e97e740187e173d711ca776dc386b48eac43862b..ef0bd96ea2652e1b1e249ca906ed5689c6b2800b 100644 (file)
@@ -178,8 +178,8 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
    *   The block content entity.
    */
   protected function getEntity() {
-    $uuid = $this->getDerivativeId();
     if (!isset($this->blockContent)) {
+      $uuid = $this->getDerivativeId();
       $this->blockContent = $this->entityManager->loadEntityByUuid('block_content', $uuid);
     }
     return $this->blockContent;
index db665c9e45ce4e7edeb346a975370aa9d8790584..3ea2dba06cfb846248ebacccfef2a8c0107dc662 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\block_content\Tests\Views;
 
+@trigger_error('\Drupal\block_content\Tests\Views\BlockContentTestBase is deprecated in 8.4.0 and will be removed before Drupal 9.0.0. Use \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase.', E_USER_DEPRECATED);
+
 use Drupal\block_content\Entity\BlockContent;
 use Drupal\block_content\Entity\BlockContentType;
 use Drupal\Component\Utility\SafeMarkup;
@@ -10,6 +12,9 @@ use Drupal\views\Tests\ViewTestData;
 
 /**
  * Base class for all block_content tests.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
+ *   Use \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase.
  */
 abstract class BlockContentTestBase extends ViewTestBase {
 
similarity index 98%
rename from web/core/modules/block_content/src/Tests/BlockContentCreationTest.php
rename to web/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
index ac9e824d4940d192be75a1e7c43fdc629cbba17d..562a4bd102ff067c2fe3e2f31e1dfb924c4bc95a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests;
+namespace Drupal\Tests\block_content\Functional;
 
 use Drupal\block_content\Entity\BlockContent;
 use Drupal\Component\Utility\Unicode;
@@ -140,7 +140,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
 
     // Go to the configure page and verify the view mode has changed.
     $this->drupalGet('admin/structure/block/manage/testblock');
-    $this->assertFieldByXPath('//select[@name="settings[view_mode]"]/option[@selected="selected"]/@value', 'test_view_mode', 'View mode changed to Test View Mode');
+    $this->assertFieldByXPath('//select[@name="settings[view_mode]"]/option[@selected="selected"]', 'test_view_mode', 'View mode changed to Test View Mode');
 
     // Check that the block exists in the database.
     $blocks = entity_load_multiple_by_properties('block_content', ['info' => $edit['info[0][value]']]);
similarity index 95%
rename from web/core/modules/block_content/src/Tests/BlockContentListTest.php
rename to web/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
index e00706e9ff5028b853c7c077b1f3f03df784c56e..aba60c366c629158b87840b6596aea7b1e72efd5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests;
+namespace Drupal\Tests\block_content\Functional;
 
 /**
  * Tests the listing of custom blocks.
@@ -41,7 +41,7 @@ class BlockContentListTest extends BlockContentTestBase {
     // Test the contents of each th cell.
     $expected_items = [t('Block description'), t('Operations')];
     foreach ($elements as $key => $element) {
-      $this->assertEqual($element[0], $expected_items[$key]);
+      $this->assertEqual($element->getText(), $expected_items[$key]);
     }
 
     $label = 'Antelope';
@@ -66,7 +66,7 @@ class BlockContentListTest extends BlockContentTestBase {
     // Check the contents of each row cell. The first cell contains the label,
     // the second contains the machine name, and the third contains the
     // operations list.
-    $this->assertIdentical((string) $elements[0], $label);
+    $this->assertIdentical($elements[0]->getText(), $label);
 
     // Edit the entity using the operations link.
     $blocks = $this->container
similarity index 91%
rename from web/core/modules/block_content/src/Tests/BlockContentListViewsTest.php
rename to web/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
index 77117fb009fe6073cb0db07b8f774047a639daf9..1c623be82eba3c9cf4af6525a00f07fa3971df37 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests;
+namespace Drupal\Tests\block_content\Functional;
 
 /**
  * Tests the Views-powered listing of custom blocks.
@@ -41,13 +41,13 @@ class BlockContentListViewsTest extends BlockContentTestBase {
     $this->assertEqual(count($elements), 4, 'Correct number of table header cells found.');
 
     // Test the contents of each th cell.
-    $expected_items = ['Block description', 'Block type', 'Updated', 'Operations'];
+    $expected_items = ['Block description', 'Block type', 'Updated Sort ascending', 'Operations'];
     foreach ($elements as $key => $element) {
-      if ($element->xpath('a')) {
-        $this->assertIdentical(trim((string) $element->xpath('a')[0]), $expected_items[$key]);
+      if ($element->find('xpath', 'a')) {
+        $this->assertIdentical(trim($element->find('xpath', 'a')->getText()), $expected_items[$key]);
       }
       else {
-        $this->assertIdentical(trim((string) $element[0]), $expected_items[$key]);
+        $this->assertIdentical(trim($element->getText()), $expected_items[$key]);
       }
     }
 
@@ -73,7 +73,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
     // Check the contents of each row cell. The first cell contains the label,
     // the second contains the machine name, and the third contains the
     // operations list.
-    $this->assertIdentical((string) $elements[0]->xpath('a')[0], $label);
+    $this->assertIdentical($elements[0]->find('xpath', 'a')->getText(), $label);
 
     // Edit the entity using the operations link.
     $blocks = $this->container
similarity index 99%
rename from web/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
rename to web/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
index 198beee8fb3fbabb465282aaf9a203392fbf0b3e..2699fcfb691282acafbd8d5f803628142c8492fe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests;
+namespace Drupal\Tests\block_content\Functional;
 
 use Drupal\block_content\Entity\BlockContent;
 use Drupal\block_content\Entity\BlockContentType;
similarity index 96%
rename from web/core/modules/block_content/src/Tests/BlockContentValidationTest.php
rename to web/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php
index a0db394c6e90f90eacaa8183cdae7d2039c87118..bfa84082c1ca364eaec02bfeb1c9d6850c985588 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests;
+namespace Drupal\Tests\block_content\Functional;
 
 /**
  * Tests block content validation constraints.
similarity index 95%
rename from web/core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php
rename to web/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
index 1ff4fb55baf74daf117f430b31df552611d28c82..a016ab9141b72a375e48acd1cc9acd6f053b1463 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests\Views;
+namespace Drupal\Tests\block_content\Functional\Views;
 
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -35,8 +35,8 @@ class BlockContentFieldFilterTest extends BlockContentTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
-    parent::setUp();
+  public function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Add two new languages.
     ConfigurableLanguage::createFromLangcode('fr')->save();
similarity index 95%
rename from web/core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php
rename to web/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php
index 8ec17e238165c6dec7a6a585dcf2ace7bfd234c5..93661578bd9df34229d0a1880bfee8c1f91f3603 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests\Views;
+namespace Drupal\Tests\block_content\Functional\Views;
 
 /**
  * Tests the block_content integration into views.
@@ -59,7 +59,7 @@ class BlockContentIntegrationTest extends BlockContentTestBase {
     $result = $this->xpath('//span[@class="field-content"]');
     $ids = [];
     foreach ($result as $element) {
-      $ids[] = (int) $element;
+      $ids[] = $element->getText();
     }
     $this->assertEqual($ids, $expected_ids);
   }
similarity index 95%
rename from web/core/modules/block_content/src/Tests/Views/BlockContentRedirectTest.php
rename to web/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
index 828aa8468b12f0e355759fe44eeb4d24762c5e10..10ce140e967edd2b39054a1d41a294f23c68f04f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests\Views;
+namespace Drupal\Tests\block_content\Functional\Views;
 
 /**
  * Tests the redirect destination on block content on entity operations.
diff --git a/web/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php b/web/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php
new file mode 100644 (file)
index 0000000..ffce588
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+
+namespace Drupal\Tests\block_content\Functional\Views;
+
+use Drupal\block_content\Entity\BlockContent;
+use Drupal\block_content\Entity\BlockContentType;
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Tests\views\Functional\ViewTestBase;
+use Drupal\views\Tests\ViewTestData;
+
+/**
+ * Base class for all block_content tests.
+ */
+abstract class BlockContentTestBase extends ViewTestBase {
+
+  /**
+   * Admin user
+   *
+   * @var object
+   */
+  protected $adminUser;
+
+  /**
+   * Permissions to grant admin user.
+   *
+   * @var array
+   */
+  protected $permissions = [
+    'administer blocks',
+  ];
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['block', 'block_content', 'block_content_test_views'];
+
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
+    // Ensure the basic bundle exists. This is provided by the standard profile.
+    $this->createBlockContentType(['id' => 'basic']);
+
+    $this->adminUser = $this->drupalCreateUser($this->permissions);
+
+    if ($import_test_views) {
+      ViewTestData::createTestViews(get_class($this), ['block_content_test_views']);
+    }
+  }
+
+  /**
+   * Creates a custom block.
+   *
+   * @param array $settings
+   *   (optional) An associative array of settings for the block_content, as
+   *   used in entity_create().
+   *
+   * @return \Drupal\block_content\Entity\BlockContent
+   *   Created custom block.
+   */
+  protected function createBlockContent(array $settings = []) {
+    $status = 0;
+    $settings += [
+      'info' => $this->randomMachineName(),
+      'type' => 'basic',
+      'langcode' => 'en',
+    ];
+    if ($block_content = BlockContent::create($settings)) {
+      $status = $block_content->save();
+    }
+    $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content %info.', ['%info' => $block_content->label()]));
+    return $block_content;
+  }
+
+  /**
+   * Creates a custom block type (bundle).
+   *
+   * @param array $values
+   *   An array of settings to change from the defaults.
+   *
+   * @return \Drupal\block_content\Entity\BlockContentType
+   *   Created custom block type.
+   */
+  protected function createBlockContentType(array $values = []) {
+    // Find a non-existent random type name.
+    if (!isset($values['id'])) {
+      do {
+        $id = strtolower($this->randomMachineName(8));
+      } while (BlockContentType::load($id));
+    }
+    else {
+      $id = $values['id'];
+    }
+    $values += [
+      'id' => $id,
+      'label' => $id,
+      'revision' => FALSE
+    ];
+    $bundle = BlockContentType::create($values);
+    $status = $bundle->save();
+    block_content_add_body_field($bundle->id());
+
+    $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content type %bundle.', ['%bundle' => $bundle->id()]));
+    return $bundle;
+  }
+
+}
similarity index 93%
rename from web/core/modules/block_content/src/Tests/Views/FieldTypeTest.php
rename to web/core/modules/block_content/tests/src/Functional/Views/FieldTypeTest.php
index e9aa336985370ae893f5e2cfc8aa18d05269f646..8ff2fc05ca0ed94df869e0a61ec599e0842c239c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\block_content\Tests\Views;
+namespace Drupal\Tests\block_content\Functional\Views;
 
 use Drupal\views\Views;
 
similarity index 92%
rename from web/core/modules/block_content/src/Tests/Views/RevisionRelationshipsTest.php
rename to web/core/modules/block_content/tests/src/Functional/Views/RevisionRelationshipsTest.php
index 7bad093dd3a6b727c8a0c7128c1bf918f32c21c6..0ccebd2a9f665bd5daa3573c95d186a3cadf9c86 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\block_content\Tests\Views;
+namespace Drupal\Tests\block_content\Functional\Views;
 
 use Drupal\block_content\Entity\BlockContentType;
 use Drupal\block_content\Entity\BlockContent;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Views;
 use Drupal\views\Tests\ViewTestData;
 
@@ -29,8 +29,8 @@ class RevisionRelationshipsTest extends ViewTestBase {
    */
   public static $testViews = ['test_block_content_revision_id', 'test_block_content_revision_revision_id'];
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
     BlockContentType::create([
       'id' => 'basic',
       'label' => 'basic',
similarity index 95%
rename from web/core/modules/book/src/Tests/Views/BookRelationshipTest.php
rename to web/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
index c1f872803aeb219c0656b38f448abbfba1333a94..9ee79c78dc6110ec7a7573319f11719c047c5bc1 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\book\Tests\Views;
+namespace Drupal\Tests\book\Functional\Views;
 
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 
 /**
@@ -45,8 +45,8 @@ class BookRelationshipTest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Create users.
     $this->bookAuthor = $this->drupalCreateUser(
index a5f196646974da48c9e71ba4b35f1cc12d338630..8ce0c73edb9efd967d04e34160155edd6330c718 100644 (file)
@@ -81,14 +81,6 @@ class Comment extends ContentEntityBase implements CommentInterface {
   public function preSave(EntityStorageInterface $storage) {
     parent::preSave($storage);
 
-    if (is_null($this->get('status')->value)) {
-      if (\Drupal::currentUser()->hasPermission('skip comment approval')) {
-        $this->setPublished();
-      }
-      else {
-        $this->setUnpublished();
-      }
-    }
     if ($this->isNew()) {
       // Add the comment to database. This next section builds the thread field.
       // @see \Drupal\comment\CommentViewBuilder::buildComponents()
@@ -237,6 +229,9 @@ class Comment extends ContentEntityBase implements CommentInterface {
 
     $fields['langcode']->setDescription(t('The comment language code.'));
 
+    // Set the default value callback for the status field.
+    $fields['status']->setDefaultValueCallback('Drupal\comment\Entity\Comment::getDefaultStatus');
+
     $fields['pid'] = BaseFieldDefinition::create('entity_reference')
       ->setLabel(t('Parent ID'))
       ->setDescription(t('The parent comment ID if this is a reply to a comment.'))
@@ -558,4 +553,16 @@ class Comment extends ContentEntityBase implements CommentInterface {
     return $this->bundle();
   }
 
+  /**
+   * Default value callback for 'status' base field definition.
+   *
+   * @see ::baseFieldDefinitions()
+   *
+   * @return bool
+   *  TRUE if the comment should be published, FALSE otherwise.
+   */
+  public static function getDefaultStatus() {
+    return \Drupal::currentUser()->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED;
+  }
+
 }
index e724dc6b89c5c14c4a9b8e415ae65cb64daa6cd5..9dbe6d36eba7d7786980dccbc7233cc097f0a3f5 100644 (file)
@@ -81,10 +81,6 @@ class CommentLockTest extends UnitTestCase {
     $comment->expects($this->any())
       ->method('getEntityType')
       ->will($this->returnValue($entity_type));
-    $comment->expects($this->at(1))
-      ->method('get')
-      ->with('status')
-      ->will($this->returnValue((object) ['value' => NULL]));
     $storage = $this->getMock('Drupal\comment\CommentStorageInterface');
 
     // preSave() should acquire the lock. (This is what's really being tested.)
similarity index 92%
rename from web/core/modules/config_translation/src/Tests/ConfigTranslationFormTest.php
rename to web/core/modules/config_translation/tests/src/Functional/ConfigTranslationFormTest.php
index 387d6864604d33f88c08e17129ae7c549a8a1f32..4698b05a8ec313aa8dc02f8e9ab5d8a2103a9976 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
-namespace Drupal\config_translation\Tests;
+namespace Drupal\Tests\config_translation\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests for altering configuration translation forms.
  *
  * @group config_translation
  */
-class ConfigTranslationFormTest extends WebTestBase {
+class ConfigTranslationFormTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
similarity index 90%
rename from web/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
rename to web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
index d593a69d385d7a262389a6b4f4d0cea2d45409bd..55b02dca75ebaaee09f9220bb734bfce0da7f741 100644 (file)
@@ -1,17 +1,17 @@
 <?php
 
-namespace Drupal\config_translation\Tests;
+namespace Drupal\Tests\config_translation\Functional;
 
 use Drupal\Component\Utility\Html;
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Translate settings and entities to various languages.
  *
  * @group config_translation
  */
-class ConfigTranslationOverviewTest extends WebTestBase {
+class ConfigTranslationOverviewTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -77,10 +77,8 @@ class ConfigTranslationOverviewTest extends WebTestBase {
     // Make sure there is only a single operation for each dropbutton, either
     // 'List' or 'Translate'.
     foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
-      $this->assertIdentical(1, $dropbutton->count());
-      foreach ($dropbutton->li as $link) {
-        $this->assertTrue(((string) $link->a === 'Translate') || ((string) $link->a === 'List'));
-      }
+      $this->assertIdentical(1, count($dropbutton->find('xpath', 'li')));
+      $this->assertTrue(($dropbutton->getText() === 'Translate') || ($dropbutton->getText() === 'List'));
     }
 
     $labels = [
@@ -104,10 +102,8 @@ class ConfigTranslationOverviewTest extends WebTestBase {
       // Make sure there is only a single 'Translate' operation for each
       // dropbutton.
       foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
-        $this->assertIdentical(1, $dropbutton->count());
-        foreach ($dropbutton->li as $link) {
-          $this->assertIdentical('Translate', (string) $link->a);
-        }
+        $this->assertIdentical(1, count($dropbutton->find('xpath', 'li')));
+        $this->assertIdentical('Translate', $dropbutton->getText());
       }
 
       $entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId());
similarity index 86%
rename from web/core/modules/config_translation/src/Tests/ConfigTranslationUiThemeTest.php
rename to web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php
index 53713a92384703e13495405f3c7a2c493a9cbc25..dcfb7916fe850d1724e37e531d47b477097b679c 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
-namespace Drupal\config_translation\Tests;
+namespace Drupal\Tests\config_translation\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Verifies theme configuration translation settings.
  *
  * @group config_translation
  */
-class ConfigTranslationUiThemeTest extends WebTestBase {
+class ConfigTranslationUiThemeTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -65,7 +65,7 @@ class ConfigTranslationUiThemeTest extends WebTestBase {
       ':label' => 'Install and set as default',
       ':theme' => $theme,
     ]);
-    $this->drupalGet($GLOBALS['base_root'] . $elements[0]['href'], ['external' => TRUE]);
+    $this->drupalGet($GLOBALS['base_root'] . $elements[0]->getAttribute('href'), ['external' => TRUE]);
 
     $translation_base_url = 'admin/config/development/performance/translate';
     $this->drupalGet($translation_base_url);
similarity index 86%
rename from web/core/modules/config_translation/src/Tests/ConfigTranslationViewListUiTest.php
rename to web/core/modules/config_translation/tests/src/Functional/ConfigTranslationViewListUiTest.php
index b259a1858cfdd3b6ff560a03b50d7361515ff28b..edb41f9ad44190537af4920317c92fdd14a7eba3 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\config_translation\Tests;
+namespace Drupal\Tests\config_translation\Functional;
 
-use Drupal\views_ui\Tests\UITestBase;
+use Drupal\Tests\views_ui\Functional\UITestBase;
 
 /**
  * Visit view list and test if translate is available.
@@ -25,8 +25,8 @@ class ConfigTranslationViewListUiTest extends UITestBase {
    */
   public static $modules = ['config_translation', 'views_ui'];
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $permissions = [
       'administer views',
similarity index 88%
rename from web/core/modules/contact/src/Tests/Views/ContactFieldsTest.php
rename to web/core/modules/contact/tests/src/Functional/Views/ContactFieldsTest.php
index fafe451be5c18080a8b9a222d58961737dbca22c..c66b5ad5d4cbc20d3d6f99d8575d79261e4d7697 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\contact\Tests\Views;
+namespace Drupal\Tests\contact\Functional\Views;
 
 use Drupal\field\Entity\FieldConfig;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\contact\Entity\ContactForm;
 
@@ -28,8 +28,8 @@ class ContactFieldsTest extends ViewTestBase {
    */
   protected $fieldStorage;
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $this->fieldStorage = FieldStorageConfig::create([
       'field_name' => strtolower($this->randomMachineName()),
similarity index 94%
rename from web/core/modules/contact/src/Tests/Views/ContactLinkTest.php
rename to web/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php
index f6b6013b43aef02f34bc24284032fb27fa26088c..c3b68f067a6baa9c02d091c93a5580a0a32abf58 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\contact\Tests\Views;
+namespace Drupal\Tests\contact\Functional\Views;
 
 use Drupal\Core\Cache\Cache;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\user\Entity\User;
 
@@ -39,8 +39,8 @@ class ContactLinkTest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(get_class($this), ['contact_test_views']);
 
index 51605d5383d68aa9113afffcceabfe7ef49fe5f7..2e8d27ffa83a0ef292aa296278f392f5211af250 100644 (file)
@@ -295,7 +295,7 @@ class ContentModeration extends WorkflowTypeBase implements ContainerFactoryPlug
    */
   public function getInitialState(WorkflowInterface $workflow, $entity = NULL) {
     if ($entity instanceof EntityPublishedInterface) {
-      return $workflow->getState($entity->isPublished() ? 'published' : 'draft');
+      return $workflow->getState($entity->isPublished() && !$entity->isNew() ? 'published' : 'draft');
     }
     return parent::getInitialState($workflow);
   }
index 0150d3c6e5f524c329937700aed7832c0864ca22..3db6a662ce266724314b47d38c6b04ab76ac8544 100644 (file)
@@ -77,6 +77,12 @@ class InitialStateTest extends KernelTestBase {
     $this->assertEquals('draft', $loaded_unpublished_node->moderation_state->value);
     $this->assertEquals('published', $loaded_published_node->moderation_state->value);
     $this->assertEquals('draft', $loaded_entity_test->moderation_state->value);
+
+    $presave_node = Node::create([
+      'type' => 'example',
+      'title' => 'Presave node',
+    ]);
+    $this->assertEquals('draft', $presave_node->moderation_state->value);
   }
 
 }
index 7e9a75c3f412e0d78dcf3afa062472edcf9dae68..5a2f6a0b325559275b9fb3740f098bcf28c63907 100644 (file)
@@ -64,7 +64,8 @@ class ModerationStateFieldItemListTest extends KernelTestBase {
    * Test the field item list when accessing an index.
    */
   public function testArrayIndex() {
-    $this->assertEquals('published', $this->testNode->moderation_state[0]->value);
+    $this->assertFalse($this->testNode->isPublished());
+    $this->assertEquals('draft', $this->testNode->moderation_state[0]->value);
   }
 
   /**
@@ -75,7 +76,7 @@ class ModerationStateFieldItemListTest extends KernelTestBase {
     foreach ($this->testNode->moderation_state as $item) {
       $states[] = $item->value;
     }
-    $this->assertEquals(['published'], $states);
+    $this->assertEquals(['draft'], $states);
   }
 
 }
similarity index 93%
rename from web/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php
rename to web/core/modules/content_translation/tests/src/Functional/ContentTestTranslationUITest.php
index 1688f75fd6b0bfa7499305f746e63d87f0959379..0b1de0b204f4ff108b12d0b80e11130c58f21a31 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\content_translation\Tests;
+namespace Drupal\Tests\content_translation\Functional;
 
 /**
  * Tests the test content translation UI with the test entity.
similarity index 88%
rename from web/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php
rename to web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
index 11c816c1d724cb4ca87a786bb4180beeb0d16c38..a3cc4e99466c59333193e355f87f32ff8ad37fd8 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\content_translation\Tests;
+namespace Drupal\Tests\content_translation\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Test enabling content translation module.
  *
  * @group content_translation
  */
-class ContentTranslationEnableTest extends WebTestBase {
+class ContentTranslationEnableTest extends BrowserTestBase {
 
   /**
    * {@inheritdoc}
@@ -36,7 +36,7 @@ class ContentTranslationEnableTest extends WebTestBase {
     // No pending updates should be available.
     $this->drupalGet('admin/reports/status');
     $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
-    $this->assertEqual(t('Up to date'), trim((string) $requirement_value[0]));
+    $this->assertEqual(t('Up to date'), trim($requirement_value[0]->getText()));
 
     $this->drupalGet('admin/config/regional/content-language');
     // The node entity type should not be an option because it has no bundles.
@@ -54,7 +54,7 @@ class ContentTranslationEnableTest extends WebTestBase {
     // No pending updates should be available.
     $this->drupalGet('admin/reports/status');
     $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
-    $this->assertEqual(t('Up to date'), trim((string) $requirement_value[0]));
+    $this->assertEqual(t('Up to date'), trim($requirement_value[0]->getText()));
 
     // Create a node type and check the content translation settings are now
     // available for nodes.
similarity index 98%
rename from web/core/modules/content_translation/src/Tests/ContentTranslationLanguageChangeTest.php
rename to web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php
index bb9b2235ebd87f8a089d126d1fbc0a197177f55a..3236a592c3dc091f5516409a799201a662e5daf3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\content_translation\Tests;
+namespace Drupal\Tests\content_translation\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\node\Tests\NodeTestBase;
similarity index 98%
rename from web/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
rename to web/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
index 7a1c598047b7d2d55d77daa47717bb1e7bc1415c..f15a8f9bc8d11a5fdf517567863e3e73cd1eec86 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\content_translation\Tests;
+namespace Drupal\Tests\content_translation\Functional;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
 use Drupal\comment\Tests\CommentTestTrait;
@@ -8,14 +8,14 @@ use Drupal\Core\Field\Entity\BaseFieldOverride;
 use Drupal\Core\Language\Language;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\language\Entity\ContentLanguageSettings;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests the content translation settings UI.
  *
  * @group content_translation
  */
-class ContentTranslationSettingsTest extends WebTestBase {
+class ContentTranslationSettingsTest extends BrowserTestBase {
 
   use CommentTestTrait;
 
@@ -193,7 +193,7 @@ class ContentTranslationSettingsTest extends WebTestBase {
     $elements = $this->xpath('//select[@id="edit-settings-node-article-settings-language-langcode"]/option');
     // Compare values inside the option elements with expected values.
     for ($i = 0; $i < count($elements); $i++) {
-      $this->assertEqual($elements[$i]->attributes()->{'value'}, $expected_elements[$i]);
+      $this->assertEqual($elements[$i]->getValue(), $expected_elements[$i]);
     }
   }
 
similarity index 98%
rename from web/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
rename to web/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php
index 30ff32de5224908e1bb4f4f73f656f17366c4f7c..5f7c9fd9b8ecebf885a4a5e8b4f82379103c83db 100644 (file)
@@ -1,11 +1,12 @@
 <?php
 
-namespace Drupal\content_translation\Tests;
+namespace Drupal\Tests\content_translation\Functional;
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\file\Entity\File;
+use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * Tests the field synchronization behavior for the image field.
@@ -14,6 +15,10 @@ use Drupal\file\Entity\File;
  */
 class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
 
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+
   /**
    * The cardinality of the image field.
    *
similarity index 86%
rename from web/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php
rename to web/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php
index 07b5d00b0845d27634215f5c4094f6c6eb832b7c..4b4d53a484d8780c225fc5c0ca64a7b5f0049d46 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\content_translation\Tests\Views;
+namespace Drupal\Tests\content_translation\Functional\Views;
 
-use Drupal\views_ui\Tests\UITestBase;
+use Drupal\Tests\views_ui\Functional\UITestBase;
 
 /**
  * Tests the views UI when content_translation is enabled.
similarity index 92%
rename from web/core/modules/content_translation/src/Tests/Views/TranslationLinkTest.php
rename to web/core/modules/content_translation/tests/src/Functional/Views/TranslationLinkTest.php
index 23c74a40f541aa2d80de1e03a98c9c24d3ad7176..d2e9e0d0cbeda0f4a8df093a6aedd1d08d1014c6 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\content_translation\Tests\Views;
+namespace Drupal\Tests\content_translation\Functional\Views;
 
-use Drupal\content_translation\Tests\ContentTranslationTestBase;
+use Drupal\Tests\content_translation\Functional\ContentTranslationTestBase;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\Core\Language\Language;
 use Drupal\user\Entity\User;
index f81983637fb01102d0b95823385676e480a51532..cc1f9fa9054a31a79ec2e73e7fc8c0e3ddf25ebd 100644 (file)
@@ -151,15 +151,18 @@ 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, 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])) {
+  if (($field_name = \Drupal::state()->get('field_test_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) {
+    // Set a property constraint using
+    // \Drupal\Core\Field\FieldConfigInterface::setPropertyConstraints().
     $fields[$field_name]->setPropertyConstraints('value', [
-      'Range' => [
-        'min' => 0,
-        'max' => 32,
+      'TestField' => [
+        'value' => -2,
+        'message' => t('%name does not accept the value @value.', ['%name' => $field_name, '@value' => -2]),
       ],
     ]);
-  }
-  if (($field_name = \Drupal::state()->get('field_test_add_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) {
+
+    // Add a property constraint using
+    // \Drupal\Core\Field\FieldConfigInterface::addPropertyConstraints().
     $fields[$field_name]->addPropertyConstraints('value', [
       'Range' => [
         'min' => 0,
index 87441dc4079b3e15e058c1592be671d44fc691f6..08fe18c5c2a66b8bb06ae83fd768db04315c8ffa 100644 (file)
@@ -12,6 +12,8 @@ use Drupal\field\Entity\FieldConfig;
 /**
  * Create field entities by attaching fields to entities.
  *
+ * @coversDefaultClass \Drupal\Core\Field\FieldConfigBase
+ *
  * @group field
  */
 class FieldCrudTest extends FieldKernelTestBase {
@@ -64,10 +66,6 @@ class FieldCrudTest extends FieldKernelTestBase {
    * Test the creation of a field.
    */
   public function testCreateField() {
-    // Set a state flag so that field_test.module knows to add an in-memory
-    // constraint for this field.
-    \Drupal::state()->set('field_test_add_constraint', $this->fieldStorage->getName());
-    /** @var \Drupal\Core\Field\FieldConfigInterface $field */
     $field = FieldConfig::create($this->fieldDefinition);
     $field->save();
 
@@ -100,17 +98,6 @@ class FieldCrudTest extends FieldKernelTestBase {
     // Check that the denormalized 'field_type' was properly written.
     $this->assertEqual($config['field_type'], $this->fieldStorageDefinition['type']);
 
-    // Test constraints are applied. A Range constraint is added dynamically to
-    // limit the field to values between 0 and 32.
-    // @see field_test_entity_bundle_field_info_alter()
-    $this->doFieldValidationTests();
-
-    // Test FieldConfigBase::setPropertyConstraints().
-    \Drupal::state()->set('field_test_set_constraint', $this->fieldStorage->getName());
-    \Drupal::state()->set('field_test_add_constraint', FALSE);
-    \Drupal::entityManager()->clearCachedFieldDefinitions();
-    $this->doFieldValidationTests();
-
     // Guarantee that the field/bundle combination is unique.
     try {
       FieldConfig::create($this->fieldDefinition)->save();
@@ -133,6 +120,81 @@ class FieldCrudTest extends FieldKernelTestBase {
     // TODO: test other failures.
   }
 
+  /**
+   * Tests setting and adding property constraints to a configurable field.
+   *
+   * @covers ::setPropertyConstraints
+   * @covers ::addPropertyConstraints
+   */
+  public function testFieldPropertyConstraints() {
+    $field = FieldConfig::create($this->fieldDefinition);
+    $field->save();
+    $field_name = $this->fieldStorage->getName();
+
+    // Test that constraints are applied to configurable fields. A TestField and
+    // a Range constraint are added dynamically to limit the field to values
+    // between 0 and 32.
+    // @see field_test_entity_bundle_field_info_alter()
+    \Drupal::state()->set('field_test_constraint', $field_name);
+
+    // Clear the field definitions cache so the new constraints added by
+    // field_test_entity_bundle_field_info_alter() are taken into consideration.
+    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
+
+    // Test the newly added property constraints in the same request as when the
+    // caches were cleared. This will test the field definitions that are stored
+    // in the static cache of
+    // \Drupal\Core\Entity\EntityFieldManager::getFieldDefinitions().
+    $this->doFieldPropertyConstraintsTests();
+
+    // In order to test a real-world scenario where the property constraints are
+    // only stored in the persistent cache of
+    // \Drupal\Core\Entity\EntityFieldManager::getFieldDefinitions(), we need to
+    // simulate a new request by removing the 'entity_field.manager' service,
+    // thus forcing it to be re-initialized without static caches.
+    \Drupal::getContainer()->set('entity_field.manager', NULL);
+
+    // This will test the field definitions that are stored in the persistent
+    // cache by \Drupal\Core\Entity\EntityFieldManager::getFieldDefinitions().
+    $this->doFieldPropertyConstraintsTests();
+  }
+
+  /**
+   * Tests configurable field validation.
+   *
+   * @see field_test_entity_bundle_field_info_alter()
+   */
+  protected function doFieldPropertyConstraintsTests() {
+    $field_name = $this->fieldStorage->getName();
+
+    // Check that a valid value (not -2 and between 0 and 32) doesn't trigger
+    // any violation.
+    $entity = EntityTest::create();
+    $entity->set($field_name, 1);
+    $violations = $entity->validate();
+    $this->assertCount(0, $violations, 'No violations found when in-range value passed.');
+
+    // Check that a value that is specifically restricted triggers both
+    // violations.
+    $entity->set($field_name, -2);
+    $violations = $entity->validate();
+    $this->assertCount(2, $violations, 'Two violations found when using a null and outside the range value.');
+
+    $this->assertEquals($field_name . '.0.value', $violations[0]->getPropertyPath());
+    $this->assertEquals(t('%name does not accept the value @value.', ['%name' => $field_name, '@value' => -2]), $violations[0]->getMessage());
+
+    $this->assertEquals($field_name . '.0.value', $violations[1]->getPropertyPath());
+    $this->assertEquals(t('This value should be %limit or more.', ['%limit' => 0]), $violations[1]->getMessage());
+
+    // Check that a value that is not specifically restricted but outside the
+    // range triggers the expected violation.
+    $entity->set($field_name, 33);
+    $violations = $entity->validate();
+    $this->assertCount(1, $violations, 'Violations found when using value outside the range.');
+    $this->assertEquals($field_name . '.0.value', $violations[0]->getPropertyPath());
+    $this->assertEquals(t('This value should be %limit or less.', ['%limit' => 32]), $violations[0]->getMessage());
+  }
+
   /**
    * Test creating a field with custom storage set.
    */
@@ -280,24 +342,4 @@ class FieldCrudTest extends FieldKernelTestBase {
     $this->assertFalse(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
   }
 
-  /**
-   * Tests configurable field validation.
-   *
-   * @see field_test_entity_bundle_field_info_alter()
-   */
-  protected function doFieldValidationTests() {
-    $entity = EntityTest::create();
-    $entity->set($this->fieldStorage->getName(), 1);
-    $violations = $entity->validate();
-    $this->assertEqual(count($violations), 0, 'No violations found when in-range value passed.');
-
-    $entity->set($this->fieldStorage->getName(), 33);
-    $violations = $entity->validate();
-    $this->assertEqual(count($violations), 1, 'Violations found when using value outside the range.');
-    $this->assertEqual($violations[0]->getPropertyPath(), $this->fieldStorage->getName() . '.0.value');
-    $this->assertEqual($violations[0]->getMessage(), t('This value should be %limit or less.', [
-      '%limit' => 32,
-    ]));
-  }
-
 }
index 7b35aff9c82bfee8b294120280427bafe174acf4..3fee046623ee546dada0a12749b677fc4ea05527 100644 (file)
@@ -6,6 +6,7 @@ migration_tags:
   - Drupal 7
 source:
   plugin: d7_file
+  scheme: public
   constants:
     # The tool configuring this migration must set source_base_path. It
     # represents the fully qualified path relative to which URIs in the files
diff --git a/web/core/modules/file/migration_templates/d7_file_private.yml b/web/core/modules/file/migration_templates/d7_file_private.yml
new file mode 100644 (file)
index 0000000..9c6b8e2
--- /dev/null
@@ -0,0 +1,39 @@
+id: d7_file_private
+label: Files
+migration_tags:
+  - Drupal 7
+source:
+  plugin: d7_file
+  scheme: private
+  constants:
+    # source_base_path must be set by the tool configuring this migration.
+    # It represents the fully qualified path relative to which uris in the files
+    # table are specified, and must end with a /. See source_full_path
+    # configuration in this migration's process pipeline as an example.
+    source_base_path: ''
+process:
+  # If you are using this file to build a custom migration consider removing
+  # the fid field to allow incremental migrations.
+  fid: fid
+  filename: filename
+  source_full_path:
+    -
+      plugin: concat
+      delimiter: /
+      source:
+        - constants/source_base_path
+        - filepath
+  uri:
+    plugin: file_copy
+    source:
+      - '@source_full_path'
+      - uri
+  filemime: filemime
+  status: status
+  # Drupal 7 didn't keep track of the file's creation or update time -- all it
+  # had was the vague "timestamp" column. So we'll use it for both.
+  created: timestamp
+  changed: timestamp
+  uid: uid
+destination:
+  plugin: entity:file
diff --git a/web/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php b/web/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php
new file mode 100644 (file)
index 0000000..7b6f763
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+
+namespace Drupal\Tests\file\Kernel\Migrate\d7;
+
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\file\Entity\File;
+use Drupal\file\FileInterface;
+use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
+
+/**
+ * Tests private files migration.
+ *
+ * @group file
+ */
+class MigratePrivateFileTest extends MigrateDrupal7TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['file'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->setSetting('file_private_path', $this->container->get('site.path') . '/private');
+    $this->installEntitySchema('file');
+    $fs = $this->container->get('file_system');
+
+    // Ensure that the private files directory exists.
+    $fs->mkdir('private://sites/default/private/', NULL, TRUE);
+    // Put test file in the source directory.
+    file_put_contents('private://sites/default/private/Babylon5.txt', str_repeat('*', 3));
+
+    /** @var \Drupal\migrate\Plugin\Migration $migration */
+    $migration = $this->getMigration('d7_file_private');
+    // Set the source plugin's source_file_private_path configuration value,
+    // which would normally be set by the user running the migration.
+    $source = $migration->getSourceConfiguration();
+    $source['constants']['source_base_path'] = $fs->realpath('private://');
+    $migration->set('source', $source);
+    $this->executeMigration($migration);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
+    $container->register('stream_wrapper.private', 'Drupal\Core\StreamWrapper\PrivateStream')
+      ->addTag('stream_wrapper', ['scheme' => 'private']);
+  }
+
+  /**
+   * Tests a single file entity.
+   *
+   * @param int $id
+   *   The file ID.
+   * @param string $name
+   *   The expected file name.
+   * @param string $uri
+   *   The expected URI.
+   * @param string $mime
+   *   The expected MIME type.
+   * @param int $size
+   *   The expected file size.
+   * @param int $created
+   *   The expected creation time.
+   * @param int $changed
+   *   The expected modification time.
+   * @param int $uid
+   *   The expected owner ID.
+   */
+  protected function assertEntity($id, $name, $uri, $mime, $size, $created, $changed, $uid) {
+    /** @var \Drupal\file\FileInterface $file */
+    $file = File::load($id);
+    $this->assertInstanceOf(FileInterface::class, $file);
+    $this->assertSame($name, $file->getFilename());
+    $this->assertSame($uri, $file->getFileUri());
+    $this->assertFileExists($uri);
+    $this->assertSame($mime, $file->getMimeType());
+    $this->assertSame($size, $file->getSize());
+    // isPermanent(), isTemporary(), etc. are determined by the status column.
+    $this->assertTrue($file->isPermanent());
+    $this->assertSame($created, $file->getCreatedTime());
+    $this->assertSame($changed, $file->getChangedTime());
+    $this->assertSame($uid, $file->getOwnerId());
+  }
+
+  /**
+   * Tests that all expected files are migrated.
+   */
+  public function testFileMigration() {
+    $this->assertEntity(3, 'Babylon5.txt', 'private://Babylon5.txt', 'text/plain', '3', '1486104045', '1486104045', '1');
+  }
+
+}
index 8c7a160167c23d22b70db79a2c5b15a67364c98a..ae8fb9da642db22137335d90046875c69343987d 100644 (file)
@@ -40,12 +40,16 @@ class FilterFormatPermission extends ProcessPluginBase implements ContainerFacto
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+    $migration_plugin_configuration = $configuration + [
+      'migration' => 'd6_filter_format',
+    ];
+
     return new static(
       $configuration,
       $plugin_id,
       $plugin_definition,
       $migration,
-      $container->get('plugin.manager.migrate.process')->createInstance('migration', ['migration' => 'd6_filter_format'], $migration)
+      $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
     );
   }
 
diff --git a/web/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php b/web/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php
new file mode 100644 (file)
index 0000000..80b0c7d
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\Tests\filter\Kernel\Migrate\d6;
+
+use Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission;
+use Drupal\migrate\Plugin\Migration;
+use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
+
+/**
+ * Tests conversion of format serial to string id in permission name.
+ *
+ * @coversDefaultClass \Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission
+ *
+ * @group filter
+ */
+class FilterFormatPermissionTest extends MigrateDrupalTestBase {
+
+  /**
+   * Tests configurability of filter_format migration name.
+   *
+   * @covers ::__construct
+   */
+  public function testConfigurableFilterFormat() {
+    $migration = Migration::create($this->container, [], 'custom_migration', []);
+    $filterFormatPermissionMigration = FilterFormatPermission::create($this->container, ['migration' => 'custom_filter_format'], 'custom_filter_format', [], $migration);
+    $migrationPlugin = $this->readAttribute($filterFormatPermissionMigration, 'migrationPlugin');
+    $config = $this->readAttribute($migrationPlugin, 'configuration');
+
+    $this->assertEquals($config['migration'], 'custom_filter_format');
+  }
+
+}
similarity index 92%
rename from web/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php
rename to web/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php
index f5677e41b6a9314c17cab7ed095826889403ffd2..19c000012d7cf6410e8154276c06ec0c503abb7d 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\forum\Tests\Views;
+namespace Drupal\Tests\forum\Functional\Views;
 
 use Drupal\node\NodeInterface;
 use Drupal\views\Views;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 
 /**
@@ -28,8 +28,8 @@ class ForumIntegrationTest extends ViewTestBase {
    */
   public static $testViews = ['test_forum_index'];
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(get_class($this), ['forum_test_views']);
   }
index 3146e12c58b2a643d314563adc9ee6284d82f553..a33b6c32bbd3fad06d602e88cf233457a3bd18ca 100644 (file)
@@ -72,6 +72,7 @@ class RelationLinkManager extends LinkManagerBase implements RelationLinkManager
     $this->moduleHandler->alter('hal_relation_uri', $uri, $context);
     // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This
     // hook is invoked to maintain backwards compatibility
+    // @see https://www.drupal.org/node/2830467
     $this->moduleHandler->alter('rest_relation_uri', $uri, $context);
     return $uri;
   }
index c3a948ff86eb85d89c0e37626ece38b98cb7df11..51b2de5032c5ed7f94e8cb025aad9bb1a1606dc8 100644 (file)
@@ -73,6 +73,7 @@ class TypeLinkManager extends LinkManagerBase implements TypeLinkManagerInterfac
     $this->moduleHandler->alter('hal_type_uri', $uri, $context);
     // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This
     // hook is invoked to maintain backwards compatibility
+    // @see https://www.drupal.org/node/2830467
     $this->moduleHandler->alter('rest_type_uri', $uri, $context);
     return $uri;
   }
index 8788eaf41eac1039848b74be06ff4bcb0a2cbceb..82363458715853750379b2c7ded95863ef80e843 100644 (file)
@@ -27,6 +27,8 @@ function hal_test_hal_relation_uri_alter(&$uri, $context = []) {
  * Implements hook_rest_type_uri_alter().
  *
  * @deprecated Kept only for BC test coverage, see \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetTypeUri().
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 function hal_test_rest_type_uri_alter(&$uri, $context = []) {
   if (!empty($context['rest_test'])) {
@@ -38,6 +40,8 @@ function hal_test_rest_type_uri_alter(&$uri, $context = []) {
  * Implements hook_rest_relation_uri_alter().
  *
  * @deprecated Kept only for BC test coverage, see \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetRelationUri().
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 function hal_test_rest_relation_uri_alter(&$uri, $context = []) {
   if (!empty($context['rest_test'])) {
index 0dabde37ce1f9dc8baa29f5c08913ed590fb8830..34cfd4be572ec0f5d7d135b9b0ad59b0b1dd5c7b 100644 (file)
@@ -6,7 +6,7 @@ use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
 use Drupal\Tests\rest\Functional\EntityResource\ImageStyle\ImageStyleResourceTestBase;
 
 /**
- * @group rest
+ * @group hal
  */
 class ImageStyleHalJsonAnonTest extends ImageStyleResourceTestBase {
 
index 2e4d3eb509755e3d350bee08b6a99bfbe2271c60..61cc149e3b34c9b81a71cb405d5f930596fa4c97 100644 (file)
@@ -6,7 +6,7 @@ use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
 use Drupal\Tests\rest\Functional\EntityResource\ImageStyle\ImageStyleResourceTestBase;
 
 /**
- * @group rest
+ * @group hal
  */
 class ImageStyleHalJsonBasicAuthTest extends ImageStyleResourceTestBase {
 
index b0f57b96381af193b9c9f19944ab58666cfb4e95..aa496535cd89c3555c0b84390258b4000c8ea942 100644 (file)
@@ -6,7 +6,7 @@ use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
 use Drupal\Tests\rest\Functional\EntityResource\ImageStyle\ImageStyleResourceTestBase;
 
 /**
- * @group rest
+ * @group hal
  */
 class ImageStyleHalJsonCookieTest extends ImageStyleResourceTestBase {
 
index e9cb157abe155953d5821e400a85396aefda2021..3207442ab272543e12d2ba0c444411cfdbd359d9 100644 (file)
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\image\Functional;
 
 use Drupal\image\Entity\ImageStyle;
-use Drupal\system\Tests\Image\ToolkitTestBase;
+use Drupal\FunctionalTests\Image\ToolkitTestBase;
 
 /**
  * Tests that the image effects pass parameters to the toolkit correctly.
diff --git a/web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d6/LanguageContentSettingsTest.php b/web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d6/LanguageContentSettingsTest.php
new file mode 100644 (file)
index 0000000..a4c7534
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+
+namespace Drupal\Tests\language\Kernel\Plugin\migrate\source\d6;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests menu source plugin.
+ *
+ * @covers \Drupal\language\Plugin\migrate\source\d6\LanguageContentSettings
+ *
+ * @group language
+ */
+class LanguageContentSettingsTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['language', 'migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['node_type'] = [
+      [
+        'type' => 'article',
+        'name' => 'Article',
+        'module' => 'node',
+        'description' => 'An <em>article</em>, content type.',
+        'help' => '',
+        'has_title' => 1,
+        'title_label' => 'Title',
+        'has_body' => 1,
+        'body_label' => 'Body',
+        'min_word_count' => 0,
+        'custom' => 1,
+        'modified' => 1,
+        'locked' => 0,
+        'orig_type' => 'story',
+      ],
+      [
+        'type' => 'company',
+        'name' => 'Company',
+        'module' => 'node',
+        'description' => 'Company node type',
+        'help' => '',
+        'has_title' => 1,
+        'title_label' => 'Name',
+        'has_body' => 1,
+        'body_label' => 'Description',
+        'min_word_count' => 0,
+        'custom' => 0,
+        'modified' => 1,
+        'locked' => 0,
+        'orig_type' => 'company',
+      ],
+    ];
+
+    foreach ($tests[0]['source_data']['node_type'] as $node_type) {
+      $tests[0]['expected_data'][] = [
+        'type' => $node_type['type'],
+        'language_content_type' => NULL,
+        'i18n_lock_node' => 0,
+      ];
+    }
+
+    return $tests;
+  }
+
+}
diff --git a/web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d7/LanguageContentSettingsTest.php b/web/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d7/LanguageContentSettingsTest.php
new file mode 100644 (file)
index 0000000..39d6450
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+namespace Drupal\Tests\language\Kernel\Plugin\migrate\source\d7;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests menu source plugin.
+ *
+ * @covers \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettings
+ *
+ * @group language
+ */
+class LanguageContentSettingsTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['language', 'migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['node_type'] = [
+      [
+        'type' => 'article',
+        'name' => 'Article',
+        'base' => 'node_content',
+        'module' => 'node',
+        'description' => 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.',
+        'help' => 'Help text for articles',
+        'has_title' => 1,
+        'title_label' => 'Title',
+        'custom' => 1,
+        'modified' => 1,
+        'locked' => 0,
+        'disabled' => 0,
+        'orig_type' => 'article',
+      ],
+      [
+        'type' => 'blog',
+        'name' => 'Blog entry',
+        'base' => 'blog',
+        'module' => 'blog',
+        'description' => 'Use for multi-user blogs. Every user gets a personal blog.',
+        'help' => 'Blog away, good sir!',
+        'has_title' => 1,
+        'title_label' => 'Title',
+        'custom' => 0,
+        'modified' => 1,
+        'locked' => 1,
+        'disabled' => 0,
+        'orig_type' => 'blog',
+      ],
+    ];
+
+    foreach ($tests[0]['source_data']['node_type'] as $node_type) {
+      $tests[0]['expected_data'][] = [
+        'type' => $node_type['type'],
+        'language_content_type' => NULL,
+        'i18n_lock_node' => 0,
+      ];
+    }
+
+    return $tests;
+  }
+
+}
index 29a816fce5267e888431e42eb48113d6779daac3..7f651176789794ac96184b819bd7de6c68c7c0bf 100644 (file)
 
 @media screen and (min-width: 40em) {
   .layout--threecol-33-34-33 > .layout__region--first,
-  .layout--threecol-33-34-33 > .layout__region--second,
   .layout--threecol-33-34-33 > .layout__region--third {
     flex: 0 1 33%;
   }
+  .layout--threecol-33-34-33 > .layout__region--second {
+    flex: 0 1 34%;
+  }
 }
similarity index 98%
rename from web/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php
index 479a60046bf55fb50a6bbee19c7a1ea8d2dff154..67c2dfa7078eccc95fae18e1e22d848f6b70ea95 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\locale\Locale;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
@@ -11,7 +11,7 @@ use Drupal\language\Entity\ConfigurableLanguage;
  *
  * @group locale
  */
-class LocaleConfigTranslationImportTest extends WebTestBase {
+class LocaleConfigTranslationImportTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -206,7 +206,7 @@ class LocaleConfigTranslationImportTest extends WebTestBase {
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textareas = $this->xpath('//textarea');
     $textarea = current($textareas);
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => '',
     ];
similarity index 97%
rename from web/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
index a90dce0c54c8ff3bc3b1c995a4bf3376a62d551c..4d1b9df2cd6bd70f71c976aa76152966a47715fb 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\Core\Language\LanguageInterface;
 
 /**
@@ -10,7 +10,7 @@ use Drupal\Core\Language\LanguageInterface;
  *
  * @group locale
  */
-class LocaleConfigTranslationTest extends WebTestBase {
+class LocaleConfigTranslationTest extends BrowserTestBase {
 
   /**
    * The language code used.
@@ -76,7 +76,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textareas = $this->xpath('//textarea');
     $textarea = current($textareas);
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $message,
     ];
@@ -100,7 +100,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textareas = $this->xpath('//textarea');
     $textarea = current($textareas);
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => 'D',
     ];
@@ -143,7 +143,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $image_style_label,
     ];
@@ -175,7 +175,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $category_label,
     ];
similarity index 97%
rename from web/core/modules/locale/src/Tests/LocaleExportTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleExportTest.php
index 54d36e2bc80c123759a94e1a5a1dc054b1f9111f..05621f6c13dec094de4058781d73b9630bb43f73 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests the exportation of locale files.
  *
  * @group locale
  */
-class LocaleExportTest extends WebTestBase {
+class LocaleExportTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
similarity index 91%
rename from web/core/modules/locale/src/Tests/LocaleFileSystemFormTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php
index 3ac296abe27c0484e177aa84d7d0e82be40b83b1..face32e69b683751f0b9f18d531428707a61268a 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests the locale functionality in the altered file settings form.
  *
  * @group locale
  */
-class LocaleFileSystemFormTest extends WebTestBase {
+class LocaleFileSystemFormTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
similarity index 99%
rename from web/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
index c1d9a612a9c93d5383b4f79bea453cf1b83c5631..e3a2c2612e2bf5a4ff989d092cd884fb60516fcd 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\Core\Language\LanguageInterface;
 
 /**
@@ -10,7 +10,7 @@ use Drupal\Core\Language\LanguageInterface;
  *
  * @group locale
  */
-class LocaleImportFunctionalTest extends WebTestBase {
+class LocaleImportFunctionalTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
similarity index 92%
rename from web/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php
index fe99ce2f37c424c3680c17dd542616cf4d72ce98..bbb825832b77324c3f9e1d4ecbf8e64419ce2c6b 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\Component\Utility\SafeMarkup;
 
 /**
@@ -11,7 +11,7 @@ use Drupal\Component\Utility\SafeMarkup;
  *
  * @group locale
  */
-class LocaleJavascriptTranslationTest extends WebTestBase {
+class LocaleJavascriptTranslationTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -21,7 +21,7 @@ class LocaleJavascriptTranslationTest extends WebTestBase {
   public static $modules = ['locale', 'locale_test'];
 
   public function testFileParsing() {
-    $filename = __DIR__ . '/../../tests/locale_test.js';
+    $filename = __DIR__ . '/../../locale_test.js';
 
     // Parse the file to look for source strings.
     _locale_parse_js_file($filename);
@@ -138,8 +138,9 @@ class LocaleJavascriptTranslationTest extends WebTestBase {
     $js_translation_files = \Drupal::state()->get('locale.translation.javascript');
     $js_filename = $prefix . '_' . $js_translation_files[$prefix] . '.js';
 
+    $content = $this->getSession()->getPage()->getContent();
     // Assert translations JS is included before drupal.js.
-    $this->assertTrue(strpos($this->content, $js_filename) < strpos($this->content, 'core/misc/drupal.js'), 'Translations are included before Drupal.t.');
+    $this->assertTrue(strpos($content, $js_filename) < strpos($content, 'core/misc/drupal.js'), 'Translations are included before Drupal.t.');
   }
 
 }
similarity index 85%
rename from web/core/modules/locale/src/Tests/LocaleLibraryAlterTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleLibraryAlterTest.php
index 68996f44a20884c3d769769983788fa5af2b0673..5425fc5f4c47f891357f0ea8e0efa761659dea42 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Core\Asset\AttachedAssets;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests localization of the JavaScript libraries.
@@ -12,7 +12,7 @@ use Drupal\simpletest\WebTestBase;
  *
  * @group locale
  */
-class LocaleLibraryAlterTest extends WebTestBase {
+class LocaleLibraryAlterTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
similarity index 99%
rename from web/core/modules/locale/src/Tests/LocalePluralFormatTest.php
rename to web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
index 2315dbd22b4d9f63cc560a42e47567b00e11d6d2..57916caf04ca555270b5bef3e3ce1023e33ec624 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests plural handling for various languages.
  *
  * @group locale
  */
-class LocalePluralFormatTest extends WebTestBase {
+class LocalePluralFormatTest extends BrowserTestBase {
 
   /**
    * An admin user.
similarity index 96%
rename from web/core/modules/locale/src/Tests/LocaleTranslateStringTourTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleTranslateStringTourTest.php
index a4b1656655b92a9723f69734450ac6435aa9bdfe..397c1c763f8b7857be15ff64b66c3a5cdca577e3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\tour\Tests\TourTestBase;
 
similarity index 96%
rename from web/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
index 53f77c19fd2c005fd2cf1fa7146e6b2b51d64141..e7d28b36834ef2f7f9c4a01d8f754bd1f581b5d5 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Component\Utility\SafeMarkup;
 
@@ -13,7 +13,7 @@ use Drupal\Component\Utility\SafeMarkup;
  *
  * @group locale
  */
-class LocaleTranslationUiTest extends WebTestBase {
+class LocaleTranslationUiTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -44,7 +44,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomMachineName(16);
+    $name = 'cucurbitaceae';
     // This will be the translation of $name.
     $translation = $this->randomMachineName(16);
     $translation_to_en = $this->randomMachineName(16);
@@ -89,7 +89,7 @@ class LocaleTranslationUiTest extends WebTestBase {
 
     // Assume this is the only result, given the random name.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $translation,
     ];
@@ -112,7 +112,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $translation_to_en,
     ];
@@ -155,7 +155,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => 'Please enter your Llama username.',
     ];
@@ -189,7 +189,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     // Assume this is the only result, given the random name.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => '',
     ];
@@ -248,7 +248,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
 
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $this->randomMachineName(),
     ];
@@ -309,7 +309,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     // Find the edit path.
 
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     foreach ($bad_translations as $translation) {
       $edit = [
         $lid => $translation,
@@ -317,7 +317,7 @@ class LocaleTranslationUiTest extends WebTestBase {
       $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
       // Check for a form error on the textarea.
       $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class');
-      $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), 'The string was rejected as unsafe.');
+      $this->assertContains('error', $form_class[0]->getText(), 'The string was rejected as unsafe.');
       $this->assertNoText(t('The string has been saved.'), 'The string was not saved.');
     }
   }
@@ -399,7 +399,7 @@ class LocaleTranslationUiTest extends WebTestBase {
     // Assume this is the only result, given the random name.
     // We save the lid from the path.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $translation,
     ];
@@ -503,7 +503,7 @@ class LocaleTranslationUiTest extends WebTestBase {
 
     // Submit the translations without changing the translation.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $translation->getString(),
     ];
@@ -522,7 +522,7 @@ class LocaleTranslationUiTest extends WebTestBase {
 
     // Submit the translations with a new translation.
     $textarea = current($this->xpath('//textarea'));
-    $lid = (string) $textarea[0]['name'];
+    $lid = $textarea->getAttribute('name');
     $edit = [
       $lid => $this->randomMachineName(100),
     ];
similarity index 98%
rename from web/core/modules/locale/src/Tests/LocaleUpdateBase.php
rename to web/core/modules/locale/tests/src/Functional/LocaleUpdateBase.php
index b228a962de5f7dab19d7899d785fb7a3dbb02834..f4c59b2873b4fa6a6eb841111a6509976dd80454 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Core\StreamWrapper\PublicStream;
 use Drupal\file\Entity\File;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 use Drupal\Component\Utility\SafeMarkup;
 
 /**
  * Base class for testing updates to string translations.
  */
-abstract class LocaleUpdateBase extends WebTestBase {
+abstract class LocaleUpdateBase extends BrowserTestBase {
 
   /**
    * Timestamp for an old translation.
similarity index 97%
rename from web/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
index 78a14ecac858c86131628abe3e0ce3dcb64d5f90..d0d5379139422689f26468c4ae03733ac5c59723 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
+
+use Drupal\Tests\Traits\Core\CronRunTrait;
 
 /**
  * Tests for using cron to update project interface translations.
@@ -9,6 +11,8 @@ namespace Drupal\locale\Tests;
  */
 class LocaleUpdateCronTest extends LocaleUpdateBase {
 
+  use CronRunTrait;
+
   protected $batchOutput = [];
 
   /**
similarity index 88%
rename from web/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleUpdateDevelopmentReleaseTest.php
index 3d7970bb984f3e7576947b47cba3403060c5d293..5c972d1ef377a699001f688763aa0785223d6591 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Test for proper version fallback in case of a development release.
  *
  * @group language
  */
-class LocaleUpdateDevelopmentReleaseTest extends WebTestBase {
+class LocaleUpdateDevelopmentReleaseTest extends BrowserTestBase {
 
   public static $modules = ['locale', 'locale_test_development_release'];
 
similarity index 99%
rename from web/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php
index 32928b1d8bf3ec39b9f2f7f425053ecd7e979f72..c6c69c2a97e9470516ab93d8a66d7e7f774fa378 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Component\Utility\SafeMarkup;
similarity index 99%
rename from web/core/modules/locale/src/Tests/LocaleUpdateTest.php
rename to web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
index 957419b721530a72b8a28360355595a7666c6367..907e572c428d28cbef1837eb36de58162a58d370 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\locale\Tests;
+namespace Drupal\Tests\locale\Functional;
 
 use Drupal\Core\Language\LanguageInterface;
 
index f387df5233fdb7613aa3c806faf5e541401afc0f..835fd691c9b3bf20c14973f71af72448a1994836 100644 (file)
@@ -217,7 +217,7 @@ class MigrationLookup extends ProcessPluginBase implements ContainerFactoryPlugi
         $values[$source_id] = $source_id_values[$migration->id()][$index];
       }
 
-      $stub_row = new Row($values + $migration->getSourceConfiguration(), $source_ids, TRUE);
+      $stub_row = $this->createStubRow($values + $migration->getSourceConfiguration(), $source_ids);
 
       // Do a normal migration with the stub row.
       $migrate_executable->processRow($stub_row, $process);
@@ -257,4 +257,23 @@ class MigrationLookup extends ProcessPluginBase implements ContainerFactoryPlugi
     }
   }
 
+  /**
+   * Create a stub row source for later import as stub data.
+   *
+   * This simple wrapper of the Row constructor allows sub-classing plugins to
+   * have more control over the row.
+   *
+   * @param array $values
+   *   An array of values to add as properties on the object.
+   * @param array $source_ids
+   *   An array containing the IDs of the source using the keys as the field
+   *   names.
+   *
+   * @return \Drupal\migrate\Row
+   *   The stub row.
+   */
+  protected function createStubRow(array $values, array $source_ids) {
+    return new Row($values, $source_ids, TRUE);
+  }
+
 }
index 3d88d777b7edb1e307a5953d7dcaf7f2eb37afd0..bdb2879282f4d3778a94ca5a7ccb5c1968086937 100644 (file)
@@ -11,5 +11,7 @@ instead.', E_USER_DEPRECATED);
  *
  * @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
  *   \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface instead.
+ *
+ * @see https://www.drupal.org/node/2751897
  */
 interface MigrateCckFieldPluginManagerInterface extends MigrateFieldPluginManagerInterface { }
diff --git a/web/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php b/web/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
new file mode 100644 (file)
index 0000000..4f1a603
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\migrate_drupal\Plugin\migrate\field;
+
+use Drupal\migrate\Plugin\MigrationInterface;
+
+/**
+ * @MigrateField(
+ *   id = "userreference",
+ *   core = {6},
+ *   type_map = {
+ *     "userreference" = "entity_reference",
+ *   },
+ * )
+ */
+class UserReference extends FieldPluginBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFieldFormatterMap() {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
+    $process = [
+      'plugin' => 'iterator',
+      'source' => $field_name,
+      'process' => [
+        'target_id' => [
+          'plugin' => 'migration_lookup',
+          'migration' => 'd6_user',
+          'source' => 'uid',
+        ],
+      ],
+    ];
+    $migration->setProcessOfProperty($field_name, $process);
+  }
+
+}
index c94870e2f4ac67afac1759d1d6dc69a94177fb0f..0003684ebbb44cec3cc46b3a171d4e2351dc83f4 100644 (file)
@@ -45966,28 +45966,28 @@ $connection->insert('term_data')
 ->values(array(
   'tid' => '1',
   'vid' => '1',
-  'name' => 'term 1 of vocabulary 1',
-  'description' => 'description of term 1 of vocabulary 1',
+  'name' => 'zu - term 1 of vocabulary 1',
+  'description' => 'zu - description of term 1 of vocabulary 1',
   'weight' => '0',
-  'language' => '',
+  'language' => 'zu',
   'trid' => '0',
 ))
 ->values(array(
   'tid' => '2',
   'vid' => '2',
-  'name' => 'term 2 of vocabulary 2',
-  'description' => 'description of term 2 of vocabulary 2',
+  'name' => 'fr - term 2 of vocabulary 2',
+  'description' => 'fr - description of term 2 of vocabulary 2',
   'weight' => '3',
-  'language' => '',
+  'language' => 'fr',
   'trid' => '0',
 ))
 ->values(array(
   'tid' => '3',
   'vid' => '2',
-  'name' => 'term 3 of vocabulary 2',
-  'description' => 'description of term 3 of vocabulary 2',
+  'name' => 'fr - term 3 of vocabulary 2',
+  'description' => 'fr - description of term 3 of vocabulary 2',
   'weight' => '4',
-  'language' => '',
+  'language' => 'fr',
   'trid' => '0',
 ))
 ->values(array(
@@ -46017,6 +46017,15 @@ $connection->insert('term_data')
   'language' => '',
   'trid' => '0',
 ))
+->values(array(
+  'tid' => '7',
+  'vid' => '1',
+  'name' => 'fr - term 2 of vocabulary 1',
+  'description' => 'fr - desc of term 2 vocab 1',
+  'weight' => '0',
+  'language' => 'fr',
+  'trid' => '0',
+))
 ->execute();
 
 $connection->schema()->createTable('term_hierarchy', array(
@@ -46060,6 +46069,10 @@ $connection->insert('term_hierarchy')
   'tid' => '4',
   'parent' => '0',
 ))
+->values(array(
+  'tid' => '7',
+  'parent' => '0',
+))
 ->values(array(
   'tid' => '3',
   'parent' => '2',
@@ -46120,6 +46133,11 @@ $connection->insert('term_node')
   'vid' => '1',
   'tid' => '1',
 ))
+->values(array(
+  'nid' => '1',
+  'vid' => '1',
+  'tid' => '2',
+))
 ->values(array(
   'nid' => '2',
   'vid' => '3',
@@ -47632,6 +47650,10 @@ $connection->insert('variable')
   'name' => 'i18nstrings_allowed_formats',
   'value' => 'a:2:{i:0;i:1;i:1;i:2;}',
 ))
+->values(array(
+  'name' => 'i18ntaxonomy_vocabulary',
+  'value' => 'a:2:{i:1;s:1:"3";i:2;s:1:"2";}',
+))
 ->values(array(
   'name' => 'i18n_lock_node_article',
   'value' => 'i:1;',
@@ -48160,7 +48182,7 @@ $connection->insert('vocabulary')
   'tags' => '1',
   'module' => 'taxonomy',
   'weight' => '5',
-  'language' => '',
+  'language' => 'fr',
 ))
 ->values(array(
   'vid' => '3',
index 78fb095e2a8603e67d9a6de4d80a47bdbefc1e35..711d2add65290c1e9e15264eab7c1b001f63ba46 100644 (file)
@@ -3426,6 +3426,21 @@ $connection->insert('field_config')
   'translatable' => '0',
   'deleted' => '0',
 ))
+->values(array(
+  'id' => '25',
+  'field_name' => 'field_private_file',
+  'type' => 'file',
+  'module' => 'file',
+  'active' => '1',
+  'storage_type' => 'field_sql_storage',
+  'storage_module' => 'field_sql_storage',
+  'storage_active' => '1',
+  'locked' => '0',
+  'data' => 'a:7:{s:12:"translatable";s:1:"0";s:12:"entity_types";a:0:{}s:8:"settings";a:3:{s:13:"display_field";i:0;s:15:"display_default";i:0;s:10:"uri_scheme";s:7:"private";}s:7:"storage";a:5:{s:4:"type";s:17:"field_sql_storage";s:8:"settings";a:0:{}s:6:"module";s:17:"field_sql_storage";s:6:"active";s:1:"1";s:7:"details";a:1:{s:3:"sql";a:2:{s:18:"FIELD_LOAD_CURRENT";a:1:{s:29:"field_data_field_private_file";a:3:{s:3:"fid";s:22:"field_private_file_fid";s:7:"display";s:26:"field_private_file_display";s:11:"description";s:30:"field_private_file_description";}}s:19:"FIELD_LOAD_REVISION";a:1:{s:33:"field_revision_field_private_file";a:3:{s:3:"fid";s:22:"field_private_file_fid";s:7:"display";s:26:"field_private_file_display";s:11:"description";s:30:"field_private_file_description";}}}}}s:12:"foreign keys";a:1:{s:3:"fid";a:2:{s:5:"table";s:12:"file_managed";s:7:"columns";a:1:{s:3:"fid";s:3:"fid";}}}s:7:"indexes";a:1:{s:3:"fid";a:1:{i:0;s:3:"fid";}}s:2:"id";s:2:"25";}',
+  'cardinality' => '1',
+  'translatable' => '0',
+  'deleted' => '0',
+))
 ->execute();
 
 $connection->schema()->createTable('field_config_instance', array(
@@ -3837,6 +3852,15 @@ $connection->insert('field_config_instance')
   'data' => 'a:7:{s:5:"label";s:14:"Term Reference";s:6:"widget";a:5:{s:6:"weight";s:2:"14";s:4:"type";s:21:"taxonomy_autocomplete";s:6:"module";s:8:"taxonomy";s:6:"active";i:0;s:8:"settings";a:2:{s:4:"size";i:60;s:17:"autocomplete_path";s:21:"taxonomy/autocomplete";}}s:8:"settings";a:1:{s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:4:{s:5:"label";s:5:"above";s:4:"type";s:6:"hidden";s:6:"weight";s:2:"13";s:8:"settings";a:0:{}}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}',
   'deleted' => '0',
 ))
+->values(array(
+  'id' => '42',
+  'field_id' => '25',
+  'field_name' => 'field_private_file',
+  'entity_type' => 'node',
+  'bundle' => 'test_content_type',
+  'data' => 'a:6:{s:5:"label";s:12:"Private file";s:6:"widget";a:5:{s:6:"weight";s:2:"19";s:4:"type";s:12:"file_generic";s:6:"module";s:4:"file";s:6:"active";i:1;s:8:"settings";a:1:{s:18:"progress_indicator";s:8:"throbber";}}s:8:"settings";a:5:{s:14:"file_directory";s:0:"";s:15:"file_extensions";s:3:"txt";s:12:"max_filesize";s:0:"";s:17:"description_field";i:0;s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:12:"file_default";s:8:"settings";a:0:{}s:6:"module";s:4:"file";s:6:"weight";i:18;}}s:8:"required";i:0;s:11:"description";s:0:"";}',
+  'deleted' => '0',
+))
 ->execute();
 
 $connection->schema()->createTable('field_data_body', array(
@@ -5340,13 +5364,136 @@ $connection->insert('field_data_field_phone')
   'bundle' => 'test_content_type',
   'deleted' => '0',
   'entity_id' => '1',
-  'revision_id' => '1',
+  'revision_id' => '6',
   'language' => 'und',
   'delta' => '0',
   'field_phone_value' => '99-99-99-99',
 ))
 ->execute();
 
+$connection->schema()->createTable('field_data_field_private_file', array(
+  'fields' => array(
+    'entity_type' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'bundle' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'deleted' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '0',
+    ),
+    'entity_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'revision_id' => array(
+      'type' => 'int',
+      'not null' => FALSE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'language' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '32',
+      'default' => '',
+    ),
+    'delta' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_fid' => array(
+      'type' => 'int',
+      'not null' => FALSE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_display' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '1',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_description' => array(
+      'type' => 'text',
+      'not null' => FALSE,
+      'size' => 'normal',
+    ),
+  ),
+  'primary key' => array(
+    'entity_type',
+    'entity_id',
+    'deleted',
+    'delta',
+    'language',
+  ),
+  'indexes' => array(
+    'entity_type' => array(
+      'entity_type',
+    ),
+    'bundle' => array(
+      'bundle',
+    ),
+    'deleted' => array(
+      'deleted',
+    ),
+    'entity_id' => array(
+      'entity_id',
+    ),
+    'revision_id' => array(
+      'revision_id',
+    ),
+    'language' => array(
+      'language',
+    ),
+    'field_private_file_fid' => array(
+      'field_private_file_fid',
+    ),
+  ),
+  'mysql_character_set' => 'utf8',
+));
+
+$connection->insert('field_data_field_private_file')
+->fields(array(
+  'entity_type',
+  'bundle',
+  'deleted',
+  'entity_id',
+  'revision_id',
+  'language',
+  'delta',
+  'field_private_file_fid',
+  'field_private_file_display',
+  'field_private_file_description',
+))
+->values(array(
+  'entity_type' => 'node',
+  'bundle' => 'test_content_type',
+  'deleted' => '0',
+  'entity_id' => '1',
+  'revision_id' => '6',
+  'language' => 'und',
+  'delta' => '0',
+  'field_private_file_fid' => '4',
+  'field_private_file_display' => '1',
+  'field_private_file_description' => '',
+))
+->execute();
+
 $connection->schema()->createTable('field_data_field_tags', array(
   'fields' => array(
     'entity_type' => array(
@@ -7579,6 +7726,140 @@ $connection->insert('field_revision_field_phone')
   'delta' => '0',
   'field_phone_value' => '99-99-99-99',
 ))
+->values(array(
+  'entity_type' => 'node',
+  'bundle' => 'test_content_type',
+  'deleted' => '0',
+  'entity_id' => '1',
+  'revision_id' => '6',
+  'language' => 'und',
+  'delta' => '0',
+  'field_phone_value' => '99-99-99-99',
+))
+->execute();
+
+$connection->schema()->createTable('field_revision_field_private_file', array(
+  'fields' => array(
+    'entity_type' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'bundle' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'deleted' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '0',
+    ),
+    'entity_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'revision_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'language' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '32',
+      'default' => '',
+    ),
+    'delta' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_fid' => array(
+      'type' => 'int',
+      'not null' => FALSE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_display' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '1',
+      'unsigned' => TRUE,
+    ),
+    'field_private_file_description' => array(
+      'type' => 'text',
+      'not null' => FALSE,
+      'size' => 'normal',
+    ),
+  ),
+  'primary key' => array(
+    'entity_type',
+    'entity_id',
+    'revision_id',
+    'deleted',
+    'delta',
+    'language',
+  ),
+  'indexes' => array(
+    'entity_type' => array(
+      'entity_type',
+    ),
+    'bundle' => array(
+      'bundle',
+    ),
+    'deleted' => array(
+      'deleted',
+    ),
+    'entity_id' => array(
+      'entity_id',
+    ),
+    'revision_id' => array(
+      'revision_id',
+    ),
+    'language' => array(
+      'language',
+    ),
+    'field_private_file_fid' => array(
+      'field_private_file_fid',
+    ),
+  ),
+  'mysql_character_set' => 'utf8',
+));
+
+$connection->insert('field_revision_field_private_file')
+->fields(array(
+  'entity_type',
+  'bundle',
+  'deleted',
+  'entity_id',
+  'revision_id',
+  'language',
+  'delta',
+  'field_private_file_fid',
+  'field_private_file_display',
+  'field_private_file_description',
+))
+->values(array(
+  'entity_type' => 'node',
+  'bundle' => 'test_content_type',
+  'deleted' => '0',
+  'entity_id' => '1',
+  'revision_id' => '6',
+  'language' => 'und',
+  'delta' => '0',
+  'field_private_file_fid' => '4',
+  'field_private_file_display' => '1',
+  'field_private_file_description' => '',
+))
 ->execute();
 
 $connection->schema()->createTable('field_revision_field_tags', array(
@@ -8365,6 +8646,16 @@ $connection->insert('file_managed')
   'status' => '1',
   'timestamp' => '1421727516',
 ))
+->values(array(
+  'fid' => '3',
+  'uid' => '1',
+  'filename' => 'Babylon5.txt',
+  'uri' => 'private://Babylon5.txt',
+  'filemime' => 'text/plain',
+  'filesize' => '4',
+  'status' => '1',
+  'timestamp' => '1486104045',
+))
 ->execute();
 
 $connection->schema()->createTable('file_usage', array(
@@ -8424,14 +8715,14 @@ $connection->insert('file_usage')
   'module' => 'file',
   'type' => 'node',
   'id' => '1',
-  'count' => '2',
+  'count' => '3',
 ))
 ->values(array(
   'fid' => '2',
   'module' => 'file',
   'type' => 'node',
   'id' => '1',
-  'count' => '1',
+  'count' => '2',
 ))
 ->values(array(
   'fid' => '2',
@@ -8440,6 +8731,13 @@ $connection->insert('file_usage')
   'id' => '2',
   'count' => '1',
 ))
+->values(array(
+  'fid' => '3',
+  'module' => 'file',
+  'type' => 'node',
+  'id' => '1',
+  'count' => '1',
+))
 ->execute();
 
 $connection->schema()->createTable('filter', array(
@@ -43862,7 +44160,7 @@ $connection->insert('variable')
 ))
 ->values(array(
   'name' => 'file_private_path',
-  'value' => 's:0:"";',
+  'value' => 's:21:"sites/default/private";',
 ))
 ->values(array(
   'name' => 'file_public_path',
index 8d9fd8f0a10411049948e31b5dbc4a22cefc3ff1..12dc5c1c89229f8c45612420f3b204c3db8a457e 100644 (file)
@@ -104,6 +104,9 @@ class MigrateUpgradeImportBatch {
     // @todo Find a way to avoid this in https://www.drupal.org/node/2804611.
     if ($definition['destination']['plugin'] === 'entity:file') {
       // Make sure we have a single trailing slash.
+      if ($definition['source']['plugin'] === 'd7_file_private') {
+        $configuration['source']['constants']['source_base_path'] = rtrim($config['source_private_file_path'], '/') . '/';
+      }
       $configuration['source']['constants']['source_base_path'] = rtrim($config['source_base_path'], '/') . '/';
     }
 
index 27e0146016ca08db510b21b11bd6c19f9b5d68a2..c87247eb364554043469f4bf409de3d417cd7115 100644 (file)
@@ -250,6 +250,10 @@ class MigrateUpgradeForm extends ConfirmFormBase {
       'source_module' => 'file',
       'destination_module' => 'file',
     ],
+    'd7_file_private' => [
+      'source_module' => 'file',
+      'destination_module' => 'file',
+    ],
     'd6_filter_format' => [
       'source_module' => 'filter',
       'destination_module' => 'filter',
@@ -530,10 +534,18 @@ class MigrateUpgradeForm extends ConfirmFormBase {
       'source_module' => 'taxonomy',
       'destination_module' => 'taxonomy',
     ],
+    'd6_taxonomy_term_translation' => [
+      'source_module' => 'i18n',
+      'destination_module' => 'taxonomy',
+    ],
     'd6_taxonomy_vocabulary' => [
       'source_module' => 'taxonomy',
       'destination_module' => 'taxonomy',
     ],
+    'd6_taxonomy_vocabulary_translation' => [
+      'source_module' => 'i18n',
+      'destination_module' => 'taxonomy',
+    ],
     'd6_term_node' => [
       'source_module' => 'taxonomy',
       'destination_module' => 'taxonomy',
@@ -877,6 +889,15 @@ class MigrateUpgradeForm extends ConfirmFormBase {
 
     $default_options = [];
 
+
+    $form['version'] = [
+      '#type' => 'radios',
+      '#default_value' => 7,
+      '#title' => $this->t('Drupal version of the source site'),
+      '#options' => [6 => $this->t('Drupal 6'), 7 => $this->t('Drupal 7')],
+      '#required' => TRUE,
+    ];
+
     $form['database'] = [
       '#type' => 'details',
       '#title' => $this->t('Source database'),
@@ -930,10 +951,38 @@ class MigrateUpgradeForm extends ConfirmFormBase {
       '#title' => $this->t('Source files'),
       '#open' => TRUE,
     ];
-    $form['source']['source_base_path'] = [
+    $form['source']['d6_source_base_path'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Files directory'),
       '#description' => $this->t('To import files from your current Drupal site, enter a local file directory containing your site (e.g. /var/www/docroot), or your site address (for example http://example.com).'),
+      '#states' => [
+        'visible' => [
+          ':input[name="version"]' => ['value' => 6],
+        ],
+      ],
+    ];
+
+    $form['source']['source_base_path'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Public files directory'),
+      '#description' => $this->t('To import public files from your current Drupal site, enter a local file directory containing your site (e.g. /var/www/docroot), or your site address (for example http://example.com).'),
+      '#states' => [
+        'visible' => [
+          ':input[name="version"]' => ['value' => 7],
+        ],
+      ],
+    ];
+
+    $form['source']['source_private_file_path'] = [
+      '#type' => 'textfield',
+      '#title' => $this->t('Private file directory'),
+      '#default_value' => '',
+      '#description' => $this->t('To import private files from your current Drupal site, enter a local file directory containing your site (e.g. /var/www/docroot).'),
+      '#states' => [
+        'visible' => [
+          ':input[name="version"]' => ['value' => 7],
+        ],
+      ],
     ];
 
     $form['actions'] = ['#type' => 'actions'];
@@ -984,6 +1033,12 @@ class MigrateUpgradeForm extends ConfirmFormBase {
       if (!$version) {
         $form_state->setErrorByName($database['driver'] . '][0', $this->t('Source database does not contain a recognizable Drupal version.'));
       }
+      elseif ($version != $form_state->getValue('version')) {
+        $form_state->setErrorByName($database['driver'] . '][0', $this->t('Source database is Drupal version @version but version @selected was selected.', [
+          '@version' => $version,
+          '@selected' => $form_state->getValue('version'),
+        ]));
+      }
       else {
         $this->createDatabaseStateSettings($database, $version);
         $migrations = $this->getMigrations('migrate_drupal_' . $version, $version);
@@ -1001,6 +1056,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
         // Store the retrieved migration IDs in form storage.
         $form_state->set('migrations', $migration_array);
         $form_state->set('source_base_path', $form_state->getValue('source_base_path'));
+        $form_state->set('source_private_file_path', $form_state->getValue('source_private_file_path'));
 
         // Store the retrived system data in form storage.
         $form_state->set('system_data', $system_data);
index b635f2ab22170923a98d23c99f102e90e8ad9784..4aea3f1d093b5b8ebe3d2582815682befbae465b 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\migrate_drupal_ui\Tests;
 
+@trigger_error('\Drupal\migrate_drupal_ui\Tests\MigrateUpgradeTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase instead.', E_USER_DEPRECATED);
+
 use Drupal\Core\Database\Database;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate_drupal\MigrationConfigurationTrait;
@@ -9,6 +11,9 @@ use Drupal\simpletest\WebTestBase;
 
 /**
  * Provides a base class for testing migration upgrades in the UI.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase instead.
  */
 abstract class MigrateUpgradeTestBase extends WebTestBase {
   use MigrationConfigurationTrait;
similarity index 82%
rename from web/core/modules/migrate_drupal_ui/src/Tests/MigrateAccessTest.php
rename to web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php
index 04f2048eac66c75b7c6b16d6587a9a3a4412d489..3c475e20688fa7d98efe277ed5291bc9c708b9f8 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\migrate_drupal_ui\Tests;
+namespace Drupal\Tests\migrate_drupal_ui\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests that only user 1 can access the migrate UI.
  *
  * @group migrate_drupal_ui
  */
-class MigrateAccessTest extends WebTestBase {
+class MigrateAccessTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
diff --git a/web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/web/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
new file mode 100644 (file)
index 0000000..9741a0b
--- /dev/null
@@ -0,0 +1,231 @@
+<?php
+
+namespace Drupal\Tests\migrate_drupal_ui\Functional;
+
+use Drupal\Core\Database\Database;
+use Drupal\migrate\Plugin\MigrateIdMapInterface;
+use Drupal\migrate_drupal\MigrationConfigurationTrait;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Provides a base class for testing migration upgrades in the UI.
+ */
+abstract class MigrateUpgradeTestBase extends BrowserTestBase {
+  use MigrationConfigurationTrait;
+
+  /**
+   * Use the Standard profile to test help implementations of many core modules.
+   */
+  protected $profile = 'standard';
+
+  /**
+   * The source database connection.
+   *
+   * @var \Drupal\Core\Database\Connection
+   */
+  protected $sourceDatabase;
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = [
+    'language',
+    'content_translation',
+    'migrate_drupal_ui',
+    'telephone',
+    'aggregator',
+    'book',
+    'forum',
+    'statistics',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->createMigrationConnection();
+    $this->sourceDatabase = Database::getConnection('default', 'migrate_drupal_ui');
+
+    // Log in as user 1. Migrations in the UI can only be performed as user 1.
+    $this->drupalLogin($this->rootUser);
+  }
+
+  /**
+   * Loads a database fixture into the source database connection.
+   *
+   * @param string $path
+   *   Path to the dump file.
+   */
+  protected function loadFixture($path) {
+    $default_db = Database::getConnection()->getKey();
+    Database::setActiveConnection($this->sourceDatabase->getKey());
+
+    if (substr($path, -3) == '.gz') {
+      $path = 'compress.zlib://' . $path;
+    }
+    require $path;
+
+    Database::setActiveConnection($default_db);
+  }
+
+  /**
+   * Changes the database connection to the prefixed one.
+   *
+   * @todo Remove when we don't use global. https://www.drupal.org/node/2552791
+   */
+  protected function createMigrationConnection() {
+    $connection_info = Database::getConnectionInfo('default')['default'];
+    if ($connection_info['driver'] === 'sqlite') {
+      // Create database file in the test site's public file directory so that
+      // \Drupal\simpletest\TestBase::restoreEnvironment() will delete this once
+      // the test is complete.
+      $file = $this->publicFilesDirectory . '/' . $this->testId . '-migrate.db.sqlite';
+      touch($file);
+      $connection_info['database'] = $file;
+      $connection_info['prefix'] = '';
+    }
+    else {
+      $prefix = is_array($connection_info['prefix']) ? $connection_info['prefix']['default'] : $connection_info['prefix'];
+      // Simpletest uses fixed length prefixes. Create a new prefix for the
+      // source database. Adding to the end of the prefix ensures that
+      // \Drupal\simpletest\TestBase::restoreEnvironment() will remove the
+      // additional tables.
+      $connection_info['prefix'] = $prefix . '0';
+    }
+
+    Database::addConnectionInfo('migrate_drupal_ui', 'default', $connection_info);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function tearDown() {
+    Database::removeConnection('migrate_drupal_ui');
+    parent::tearDown();
+  }
+
+  /**
+   * Executes all steps of migrations upgrade.
+   */
+  public function testMigrateUpgrade() {
+    $connection_options = $this->sourceDatabase->getConnectionOptions();
+    $this->drupalGet('/upgrade');
+    $this->assertText('Upgrade a site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the online documentation for Drupal site upgrades for more detailed information.');
+
+    $this->drupalPostForm(NULL, [], t('Continue'));
+    $this->assertText('Provide credentials for the database of the Drupal site you want to upgrade.');
+    $this->assertFieldByName('mysql[host]');
+
+    $driver = $connection_options['driver'];
+    $connection_options['prefix'] = $connection_options['prefix']['default'];
+
+    // Use the driver connection form to get the correct options out of the
+    // database settings. This supports all of the databases we test against.
+    $drivers = drupal_get_database_types();
+    $form = $drivers[$driver]->getFormOptions($connection_options);
+    $connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']);
+    $version = $this->getLegacyDrupalVersion($this->sourceDatabase);
+    $edit = [
+      $driver => $connection_options,
+      'source_base_path' => $this->getSourceBasePath(),
+      'source_private_file_path' => $this->getSourceBasePath(),
+      'version' => $version,
+    ];
+    if (count($drivers) !== 1) {
+      $edit['driver'] = $driver;
+    }
+    $edits = $this->translatePostValues($edit);
+
+    // Ensure submitting the form with invalid database credentials gives us a
+    // nice warning.
+    $this->drupalPostForm(NULL, [$driver . '[database]' => 'wrong'] + $edits, t('Review upgrade'));
+    $this->assertText('Resolve the issue below to continue the upgrade.');
+
+    $this->drupalPostForm(NULL, $edits, t('Review upgrade'));
+    $this->assertResponse(200);
+    $this->assertText('Are you sure?');
+    $this->drupalPostForm(NULL, [], t('Perform upgrade'));
+    $this->assertText(t('Congratulations, you upgraded Drupal!'));
+
+    // Have to reset all the statics after migration to ensure entities are
+    // loadable.
+    $this->resetAll();
+
+    $expected_counts = $this->getEntityCounts();
+    foreach (array_keys(\Drupal::entityTypeManager()
+      ->getDefinitions()) as $entity_type) {
+      $real_count = \Drupal::entityQuery($entity_type)->count()->execute();
+      $expected_count = isset($expected_counts[$entity_type]) ? $expected_counts[$entity_type] : 0;
+      $this->assertEqual($expected_count, $real_count, "Found $real_count $entity_type entities, expected $expected_count.");
+    }
+
+    $plugin_manager = \Drupal::service('plugin.manager.migration');
+    /** @var \Drupal\migrate\Plugin\Migration[] $all_migrations */
+    $all_migrations = $plugin_manager->createInstancesByTag('Drupal ' . $version);
+    foreach ($all_migrations as $migration) {
+      $id_map = $migration->getIdMap();
+      foreach ($id_map as $source_id => $map) {
+        // Convert $source_id into a keyless array so that
+        // \Drupal\migrate\Plugin\migrate\id_map\Sql::getSourceHash() works as
+        // expected.
+        $source_id_values = array_values(unserialize($source_id));
+        $row = $id_map->getRowBySource($source_id_values);
+        $destination = serialize($id_map->currentDestination());
+        $message = "Migration of $source_id to $destination as part of the {$migration->id()} migration. The source row status is " . $row['source_row_status'];
+        // A completed migration should have maps with
+        // MigrateIdMapInterface::STATUS_IGNORED or
+        // MigrateIdMapInterface::STATUS_IMPORTED.
+        if ($row['source_row_status'] == MigrateIdMapInterface::STATUS_FAILED || $row['source_row_status'] == MigrateIdMapInterface::STATUS_NEEDS_UPDATE) {
+          $this->fail($message);
+        }
+        else {
+          $this->pass($message);
+        }
+      }
+    }
+    \Drupal::service('module_installer')->install(['forum']);
+    \Drupal::service('module_installer')->install(['book']);
+  }
+
+  /**
+   * Transforms a nested array into a flat array suitable for BrowserTestBase::drupalPostForm().
+   *
+   * @param array $values
+   *   A multi-dimensional form values array to convert.
+   *
+   * @return array
+   *   The flattened $edit array suitable for BrowserTestBase::drupalPostForm().
+   */
+  protected function translatePostValues(array $values) {
+    $edit = [];
+    // The easiest and most straightforward way to translate values suitable for
+    // BrowserTestBase::drupalPostForm() is to actually build the POST data string
+    // and convert the resulting key/value pairs back into a flat array.
+    $query = http_build_query($values);
+    foreach (explode('&', $query) as $item) {
+      list($key, $value) = explode('=', $item);
+      $edit[urldecode($key)] = urldecode($value);
+    }
+    return $edit;
+  }
+
+  /**
+   * Gets the source base path for the concrete test.
+   *
+   * @return string
+   *   The source base path.
+   */
+  abstract protected function getSourceBasePath();
+
+  /**
+   * Gets the expected number of entities per entity type after migration.
+   *
+   * @return int[]
+   *   An array of expected counts keyed by entity type ID.
+   */
+  abstract protected function getEntityCounts();
+
+}
similarity index 90%
rename from web/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php
rename to web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php
index 48d3d8d99e39dbbbc4f47d297555adcf317b84b9..0578675c054b0514bc168598092759b609fd0c96 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\migrate_drupal_ui\Tests\d6;
+namespace Drupal\Tests\migrate_drupal_ui\Functional\d6;
 
-use Drupal\migrate_drupal_ui\Tests\MigrateUpgradeTestBase;
+use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase;
 use Drupal\user\Entity\User;
 
 /**
@@ -59,7 +59,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
       'shortcut_set' => 1,
       'action' => 22,
       'menu' => 8,
-      'taxonomy_term' => 6,
+      'taxonomy_term' => 7,
       'taxonomy_vocabulary' => 6,
       'tour' => 4,
       'user' => 7,
@@ -83,7 +83,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
 
     // Ensure migrated users can log in.
     $user = User::load(2);
-    $user->pass_raw = 'john.doe_pass';
+    $user->passRaw = 'john.doe_pass';
     $this->drupalLogin($user);
   }
 
similarity index 86%
rename from web/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php
rename to web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php
index 94a42e2c956463cfd8e65b767565099809be4323..2917b163c13dd7750e541e6ea4837c7483b84950 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\migrate_drupal_ui\Tests\d7;
+namespace Drupal\Tests\migrate_drupal_ui\Functional\d7;
 
-use Drupal\migrate_drupal_ui\Tests\MigrateUpgradeTestBase;
+use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase;
 use Drupal\user\Entity\User;
 
 /**
@@ -14,6 +14,11 @@ use Drupal\user\Entity\User;
  */
 class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['file'];
+
   /**
    * {@inheritdoc}
    */
@@ -45,9 +50,9 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
       'configurable_language' => 4,
       'contact_form' => 3,
       'editor' => 2,
-      'field_config' => 52,
-      'field_storage_config' => 39,
-      'file' => 2,
+      'field_config' => 53,
+      'field_storage_config' => 40,
+      'file' => 3,
       'filter_format' => 7,
       'image_style' => 6,
       'language_content_settings' => 2,
@@ -84,7 +89,7 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
 
     // Ensure migrated users can log in.
     $user = User::load(2);
-    $user->pass_raw = 'a password';
+    $user->passRaw = 'a password';
     $this->drupalLogin($user);
   }
 
diff --git a/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/private/Babylon5.txt b/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/private/Babylon5.txt
new file mode 100644 (file)
index 0000000..6a7e452
--- /dev/null
@@ -0,0 +1 @@
+***
index b480f899d95b1de35e5241559342726fd599eea9..ce4ce76e968f29b0ecfbbe1c5e33b54ae55764f1 100644 (file)
@@ -95,6 +95,10 @@ class MigrateNodeTest extends MigrateNodeTestBase {
     $this->assertSame('Klingon Empire', $node->field_company[0]->entity->label());
     $this->assertSame('Romulan Empire', $node->field_company[1]->entity->label());
 
+    // Test that user reference field values were migrated.
+    $this->assertCount(1, $node->field_commander);
+    $this->assertSame('joe.roe', $node->field_commander[0]->entity->getUsername());
+
     $node = Node::load(2);
     $this->assertIdentical('Test title rev 3', $node->getTitle());
     $this->assertIdentical('test rev 3', $node->body->value);
index 3c86aca36397648d2a1ff48b5cba2f5d825e034d..64a2ca2ff99690888333d4484feeaed5a082474a 100644 (file)
   -moz-transition: all .7s ease;
   transition: all .7s ease;
 }
-
-/* Transition the position of the toolbar. */
-.toolbar-fixed,
-.toolbar-tray-open {
-  -webkit-transition: all .5s ease;
-  -moz-transition: all .5s ease;
-  transition: all .5s ease;
-}
-
-/* Transition the administration tray.
-#toolbar-administration,
-#toolbar-administration * {
-  -webkit-transition: all .7s ease;
-  -moz-transition: all .7s ease;
-  transition: all .7s ease;
-}*/
index 011d198daed209e0d449c54ad3222934f04c98e5..235631397392cad6964101976e5ac22a986365d1 100644 (file)
@@ -9,7 +9,7 @@
 
 /* Style the edit mode toolbar and tabs. */
 #toolbar-bar.js-outside-in-edit-mode {
-  background-color: #fff;
+  background-image: linear-gradient(to bottom,#0c97ed,#1f86c7);
 }
 .js-outside-in-edit-mode .toolbar-item:not(.toolbar-icon-edit) {
   color: #999;
index 9989d91f652745abb9cd4f84d3776d82c0feadb0..2371483ed531b847c9dbcd087c96f75dc12a190a 100644 (file)
@@ -11,6 +11,11 @@ use Drupal\Core\Ajax\OpenDialogCommand;
  */
 class OpenOffCanvasDialogCommand extends OpenDialogCommand {
 
+  /**
+   * The dialog width to use if none is provided.
+   */
+  const DEFAULT_DIALOG_WIDTH = 300;
+
   /**
    * Constructs an OpenOffCanvasDialogCommand object.
    *
@@ -42,6 +47,12 @@ class OpenOffCanvasDialogCommand extends OpenDialogCommand {
     // @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an
     //   empty set of buttons until https://www.drupal.org/node/2793343 is in.
     $this->dialogOptions['buttons'] = [];
+    // If no width option is provided then use the default width to avoid the
+    // dialog staying at the width of the previous instance when opened
+    // more than once, with different widths, on a single page.
+    if (!isset($this->dialogOptions['width'])) {
+      $this->dialogOptions['width'] = static::DEFAULT_DIALOG_WIDTH;
+    }
   }
 
   /**
index 4e0f081fb5c840a14560cbcac263131b79f2e19d..f97f79ae05e51fb89129a283b5758de7281cb8e7 100644 (file)
@@ -44,7 +44,7 @@ class BlockEntityOffCanvasForm extends BlockForm {
     }
     $form['advanced_link'] = [
       '#type' => 'link',
-      '#title' => $this->t('Advanced options'),
+      '#title' => $this->t('Advanced block options'),
       '#url' => $this->entity->toUrl('edit-form', ['query' => $query]),
       '#weight' => 1000,
     ];
@@ -52,6 +52,18 @@ class BlockEntityOffCanvasForm extends BlockForm {
     // Remove the ID and region elements.
     unset($form['id'], $form['region'], $form['settings']['admin_label']);
 
+    if (isset($form['settings']['label_display']) && isset($form['settings']['label'])) {
+      // Only show the label input if the label will be shown on the page.
+      $form['settings']['label_display']['#weight'] = -100;
+      $form['settings']['label']['#states']['visible'] = [
+        ':input[name="settings[label_display]"]' => ['checked' => TRUE],
+      ];
+
+      // Relabel to "Block title" because on the front-end this may be confused
+      // with page title.
+      $form['settings']['label']['#title'] = $this->t("Block title");
+      $form['settings']['label_display']['#title'] = $this->t("Display block title");
+    }
     return $form;
   }
 
index 41d66dde3f00a3b4faa9e8725d38f8bace976674..e2b451e1a7d7e20b7dac505e656140686be290e9 100644 (file)
@@ -46,6 +46,7 @@ class OffCanvasDialogTest extends AjaxTestBase {
           'draggable' => FALSE,
           'drupalAutoButtons' => FALSE,
           'buttons' => [],
+          'width' => 300,
         ],
       'effect' => 'fade',
       'speed' => 1000,
index b224deb9355a2fd34e5cbc8d6adcd54e59511edf..11c7f5311d8508a6096a5b37b556eeef3693f1e6 100644 (file)
@@ -5,7 +5,13 @@
  *
  * For consistent wrapping to {{ page }} render in all themes. The
  * "data-off-canvas-main-canvas" attribute is required by the off-canvas dialog.
- * It cannot be removed without breaking the off-canvas dialog functionality.
+ * This is used by the outside_in/drupal.off_canvas library to select the
+ * "main canvas" page element as opposed to the "off canvas" which is the tray
+ * itself. The "main canvas" element must be resized according to the width of
+ * the "off canvas" tray so that no portion of the "main canvas" is obstructed
+ * by the tray. The tray can vary in width when opened and can be resized by the
+ * user. The "data-off-canvas-main-canvas" attribute cannot be removed without
+ * breaking the off-canvas dialog functionality.
  *
  * Available variables:
  * - children: Contains the child elements of the page.
index 3254ca981ec40708de384ecf503075bcb25b8d2f..94c18f039a90909af44baf052c2047226a45c7e2 100644 (file)
@@ -63,7 +63,11 @@ class OffCanvasTest extends OutsideInJavascriptTestBase {
           $this->assertEquals('', $header_text);
 
           $style = $page->find('css', '.ui-dialog-off-canvas')->getAttribute('style');
-          self::assertTrue(strstr($style, 'width: 555px;') !== FALSE, 'Dialog width respected.');
+          $this->assertTrue(strstr($style, 'width: 555px;') !== FALSE, 'Dialog width respected.');
+          $page->clickLink("Click Me 1!");
+          $this->waitForOffCanvasToOpen();
+          $style = $page->find('css', '.ui-dialog-off-canvas')->getAttribute('style');
+          $this->assertTrue(strstr($style, 'width: 555px;') === FALSE, 'Dialog width reset to default.');
         }
         else {
           // Check that header is correct.
index a5eacc5c53932169ea798209d8221c9628bfdd22..313e12dc011722d62ab8b3e29854afb9689b0d17 100644 (file)
@@ -16,6 +16,8 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
 
   const TOOLBAR_EDIT_LINK_SELECTOR = '#toolbar-bar div.contextual-toolbar-tab button';
 
+  const LABEL_INPUT_SELECTOR = 'input[data-drupal-selector="edit-settings-label"]';
+
   /**
    * {@inheritdoc}
    */
@@ -83,7 +85,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
           $this->waitForNoElement("#toolbar-administration a.is-active");
         }
         $page->find('css', $toolbar_item)->click();
-        $web_assert->waitForElementVisible('css', "{$toolbar_item}.is-active");
+        $this->assertElementVisibleAfterWait('css', "{$toolbar_item}.is-active");
       }
       $this->enableEditMode();
       if (isset($toolbar_item)) {
@@ -92,9 +94,15 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
       $this->openBlockForm($block_selector);
       switch ($block_plugin) {
         case 'system_powered_by_block':
+          // Confirm "Display Title" is not checked.
+          $web_assert->checkboxNotChecked('settings[label_display]');
+          // Confirm Title is not visible.
+          $this->assertEquals($this->isLabelInputVisible(), FALSE, 'Label is not visible');
+          $page->checkField('settings[label_display]');
+          $this->assertEquals($this->isLabelInputVisible(), TRUE, 'Label is visible');
           // Fill out form, save the form.
           $page->fillField('settings[label]', $new_page_text);
-          $page->checkField('settings[label_display]');
+
           break;
 
         case 'system_branding_block':
@@ -195,8 +203,19 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
    */
   protected function assertOffCanvasBlockFormIsValid() {
     $web_assert = $this->assertSession();
+    // Confirm that Block title display label has been changed.
+    $web_assert->elementTextContains('css', '.form-item-settings-label-display label', 'Display block title');
+    // Confirm Block title label is shown if checkbox is checked.
+    if ($this->getSession()->getPage()->find('css', 'input[name="settings[label_display]"]')->isChecked()) {
+      $this->assertEquals($this->isLabelInputVisible(), TRUE, 'Label is visible');
+      $web_assert->elementTextContains('css', '.form-item-settings-label label', 'Block title');
+    }
+    else {
+      $this->assertEquals($this->isLabelInputVisible(), FALSE, 'Label is not visible');
+    }
+
     // Check that common block form elements exist.
-    $web_assert->elementExists('css', 'input[data-drupal-selector="edit-settings-label"]');
+    $web_assert->elementExists('css', static::LABEL_INPUT_SELECTOR);
     $web_assert->elementExists('css', 'input[data-drupal-selector="edit-settings-label-display"]');
     // Check that advanced block form elements do not exist.
     $web_assert->elementNotExists('css', 'input[data-drupal-selector="edit-visibility-request-path-pages"]');
@@ -257,7 +276,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
         $this->drupalGet('node/' . $node->id());
         // Waiting for Toolbar module.
         // @todo Remove the hack after https://www.drupal.org/node/2542050.
-        $web_assert->waitForElementVisible('css', '.toolbar-fixed');
+        $this->assertElementVisibleAfterWait('css', '.toolbar-fixed');
         // Waiting for Toolbar animation.
         $web_assert->assertWaitOnAjaxRequest();
         // The 2nd page load we should already be in edit mode.
@@ -266,7 +285,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
         }
         // In Edit mode clicking field should open QuickEdit toolbar.
         $page->find('css', $body_selector)->click();
-        $web_assert->waitForElementVisible('css', $quick_edit_selector);
+        $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
 
         $this->disableEditMode();
         // Exiting Edit mode should close QuickEdit toolbar.
@@ -277,7 +296,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
         $this->enableEditMode();
         $this->openBlockForm($block_selector);
         $page->find('css', $body_selector)->click();
-        $web_assert->waitForElementVisible('css', $quick_edit_selector);
+        $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
         // Off-canvas dialog should be closed when opening QuickEdit toolbar.
         $this->waitForOffCanvasToClose();
 
@@ -291,7 +310,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
       $this->disableEditMode();
       // Open QuickEdit toolbar before going into Edit mode.
       $this->clickContextualLink($node_selector, "Quick edit");
-      $web_assert->waitForElementVisible('css', $quick_edit_selector);
+      $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
       // Open off-canvas and enter Edit mode via contextual link.
       $this->clickContextualLink($block_selector, "Quick edit");
       $this->waitForOffCanvasToOpen();
@@ -300,7 +319,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
       // Open QuickEdit toolbar via contextual link while in Edit mode.
       $this->clickContextualLink($node_selector, "Quick edit", FALSE);
       $this->waitForOffCanvasToClose();
-      $web_assert->waitForElementVisible('css', $quick_edit_selector);
+      $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
       $this->disableEditMode();
     }
   }
@@ -469,4 +488,14 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
     return '#block-' . $block->id();
   }
 
+  /**
+   * Determines if the label input is visible.
+   *
+   * @return bool
+   *   TRUE if the label is visible, FALSE if it is not.
+   */
+  protected function isLabelInputVisible() {
+    return $this->getSession()->getPage()->find('css', static::LABEL_INPUT_SELECTOR)->isVisible();
+  }
+
 }
index 2dcc40fb44b4e7c9bc8d6ecf96bddce4a8a8ac09..129aaec7ec2d8c1f42ea1f048698d728d647d87f 100644 (file)
@@ -42,7 +42,7 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
   protected function waitForOffCanvasToOpen() {
     $web_assert = $this->assertSession();
     $web_assert->assertWaitOnAjaxRequest();
-    $web_assert->waitForElementVisible('css', '#drupal-off-canvas');
+    $this->assertElementVisibleAfterWait('css', '#drupal-off-canvas');
   }
 
   /**
@@ -125,7 +125,7 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
     $web_assert = $this->assertSession();
     // Waiting for Toolbar module.
     // @todo Remove the hack after https://www.drupal.org/node/2542050.
-    $web_assert->waitForElementVisible('css', '.toolbar-fixed');
+    $this->assertElementVisibleAfterWait('css', '.toolbar-fixed');
     // Waiting for Toolbar animation.
     $web_assert->assertWaitOnAjaxRequest();
   }
@@ -140,4 +140,19 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
     return ['bartik', 'stark', 'classy', 'stable'];
   }
 
+  /**
+   * Asserts the specified selector is visible after a wait.
+   *
+   * @param string $selector
+   *   The selector engine name. See ElementInterface::findAll() for the
+   *   supported selectors.
+   * @param string|array $locator
+   *   The selector locator.
+   * @param int $timeout
+   *   (Optional) Timeout in milliseconds, defaults to 10000.
+   */
+  protected function assertElementVisibleAfterWait($selector, $locator, $timeout = 10000) {
+    $this->assertNotEmpty($this->assertSession()->waitForElementVisible($selector, $locator, $timeout));
+  }
+
 }
index 92103b401a1ebf8b6637c4b92fecdad62520b5de..d822415d61ad51c7641bd205fb2ff3f54ae6b14d 100644 (file)
@@ -31,6 +31,7 @@ class OpenOffCanvasDialogCommandTest extends UnitTestCase {
         'draggable' => FALSE,
         'drupalAutoButtons' => FALSE,
         'buttons' => [],
+        'width' => 300,
       ],
       'effect' => 'fade',
       'speed' => 1000,
index 41a03657af9f1d8b4d22acc507fe8ea660782d1c..629c4aa810155475847ba92190839e18b221957a 100644 (file)
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\rdf\Functional;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\taxonomy\Tests\TaxonomyTestBase;
+use Drupal\Tests\taxonomy\Functional\TaxonomyTestBase;
 
 /**
  * Tests RDFa markup generation for taxonomy term fields.
index ea74ce5c27b060784411a78722b622857903f4be..346ffb7eb9dca78586822d796ce4737117df870d 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\rdf\Functional;
 
-use Drupal\taxonomy\Tests\TaxonomyTestBase;
+use Drupal\Tests\taxonomy\Functional\TaxonomyTestBase;
 
 /**
  * Tests the RDFa markup of Taxonomy terms.
index 5f181c9cbdf59d63aa9af6ebe521f7cf21cfd1c5..98b35ae6f01f3bfc0304e7f9b459b71afdacb261 100644 (file)
@@ -4,6 +4,7 @@ rest.settings:
   label: 'REST settings'
   mapping:
     # @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+    # @see https://www.drupal.org/node/2830467
     link_domain:
       type: string
       label: 'Domain of the relation'
index ac601072bea0a4002ed74e5299bca9d19f275d9e..6c09bbff530b8fba1dffa36eda2b23d28dc80582 100644 (file)
@@ -34,6 +34,8 @@ function hook_rest_resource_alter(&$definitions) {
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use
  *   hook_serialization_type_uri_alter() instead. This exists solely for BC.
  *
+ * @see https://www.drupal.org/node/2830467
+ *
  * Modules may wish to alter the type URI generated for a resource based on the
  * context of the serializer/normalizer operation.
  *
@@ -61,6 +63,8 @@ function hook_rest_type_uri_alter(&$uri, $context = []) {
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use
  *   hook_serialization_relation_uri_alter() instead. This exists solely for BC.
  *
+ * @see https://www.drupal.org/node/2830467
+ *
  * Modules may wish to alter the relation URI generated for a resource based on
  * the context of the serializer/normalizer operation.
  *
index f9343f40c700a300ec03de15b01d35379f9e81a9..e521459195bdd3649ad32211d37aa1d61f7a4ddf 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\ConfigurableLinkManagerInterface as MovedConfigurable
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 interface ConfigurableLinkManagerInterface extends MovedConfigurableLinkManagerInterface {}
index 4cb8384f61781a6bce6e51dca8e3b34e7524130f..4586c62ecdced043d83458d85b0ea6d5a0cbbf24 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\LinkManager as MovedLinkManager;
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 class LinkManager extends MovedLinkManager implements LinkManagerInterface {}
index 13f7004224943a25d5a9a7e5b48a6539b8f46a7a..85eb7b70a923820aeb19fc824e3eb0e3de903dae 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\LinkManagerBase as MovedLinkManagerBase;
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 abstract class LinkManagerBase extends MovedLinkManagerBase {}
index 15852a59d3d0878219feed1ff5b1eb886cda0599..9f5d2f2d25170bd8cc1305f4eae9205c7b662148 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\LinkManagerInterface as MovedLinkManagerInterface;
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 interface LinkManagerInterface extends MovedLinkManagerInterface {}
index 8a5d49d5a38051f1f082c8cb71da353efdd401d5..6690e2100634302e093d4d4e18daa76dcce1c7f2 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\RelationLinkManager as MovedLinkRelationManager;
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 class RelationLinkManager extends MovedLinkRelationManager implements RelationLinkManagerInterface {}
index c9a89388f11a742d4af1604aaddf83793cc690f2..c2eec34612b629cc8f5b26ae7574dac5f06f5cb4 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\RelationLinkManagerInterface as MovedRelationLinkMana
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 interface RelationLinkManagerInterface extends MovedRelationLinkManagerInterface {}
index 7c81a2582380d9923418e6e9de776920dd7f6b63..6d7ba03ecfd5671b0cd0bb80ebcc7d72e6309a18 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\TypeLinkManager as MovedTypeLinkManager;
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 class TypeLinkManager extends MovedTypeLinkManager implements TypeLinkManagerInterface {}
index 85407fff65531d05210d60d54e509cb9edbe0963..9a37049e240e65a50a93d33a854d1193d9aadeed 100644 (file)
@@ -7,5 +7,7 @@ use Drupal\hal\LinkManager\TypeLinkManagerInterface as MovedTypeLinkManagerInter
 /**
  * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This has
  *   been moved to the hal module. This exists solely for BC.
+ *
+ * @see https://www.drupal.org/node/2830467
  */
 interface TypeLinkManagerInterface extends MovedTypeLinkManagerInterface {}
index 4aa46b209f665f54f2a4a48dc04c619d33650d9a..3ba73331e97c90f89dcd3b77de33d7f94788be1d 100644 (file)
@@ -40,6 +40,8 @@ class ResourcePluginManager extends DefaultPluginManager {
    * @deprecated in Drupal 8.2.0.
    *   Use Drupal\rest\Plugin\Type\ResourcePluginManager::createInstance()
    *   instead.
+   *
+   * @see https://www.drupal.org/node/2874934
    */
   public function getInstance(array $options){
     if (isset($options['id'])) {
index ca6b14b76fb183624b154cfac9c30bfb30914028..e705de4177d09c43da64f5de2b878c5d0deae346 100644 (file)
@@ -27,18 +27,21 @@ class RestServiceProvider implements ServiceProviderInterface {
     if (isset($modules['hal'])) {
       // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
       //   Use hal.link_manager instead.
+      // @see https://www.drupal.org/node/2830467
       $service_definition = new DefinitionDecorator(new Reference('hal.link_manager'));
       $service_definition->setClass(LinkManager::class);
       $container->setDefinition('rest.link_manager', $service_definition);
 
       // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
       //   Use hal.link_manager.type instead.
+      // @see https://www.drupal.org/node/2830467
       $service_definition = new DefinitionDecorator(new Reference('hal.link_manager.type'));
       $service_definition->setClass(TypeLinkManager::class);
       $container->setDefinition('rest.link_manager.type', $service_definition);
 
       // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
       //   Use hal.link_manager.relation instead.
+      // @see https://www.drupal.org/node/2830467
       $service_definition = new DefinitionDecorator(new Reference('hal.link_manager.relation'));
       $service_definition->setClass(RelationLinkManager::class);
       $container->setDefinition('rest.link_manager.relation', $service_definition);
index 8355f86cc5d1939d31f43c505fcae73b9ff2e23d..43a0e3d05e89efbad39874066d076acb9a27c669 100644 (file)
@@ -328,4 +328,37 @@ abstract class CommentResourceTestBase extends EntityResourceTestBase {
     }
   }
 
+  /**
+   * Tests POSTing a comment with and without 'skip comment approval'
+   */
+  public function testPostSkipCommentApproval() {
+    $this->initAuthentication();
+    $this->provisionEntityResource();
+    $this->setUpAuthorization('POST');
+
+    // Create request.
+    $request_options = [];
+    $request_options[RequestOptions::HEADERS]['Accept'] = static::$mimeType;
+    $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType;
+    $request_options = array_merge_recursive($request_options, $this->getAuthenticationRequestOptions('POST'));
+    $request_options[RequestOptions::BODY] = $this->serializer->encode($this->getNormalizedPostEntity(), static::$format);
+
+    $url = $this->getEntityResourcePostUrl()->setOption('query', ['_format' => static::$format]);
+
+    // Status should be FALSE when posting as anonymous.
+    $response = $this->request('POST', $url, $request_options);
+    $unserialized = $this->serializer->deserialize((string) $response->getBody(), get_class($this->entity), static::$format);
+    $this->assertResourceResponse(201, FALSE, $response);
+    $this->assertFalse($unserialized->getStatus());
+
+    // Grant anonymous permission to skip comment approval.
+    $this->grantPermissionsToTestedRole(['skip comment approval']);
+
+    // Status should be TRUE when posting as anonymous and skip comment approval.
+    $response = $this->request('POST', $url, $request_options);
+    $unserialized = $this->serializer->deserialize((string) $response->getBody(), get_class($this->entity), static::$format);
+    $this->assertResourceResponse(201, FALSE, $response);
+    $this->assertTrue($unserialized->getStatus());
+  }
+
 }
similarity index 97%
rename from web/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
rename to web/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php
index f36243e3d12c234a328c343d6e6042de0b64ee78..88a2aca62f74218a22ac82b3da94b616a7942485 100644 (file)
@@ -1,10 +1,5 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\Tests\simpletest\Unit\TestInfoParsingTest.
- */
-
 namespace Drupal\Tests\simpletest\Unit;
 
 use Composer\Autoload\ClassLoader;
@@ -19,7 +14,7 @@ use org\bovigo\vfs\vfsStream;
  * @coversDefaultClass \Drupal\simpletest\TestDiscovery
  * @group simpletest
  */
-class TestInfoParsingTest extends UnitTestCase {
+class TestDiscoveryTest extends UnitTestCase {
 
   /**
    * @covers ::getTestInfo
@@ -35,13 +30,13 @@ class TestInfoParsingTest extends UnitTestCase {
     $tests[] = [
       // Expected result.
       [
-        'name' => 'Drupal\Tests\simpletest\Unit\TestInfoParsingTest',
+        'name' => 'Drupal\Tests\simpletest\Unit\TestDiscoveryTest',
         'group' => 'simpletest',
         'description' => 'Tests \Drupal\simpletest\TestDiscovery.',
         'type' => 'PHPUnit-Unit',
       ],
       // Classname.
-      'Drupal\Tests\simpletest\Unit\TestInfoParsingTest',
+      'Drupal\Tests\simpletest\Unit\TestDiscoveryTest',
     ];
 
     // A core unit test.
@@ -366,26 +361,6 @@ EOF;
     ], $result);
   }
 
-}
-
-class TestTestDiscovery extends TestDiscovery {
-
-  /**
-   * @var \Drupal\Core\Extension\Extension[]
-   */
-  protected $extensions = [];
-
-  public function setExtensions(array $extensions) {
-    $this->extensions = $extensions;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExtensions() {
-    return $this->extensions;
-  }
-
   /**
    * @covers ::getPhpunitTestSuite
    * @dataProvider providerTestGetPhpunitTestSuite
@@ -413,6 +388,26 @@ class TestTestDiscovery extends TestDiscovery {
 
 }
 
+class TestTestDiscovery extends TestDiscovery {
+
+  /**
+   * @var \Drupal\Core\Extension\Extension[]
+   */
+  protected $extensions = [];
+
+  public function setExtensions(array $extensions) {
+    $this->extensions = $extensions;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getExtensions() {
+    return $this->extensions;
+  }
+
+}
+
 namespace Drupal\simpletest\Tests;
 
 use Drupal\simpletest\WebTestBase;
index 8fb369a37618e120e0e453a3be24dabb5a116446..8a250baf358884f2c7dd50531aaf7dcdff1f0a2f 100644 (file)
@@ -2,11 +2,16 @@
 
 namespace Drupal\system\Tests\Database;
 
+@trigger_error(__NAMESPACE__ . '\DatabaseWebTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Database\DatabaseTestBase', E_USER_DEPRECATED);
+
 use Drupal\KernelTests\Core\Database\DatabaseTestBase;
 use Drupal\simpletest\WebTestBase;
 
 /**
  * Base class for databases database tests.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead
+ *   use \Drupal\Tests\system\Functional\Database\DatabaseTestBase.
  */
 abstract class DatabaseWebTestBase extends WebTestBase {
 
index fce136684ee85c1aaabad91062344e66c5c098d8..cd7486cc73f92109c01ad8125d305985da322a79 100644 (file)
@@ -2,11 +2,16 @@
 
 namespace Drupal\system\Tests\Database;
 
+@trigger_error(__NAMESPACE__ . '\FakeRecord is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Database\FakeRecord', E_USER_DEPRECATED);
+
 /**
  * Fetches into a class.
  *
  * PDO supports using a new instance of an arbitrary class for records
  * rather than just a stdClass or array. This class is for testing that
  * functionality. (See testQueryFetchClass() below)
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead
+ *   use \Drupal\Tests\system\Functional\Database\FakeRecord.
  */
 class FakeRecord { }
index 0051e94117397d12ad58842680d718b77700092f..6c5ce54f24314e8ccf860ae121e1640895fa9228 100644 (file)
@@ -2,11 +2,18 @@
 
 namespace Drupal\system\Tests\Image;
 
+@trigger_error(__FILE__ . ' is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use Drupal\FunctionalTests\Image\ToolkitTestBase instead. See https://www.drupal.org/node/2862641.', E_USER_DEPRECATED);
+
 use Drupal\simpletest\WebTestBase;
 use Drupal\Component\Utility\SafeMarkup;
 
 /**
  * Base class for image manipulation testing.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
+ *   Use Drupal\FunctionalTests\Image\ToolkitTestBase instead.
+ *
+ * @see https://www.drupal.org/node/2862641
  */
 abstract class ToolkitTestBase extends WebTestBase {
 
index e5fa873d0969ec954e2b54ce62d5026e854f447e..cc9a09ca691bfcbf233ab9713f0d8b320ec1731f 100644 (file)
@@ -160,15 +160,6 @@ function entity_test_entity_base_field_info_alter(&$fields, EntityTypeInterface
   }
 }
 
-/**
- * Implements hook_entity_field_storage_info().
- */
-function entity_test_entity_field_storage_info(EntityTypeInterface $entity_type) {
-  if ($entity_type->id() == 'entity_test_update') {
-    return \Drupal::state()->get('entity_test_update.additional_field_storage_definitions', []);
-  }
-}
-
 /**
  * Creates a new bundle for entity_test entities.
  *
@@ -756,6 +747,16 @@ function entity_test_entity_access(EntityInterface $entity, $operation, AccountI
     return AccessResult::allowed();
   }
 
+  // Create specific labels to allow or deny access based on certain test
+  // conditions.
+  // @see \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest
+  if ($entity->label() == 'Accessible') {
+    return AccessResult::allowed();
+  }
+  if ($entity->label() == 'Inaccessible') {
+    return AccessResult::forbidden();
+  }
+
   // Uncacheable because the access result depends on a State key-value pair and
   // might therefore change at any time.
   $condition = \Drupal::state()->get("entity_test_entity_access.{$operation}." . $entity->id(), FALSE);
diff --git a/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoUuid.php b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoUuid.php
new file mode 100644 (file)
index 0000000..8d0ddac
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\entity_test\Entity;
+
+/**
+ * Test entity class with revisions but without UUIDs.
+ *
+ * @ContentEntityType(
+ *   id = "entity_test_no_uuid",
+ *   label = @Translation("Test entity without UUID"),
+ *   handlers = {
+ *     "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
+ *   },
+ *   base_table = "entity_test_no_uuid",
+ *   revision_table = "entity_test_no_uuid_revision",
+ *   admin_permission = "administer entity_test content",
+ *   persistent_cache = FALSE,
+ *   entity_keys = {
+ *     "id" = "id",
+ *     "revision" = "vid",
+ *     "bundle" = "type",
+ *     "label" = "name",
+ *     "langcode" = "langcode",
+ *   },
+ * )
+ */
+class EntityTestNoUuid extends EntityTest {
+
+}
diff --git a/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUpdate.php b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestUpdate.php
deleted file mode 100644 (file)
index 6d72f7a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-namespace Drupal\entity_test\Entity;
-
-use Drupal\Core\Entity\EntityTypeInterface;
-
-/**
- * Defines the test entity class for testing definition updates.
- *
- * This entity type starts out non-revisionable by lacking a "revision_id" key,
- * but during an update test, can be made revisionable by adding that key.
- *
- * @ContentEntityType(
- *   id = "entity_test_update",
- *   label = @Translation("Test entity update"),
- *   handlers = {
- *     "storage_schema" = "Drupal\entity_test\EntityTestStorageSchema"
- *   },
- *   base_table = "entity_test_update",
- *   revision_table = "entity_test_update_revision",
- *   persistent_cache = FALSE,
- *   entity_keys = {
- *     "id" = "id",
- *     "uuid" = "uuid",
- *     "bundle" = "type",
- *     "label" = "name",
- *     "langcode" = "langcode",
- *   }
- * )
- */
-class EntityTestUpdate extends EntityTestRev {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
-    $fields = parent::baseFieldDefinitions($entity_type);
-    $fields += \Drupal::state()->get('entity_test_update.additional_base_field_definitions', []);
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
-    $fields = parent::bundleFieldDefinitions($entity_type, $bundle, $base_field_definitions);
-    $fields += \Drupal::state()->get('entity_test_update.additional_bundle_field_definitions.' . $bundle, []);
-    return $fields;
-  }
-
-}
index 86ca5a9712c329fabc66d85f7b8528b42a044252..5b32eb8863f2cc758af448f370dbb6b1411c05de 100644 (file)
@@ -29,6 +29,15 @@ function entity_test_update_entity_base_field_info(EntityTypeInterface $entity_t
   }
 }
 
+/**
+ * Implements hook_entity_field_storage_info().
+ */
+function entity_test_update_entity_field_storage_info(EntityTypeInterface $entity_type) {
+  if ($entity_type->id() == 'entity_test_update') {
+    return \Drupal::state()->get('entity_test_update.additional_field_storage_definitions', []);
+  }
+}
+
 /**
  * Implements hook_entity_type_alter().
  */
index a28c786904882b26fde5704c56d368baba7b4653..a0f508041bd78d7b919fbadb8fd6b0d55a9913dd 100644 (file)
@@ -161,8 +161,8 @@ class TestToolkit extends ImageToolkitBase {
    * @param array $args
    *   Values passed to hook.
    *
-   * @see \Drupal\system\Tests\Image\ToolkitTestBase::imageTestReset()
-   * @see \Drupal\system\Tests\Image\ToolkitTestBase::imageTestGetAllCalls()
+   * @see \Drupal\Tests\system\Functional\Image\ToolkitTestBase::imageTestReset()
+   * @see \Drupal\Tests\system\Functional\Image\ToolkitTestBase::imageTestGetAllCalls()
    */
   protected function logCall($op, $args) {
     $results = $this->state->get('image_test.results') ?: [];
diff --git a/web/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php b/web/core/modules/system/tests/src/Functional/Database/DatabaseTestBase.php
new file mode 100644 (file)
index 0000000..a28c1db
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\Tests\system\Functional\Database;
+
+use Drupal\KernelTests\Core\Database\DatabaseTestBase as DatabaseKernelTestBase;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Base class for databases database tests.
+ */
+abstract class DatabaseTestBase extends BrowserTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['database_test'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    DatabaseKernelTestBase::addSampleData();
+  }
+
+}
diff --git a/web/core/modules/system/tests/src/Functional/Database/FakeRecord.php b/web/core/modules/system/tests/src/Functional/Database/FakeRecord.php
new file mode 100644 (file)
index 0000000..aa3a5fe
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace Drupal\Tests\system\Functional\Database;
+
+/**
+ * Fetches into a class.
+ *
+ * PDO supports using a new instance of an arbitrary class for records
+ * rather than just a stdClass or array. This class is for testing that
+ * functionality. (See testQueryFetchClass() below)
+ */
+class FakeRecord {}
similarity index 89%
rename from web/core/modules/system/src/Tests/Database/SelectPagerDefaultTest.php
rename to web/core/modules/system/tests/src/Functional/Database/SelectPagerDefaultTest.php
index a264d33ea6099915632e0e655cd4bcf8c093c716..63e7e3163775f8e425ce0cc36dd9a2e73e039a06 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-namespace Drupal\system\Tests\Database;
+namespace Drupal\Tests\system\Functional\Database;
+
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -8,7 +9,7 @@ use Symfony\Component\HttpFoundation\Request;
  *
  * @group Database
  */
-class SelectPagerDefaultTest extends DatabaseWebTestBase {
+class SelectPagerDefaultTest extends DatabaseTestBase {
 
   /**
    * Confirms that a pager query returns the correct results.
@@ -34,13 +35,13 @@ class SelectPagerDefaultTest extends DatabaseWebTestBase {
 
     for ($page = 0; $page <= $num_pages; ++$page) {
       $this->drupalGet('database_test/pager_query_even/' . $limit, ['query' => ['page' => $page]]);
-      $data = json_decode($this->getRawContent());
+      $data = json_decode($this->getSession()->getPage()->getContent());
 
       if ($page == $num_pages) {
         $correct_number = $count - ($limit * $page);
       }
 
-      $this->assertEqual(count($data->names), $correct_number, format_string('Correct number of records returned by pager: @number', ['@number' => $correct_number]));
+      $this->assertCount($correct_number, $data->names, format_string('Correct number of records returned by pager: @number', ['@number' => $correct_number]));
     }
   }
 
@@ -68,13 +69,13 @@ class SelectPagerDefaultTest extends DatabaseWebTestBase {
 
     for ($page = 0; $page <= $num_pages; ++$page) {
       $this->drupalGet('database_test/pager_query_odd/' . $limit, ['query' => ['page' => $page]]);
-      $data = json_decode($this->getRawContent());
+      $data = json_decode($this->getSession()->getPage()->getContent());
 
       if ($page == $num_pages) {
         $correct_number = $count - ($limit * $page);
       }
 
-      $this->assertEqual(count($data->names), $correct_number, format_string('Correct number of records returned by pager: @number', ['@number' => $correct_number]));
+      $this->assertCount($correct_number, $data->names, format_string('Correct number of records returned by pager: @number', ['@number' => $correct_number]));
     }
   }
 
similarity index 85%
rename from web/core/modules/system/src/Tests/Database/SelectTableSortDefaultTest.php
rename to web/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php
index 97a676b162826e113cb90afa7e35eafc3d1135d6..2904d31fa651f4f4f5dd37b9c1d638c97cbb405e 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 
-namespace Drupal\system\Tests\Database;
+namespace Drupal\Tests\system\Functional\Database;
 
 /**
  * Tests the tablesort query extender.
  *
  * @group Database
  */
-class SelectTableSortDefaultTest extends DatabaseWebTestBase {
+class SelectTableSortDefaultTest extends DatabaseTestBase {
 
   /**
    * Confirms that a tablesort query returns the correct results.
@@ -27,7 +27,7 @@ class SelectTableSortDefaultTest extends DatabaseWebTestBase {
 
     foreach ($sorts as $sort) {
       $this->drupalGet('database_test/tablesort/', ['query' => ['order' => $sort['field'], 'sort' => $sort['sort']]]);
-      $data = json_decode($this->getRawContent());
+      $data = json_decode($this->getSession()->getPage()->getContent());
 
       $first = array_shift($data->tasks);
       $last = array_pop($data->tasks);
@@ -55,7 +55,7 @@ class SelectTableSortDefaultTest extends DatabaseWebTestBase {
 
     foreach ($sorts as $sort) {
       $this->drupalGet('database_test/tablesort_first/', ['query' => ['order' => $sort['field'], 'sort' => $sort['sort']]]);
-      $data = json_decode($this->getRawContent());
+      $data = json_decode($this->getSession()->getPage()->getContent());
 
       $first = array_shift($data->tasks);
       $last = array_pop($data->tasks);
@@ -72,16 +72,18 @@ class SelectTableSortDefaultTest extends DatabaseWebTestBase {
    * are correct.
    */
   public function testTableSortDefaultSort() {
+    $assert = $this->assertSession();
+
     $this->drupalGet('database_test/tablesort_default_sort');
 
     // Verify that the table was displayed. Just the header is checked for
     // because if there were any fatal errors or exceptions in displaying the
     // sorted table, it would not print the table.
-    $this->assertText(t('Username'));
+    $assert->pageTextContains(t('Username'));
 
     // Verify that the header links are built properly.
-    $this->assertLinkByHref('database_test/tablesort_default_sort');
-    $this->assertPattern('/\<a.*title\=\"' . t('sort by Username') . '\".*\>/');
+    $assert->linkByHrefExists('database_test/tablesort_default_sort');
+    $assert->responseMatches('/\<a.*title\=\"' . t('sort by Username') . '\".*\>/');
   }
 
 }
similarity index 90%
rename from web/core/modules/system/src/Tests/Database/TemporaryQueryTest.php
rename to web/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
index d0dce74e46a252b0233fe86d3aef900e5df6cb22..52265857904accc14c5dd289a940598ee8cc3470 100644 (file)
@@ -1,18 +1,16 @@
 <?php
 
-namespace Drupal\system\Tests\Database;
+namespace Drupal\Tests\system\Functional\Database;
 
 /**
  * Tests the temporary query functionality.
  *
  * @group Database
  */
-class TemporaryQueryTest extends DatabaseWebTestBase {
+class TemporaryQueryTest extends DatabaseTestBase {
 
   /**
-   * Modules to enable.
-   *
-   * @var array
+   * {@inheritdoc}
    */
   public static $modules = ['database_test'];
 
@@ -28,7 +26,7 @@ class TemporaryQueryTest extends DatabaseWebTestBase {
    */
   public function testTemporaryQuery() {
     $this->drupalGet('database_test/db_query_temporary');
-    $data = json_decode($this->getRawContent());
+    $data = json_decode($this->getSession()->getPage()->getContent());
     if ($data) {
       $this->assertEqual($this->countTableRows('test'), $data->row_count, 'The temporary table contains the correct amount of rows.');
       $this->assertFalse(db_table_exists($data->table_name), 'The temporary table is, indeed, temporary.');
similarity index 63%
rename from web/core/modules/system/src/Tests/DrupalKernel/ContainerRebuildWebTest.php
rename to web/core/modules/system/tests/src/Functional/DrupalKernel/ContainerRebuildWebTest.php
index c87e3ad8eb0ecdc506fd54ecf2061046fa1dd2aa..828b92f2891341442847d94ceb57a6a4d406faa9 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\system\Tests\DrupalKernel;
+namespace Drupal\Tests\system\Functional\DrupalKernel;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Ensures that the container rebuild works as expected.
  *
  * @group DrupalKernel
  */
-class ContainerRebuildWebTest extends WebTestBase {
+class ContainerRebuildWebTest extends BrowserTestBase {
 
   /**
    * {@inheritdoc}
@@ -20,36 +20,40 @@ class ContainerRebuildWebTest extends WebTestBase {
    * Sets a different deployment identifier.
    */
   public function testSetContainerRebuildWithDifferentDeploymentIdentifier() {
+    $assert = $this->assertSession();
+
+    // Ensure the parameter is not set.
     $this->drupalGet('<front>');
-    $this->assertHeader('container_rebuild_indicator', FALSE);
+    $assert->responseHeaderEquals('container_rebuild_indicator', NULL);
 
     $this->writeSettings(['settings' => ['deployment_identifier' => (object) ['value' => 'new-identifier', 'required' => TRUE]]]);
 
     $this->drupalGet('<front>');
 
-    $this->assertHeader('container_rebuild_indicator', 'new-identifier');
+    $assert->responseHeaderEquals('container_rebuild_indicator', 'new-identifier');
   }
 
   /**
    * Tests container invalidation.
    */
   public function testContainerInvalidation() {
+    $assert = $this->assertSession();
 
     // Ensure that parameter is not set.
     $this->drupalGet('<front>');
-    $this->assertHeader('container_rebuild_test_parameter', FALSE);
+    $assert->responseHeaderEquals('container_rebuild_test_parameter', NULL);
 
     // Ensure that after setting the parameter, without a container rebuild the
     // parameter is still not set.
     $this->writeSettings(['settings' => ['container_rebuild_test_parameter' => (object) ['value' => 'rebuild_me_please', 'required' => TRUE]]]);
 
     $this->drupalGet('<front>');
-    $this->assertHeader('container_rebuild_test_parameter', FALSE);
+    $assert->responseHeaderEquals('container_rebuild_test_parameter', NULL);
 
     // Ensure that after container invalidation the parameter is set.
     \Drupal::service('kernel')->invalidateContainer();
     $this->drupalGet('<front>');
-    $this->assertHeader('container_rebuild_test_parameter', 'rebuild_me_please');
+    $assert->responseHeaderEquals('container_rebuild_test_parameter', 'rebuild_me_please');
   }
 
 }
diff --git a/web/core/modules/taxonomy/migration_templates/d6_taxonomy_term_translation.yml b/web/core/modules/taxonomy/migration_templates/d6_taxonomy_term_translation.yml
new file mode 100644 (file)
index 0000000..11af8cd
--- /dev/null
@@ -0,0 +1,39 @@
+id: d6_taxonomy_term_translation
+label: Taxonomy terms
+migration_tags:
+  - Drupal 6
+source:
+  plugin: d6_taxonomy_term
+  translations: true
+process:
+  # If you are using this file to build a custom migration consider removing
+  # the tid field to allow incremental migrations.
+  tid: tid
+  langcode: language
+  vid:
+    plugin: migration
+    migration: d6_taxonomy_vocabulary
+    source: vid
+  name: name
+  description: description
+  weight: weight
+  # Only attempt to stub real (non-zero) parents.
+  parent_id:
+    -
+      plugin: skip_on_empty
+      method: process
+      source: parent
+    -
+      plugin: migration
+      migration: d6_taxonomy_term
+  parent:
+    plugin: default_value
+    default_value: 0
+    source: '@parent_id'
+  changed: timestamp
+destination:
+  plugin: entity:taxonomy_term
+migration_dependencies:
+  required:
+    - d6_taxonomy_vocabulary
+    - d6_taxonomy_term
diff --git a/web/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary_translation.yml b/web/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary_translation.yml
new file mode 100644 (file)
index 0000000..dbb1793
--- /dev/null
@@ -0,0 +1,27 @@
+id: d6_taxonomy_vocabulary_translation
+label: Taxonomy vocabularies
+migration_tags:
+  - Drupal 6
+source:
+  plugin: d6_taxonomy_vocabulary_translation
+process:
+  vid:
+    -
+      plugin: machine_name
+      source: name
+    -
+      plugin: substr
+      length: 32
+  langcode: language
+  property:
+    plugin: static_map
+    source: property
+    map:
+      name: name
+      description: description
+  translation: translation
+destination:
+  plugin: entity:taxonomy_vocabulary
+migration_dependencies:
+  required:
+    - d6_taxonomy_vocabulary
index b8a603d0fed2b9632e4f13927e3b584dfa2330e4..9170cd8ae3ba92fdfbadfe55a6e977b741ddb942 100644 (file)
@@ -45,6 +45,10 @@ class Term extends DrupalSqlBase {
       'weight' => $this->t('Weight'),
       'parent' => $this->t("The Drupal term IDs of the term's parents."),
     ];
+    if (isset($this->configuration['translations'])) {
+      $fields['language'] = $this->t('The term language.');
+      $fields['trid'] = $this->t('Translation ID.');
+    }
     return $fields;
   }
 
diff --git a/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php b/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php
new file mode 100644 (file)
index 0000000..a6edd05
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\taxonomy\Plugin\migrate\source\d6;
+
+use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
+
+/**
+ * Drupal 6 vocabulary translations from source database.
+ *
+ * @MigrateSource(
+ *   id = "d6_taxonomy_vocabulary_translation",
+ *   source_provider = "taxonomy"
+ * )
+ */
+class VocabularyTranslation extends DrupalSqlBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    $query = $this->select('vocabulary', 'v')
+      ->fields('v', ['vid', 'name', 'description'])
+      ->fields('i18n', ['lid', 'type', 'property', 'objectid'])
+      ->fields('lt', ['lid', 'translation'])
+      ->condition('i18n.type', 'vocabulary');
+    $query->addField('lt', 'language', 'language');
+    // The i18n_strings table has two columns containing the object ID, objectid
+    // and objectindex. The objectid column is a text field. Therefore, for the
+    // join to work in PostgreSQL, use the objectindex field as this is numeric
+    // like the vid field.
+    $query->join('i18n_strings', 'i18n', 'v.vid = i18n.objectindex');
+    $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
+
+    return $query;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields() {
+    return [
+      'vid' => $this->t('The vocabulary ID.'),
+      'language' => $this->t('Language for this field.'),
+      'property' => $this->t('Name of property being translated.'),
+      'translation' => $this->t('Translation of either the title or explanation.'),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids['vid']['type'] = 'integer';
+    return $ids;
+  }
+
+}
index 838a9b02c90f0c121be860b5511bf359f5afaf25..b4f941da5b666d7f62dc15e9ebaea37b9224f4f3 100644 (file)
@@ -2,8 +2,11 @@
 
 namespace Drupal\taxonomy\Tests;
 
+@trigger_error(__NAMESPACE__ . '\TaxonomyTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase', E_USER_DEPRECATED);
+
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
 
 /**
  * Provides common helper methods for Taxonomy module tests.
index 744ab1b28b497c5a8feb6ff9cb0b65ce912370fb..8c4a6672703d8f542353fd57520c02cd3abb7fb4 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\taxonomy\Tests;
 
+@trigger_error(__NAMESPACE__ . '\TaxonomyTestTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait', E_USER_DEPRECATED);
+
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -9,6 +11,9 @@ use Drupal\taxonomy\Entity\Term;
 
 /**
  * Provides common helper methods for Taxonomy module tests.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
+ * Use \Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait
  */
 trait TaxonomyTestTrait {
 
index 3607fc6b0a52233df654f45849b365e0cc133f0c..644211714ac45d7b10575b81575a792426c407ba 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\taxonomy\Tests;
 
+@trigger_error(__NAMESPACE__ . '\TaxonomyTranslationTestTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\taxonomy\Functional\TaxonomyTranslationTestTrait', E_USER_DEPRECATED);
+
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -9,6 +11,9 @@ use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
  * Provides common testing base for translated taxonomy terms.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
+ *   Use \Drupal\Tests\taxonomy\Functional\TaxonomyTranslationTestTrait
  */
 trait TaxonomyTranslationTestTrait {
 
similarity index 94%
rename from web/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php
index 7d2ee2b639d3a83cccd18ef09947b1c40dcd4aae..504c0da6c411f17d4702399ab96f76bea26c0319 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 
 use Drupal\field\Entity\FieldConfig;
+use Drupal\Tests\TestFileCreationTrait;
 use Drupal\user\RoleInterface;
 use Drupal\file\Entity\File;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -14,6 +15,11 @@ use Drupal\field\Entity\FieldStorageConfig;
  */
 class TaxonomyImageTest extends TaxonomyTestBase {
 
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+    compareFiles as drupalCompareFiles;
+  }
+
   /**
    * Used taxonomy vocabulary.
    *
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/TaxonomyQueryAlterTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php
index e5e787bb59b527e4a9d2631b4516e8056210b85c..85310e9aa945a159f378e43f5732a8838fe21f16 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests that appropriate query tags are added.
  *
  * @group taxonomy
  */
-class TaxonomyQueryAlterTest extends WebTestBase {
+class TaxonomyQueryAlterTest extends BrowserTestBase {
 
   use TaxonomyTestTrait;
 
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php
index f69398833debe4716fe0e3d6bc8a4c8772c6e8e4..66782f3e7ab910354ee964ec556374d7b470078a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 
 /**
  * Ensures that the term pager works properly.
index ed8b95f60624c5f2360931955dd253ea1e86b109..fdbfccd30341c1badd0624b0f0f28023f71f37be 100644 (file)
@@ -4,7 +4,6 @@ namespace Drupal\Tests\taxonomy\Functional;
 
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\Tests\BrowserTestBase;
-use Drupal\taxonomy\Tests\TaxonomyTestTrait;
 
 /**
  * Provides common helper methods for Taxonomy module tests.
diff --git a/web/core/modules/taxonomy/tests/src/Functional/TaxonomyTestTrait.php b/web/core/modules/taxonomy/tests/src/Functional/TaxonomyTestTrait.php
new file mode 100644 (file)
index 0000000..db445e9
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Functional;
+
+use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Language\LanguageInterface;
+use Drupal\taxonomy\Entity\Vocabulary;
+use Drupal\taxonomy\Entity\Term;
+
+/**
+ * Provides common helper methods for Taxonomy module tests.
+ */
+trait TaxonomyTestTrait {
+
+  /**
+   * Returns a new vocabulary with random properties.
+   */
+  public function createVocabulary() {
+    // Create a vocabulary.
+    $vocabulary = Vocabulary::create([
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+      'weight' => mt_rand(0, 10),
+    ]);
+    $vocabulary->save();
+    return $vocabulary;
+  }
+
+  /**
+   * Returns a new term with random properties in vocabulary $vid.
+   *
+   * @param \Drupal\taxonomy\Entity\Vocabulary $vocabulary
+   *   The vocabulary object.
+   * @param array $values
+   *   (optional) An array of values to set, keyed by property name. If the
+   *   entity type has bundles, the bundle key has to be specified.
+   *
+   * @return \Drupal\taxonomy\Entity\Term
+   *   The new taxonomy term object.
+   */
+  public function createTerm(Vocabulary $vocabulary, $values = []) {
+    $filter_formats = filter_formats();
+    $format = array_pop($filter_formats);
+    $term = Term::create($values + [
+      'name' => $this->randomMachineName(),
+      'description' => [
+        'value' => $this->randomMachineName(),
+        // Use the first available text format.
+        'format' => $format->id(),
+      ],
+      'vid' => $vocabulary->id(),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ]);
+    $term->save();
+    return $term;
+  }
+
+}
diff --git a/web/core/modules/taxonomy/tests/src/Functional/TaxonomyTranslationTestTrait.php b/web/core/modules/taxonomy/tests/src/Functional/TaxonomyTranslationTestTrait.php
new file mode 100644 (file)
index 0000000..fc3cea7
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Functional;
+
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\language\Entity\ConfigurableLanguage;
+
+/**
+ * Provides common testing base for translated taxonomy terms.
+ */
+trait TaxonomyTranslationTestTrait {
+
+  use EntityReferenceTestTrait;
+
+  /**
+   * The vocabulary.
+   *
+   * @var \Drupal\taxonomy\Entity\Vocabulary;
+   */
+  protected $vocabulary;
+
+  /**
+   * The field name for our taxonomy term field.
+   *
+   * @var string
+   */
+  protected $termFieldName = 'field_tag';
+
+  /**
+   * The langcode of the source language.
+   *
+   * @var string
+   */
+  protected $baseLangcode = 'en';
+
+  /**
+   * Target langcode for translation.
+   *
+   * @var string
+   */
+  protected $translateToLangcode = 'hu';
+
+  /**
+   * The node to check the translated value on.
+   *
+   * @var \Drupal\node\Entity\Node
+   */
+  protected $node;
+
+  /**
+   * Adds additional languages.
+   */
+  protected function setupLanguages() {
+    ConfigurableLanguage::createFromLangcode($this->translateToLangcode)->save();
+    $this->rebuildContainer();
+  }
+
+  /**
+   * Enables translations where it needed.
+   */
+  protected function enableTranslation() {
+    // Enable translation for the current entity type and ensure the change is
+    // picked up.
+    \Drupal::service('content_translation.manager')->setEnabled('node', 'article', TRUE);
+    \Drupal::service('content_translation.manager')->setEnabled('taxonomy_term', $this->vocabulary->id(), TRUE);
+    drupal_static_reset();
+    \Drupal::entityManager()->clearCachedDefinitions();
+    \Drupal::service('router.builder')->rebuild();
+    \Drupal::service('entity.definition_update_manager')->applyUpdates();
+  }
+
+  /**
+   * Adds term reference field for the article content type.
+   *
+   * @param bool $translatable
+   *   (optional) If TRUE, create a translatable term reference field. Defaults
+   *   to FALSE.
+   */
+  protected function setUpTermReferenceField() {
+    $handler_settings = [
+      'target_bundles' => [
+        $this->vocabulary->id() => $this->vocabulary->id(),
+      ],
+      'auto_create' => TRUE,
+    ];
+    $this->createEntityReferenceField('node', 'article', $this->termFieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
+    $field_storage = FieldStorageConfig::loadByName('node', $this->termFieldName);
+    $field_storage->setTranslatable(FALSE);
+    $field_storage->save();
+
+    entity_get_form_display('node', 'article', 'default')
+      ->setComponent($this->termFieldName, [
+        'type' => 'entity_reference_autocomplete_tags',
+      ])
+      ->save();
+    entity_get_display('node', 'article', 'default')
+      ->setComponent($this->termFieldName, [
+        'type' => 'entity_reference_label',
+      ])
+      ->save();
+  }
+
+}
index c5df74dadea2d8362829ab76a611c7136ea2b05e..dfd5e51f0b40e9b61055a9f0a6ddf7072b93cfa0 100644 (file)
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\taxonomy\Functional;
 
 use Drupal\node\Entity\Node;
-use Drupal\taxonomy\Tests\TaxonomyTranslationTestTrait;
 
 /**
  * Tests the translation of taxonomy terms field on nodes.
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
rename to web/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php
index 43edc156bb4a064ba393d3e650a13f93dd9e4070..0d24b6990e7bf9af33618ff5f3cedafbba3a6970 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 
-use Drupal\content_translation\Tests\ContentTranslationUITestBase;
+use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\taxonomy\Entity\Vocabulary;
 
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/ThemeTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php
index 8995c809a65c4de6709deb6e4c3991e838a4327f..43ed72c9eeceb9f75715d49ab27041cdf09ceae8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 
 /**
  * Verifies that various taxonomy pages use the expected theme.
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/ArgumentValidatorTermTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php
index 1630e0f0a5b7062becbf07a1a1bc24686ec11187..a7ac9b866190c7114ff9176d980c8a1128145dc3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\views\Views;
 
@@ -47,8 +47,8 @@ class ArgumentValidatorTermTest extends TaxonomyTestBase {
    */
   public static $testViews = ['test_argument_validator_term'];
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Add three terms to the 'tags' vocabulary.
     for ($i = 0; $i < 3; $i++) {
similarity index 98%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyDefaultArgumentTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyDefaultArgumentTest.php
index 8b263b4f6192f962a9ce143684af7038901a0eba..82646c03c065ef5a3c57a661ee5bd8c5744be374 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\views\Views;
similarity index 86%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldAllTermsTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
index 41780412c32c4e91ef9277378511dc09933dde41..ce70c72cc6ee8db443f80c3ea2a7e0c73bd75be8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\views\Views;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -30,14 +30,14 @@ class TaxonomyFieldAllTermsTest extends TaxonomyTestBase {
 
     $actual = $this->xpath('//a[@href="' . $this->term1->url() . '"]');
     $this->assertEqual(count($actual), 2, 'Correct number of taxonomy term1 links');
-    $this->assertEqual($actual[0]->__toString(), $this->term1->label());
-    $this->assertEqual($actual[1]->__toString(), $this->term1->label());
+    $this->assertEqual($actual[0]->getText(), $this->term1->label());
+    $this->assertEqual($actual[1]->getText(), $this->term1->label());
     $this->assertEscaped($this->term1->label());
 
     $actual = $this->xpath('//a[@href="' . $this->term2->url() . '"]');
     $this->assertEqual(count($actual), 2, 'Correct number of taxonomy term2 links');
-    $this->assertEqual($actual[0]->__toString(), $this->term2->label());
-    $this->assertEqual($actual[1]->__toString(), $this->term2->label());
+    $this->assertEqual($actual[0]->getText(), $this->term2->label());
+    $this->assertEqual($actual[1]->getText(), $this->term2->label());
   }
 
   /**
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php
index 86f67ff3de89f14af915405f05d597a90474ecc0..1b8bbcaa517e9af1dbb38d4db2f97ea9a73bf32a 100644 (file)
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\views\Views;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -45,8 +45,8 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
    */
   public $termNames = [];
 
-  public function setUp() {
-    parent::setUp();
+  public function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Add two new languages.
     ConfigurableLanguage::createFromLangcode('fr')->save();
similarity index 94%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldTidTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldTidTest.php
index b068f083a1f676c1a4d5944514b6f4b436a30210..0a44d4cb2ea15aa55f479875de890c9ab16bc1c5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\Core\Render\RenderContext;
 use Drupal\views\Views;
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidFilterTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidFilterTest.php
index aa5054feb3136b3a1b2f6cb7127e9a91e95d84b5..6fd1eba865874c3b2544b8717a70824dfbfd0a05 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\taxonomy\Entity\Term;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -34,7 +34,7 @@ class TaxonomyIndexTidFilterTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp($import_test_views = TRUE) {
     parent::setUp(FALSE);
 
     // Setup vocabulary and terms so the initial import is valid.
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php
index efa51916ddcb42d48651cde0d3427896f8606f58..4de73705d991e2bb13133f7c3d0b94e04c8d818d 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\taxonomy\Entity\Term;
 use Drupal\taxonomy\Entity\Vocabulary;
+use Drupal\Tests\views_ui\Functional\UITestBase;
 use Drupal\views\Tests\ViewTestData;
-use Drupal\views_ui\Tests\UITestBase;
 use Drupal\views\Entity\View;
 
 /**
@@ -43,8 +43,8 @@ class TaxonomyIndexTidUiTest extends UITestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $this->adminUser = $this->drupalCreateUser(['administer taxonomy', 'administer views']);
     $this->drupalLogin($this->adminUser);
@@ -93,10 +93,9 @@ class TaxonomyIndexTidUiTest extends UITestBase {
       for ($j = 0; $j <= $i; $j++) {
         $option = $result[$counter++];
         $prefix = $this->terms[$i][$j]->parent->target_id ? '-' : '';
-        $attributes = $option->attributes();
-        $tid = (string) $attributes->value;
+        $tid = $option->getAttribute('value');
 
-        $this->assertEqual($prefix . $this->terms[$i][$j]->getName(), (string) $option);
+        $this->assertEqual($prefix . $this->terms[$i][$j]->getName(), $option->getText());
         $this->assertEqual($this->terms[$i][$j]->id(), $tid);
       }
     }
@@ -108,7 +107,7 @@ class TaxonomyIndexTidUiTest extends UITestBase {
     $display['display_options']['filters']['tid']['type'] = 'textfield';
     $view->save();
     $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
-    $this->assertFieldByXPath('//input[@id="edit-options-value"]');
+    $this->assertFieldById('edit-options-value', NULL);
 
     // Tests \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::calculateDependencies().
     $expected = [
similarity index 81%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyParentUITest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php
index a57a09a7ad6bb7d3f609c9105c48993eccc88000..d8ab8ea121165cd4a3b72a0123d2aa5d57ce0044 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\views\Tests\ViewTestData;
-use Drupal\views_ui\Tests\UITestBase;
+use Drupal\Tests\views_ui\Functional\UITestBase;
 
 /**
  * Tests views taxonomy parent plugin UI.
@@ -30,8 +30,8 @@ class TaxonomyParentUITest extends UITestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(get_class($this), ['taxonomy_test_views']);
   }
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyRelationshipTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
index 7024e64b44c6066bc69ca7c333ff2b299f32d7dc..03be3e15bb389da446595136f76bc6cc67a80e12 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\node\NodeInterface;
 use Drupal\taxonomy\TermInterface;
@@ -30,8 +30,8 @@ class TaxonomyRelationshipTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Make term2 parent of term1.
     $this->term1->set('parent', $this->term2->id());
similarity index 89%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermArgumentDepthTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php
index 311118dfea0a532771aa801da42889ca3425fc5f..3505784a078599c9455b31dbb5e06280ed982ff9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 /**
  * Tests the taxonomy term with depth argument.
@@ -32,8 +32,8 @@ class TaxonomyTermArgumentDepthTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Create a term with markup in the label.
     $first = $this->createTerm(['name' => '<em>First</em>']);
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermFilterDepthTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php
index 10ccad260ef4199c22e0a074ac95f1ad0268871a..4d7a4fdf03c69cab15c92409f959c88f4cd1cb2f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\views\Views;
 
@@ -34,8 +34,8 @@ class TaxonomyTermFilterDepthTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Create a hierarchy 3 deep. Note the parent setup function creates two
     // top-level terms w/o children.
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
index bfd65cf46fdc70090a16f7fa69033a86eeecbfe6..15f47231ca5475bf098663478bcd4fa46fbefde2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
@@ -40,8 +40,8 @@ class TaxonomyTermViewTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Create an administrative user.
     $this->adminUser = $this->drupalCreateUser(['administer taxonomy', 'bypass node access']);
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php
index 6ff5514188e9d6453389ca2c9a301aaf04c0e4af..a2d8ec14a380545f77b3c81c98bfdd5122b9a215 100644 (file)
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
-use Drupal\views\Tests\ViewTestBase;
+use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\taxonomy\Entity\Term;
similarity index 92%
rename from web/core/modules/taxonomy/src/Tests/Views/TaxonomyVocabularyArgumentTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
index 532335f1977b5aeb9d2e809935f92965b7b3a6e3..8b1d58cf29e6c706478b85586c88f257fb40a98f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\taxonomy\Entity\Vocabulary;
 
@@ -36,8 +36,8 @@ class TaxonomyVocabularyArgumentTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     // Add default vocabulary to list of vocabularies.
     $this->vocabularies[] = $this->vocabulary;
similarity index 96%
rename from web/core/modules/taxonomy/src/Tests/Views/TermNameFieldTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/Views/TermNameFieldTest.php
index 98d1ab4b48f435bd2047fecdc91236021da2408d..6fbe0c0b2b5d33efdb17f47a1cb7373eacb53fc2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests\Views;
+namespace Drupal\Tests\taxonomy\Functional\Views;
 
 use Drupal\views\Views;
 
similarity index 97%
rename from web/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
rename to web/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
index 89c7a67f55478a70588cb673e6c8ab49c0754468..80ea2d7585032002f677cb65ade21c7f3749f342 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\taxonomy\Tests;
+namespace Drupal\Tests\taxonomy\Functional;
 use Drupal\Component\Utility\Unicode;
 
 use Drupal\Core\Url;
@@ -78,7 +78,6 @@ class VocabularyUiTest extends TaxonomyTestBase {
 
     $site_name = $this->config('system.site')->get('name');
     $this->assertTitle(t('Don\'t Panic | @site-name', ['@site-name' => $site_name]), 'The page title contains the escaped character.');
-    $this->assertNoTitle(t('Don&#039;t Panic | @site-name', ['@site-name' => $site_name]), 'The page title does not contain an encoded character.');
   }
 
   /**
index 125283355ee2e0362d24b9618384521b9eed4a4c..12b9a9cd1d4414aaa9ea0f97f6f062a8cbc2b9c9 100644 (file)
@@ -36,18 +36,21 @@ class MigrateTaxonomyTermTest extends MigrateDrupal6TestBase {
         'vid' => 'vocabulary_1_i_0_',
         'weight' => 0,
         'parent' => [0],
+        'language' => 'zu',
       ],
       '2' => [
         'source_vid' => 2,
         'vid' => 'vocabulary_2_i_1_',
         'weight' => 3,
         'parent' => [0],
+        'language' => 'fr',
       ],
       '3' => [
         'source_vid' => 2,
         'vid' => 'vocabulary_2_i_1_',
         'weight' => 4,
         'parent' => [2],
+        'language' => 'fr',
       ],
       '4' => [
         'source_vid' => 3,
@@ -83,8 +86,9 @@ class MigrateTaxonomyTermTest extends MigrateDrupal6TestBase {
     foreach ($expected_results as $tid => $values) {
       /** @var Term $term */
       $term = $terms[$tid];
-      $this->assertIdentical("term {$tid} of vocabulary {$values['source_vid']}", $term->name->value);
-      $this->assertIdentical("description of term {$tid} of vocabulary {$values['source_vid']}", $term->description->value);
+      $language = isset($values['language']) ? $values['language'] . ' - ' : '';
+      $this->assertSame("{$language}term {$tid} of vocabulary {$values['source_vid']}", $term->name->value);
+      $this->assertSame("{$language}description of term {$tid} of vocabulary {$values['source_vid']}", $term->description->value);
       $this->assertIdentical($values['vid'], $term->vid->target_id);
       $this->assertIdentical((string) $values['weight'], $term->weight->value);
       if ($values['parent'] === [0]) {
diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php
new file mode 100644 (file)
index 0000000..d21ad1e
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
+
+use Drupal\taxonomy\Entity\Term;
+use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
+use Drupal\taxonomy\TermInterface;
+
+/**
+ * Test migration of translated taxonomy terms.
+ *
+ * @group migrate_drupal_6
+ */
+class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = [
+    'language',
+    'menu_ui',
+    'node',
+    'taxonomy',
+  ];
+
+  /**
+   * The cached taxonomy tree items, keyed by vid and tid.
+   *
+   * @var array
+   */
+  protected $treeData = [];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->installEntitySchema('taxonomy_term');
+    $this->installConfig(static::$modules);
+    $this->executeMigrations([
+      'd6_node_type',
+      'd6_field',
+      'd6_taxonomy_vocabulary',
+      'd6_field_instance',
+      'd6_taxonomy_term',
+      'd6_taxonomy_term_translation',
+    ]);
+  }
+
+  /**
+   * Validate a migrated term contains the expected values.
+   *
+   * @param int $id
+   *   Entity ID to load and check.
+   * @param string $expected_language
+   *   The language code for this term.
+   * @param string $expected_label
+   *   The label the migrated entity should have.
+   * @param string $expected_vid
+   *   The parent vocabulary the migrated entity should have.
+   * @param string $expected_description
+   *   The description the migrated entity should have.
+   * @param string $expected_format
+   *   The format the migrated entity should have.
+   * @param int $expected_weight
+   *   The weight the migrated entity should have.
+   * @param array $expected_parents
+   *   The parent terms the migrated entity should have.
+   * @param int $expected_field_integer_value
+   *   The value the migrated entity field should have.
+   * @param int $expected_term_reference_tid
+   *   The term reference ID the migrated entity field should have.
+   */
+  protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL) {
+    /** @var \Drupal\taxonomy\TermInterface $entity */
+    $entity = Term::load($id);
+    $this->assertInstanceOf(TermInterface::class, $entity);
+    $this->assertSame($expected_language, $entity->language()->getId());
+    $this->assertSame($expected_label, $entity->label());
+    $this->assertSame($expected_vid, $entity->getVocabularyId());
+    $this->assertSame($expected_description, $entity->getDescription());
+    $this->assertSame($expected_format, $entity->getFormat());
+    $this->assertSame($expected_weight, $entity->getWeight());
+    $this->assertHierarchy($expected_vid, $id, $expected_parents);
+  }
+
+  /**
+   * Assert that a term is present in the tree storage, with the right parents.
+   *
+   * @param string $vid
+   *   Vocabulary ID.
+   * @param int $tid
+   *   ID of the term to check.
+   * @param array $parent_ids
+   *   The expected parent term IDs.
+   */
+  protected function assertHierarchy($vid, $tid, array $parent_ids) {
+    if (!isset($this->treeData[$vid])) {
+      $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
+      $this->treeData[$vid] = [];
+      foreach ($tree as $item) {
+        $this->treeData[$vid][$item->tid] = $item;
+      }
+    }
+
+    $this->assertArrayHasKey($tid, $this->treeData[$vid], "Term $tid exists in taxonomy tree");
+    $term = $this->treeData[$vid][$tid];
+    $this->assertEquals($parent_ids, array_filter($term->parents), "Term $tid has correct parents in taxonomy tree");
+  }
+
+  /**
+   * Tests the Drupal 6 i18n taxonomy term to Drupal 8 migration.
+   */
+  public function testTranslatedTaxonomyTerms() {
+    $this->assertEntity(1, 'zu', 'zu - term 1 of vocabulary 1', 'vocabulary_1_i_0_', 'zu - description of term 1 of vocabulary 1', NULL, '0', []);
+    $this->assertEntity(2, 'fr', 'fr - term 2 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 2 of vocabulary 2', NULL, '3', []);
+    $this->assertEntity(3, 'fr', 'fr - term 3 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 3 of vocabulary 2', NULL, '4', ['2']);
+    $this->assertEntity(4, 'en', 'term 4 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 4 of vocabulary 3', NULL, '6', []);
+    $this->assertEntity(5, 'en', 'term 5 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 5 of vocabulary 3', NULL, '7', ['4']);
+    $this->assertEntity(6, 'en', 'term 6 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 6 of vocabulary 3', NULL, '8', ['4', '5']);
+    $this->assertEntity(7, 'fr', 'fr - term 2 of vocabulary 1', 'vocabulary_1_i_0_', 'fr - desc of term 2 vocab 1', NULL, '0', []);
+  }
+
+}
diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php
new file mode 100644 (file)
index 0000000..3993abb
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
+
+use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
+
+/**
+ * Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.
+ *
+ * @group migrate_drupal_6
+ */
+class MigrateTaxonomyVocabularyTranslationTest extends MigrateDrupal6TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['language', 'taxonomy'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->executeMigrations([
+      'd6_taxonomy_vocabulary',
+      'd6_taxonomy_vocabulary_translation',
+    ]);
+  }
+
+  /**
+   * Tests the Drupal 6 i18n taxonomy vocabularies to Drupal 8 migration.
+   */
+  public function testTaxonomyVocabularyTranslation() {
+    $language_manager = \Drupal::service('language_manager');
+    $config = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabulary_1_i_0_');
+    $this->assertSame('fr - vocabulary 1 (i=0)', $config->get('name'));
+    $config = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabulary_2_i_1_');
+    $this->assertSame('fr - vocabulary 2 (i=1)', $config->get('name'));
+    $config = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabulary_3_i_2_');
+    $this->assertSame('fr - vocabulary 3 (i=2)', $config->get('name'));
+    $config = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabulary_name_much_longer_than');
+    $this->assertSame('Nom de vocabulaire beaucoup plus long que trente-deux caractères', $config->get('name'));
+    $config = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.tags');
+    $this->assertSame('fr - Tags', $config->get('name'));
+  }
+
+}
diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php
new file mode 100644 (file)
index 0000000..af69e30
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests taxonomy term source plugin.
+ *
+ * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\Term
+ * @group taxonomy
+ */
+class TermTranslationTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['taxonomy', 'migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['term_data'] = [
+      [
+        'tid' => 1,
+        'vid' => 5,
+        'name' => 'name value 1',
+        'description' => 'description value 1',
+        'weight' => 0,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 2,
+        'vid' => 6,
+        'name' => 'name value 2',
+        'description' => 'description value 2',
+        'weight' => 0,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 3,
+        'vid' => 6,
+        'name' => 'name value 3',
+        'description' => 'description value 3',
+        'weight' => 0,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 4,
+        'vid' => 5,
+        'name' => 'name value 4',
+        'description' => 'description value 4',
+        'weight' => 1,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 5,
+        'vid' => 6,
+        'name' => 'name value 5',
+        'description' => 'description value 5',
+        'weight' => 1,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 6,
+        'vid' => 6,
+        'name' => 'name value 6',
+        'description' => 'description value 6',
+        'weight' => 0,
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 10,
+        'vid' => 6,
+        'name' => 'zu - name value 2',
+        'description' => 'zu - description value 2',
+        'weight' => 0,
+        'language' => 'zu',
+        'trid' => 0,
+      ],
+    ];
+    $tests[0]['source_data']['term_hierarchy'] = [
+      [
+        'tid' => 1,
+        'parent' => 0,
+      ],
+      [
+        'tid' => 2,
+        'parent' => 0,
+      ],
+      [
+        'tid' => 3,
+        'parent' => 0,
+      ],
+      [
+        'tid' => 4,
+        'parent' => 1,
+      ],
+      [
+        'tid' => 5,
+        'parent' => 2,
+      ],
+      [
+        'tid' => 6,
+        'parent' => 3,
+      ],
+      [
+        'tid' => 6,
+        'parent' => 2,
+      ],
+      [
+        'tid' => 10,
+        'parent' => 0,
+      ],
+    ];
+
+    // The expected results.
+    $tests[0]['expected_data'] = [
+      [
+        'tid' => 1,
+        'vid' => 5,
+        'name' => 'name value 1',
+        'description' => 'description value 1',
+        'weight' => 0,
+        'parent' => [0],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 10,
+        'vid' => 6,
+        'name' => 'zu - name value 2',
+        'description' => 'zu - description value 2',
+        'weight' => 0,
+        'parent' => [0],
+        'language' => 'zu',
+        'trid' => 0,
+      ],
+      [
+        'tid' => 2,
+        'vid' => 6,
+        'name' => 'name value 2',
+        'description' => 'description value 2',
+        'weight' => 0,
+        'parent' => [0],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 3,
+        'vid' => 6,
+        'name' => 'name value 3',
+        'description' => 'description value 3',
+        'weight' => 0,
+        'parent' => [0],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 4,
+        'vid' => 5,
+        'name' => 'name value 4',
+        'description' => 'description value 4',
+        'weight' => 1,
+        'parent' => [1],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 5,
+        'vid' => 6,
+        'name' => 'name value 5',
+        'description' => 'description value 5',
+        'weight' => 1,
+        'parent' => [2],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+      [
+        'tid' => 6,
+        'vid' => 6,
+        'name' => 'name value 6',
+        'description' => 'description value 6',
+        'weight' => 0,
+        'parent' => [3, 2],
+        'language' => NULL,
+        'trid' => 0,
+      ],
+    ];
+
+    $tests[0]['expected_count'] = NULL;
+
+    return $tests;
+  }
+
+}
diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php
new file mode 100644 (file)
index 0000000..e54eb6e
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests D6 i18n vocabulary source plugin.
+ *
+ * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation
+ * @group taxonomy
+ */
+class VocabularyTranslationTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['taxonomy', 'migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0][0]['i18n_strings'] = [
+      [
+        'lid' => 1,
+        'objectid' => 1,
+        'type' => 'vocabulary',
+        'property' => 'name',
+        'objectindex' => 1,
+        'format' => 0,
+      ],
+      [
+        'lid' => 2,
+        'objectid' => 2,
+        'type' => 'vocabulary',
+        'property' => 'name',
+        'objectindex' => 2,
+        'format' => 0,
+      ],
+    ];
+
+    $tests[0][0]['locales_target'] = [
+      [
+        'lid' => 1,
+        'language' => 'fr',
+        'translation' => 'fr - vocabulary 1',
+        'plid' => 0,
+        'plural' => 0,
+        'i18n_status' => 0,
+      ],
+      [
+        'lid' => 2,
+        'language' => 'fr',
+        'translation' => 'fr - vocabulary 2',
+        'plid' => 0,
+        'plural' => 0,
+        'i18n_status' => 0,
+      ],
+    ];
+
+    $tests[0][0]['vocabulary'] = [
+      [
+        'vid' => 1,
+        'name' => 'vocabulary 1',
+        'description' => 'description of vocabulary 1',
+        'help' => 1,
+        'relations' => 1,
+        'hierarchy' => 1,
+        'multiple' => 0,
+        'required' => 0,
+        'tags' => 0,
+        'module' => 'taxonomy',
+        'weight' => 4,
+        'language' => '',
+      ],
+      [
+        'vid' => 2,
+        'name' => 'vocabulary 2',
+        'description' => 'description of vocabulary 2',
+        'help' => 1,
+        'relations' => 1,
+        'hierarchy' => 1,
+        'multiple' => 0,
+        'required' => 0,
+        'tags' => 0,
+        'module' => 'taxonomy',
+        'weight' => 5,
+        'language' => '',
+      ],
+    ];
+
+    $tests[0]['expected_results'] = [
+      [
+        'vid' => 1,
+        'name' => 'vocabulary 1',
+        'description' => 'description of vocabulary 1',
+        'lid' => '1',
+        'type' => 'vocabulary',
+        'property' => 'name',
+        'objectid' => '1',
+        'lt_lid' => '1',
+        'translation' => 'fr - vocabulary 1',
+        'language' => 'fr',
+      ],
+      [
+        'vid' => 2,
+        'name' => 'vocabulary 2',
+        'description' => 'description of vocabulary 2',
+        'lid' => '2',
+        'type' => 'vocabulary',
+        'property' => 'name',
+        'objectid' => '2',
+        'lt_lid' => '2',
+        'translation' => 'fr - vocabulary 2',
+        'language' => 'fr',
+      ],
+    ];
+    return $tests;
+  }
+
+}
index 0d70d840dabcc216cd4cefc15373dafed8a0a2df..832e5111bf187002254e29ef2baf9682344c98d8 100644 (file)
@@ -4,7 +4,7 @@ namespace Drupal\Tests\taxonomy\Kernel;
 
 use Drupal\taxonomy\Entity\Term;
 use Drupal\KernelTests\KernelTestBase;
-use Drupal\taxonomy\Tests\TaxonomyTestTrait;
+use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
 
 /**
  * Kernel tests for taxonomy term functions.
index fc39d1a3ccee598e39eceb6880980608ac236180..e243d0b867f35c15a16c7757eefec3c43d5adef3 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\update\Tests;
 
+@trigger_error(__NAMESPACE__ . '\UpdateTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\update\Functional\UpdateTestBase', E_USER_DEPRECATED);
+
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Url;
 use Drupal\simpletest\WebTestBase;
@@ -22,6 +24,9 @@ use Drupal\simpletest\WebTestBase;
  * (via the 'update_test_xml_map' variable), and then performs a series of
  * assertions that the report matches our expectations given the specific
  * initial state and availability scenario.
+ *
+ * @deprecated Scheduled for removal in Drupal 9.0.0.
+ *   Use \Drupal\Tests\update\Functional\UpdateTestBase instead.
  */
 abstract class UpdateTestBase extends WebTestBase {
 
@@ -58,7 +63,7 @@ abstract class UpdateTestBase extends WebTestBase {
    *   (optional) A string containing the URL to fetch update data from.
    *   Defaults to 'update-test'.
    *
-   * @see Drupal\update_test\Controller\UpdateTestController::updateTest()
+   * @see \Drupal\update_test\Controller\UpdateTestController::updateTest()
    */
   protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
     // Tell the Update Manager module to fetch from the URL provided by
similarity index 92%
rename from web/core/modules/update/src/Tests/FileTransferAuthorizeFormTest.php
rename to web/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
index 9d1819fca3d8c22faade8a92f45489bd3d3952ce..d768b06d81839a80d10a52b29f5bceebf6b48a37 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\update\Tests;
+namespace Drupal\Tests\update\Functional;
 
 /**
  * Tests the Update Manager module upload via authorize.php functionality.
@@ -23,7 +23,7 @@ class FileTransferAuthorizeFormTest extends UpdateTestBase {
 
     // Create a local cache so the module is not downloaded from drupal.org.
     $cache_directory = _update_manager_cache_directory(TRUE);
-    $validArchiveFile = __DIR__ . '/../../tests/update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
+    $validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
     copy($validArchiveFile, $cache_directory . '/update_test_new_module.tar.gz');
   }
 
similarity index 99%
rename from web/core/modules/update/src/Tests/UpdateContribTest.php
rename to web/core/modules/update/tests/src/Functional/UpdateContribTest.php
index 81f7117a3ac40ba30d1e8ef8bc68ec83781d8893..20d397cd48288dbb70ef219ecd69a4f2d0b1ed8a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\update\Tests;
+namespace Drupal\Tests\update\Functional;
 
 use Drupal\Core\Url;
 use Drupal\Core\Utility\ProjectInfo;
similarity index 98%
rename from web/core/modules/update/src/Tests/UpdateCoreTest.php
rename to web/core/modules/update/tests/src/Functional/UpdateCoreTest.php
index b6287c7c04d4eafc693952a0a5bb06ebb5105e94..5cd4b1026068653a6fd93feaa723b4c221b494a7 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\update\Tests;
+namespace Drupal\Tests\update\Functional;
 
 use Drupal\Core\Url;
+use Drupal\Tests\Traits\Core\CronRunTrait;
 
 /**
  * Tests the Update Manager module through a series of functional tests using
@@ -12,6 +13,8 @@ use Drupal\Core\Url;
  */
 class UpdateCoreTest extends UpdateTestBase {
 
+  use CronRunTrait;
+
   /**
    * Modules to enable.
    *
@@ -76,6 +79,7 @@ class UpdateCoreTest extends UpdateTestBase {
         $this->standardTests();
         $this->drupalGet('admin/reports/updates');
         $this->clickLink(t('Check manually'));
+        $this->checkForMetaRefresh();
         $this->assertNoText(t('Security update required!'));
         $this->assertRaw(\Drupal::l("8.$minor_version.1" . $extra_version, Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version-release")), 'Link to release appears.');
         $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version.tar.gz")), 'Link to download appears.');
@@ -139,6 +143,7 @@ class UpdateCoreTest extends UpdateTestBase {
           $this->standardTests();
           $this->drupalGet('admin/reports/updates');
           $this->clickLink(t('Check manually'));
+          $this->checkForMetaRefresh();
           $this->assertNoText(t('Security update required!'));
           $this->assertRaw(\Drupal::l('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release")), 'Link to release appears.');
           $this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz")), 'Link to download appears.');
@@ -226,6 +231,7 @@ class UpdateCoreTest extends UpdateTestBase {
 
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
+    $this->checkForMetaRefresh();
     $this->assertText(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
     $this->assertNoText(t('There are updates available for your version of Drupal.'));
@@ -247,6 +253,7 @@ class UpdateCoreTest extends UpdateTestBase {
 
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
+    $this->checkForMetaRefresh();
     $this->assertText(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
     $this->assertText(t('There are updates available for your version of Drupal.'));
@@ -268,6 +275,7 @@ class UpdateCoreTest extends UpdateTestBase {
 
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
+    $this->checkForMetaRefresh();
     $this->assertText(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
     $this->assertNoText(t('There are updates available for your version of Drupal.'));
similarity index 96%
rename from web/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
rename to web/core/modules/update/tests/src/Functional/UpdateDeleteFileIfStaleTest.php
index 99499d77c26a33ae12b2cab8948ba210780f4a3b..601a6cc2ff04b0f7b454643cca9df6bb22c57c96 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\update\Tests;
+namespace Drupal\Tests\update\Functional;
 
 /**
  * Tests the update_delete_file_if_stale() function.
diff --git a/web/core/modules/update/tests/src/Functional/UpdateTestBase.php b/web/core/modules/update/tests/src/Functional/UpdateTestBase.php
new file mode 100644 (file)
index 0000000..a4d07d0
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+namespace Drupal\Tests\update\Functional;
+
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Url;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Defines some shared functions used by all update tests.
+ *
+ * The overarching methodology of these tests is we need to compare a given
+ * state of installed modules and themes (e.g., version, project grouping,
+ * timestamps, etc) against a current state of what the release history XML
+ * files we fetch say is available. We have dummy XML files (in the
+ * core/modules/update/tests directory) that describe various scenarios of
+ * what's available for different test projects, and we have dummy .info file
+ * data (specified via hook_system_info_alter() in the update_test helper
+ * module) describing what's currently installed. Each test case defines a set
+ * of projects to install, their current state (via the
+ * 'update_test_system_info' variable) and the desired available update data
+ * (via the 'update_test_xml_map' variable), and then performs a series of
+ * assertions that the report matches our expectations given the specific
+ * initial state and availability scenario.
+ */
+abstract class UpdateTestBase extends BrowserTestBase {
+
+  protected function setUp() {
+    parent::setUp();
+
+    // Change the root path which Update Manager uses to install and update
+    // projects to be inside the testing site directory. See
+    // \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
+    // test child site.
+    $request = \Drupal::request();
+    $update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
+    $this->container->set('update.root', $update_root);
+    \Drupal::setContainer($this->container);
+
+    // Create the directories within the root path within which the Update
+    // Manager will install projects.
+    foreach (drupal_get_updaters() as $updater_info) {
+      $updater = $updater_info['class'];
+      $install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
+      if (!is_dir($install_directory)) {
+        mkdir($install_directory);
+      }
+    }
+  }
+
+  /**
+   * Refreshes the update status based on the desired available update scenario.
+   *
+   * @param $xml_map
+   *   Array that maps project names to availability scenarios to fetch. The key
+   *   '#all' is used if a project-specific mapping is not defined.
+   * @param $url
+   *   (optional) A string containing the URL to fetch update data from.
+   *   Defaults to 'update-test'.
+   *
+   * @see \Drupal\update_test\Controller\UpdateTestController::updateTest()
+   */
+  protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
+    // Tell the Update Manager module to fetch from the URL provided by
+    // update_test module.
+    $this->config('update.settings')->set('fetch.url', Url::fromUri('base:' . $url, ['absolute' => TRUE])->toString())->save();
+    // Save the map for UpdateTestController::updateTest() to use.
+    $this->config('update_test.settings')->set('xml_map', $xml_map)->save();
+    // Manually check the update status.
+    $this->drupalGet('admin/reports/updates');
+    $this->clickLink(t('Check manually'));
+    $this->checkForMetaRefresh();
+  }
+
+  /**
+   * Runs a series of assertions that are applicable to all update statuses.
+   */
+  protected function standardTests() {
+    $this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
+    $this->assertRaw(\Drupal::l(t('Drupal'), Url::fromUri('http://example.com/project/drupal')), 'Link to the Drupal project appears.');
+    $this->assertNoText(t('No available releases found'));
+  }
+
+}
similarity index 96%
rename from web/core/modules/update/src/Tests/UpdateUploadTest.php
rename to web/core/modules/update/tests/src/Functional/UpdateUploadTest.php
index 80d3f15d29f0ebd69e1fe63cc677241e69e4c49e..60966200629f20e1fe3f1d024f9e816d31c33042 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 
-namespace Drupal\update\Tests;
+namespace Drupal\Tests\update\Functional;
 
 use Drupal\Core\Extension\InfoParserDynamic;
 use Drupal\Core\Updater\Updater;
 use Drupal\Core\Url;
+use Drupal\Tests\TestFileCreationTrait;
 
 /**
  * Tests the Update Manager module's upload and extraction functionality.
@@ -13,6 +14,10 @@ use Drupal\Core\Url;
  */
 class UpdateUploadTest extends UpdateTestBase {
 
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+
   /**
    * Modules to enable.
    *
@@ -50,7 +55,7 @@ class UpdateUploadTest extends UpdateTestBase {
     // Check to ensure an existing module can't be reinstalled. Also checks that
     // the archive was extracted since we can't know if the module is already
     // installed until after extraction.
-    $validArchiveFile = __DIR__ . '/../../tests/aaa_update_test.tar.gz';
+    $validArchiveFile = __DIR__ . '/../../aaa_update_test.tar.gz';
     $edit = [
       'files[project_upload]' => $validArchiveFile,
     ];
@@ -63,7 +68,7 @@ class UpdateUploadTest extends UpdateTestBase {
     $moduleUpdater = $updaters['module']['class'];
     $installedInfoFilePath = $this->container->get('update.root') . '/' . $moduleUpdater::getRootDirectoryRelativePath() . '/update_test_new_module/update_test_new_module.info.yml';
     $this->assertFalse(file_exists($installedInfoFilePath), 'The new module does not exist in the filesystem before it is installed with the Update Manager.');
-    $validArchiveFile = __DIR__ . '/../../tests/update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
+    $validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
     $edit = [
       'files[project_upload]' => $validArchiveFile,
     ];
index 735c3de4e61435ae89cdcd5c3c5e620692d68813..a5bc10094bbf3edff4571e38fd7db932d0ea3fe6 100644 (file)
@@ -40,7 +40,7 @@ class UserData implements UserDataInterface {
       $query->condition('name', $name);
     }
     $result = $query->execute();
-    // If $module, $uid, and $name was passed, return the value.
+    // If $module, $uid, and $name were passed, return the value.
     if (isset($name) && isset($uid)) {
       $result = $result->fetchAllAssoc('uid');
       if (isset($result[$uid])) {
@@ -48,7 +48,7 @@ class UserData implements UserDataInterface {
       }
       return NULL;
     }
-    // If $module and $uid was passed, return the name/value pairs.
+    // If $module and $uid were passed, return data keyed by name.
     elseif (isset($uid)) {
       $return = [];
       foreach ($result as $record) {
@@ -56,7 +56,7 @@ class UserData implements UserDataInterface {
       }
       return $return;
     }
-    // If $module and $name was passed, return the uid/value pairs.
+    // If $module and $name were passed, return data keyed by uid.
     elseif (isset($name)) {
       $return = [];
       foreach ($result as $record) {
similarity index 88%
rename from web/core/modules/user/src/Tests/Views/AccessRoleUITest.php
rename to web/core/modules/user/tests/src/Functional/AccessRoleUITest.php
index bea8c53c603ffa626894171f1843e41416a92393..6c1004c9d432e7063f7e12b2053ca5b2782e362d 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\user\Tests\Views;
+namespace Drupal\Tests\user\Functional;
 
+use Drupal\Tests\views_ui\Functional\UITestBase;
 use Drupal\views\Tests\ViewTestData;
-use Drupal\views_ui\Tests\UITestBase;
 
 /**
  * Tests views role access plugin UI.
  *
  * @group user
- * @see Drupal\user\Plugin\views\access\Role
+ * @see \Drupal\user\Plugin\views\access\Role
  */
 class AccessRoleUITest extends UITestBase {
 
@@ -30,8 +30,8 @@ class AccessRoleUITest extends UITestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     ViewTestData::createTestViews(get_class($this), ['user_test_views']);
   }
index 29b97277c0b1ea8374633b5ca58c5b1a2fda0530..341aa7826d016bb60101596e12dcdc7f0ccc4c3b 100644 (file)
@@ -92,99 +92,102 @@ class UserLoginHttpTest extends BrowserTestBase {
    * Tests user session life cycle.
    */
   public function testLogin() {
+    // Without the serialization module only JSON is supported.
+    $this->doTestLogin('json');
+
+    // Enable serialization so we have access to additional formats.
+    $this->container->get('module_installer')->install(['serialization']);
+    $this->doTestLogin('json');
+    $this->doTestLogin('xml');
+    $this->doTestLogin('hal_json');
+  }
+
+  /**
+   * Do login testing for a given serialization format.
+   *
+   * @param string $format
+   *   Serialization format.
+   */
+  protected function doTestLogin($format) {
     $client = \Drupal::httpClient();
-    foreach ([FALSE, TRUE] as $serialization_enabled_option) {
-      if ($serialization_enabled_option) {
-        /** @var \Drupal\Core\Extension\ModuleInstaller $module_installer */
-        $module_installer = $this->container->get('module_installer');
-        $module_installer->install(['serialization']);
-        $formats = ['json', 'xml', 'hal_json'];
-      }
-      else {
-        // Without the serialization module only JSON is supported.
-        $formats = ['json'];
-      }
-      foreach ($formats as $format) {
-        // Create new user for each iteration to reset flood.
-        // Grant the user administer users permissions to they can see the
-        // 'roles' field.
-        $account = $this->drupalCreateUser(['administer users']);
-        $name = $account->getUsername();
-        $pass = $account->passRaw;
+    // Create new user for each iteration to reset flood.
+    // Grant the user administer users permissions to they can see the
+    // 'roles' field.
+    $account = $this->drupalCreateUser(['administer users']);
+    $name = $account->getUsername();
+    $pass = $account->passRaw;
 
-        $login_status_url = $this->getLoginStatusUrlString($format);
-        $response = $client->get($login_status_url);
-        $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_OUT);
+    $login_status_url = $this->getLoginStatusUrlString($format);
+    $response = $client->get($login_status_url);
+    $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_OUT);
 
-        // Flooded.
-        $this->config('user.flood')
-          ->set('user_limit', 3)
-          ->save();
+    // Flooded.
+    $this->config('user.flood')
+      ->set('user_limit', 3)
+      ->save();
 
-        $response = $this->loginRequest($name, 'wrong-pass', $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
+    $response = $this->loginRequest($name, 'wrong-pass', $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
 
-        $response = $this->loginRequest($name, 'wrong-pass', $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
+    $response = $this->loginRequest($name, 'wrong-pass', $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
 
-        $response = $this->loginRequest($name, 'wrong-pass', $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
+    $response = $this->loginRequest($name, 'wrong-pass', $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
 
-        $response = $this->loginRequest($name, 'wrong-pass', $format);
-        $this->assertHttpResponseWithMessage($response, 403, 'Too many failed login attempts from your IP address. This IP address is temporarily blocked.', $format);
+    $response = $this->loginRequest($name, 'wrong-pass', $format);
+    $this->assertHttpResponseWithMessage($response, 403, 'Too many failed login attempts from your IP address. This IP address is temporarily blocked.', $format);
 
-        // After testing the flood control we can increase the limit.
-        $this->config('user.flood')
-          ->set('user_limit', 100)
-          ->save();
+    // After testing the flood control we can increase the limit.
+    $this->config('user.flood')
+      ->set('user_limit', 100)
+      ->save();
 
-        $response = $this->loginRequest(NULL, NULL, $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.', $format);
+    $response = $this->loginRequest(NULL, NULL, $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.', $format);
 
-        $response = $this->loginRequest(NULL, $pass, $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.name.', $format);
+    $response = $this->loginRequest(NULL, $pass, $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.name.', $format);
 
-        $response = $this->loginRequest($name, NULL, $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.pass.', $format);
+    $response = $this->loginRequest($name, NULL, $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Missing credentials.pass.', $format);
 
-        // Blocked.
-        $account
-          ->block()
-          ->save();
+    // Blocked.
+    $account
+      ->block()
+      ->save();
 
-        $response = $this->loginRequest($name, $pass, $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'The user has not been activated or is blocked.', $format);
+    $response = $this->loginRequest($name, $pass, $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'The user has not been activated or is blocked.', $format);
 
-        $account
-          ->activate()
-          ->save();
+    $account
+      ->activate()
+      ->save();
 
-        $response = $this->loginRequest($name, 'garbage', $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
+    $response = $this->loginRequest($name, 'garbage', $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
 
-        $response = $this->loginRequest('garbage', $pass, $format);
-        $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
+    $response = $this->loginRequest('garbage', $pass, $format);
+    $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format);
 
-        $response = $this->loginRequest($name, $pass, $format);
-        $this->assertEquals(200, $response->getStatusCode());
-        $result_data = $this->serializer->decode($response->getBody(), $format);
-        $this->assertEquals($name, $result_data['current_user']['name']);
-        $this->assertEquals($account->id(), $result_data['current_user']['uid']);
-        $this->assertEquals($account->getRoles(), $result_data['current_user']['roles']);
-        $logout_token = $result_data['logout_token'];
+    $response = $this->loginRequest($name, $pass, $format);
+    $this->assertEquals(200, $response->getStatusCode());
+    $result_data = $this->serializer->decode($response->getBody(), $format);
+    $this->assertEquals($name, $result_data['current_user']['name']);
+    $this->assertEquals($account->id(), $result_data['current_user']['uid']);
+    $this->assertEquals($account->getRoles(), $result_data['current_user']['roles']);
+    $logout_token = $result_data['logout_token'];
 
-        $response = $client->get($login_status_url, ['cookies' => $this->cookies]);
-        $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_IN);
+    $response = $client->get($login_status_url, ['cookies' => $this->cookies]);
+    $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_IN);
 
-        $response = $this->logoutRequest($format, $logout_token);
-        $this->assertEquals(204, $response->getStatusCode());
+    $response = $this->logoutRequest($format, $logout_token);
+    $this->assertEquals(204, $response->getStatusCode());
 
-        $response = $client->get($login_status_url, ['cookies' => $this->cookies]);
-        $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_OUT);
+    $response = $client->get($login_status_url, ['cookies' => $this->cookies]);
+    $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_OUT);
 
-        $this->resetFlood();
-      }
-    }
+    $this->resetFlood();
   }
 
   /**
index 5ca694b84efdb5e0330014aad6a42df81b2ca207..1f460517dabb3c846751be89159163b4634d0769 100644 (file)
@@ -23,9 +23,9 @@ class AddRoleUserTest extends RoleUserTestBase {
       ->will($this->returnValue(TRUE));
 
     $config = ['rid' => 'test_role_1'];
-    $remove_role_plugin = new AddRoleUser($config, 'user_add_role_action', ['type' => 'user'], $this->userRoleEntityType);
+    $add_role_plugin = new AddRoleUser($config, 'user_add_role_action', ['type' => 'user'], $this->userRoleEntityType);
 
-    $remove_role_plugin->execute($this->account);
+    $add_role_plugin->execute($this->account);
   }
 
   /**
@@ -41,9 +41,9 @@ class AddRoleUserTest extends RoleUserTestBase {
       ->will($this->returnValue(FALSE));
 
     $config = ['rid' => 'test_role_1'];
-    $remove_role_plugin = new AddRoleUser($config, 'user_remove_role_action', ['type' => 'user'], $this->userRoleEntityType);
+    $add_role_plugin = new AddRoleUser($config, 'user_add_role_action', ['type' => 'user'], $this->userRoleEntityType);
 
-    $remove_role_plugin->execute($this->account);
+    $add_role_plugin->execute($this->account);
   }
 
 }
index c40cf857660712c67092cfb1d9c661b92cf3599f..d204766f28dba1801b6efc33c4d9024b6d45868f 100644 (file)
@@ -142,7 +142,7 @@ class ViewAjaxController implements ContainerInjectionInterface {
         throw new NotFoundHttpException();
       }
       $view = $this->executableFactory->get($entity);
-      if ($view && $view->access($display_id)) {
+      if ($view && $view->access($display_id) && $view->setDisplay($display_id) && $view->display_handler->getOption('use_ajax')) {
         $response->setView($view);
         // Fix the current path for paging.
         if (!empty($path)) {
index 48c59ef7093acecf82a45fc38656f5afd6ac018b..fb6b5bfd4d9c0d7742d2ab55ec8b91734e6f3b03 100644 (file)
@@ -321,9 +321,9 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
    * {@inheritdoc}
    */
   public function elementClasses($row_index = NULL) {
-    $classes = explode(' ', $this->options['element_class']);
+    $classes = $this->tokenizeValue($this->options['element_class'], $row_index);
+    $classes = explode(' ', $classes);
     foreach ($classes as &$class) {
-      $class = $this->tokenizeValue($class, $row_index);
       $class = Html::cleanCssIdentifier($class);
     }
     return implode(' ', $classes);
@@ -368,9 +368,9 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
    * {@inheritdoc}
    */
   public function elementLabelClasses($row_index = NULL) {
-    $classes = explode(' ', $this->options['element_label_class']);
+    $classes = $this->tokenizeValue($this->options['element_label_class'], $row_index);
+    $classes = explode(' ', $classes);
     foreach ($classes as &$class) {
-      $class = $this->tokenizeValue($class, $row_index);
       $class = Html::cleanCssIdentifier($class);
     }
     return implode(' ', $classes);
@@ -380,9 +380,9 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
    * {@inheritdoc}
    */
   public function elementWrapperClasses($row_index = NULL) {
-    $classes = explode(' ', $this->options['element_wrapper_class']);
+    $classes = $this->tokenizeValue($this->options['element_wrapper_class'], $row_index);
+    $classes = explode(' ', $classes);
     foreach ($classes as &$class) {
-      $class = $this->tokenizeValue($class, $row_index);
       $class = Html::cleanCssIdentifier($class);
     }
     return implode(' ', $classes);
index 60aa9bd3b207565c93c7cba7f066a8d0e49f921c..fe67d9beed285e259812326bb8177fe916dab10a 100644 (file)
@@ -19,9 +19,7 @@ namespace Drupal\views\Plugin\views\style;
 class DefaultStyle extends StylePluginBase {
 
   /**
-   * Does the style plugin allows to use style plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index 938c1b5236459fcaf925dec76f3adc6945280023..f33f7f9c4301fb32ebc5cb3d4202be8b800cf51c 100644 (file)
@@ -21,9 +21,7 @@ use Drupal\Core\Form\FormStateInterface;
 class Grid extends StylePluginBase {
 
   /**
-   * Does the style plugin allows to use style plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index a6df09d2b2790d1bc5680f5f70b5aa98411f2f56..519dff64b22040e7dd9ef929a1fcc93e4d76c4e0 100644 (file)
@@ -20,9 +20,7 @@ use Drupal\Core\Form\FormStateInterface;
 class HtmlList extends StylePluginBase {
 
   /**
-   * Does the style plugin allows to use style plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index 69679d3ce7bd734a47e230618bb45b5f279eb8ca..016405e4c151e6e538df5958afa46aca7eb83ae5 100644 (file)
@@ -20,9 +20,7 @@ use Drupal\Core\Url;
 class Opml extends StylePluginBase {
 
   /**
-   * Does the style plugin for itself support to add fields to its output.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index b7efa578d75b1c749be405761c47c82045ea05d5..96d1deaeaf26e8dd092a1e3a6454f32f2054ecb2 100644 (file)
@@ -21,9 +21,7 @@ use Drupal\Core\Url;
 class Rss extends StylePluginBase {
 
   /**
-   * Does the style plugin for itself support to add fields to it's output.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index 8fb5cb5bd874b58399bffbee79892880c8ba7f28..d71db329e6429866709450576f9eeef92ccad2ee 100644 (file)
@@ -50,7 +50,7 @@ abstract class StylePluginBase extends PluginBase {
   protected $rowTokens = [];
 
   /**
-   * Does the style plugin allows to use style plugins.
+   * Whether or not this style uses a row plugin.
    *
    * @var bool
    */
index 00e28b3c6dc46bde4276e17c5ac4b1c32465a478..9c9fbf1bf35ebc5b714ff46252ff44b1113a838a 100644 (file)
@@ -30,9 +30,7 @@ class Table extends StylePluginBase implements CacheableDependencyInterface {
   protected $usesFields = TRUE;
 
   /**
-   * Does the style plugin allows to use style plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = FALSE;
 
index b8b2730e6edcbd1da848ffd01d46239e9924408e..5a966a8f76ba29845e6dff2c9ecb027eda9401e5 100644 (file)
@@ -17,7 +17,7 @@ class ViewAjaxTest extends ViewTestBase {
    *
    * @var array
    */
-  public static $testViews = ['test_ajax_view'];
+  public static $testViews = ['test_ajax_view', 'test_view'];
 
   protected function setUp() {
     parent::setUp();
@@ -61,4 +61,14 @@ class ViewAjaxTest extends ViewTestBase {
     $this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.');
   }
 
+  /**
+   * Ensures that non-ajax view cannot be accessed via an ajax HTTP request.
+   */
+  public function testNonAjaxViewViaAjax() {
+    $this->drupalPost('views/ajax', '', ['view_name' => 'test_ajax_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
+    $this->assertResponse(200);
+    $this->drupalPost('views/ajax', '', ['view_name' => 'test_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
+    $this->assertResponse(403);
+  }
+
 }
index d64883c72c02ed88fb09f6ba235a70508245cca9..b924d90e2a2322d78ee0f9a15ba9bae48b6fb0e9 100644 (file)
@@ -20,9 +20,7 @@ use Drupal\views\Plugin\views\style\StylePluginBase;
 class StyleTemplateTest extends StylePluginBase {
 
   /**
-   * Can the style plugin use row plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index 9c0c3d707bdee5500fb521caf470dc63a26aa919..fa6f57f60d482996880001154ecc652dcbff169e 100644 (file)
@@ -29,9 +29,7 @@ class StyleTest extends StylePluginBase {
   public $output;
 
   /**
-   * Can the style plugin use row plugins.
-   *
-   * @var bool
+   * {@inheritdoc}
    */
   protected $usesRowPlugin = TRUE;
 
index c34e6f2a02a389903b09f7017ded8ee85d613e98..fbf5f414588f9cdffe5a982c5556338153ddac04 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\Functional;
 
-use Drupal\taxonomy\Tests\TaxonomyTestTrait;
+use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
 
 /**
  * Tests glossary functionality of taxonomy views.
index f766975e488b5049e9cc2fef3ceb966b9a518122..a02f098cda73f31f154689c5ced036ef0ea90100 100644 (file)
@@ -18,6 +18,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  */
 class ViewAjaxControllerTest extends UnitTestCase {
 
+  const USE_AJAX = TRUE;
+  const USE_NO_AJAX = FALSE;
+
   /**
    * The mocked view entity storage.
    *
@@ -186,23 +189,6 @@ class ViewAjaxControllerTest extends UnitTestCase {
 
     list($view, $executable) = $this->setupValidMocks();
 
-    $display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
-      ->disableOriginalConstructor()
-      ->getMock();
-    // Ensure that the pager element is not set.
-    $display_handler->expects($this->never())
-      ->method('setOption');
-
-    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $display_collection->expects($this->any())
-      ->method('get')
-      ->with('page_1')
-      ->will($this->returnValue($display_handler));
-
-    $executable->displayHandlers = $display_collection;
-
     $this->redirectDestination->expects($this->atLeastOnce())
       ->method('set')
       ->with('/test-page?type=article');
@@ -215,6 +201,24 @@ class ViewAjaxControllerTest extends UnitTestCase {
     $this->assertViewResultCommand($response);
   }
 
+  /**
+   * Tests a valid view without ajax enabled.
+   */
+  public function testAjaxViewWithoutAjax() {
+    $request = new Request();
+    $request->request->set('view_name', 'test_view');
+    $request->request->set('view_display_id', 'page_1');
+    $request->request->set('view_path', '/test-page');
+    $request->request->set('_wrapper_format', 'ajax');
+    $request->request->set('ajax_page_state', 'drupal.settings[]');
+    $request->request->set('type', 'article');
+
+    $this->setupValidMocks(static::USE_NO_AJAX);
+
+    $this->setExpectedException(AccessDeniedHttpException::class);
+    $this->viewAjaxController->ajaxView($request);
+  }
+
   /**
    * Tests a valid view with arguments.
    */
@@ -297,8 +301,15 @@ class ViewAjaxControllerTest extends UnitTestCase {
 
   /**
    * Sets up a bunch of valid mocks like the view entity and executable.
+   *
+   * @param bool $use_ajax
+   *   Whether the 'use_ajax' option is set on the view display. Defaults to
+   *   using ajax (TRUE).
+   *
+   * @return array
+   *   A pair of view storage entity and executable.
    */
-  protected function setupValidMocks() {
+  protected function setupValidMocks($use_ajax = self::USE_AJAX) {
     $view = $this->getMockBuilder('Drupal\views\Entity\View')
       ->disableOriginalConstructor()
       ->getMock();
@@ -314,7 +325,10 @@ class ViewAjaxControllerTest extends UnitTestCase {
     $executable->expects($this->once())
       ->method('access')
       ->will($this->returnValue(TRUE));
-    $executable->expects($this->once())
+    $executable->expects($this->any())
+      ->method('setDisplay')
+      ->willReturn(TRUE);
+    $executable->expects($this->atMost(1))
       ->method('preview')
       ->will($this->returnValue(['#markup' => 'View result']));
 
@@ -323,6 +337,28 @@ class ViewAjaxControllerTest extends UnitTestCase {
       ->with($view)
       ->will($this->returnValue($executable));
 
+    $display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
+      ->disableOriginalConstructor()
+      ->getMock();
+    // Ensure that the pager element is not set.
+    $display_handler->expects($this->never())
+      ->method('setOption');
+    $display_handler->expects($this->any())
+      ->method('getOption')
+      ->with('use_ajax')
+      ->willReturn($use_ajax);
+
+    $display_collection = $this->getMockBuilder('Drupal\views\DisplayPluginCollection')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $display_collection->expects($this->any())
+      ->method('get')
+      ->with('page_1')
+      ->will($this->returnValue($display_handler));
+
+    $executable->display_handler = $display_handler;
+    $executable->displayHandlers = $display_collection;
+
     return [$view, $executable];
   }
 
index 0b33a58917af55c1de468f83e2d73639aec93234..e8ff8d7d965694833c2f2b9c710226bbaeb466ad 100644 (file)
@@ -717,6 +717,50 @@ class FieldPluginBaseTest extends UnitTestCase {
     $this->assertEquals($expected, $field->getRenderTokens([]));
   }
 
+  /**
+   * Ensures proper token replacement when generating CSS classes.
+   *
+   * @covers ::elementClasses
+   * @covers ::elementLabelClasses
+   * @covers ::elementWrapperClasses
+   */
+  public function testElementClassesWithTokens() {
+    $functions = [
+      'elementClasses' => 'element_class',
+      'elementLabelClasses' => 'element_label_class',
+      'elementWrapperClasses' => 'element_wrapper_class',
+    ];
+
+    $tokens = ['test_token' => 'foo'];
+    $test_class = 'test-class-without-token test-class-with-{{ test_token }}-token';
+    $expected_result = 'test-class-without-token test-class-with-foo-token';
+
+    // Inline template to render the tokens.
+    $build = [
+      '#type' => 'inline_template',
+      '#template' => $test_class,
+      '#context' => $tokens,
+      '#post_render' => [function() {}],
+    ];
+
+    // We're not testing the token rendering itself, just that the function
+    // being tested correctly handles tokens when generating the element's class
+    // attribute.
+    $this->renderer->expects($this->any())
+      ->method('renderPlain')
+      ->with($build)
+      ->willReturn($expected_result);
+
+    foreach ($functions as $callable => $option_name) {
+      $field = $this->setupTestField([$option_name => $test_class]);
+      $field->view->style_plugin = new \stdClass();
+      $field->view->style_plugin->render_tokens[] = $tokens;
+
+      $result = $field->{$callable}(0);
+      $this->assertEquals($expected_result, $result);
+    }
+  }
+
 }
 
 class FieldPluginBaseTestField extends FieldPluginBase {
index 95fba8c6ad0340f82d59ab9b32f3239fe320e532..c723cb3b7689a0965f510d0ce574b3ef0bfc8d27 100644 (file)
@@ -114,6 +114,12 @@ class PreviewTest extends UITestBase {
     $settings->set('ui.show.sql_query.where', 'below')->save();
     $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
     $this->assertTrue(strpos($this->getRawContent(), 'view-test-preview') < strpos($this->getRawContent(), 'views-query-info'), 'Statistics shown below the preview.');
+
+    // Test that the preview title isn't double escaped.
+    $this->drupalPostForm("admin/structure/views/nojs/display/test_preview/default/title", $edit = ['title' => 'Double & escaped'], t('Apply'));
+    $this->drupalPostForm(NULL, [], t('Update preview'));
+    $elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => t('Double & escaped')]);
+    $this->assertEqual(1, count($elements));
   }
 
   /**
index 0b90e04d1e7715f8969ea772c7205b568754f589..83f2f85980c42d4824fa618913e5e6cd77878b30 100644 (file)
@@ -6,6 +6,9 @@ use Drupal\views\Tests\ViewTestBase;
 
 /**
  * Provides a base class for testing the Views UI.
+ *
+ * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.x.
+ *   Use \Drupal\Tests\views_ui\Functional\UITestBase.
  */
 abstract class UITestBase extends ViewTestBase {
 
@@ -48,6 +51,8 @@ abstract class UITestBase extends ViewTestBase {
       'administer permissions',
     ]);
     $this->drupalLogin($this->fullAdminUser);
+
+    @trigger_error('\Drupal\views_ui\Tests\UITestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.x. Instead, use \Drupal\Tests\views_ui\Functional\UITestBase', E_USER_DEPRECATED);
   }
 
   /**
index 08c5cfe862b02a1fde2cb6b30110acc623a1fe03..819a4391bb6566ed9910564c7bac9e8caada5efa 100644 (file)
@@ -64,6 +64,12 @@ class ViewEditTest extends UITestBase {
     $this->assertIdentical($displays['test_1']['id'], 'test_1', 'New display ID matches the display ID key.');
     $this->assertFalse(array_key_exists('attachment_1', $displays), 'Old display ID not found.');
 
+    // Set to the same machine name and save the View.
+    $edit = ['display_id' => 'test_1'];
+    $this->drupalPostForm('admin/structure/views/nojs/display/test_view/test_1/display_id', $edit, 'Apply');
+    $this->drupalPostForm(NULL, [], 'Save');
+    $this->assertLink(t('test_1'));
+
     // Test the form validation with invalid IDs.
     $machine_name_edit_url = 'admin/structure/views/nojs/display/test_view/test_1/display_id';
     $error_text = t('Display name must be letters, numbers, or underscores only.');
index 67d1229555d2f0733669be862b3659a98301afc3..75b518fdc863212a44ce8a08a41996ff5b635e0f 100644 (file)
@@ -275,7 +275,7 @@ class ViewEditForm extends ViewFormBase {
 
     // Rename display ids if needed.
     foreach ($executable->displayHandlers as $id => $display) {
-      if (!empty($display->display['new_id']) && empty($display->display['deleted'])) {
+      if (!empty($display->display['new_id']) && $display->display['new_id'] !== $display->display['id'] && empty($display->display['deleted'])) {
         $new_id = $display->display['new_id'];
         $display->display['id'] = $new_id;
         unset($display->display['new_id']);
@@ -290,6 +290,9 @@ class ViewEditForm extends ViewFormBase {
           'display_id' => $new_id,
         ]);
       }
+      elseif (isset($display->display['new_id'])) {
+        unset($display->display['new_id']);
+      }
     }
     $view->set('display', $displays);
 
index b6841a84bc6da859f7b1a91656777e858cb6bed3..2e7fabd62bf0c0413cdeda1ff53284043c61fe29 100644 (file)
@@ -4,7 +4,6 @@ namespace Drupal\views_ui;
 
 use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\Timer;
-use Drupal\Component\Utility\Xss;
 use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Views;
@@ -688,7 +687,11 @@ class ViewUI implements ViewEntityInterface {
                   '#template' => "<strong>{% trans 'Title' %}</strong>",
                 ],
               ],
-              Xss::filterAdmin($executable->getTitle()),
+              [
+                'data' => [
+                  '#markup' => $executable->getTitle(),
+                ],
+              ],
             ];
             if (isset($path)) {
               // @todo Views should expect and store a leading /. See:
similarity index 70%
rename from web/core/modules/views_ui/src/Tests/AnalyzeTest.php
rename to web/core/modules/views_ui/tests/src/Functional/AnalyzeTest.php
index 83e25313d67c1219d85280dd2ca2404e01018876..32d1ae98023cd059cc3e4b0e5bbfe9a985c87b6c 100644 (file)
@@ -1,15 +1,13 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
-
-use Drupal\views\Tests\ViewTestBase;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the views analyze system.
  *
  * @group views_ui
  */
-class AnalyzeTest extends ViewTestBase {
+class AnalyzeTest extends UITestBase {
 
   /**
    * Modules to enable.
@@ -25,27 +23,18 @@ class AnalyzeTest extends ViewTestBase {
    */
   public static $testViews = ['test_view'];
 
-  protected function setUp() {
-    parent::setUp();
-
-    $this->enableViewsTestModule();
-
-    // Add an admin user will full rights;
-    $this->admin = $this->drupalCreateUser(['administer views']);
-  }
-
   /**
    * Tests that analyze works in general.
    */
   public function testAnalyzeBasic() {
-    $this->drupalLogin($this->admin);
+    $this->drupalLogin($this->adminUser);
 
     $this->drupalGet('admin/structure/views/view/test_view/edit');
     $this->assertLink(t('Analyze view'));
 
     // This redirects the user to the analyze form.
     $this->clickLink(t('Analyze view'));
-    $this->assertText(t('View analysis'));
+    $this->assertSession()->titleEquals('View analysis | Drupal');
 
     foreach (['ok', 'warning', 'error'] as $type) {
       $xpath = $this->xpath('//div[contains(@class, :class)]', [':class' => $type]);
similarity index 93%
rename from web/core/modules/views_ui/src/Tests/AreaEntityUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/AreaEntityUITest.php
index ffe895ab036b6fdfa20fde269b5918a564539fec..d74575fd46324653b41b142a379822c81fa9f5d5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\block\Entity\Block;
 use Drupal\entity_test\Entity\EntityTest;
@@ -34,15 +34,15 @@ class AreaEntityUITest extends UITestBase {
     $this->drupalGet($view->urlInfo('edit-form'));
 
     // Add a global NULL argument to the view for testing argument placeholders.
-    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/argument", ['name[views.null]' => 1], 'Add and configure contextual filters');
+    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/argument", ['name[views.null]' => TRUE], 'Add and configure contextual filters');
     $this->drupalPostForm(NULL, [], 'Apply');
 
     // Configure both the entity_test area header and the block header to
     // reference the given entities.
-    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.entity_block]' => 1], 'Add and configure header');
+    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.entity_block]' => TRUE], 'Add and configure header');
     $this->drupalPostForm(NULL, ['options[target]' => $block->id()], 'Apply');
 
-    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.entity_entity_test]' => 1], 'Add and configure header');
+    $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.entity_entity_test]' => TRUE], 'Add and configure header');
     $this->drupalPostForm(NULL, ['options[target]' => $entity_test->id()], 'Apply');
 
     $this->drupalPostForm(NULL, [], 'Save');
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/ArgumentValidatorTest.php
rename to web/core/modules/views_ui/tests/src/Functional/ArgumentValidatorTest.php
index d94e682fb2b8f12b36a0168d6d8850918a032ef1..5a33970f7b226c3ec162717ce421f52ff52c456e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 98%
rename from web/core/modules/views_ui/src/Tests/CachedDataUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
index a605d0f29cb2196c19122c3f3710c0c36c611a6d..51e489d93e6c2236132bf0bf251a7771d91db183 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the user tempstore cache in the UI.
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/CustomBooleanTest.php
rename to web/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
index adae59ab22c8d9de64e9412b620f531393192328..95f6d566c4bdb0d3e3d0daeedecb4e78d88360eb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\views\Views;
@@ -173,8 +173,7 @@ class CustomBooleanTest extends UITestBase {
       $this->{$values['test']}(strpos($output, $values['false']), SafeMarkup::format('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
 
       // Assert that we are using the correct template.
-      $this->setRawContent($output);
-      $this->assertText('llama', 'Loaded the correct views-view-field.html.twig template');
+      $this->assertContains('llama', (string) $output);
     }
   }
 
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/DefaultViewsTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
index a709d1f41382dee4bbd62389a7bc8ea3457e3865..91ee05be0cb26612d8432bf5054ce3852646a94b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Core\Url;
 use Drupal\user\Entity\Role;
@@ -20,11 +20,10 @@ class DefaultViewsTest extends UITestBase {
    */
   public static $testViews = ['test_view_status', 'test_page_display_menu', 'test_page_display_arguments'];
 
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
-  protected function setUp() {
-    parent::setUp();
-
-    $this->drupalPlaceBlock('page_title_block');
+    $this->placeBlock('page_title_block');
   }
 
   /**
@@ -228,9 +227,9 @@ class DefaultViewsTest extends UITestBase {
    *   failure. Failure also results in a failed assertion.
    */
   public function clickViewsOperationLink($label, $unique_href_part) {
-    $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]);
+    $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => (string) $label]);
     foreach ($links as $link_index => $link) {
-      $position = strpos($link['href'], $unique_href_part);
+      $position = strpos($link->getAttribute('href'), $unique_href_part);
       if ($position !== FALSE) {
         $index = $link_index;
         break;
@@ -238,7 +237,7 @@ class DefaultViewsTest extends UITestBase {
     }
     $this->assertTrue(isset($index), format_string('Link to "@label" containing @part found.', ['@label' => $label, '@part' => $unique_href_part]));
     if (isset($index)) {
-      return $this->clickLink($label, $index);
+      return $this->clickLink((string) $label, $index);
     }
     else {
       return FALSE;
similarity index 95%
rename from web/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
index 480172bb33c59124d05590885eb06d422c08ef60..057a785c2ab0cd66cb0b5e79d5d857f4133d57e4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
@@ -16,6 +16,7 @@ class DisplayAttachmentTest extends UITestBase {
    * Views used by this test.
    *
    * @var array
+   * .
    */
   public static $testViews = ['test_attachment_ui'];
 
@@ -41,7 +42,7 @@ class DisplayAttachmentTest extends UITestBase {
     $this->assertEscaped('<em>Page</em>');
     $this->assertNoRaw('<em>Page</em>');
     $result = $this->xpath('//a[@id = :id]', [':id' => 'views-attachment-1-displays']);
-    $this->assertEqual($result[0]->attributes()->title, t('Page'));
+    $this->assertEqual($result[0]->getAttribute('title'), t('Page'));
     $this->drupalPostForm(NULL, [], t('Save'));
 
     $view = Views::getView('test_attachment_ui');
@@ -50,7 +51,7 @@ class DisplayAttachmentTest extends UITestBase {
 
     $this->drupalPostForm($attachment_display_url, ['displays[default]' => 1, 'displays[page_1]' => 1], t('Apply'));
     $result = $this->xpath('//a[@id = :id]', [':id' => 'views-attachment-1-displays']);
-    $this->assertEqual($result[0]->attributes()->title, t('Multiple displays'));
+    $this->assertEqual($result[0]->getAttribute('title'), t('Multiple displays'));
     $this->drupalPostForm(NULL, [], t('Save'));
 
     $view = Views::getView('test_attachment_ui');
similarity index 99%
rename from web/core/modules/views_ui/src/Tests/DisplayCRUDTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
index e29f0a94e926e876dc6872adc23c89707fb5787b..1e53c71108733517cab911d868e6556d3c1f5229 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayExtenderUITest.php
index e8eff0a0cb4483328aec279fefbba897bb4005b6..b222f15d7a69cebc15f2bf3231ab5b939ee943f6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 92%
rename from web/core/modules/views_ui/src/Tests/DisplayFeedTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
index d8d003191ed004586252683dfa95d6c07215ac94..9dba45010f09ba620310921bb8b65908f87ed0d4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the UI for feed display plugin.
@@ -57,10 +57,9 @@ class DisplayFeedTest extends UITestBase {
     $result = $this->xpath('//div[@id="edit-displays"]/div');
     $options = [];
     foreach ($result as $item) {
-      foreach ($item->input->attributes() as $attribute => $value) {
-        if ($attribute == 'value') {
-          $options[] = (string) $value;
-        }
+      $input_node = $item->find('css', 'input');
+      if ($input_node->hasAttribute('value')) {
+        $options[] = $input_node->getAttribute('value');
       }
     }
 
similarity index 94%
rename from web/core/modules/views_ui/src/Tests/DisplayPathTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
index d1d1732bababa81bc4a054a8ffb0685fa6ccbf9d..f8e58e719c70f79c8d9b62f91fabba76a26ce8dd 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
+
 use Drupal\Core\Menu\MenuTreeParameters;
 use Drupal\menu_link_content\Entity\MenuLinkContent;
+use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
 
 /**
  * Tests the UI of generic display path plugin.
@@ -11,11 +13,12 @@ use Drupal\menu_link_content\Entity\MenuLinkContent;
  * @see \Drupal\views\Plugin\views\display\PathPluginBase
  */
 class DisplayPathTest extends UITestBase {
+  use AssertPageCacheContextsAndTagsTrait;
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
-    $this->drupalPlaceBlock('page_title_block');
+    $this->placeBlock('page_title_block');
   }
 
   /**
@@ -158,9 +161,14 @@ class DisplayPathTest extends UITestBase {
     $this->drupalGet('admin/structure/views/nojs/display/test_page_display_menu/page_5/menu');
     $this->assertResponse(200);
     $menu_parent = $this->xpath('//select[@id="edit-menu-parent"]');
-    $menu_options = (array) $menu_parent[0]->option;
+    $menu_options = (array) $menu_parent[0]->findAll('css', 'option');
     unset($menu_options['@attributes']);
 
+    // Convert array to make the next assertion possible.
+    $menu_options = array_map(function($element) {
+      return $element->getText();
+    }, $menu_options);
+
     $this->assertEqual([
       '<User account menu>',
       '-- My account',
similarity index 77%
rename from web/core/modules/views_ui/src/Tests/DisplayTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DisplayTest.php
index afb2c7ff069039969ede896bb911930ef28e415f..44724b4211b4436f3fc56c83a4d9aff0318a176f 100644 (file)
@@ -1,10 +1,8 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
-use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Core\Template\Attribute;
 use Drupal\views\Entity\View;
 use Drupal\views\Views;
 
@@ -40,13 +38,6 @@ class DisplayTest extends UITestBase {
     $this->drupalPostForm(NULL, [], t('Add @display', ['@display' => 'Block']));
     $this->assertText('Block');
     $this->assertNoText('Block 2');
-
-    // Views has special form handling in views_ui_form_button_was_clicked()
-    // to be able to change the submit button text via JS, this simulates what
-    // the JS is doing.
-    $this->drupalPostForm(NULL, [], NULL, [], [], NULL, '&op=Block');
-    $this->assertText('Block');
-    $this->assertText('Block 2');
   }
 
   /**
@@ -94,13 +85,13 @@ class DisplayTest extends UITestBase {
     $this->drupalGet($path_prefix);
     $this->assertFalse($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class does not appear after initial adding of a view.');
 
-    $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is visible.');
-    $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is not visible.');
+    $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', NULL, 'Make sure the disable button is visible.');
+    $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', NULL, 'Make sure the enable button is not visible.');
     $this->drupalPostForm(NULL, [], 'Disable Page');
     $this->assertTrue($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class appears once the display is marked as such.');
 
-    $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is not visible.');
-    $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is visible.');
+    $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', NULL, 'Make sure the disable button is not visible.');
+    $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', NULL, 'Make sure the enable button is visible.');
     $this->drupalPostForm(NULL, [], 'Enable Page');
     $this->assertFalse($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class does not appears once the display is enabled again.');
   }
@@ -145,7 +136,7 @@ class DisplayTest extends UITestBase {
     // Assert that the expected text is found in each area category.
     foreach ($areas as $type) {
       $element = $this->xpath('//div[contains(@class, :class)]/div', [':class' => $type]);
-      $this->assertEqual((string) $element[0], SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type]));
+      $this->assertEqual($element[0]->getHtml(), SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type]));
     }
   }
 
@@ -160,7 +151,7 @@ class DisplayTest extends UITestBase {
     // Test the link text displays 'None' and not 'Block 1'
     $this->drupalGet($path);
     $result = $this->xpath("//a[contains(@href, :path)]", [':path' => $link_display_path]);
-    $this->assertEqual($result[0], t('None'), 'Make sure that the link option summary shows "None" by default.');
+    $this->assertEqual($result[0]->getHtml(), t('None'), 'Make sure that the link option summary shows "None" by default.');
 
     $this->drupalGet($link_display_path);
     $this->assertFieldChecked('edit-link-display-0');
@@ -171,7 +162,7 @@ class DisplayTest extends UITestBase {
     $this->drupalGet($path);
 
     $result = $this->xpath("//a[contains(@href, :path)]", [':path' => $link_display_path]);
-    $this->assertEqual($result[0], 'Page', 'Make sure that the link option summary shows the right linked display.');
+    $this->assertEqual($result[0]->getHtml(), 'Page', 'Make sure that the link option summary shows the right linked display.');
 
     $this->drupalPostForm($link_display_path, ['link_display' => 'custom_url', 'link_url' => 'a-custom-url'], t('Apply'));
     // The form redirects to the master display.
@@ -186,40 +177,6 @@ class DisplayTest extends UITestBase {
     $this->assertFieldByName('link_url', 'a-custom-url');
   }
 
-  /**
-   * Tests contextual links on Views page displays.
-   */
-  public function testPageContextualLinks() {
-    $this->drupalLogin($this->drupalCreateUser(['administer views', 'access contextual links']));
-    $view = View::load('test_display');
-    $view->enable()->save();
-    $this->container->get('router.builder')->rebuildIfNeeded();
-
-    // When no "main content" block is placed, we find a contextual link
-    // placeholder for editing just the view.
-    $this->drupalGet('test-display');
-    $id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1&langcode=en';
-    // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder()
-    $this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id]) . '></div>', format_string('Contextual link placeholder with id @id exists.', ['@id' => $id]));
-
-    // Get server-rendered contextual links.
-    // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks()
-    $post = ['ids[0]' => $id];
-    $response = $this->drupalPostWithFormat('contextual/render', 'json', $post, ['query' => ['destination' => 'test-display']]);
-    $this->assertResponse(200);
-    $json = Json::decode($response);
-    $this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_display/edit/page_1">Edit view</a></li></ul>');
-
-    // When a "main content" is placed, we still find a contextual link
-    // placeholder for editing just the view (not the main content block).
-    // @see system_block_view_system_main_block_alter()
-    $this->drupalPlaceBlock('system_main_block', ['id' => 'main_content']);
-    $this->drupalGet('test-display');
-    $id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1&langcode=en';
-    // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder()
-    $this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id]) . '></div>', format_string('Contextual link placeholder with id @id exists.', ['@id' => $id]));
-  }
-
   /**
    * Tests that the view status is correctly reflected on the edit form.
    */
similarity index 84%
rename from web/core/modules/views_ui/src/Tests/DuplicateTest.php
rename to web/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
index 1096ab4314ca49ffd9c22174700d7d3151c26501..91d88fa60c542c1a59f61f7a5febc75c408c3720 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the UI for view duplicate tool.
@@ -9,10 +9,10 @@ namespace Drupal\views_ui\Tests;
  */
 class DuplicateTest extends UITestBase {
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
-    $this->drupalPlaceBlock('page_title_block');
+    $this->placeBlock('page_title_block');
   }
 
   /**
similarity index 87%
rename from web/core/modules/views_ui/src/Tests/FieldUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/FieldUITest.php
index 4e873236996ee68a7c9bc6656e59f07f421346f9..dc3081f6505fbb97bb2fb2a67eb3c07c74ff1de9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Component\Serialization\Json;
 use Drupal\views\Views;
@@ -39,20 +39,20 @@ class FieldUITest extends UITestBase {
     $edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/age';
     $this->drupalGet($edit_handler_url);
     $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/ul/li');
-    $this->assertEqual((string) $result[0], '{{ age }} == Age');
+    $this->assertEqual($result[0]->getHtml(), '{{ age }} == Age');
 
     $edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/id';
     $this->drupalGet($edit_handler_url);
     $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/ul/li');
-    $this->assertEqual((string) $result[0], '{{ age }} == Age');
-    $this->assertEqual((string) $result[1], '{{ id }} == ID');
+    $this->assertEqual(trim($result[0]->getHtml()), '{{ age }} == Age');
+    $this->assertEqual(trim($result[1]->getHtml()), '{{ id }} == ID');
 
     $edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/name';
     $this->drupalGet($edit_handler_url);
     $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/ul/li');
-    $this->assertEqual((string) $result[0], '{{ age }} == Age');
-    $this->assertEqual((string) $result[1], '{{ id }} == ID');
-    $this->assertEqual((string) $result[2], '{{ name }} == Name');
+    $this->assertEqual(trim($result[0]->getHtml()), '{{ age }} == Age');
+    $this->assertEqual(trim($result[1]->getHtml()), '{{ id }} == ID');
+    $this->assertEqual(trim($result[2]->getHtml()), '{{ name }} == Name');
 
     $result = $this->xpath('//details[@id="edit-options-more"]');
     $this->assertEqual(empty($result), TRUE, "Container 'more' is empty and should not be displayed.");
@@ -71,7 +71,7 @@ class FieldUITest extends UITestBase {
 
     $edit_handler_url = '/admin/structure/views/ajax/handler-group/test_view/default/field/name';
     $this->drupalGet($edit_handler_url);
-    $data = Json::decode($this->getRawContent());
+    $data = Json::decode($this->getSession()->getPage()->getContent());
     $this->assertEqual($data[3]['dialogOptions']['title'], 'Configure aggregation settings for field Views test: Name');
   }
 
similarity index 89%
rename from web/core/modules/views_ui/src/Tests/FilterBooleanWebTest.php
rename to web/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
index a3e58d755eb7f0ec0dc54a197ea933475446c26f..e6adfeea713217abc194d97af862e957bacc3726 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the boolean filter UI.
@@ -25,7 +25,7 @@ class FilterBooleanWebTest extends UITestBase {
 
     // Check the field widget label. 'title' should be used as a fallback.
     $result = $this->cssSelect('#edit-options-value--wrapper legend span');
-    $this->assertEqual((string) $result[0], 'Status');
+    $this->assertEqual($result[0]->getHtml(), 'Status');
 
     $this->drupalPostForm(NULL, [], t('Expose filter'));
     $this->drupalPostForm(NULL, [], t('Grouped filters'));
@@ -46,11 +46,11 @@ class FilterBooleanWebTest extends UITestBase {
     $this->drupalGet('admin/structure/views/nojs/handler/test_view/default/filter/status');
 
     $result = $this->xpath('//input[@name="options[group_info][group_items][1][value]"]');
-    $this->assertEqual((int) $result[1]->attributes()->checked, 'checked');
+    $this->assertEqual($result[1]->getAttribute('checked'), 'checked');
     $result = $this->xpath('//input[@name="options[group_info][group_items][2][value]"]');
-    $this->assertEqual((int) $result[2]->attributes()->checked, 'checked');
+    $this->assertEqual($result[2]->getAttribute('checked'), 'checked');
     $result = $this->xpath('//input[@name="options[group_info][group_items][3][value]"]');
-    $this->assertEqual((int) $result[1]->attributes()->checked, 'checked');
+    $this->assertEqual($result[1]->getAttribute('checked'), 'checked');
 
     // Test that there is a remove link for each group.
     $this->assertEqual(count($this->cssSelect('a.views-remove-link')), 3);
similarity index 86%
rename from web/core/modules/views_ui/src/Tests/FilterNumericWebTest.php
rename to web/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php
index 104d62f54da73f8da14eb8f92b0fbaff712b02e2..8dc568de9bdf2f784b966aa0ded68e39d9433a73 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Tests\SchemaCheckTestTrait;
 
@@ -24,6 +24,12 @@ class FilterNumericWebTest extends UITestBase {
    * Tests the filter numeric UI.
    */
   public function testFilterNumericUI() {
+    // Add a page display to the test_view to be able to test the filtering.
+    $path = 'test_view-path';
+    $this->drupalPostForm('admin/structure/views/view/test_view/edit', [], 'Add Page');
+    $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => $path], 'Apply');
+    $this->drupalPostForm(NULL, [], t('Save'));
+
     $this->drupalPostForm('admin/structure/views/nojs/add-handler/test_view/default/filter', ['name[views_test_data.age]' => TRUE], t('Add and configure @handler', ['@handler' => t('filter criteria')]));
 
     $this->drupalPostForm(NULL, [], t('Expose filter'));
@@ -52,13 +58,13 @@ class FilterNumericWebTest extends UITestBase {
     $this->assertConfigSchemaByName('views.view.test_view');
 
     // Test that the exposed filter works as expected.
-    $this->drupalPostForm(NULL, [], t('Update preview'));
+    $this->drupalGet('test_view-path');
     $this->assertText('John');
     $this->assertText('Paul');
     $this->assertText('Ringo');
     $this->assertText('George');
     $this->assertText('Meredith');
-    $this->drupalPostForm(NULL, ['age' => '2'], t('Update preview'));
+    $this->drupalPostForm(NULL, ['age' => '2'], 'Apply');
     $this->assertText('John');
     $this->assertText('Paul');
     $this->assertNoText('Ringo');
@@ -75,13 +81,13 @@ class FilterNumericWebTest extends UITestBase {
     $this->assertConfigSchemaByName('views.view.test_view');
 
     // Test that the filter works as expected.
-    $this->drupalPostForm(NULL, [], t('Update preview'));
+    $this->drupalGet('test_view-path');
     $this->assertText('John');
     $this->assertNoText('Paul');
     $this->assertNoText('Ringo');
     $this->assertNoText('George');
     $this->assertNoText('Meredith');
-    $this->drupalPostForm(NULL, ['age' => '26'], t('Update preview'));
+    $this->drupalPostForm(NULL, ['age' => '26'], t('Apply'));
     $this->assertNoText('John');
     $this->assertText('Paul');
     $this->assertNoText('Ringo');
@@ -106,7 +112,7 @@ class FilterNumericWebTest extends UITestBase {
     $this->assertRaw('<label for="edit-age-max">And</label>', 'Max field label found');
     $this->assertRaw('<label for="edit-age-min">Age between</label>', 'Min field label found');
     // Check that the description is shown in the right place.
-    $this->assertEqual(trim($this->cssSelect('.form-item-age-min .description')[0]), 'Description of the exposed filter');
+    $this->assertEqual(trim($this->cssSelect('.form-item-age-min .description')[0]->getText()), 'Description of the exposed filter');
   }
 
 }
similarity index 94%
rename from web/core/modules/views_ui/src/Tests/FilterUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/FilterUITest.php
index 1197fc6e022eb3f5f506804280db3c244406d4bf..18ada1bca54ace3ea1c7a185aee6ed0de49bd11f 100644 (file)
@@ -1,15 +1,13 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
-
-use Drupal\views\Tests\ViewTestBase;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests for the filters from the UI.
  *
  * @group views_ui
  */
-class FilterUITest extends ViewTestBase {
+class FilterUITest extends UITestBase {
 
 
   /**
@@ -29,10 +27,9 @@ class FilterUITest extends ViewTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
     $this->drupalCreateContentType(['type' => 'page']);
-    $this->enableViewsTestModule();
   }
 
   /**
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/GroupByTest.php
rename to web/core/modules/views_ui/tests/src/Functional/GroupByTest.php
index 4b564c518688efaee19db53567015547d3a6ac02..4a45d85feef1922bda27863f65afb8f0c3522793 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests UI of aggregate functionality..
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/HandlerTest.php
rename to web/core/modules/views_ui/tests/src/Functional/HandlerTest.php
index 8fb29f97c89435704a2e3cc480bee828cfc93d8a..826cdc24e53e46801293b24474c17be6624f998f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\field\Entity\FieldConfig;
@@ -31,10 +31,10 @@ class HandlerTest extends UITestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
-    $this->drupalPlaceBlock('page_title_block');
+    $this->placeBlock('page_title_block');
     ViewTestData::createTestViews(get_class($this), ['node_test_views']);
   }
 
@@ -208,11 +208,11 @@ class HandlerTest extends UITestBase {
 
       $text = 'Broken/missing handler';
 
-      $this->assertIdentical((string) $result[0], $text, 'Ensure the broken handler text was found.');
+      $this->assertIdentical($result[0]->getText(), $text, 'Ensure the broken handler text was found.');
 
       $this->drupalGet($href);
       $result = $this->xpath('//h1[@class="page-title"]');
-      $this->assertTrue(strpos((string) $result[0], $text) !== FALSE, 'Ensure the broken handler text was found.');
+      $this->assertContains($text, $result[0]->getText(), 'Ensure the broken handler text was found.');
 
       $original_configuration = [
         'field' => 'id_broken',
similarity index 90%
rename from web/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php
rename to web/core/modules/views_ui/tests/src/Functional/NewViewConfigSchemaTest.php
index 3318f0b640ae9e8d53ba13b931768454773091dd..ef493ff8c8945ba8eb96ba1bb7423973fa587cd3 100644 (file)
@@ -1,15 +1,13 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
-
-use Drupal\simpletest\WebTestBase;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests configuration schema against new views.
  *
  * @group views_ui
  */
-class NewViewConfigSchemaTest extends WebTestBase {
+class NewViewConfigSchemaTest extends UITestBase {
 
   /**
    * Modules to enable.
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php
rename to web/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php
index ba425424087952a4cecd66ad3beef7a85dbed633..24116d97ae2afc9ebc862b30bf77d82e1c628d66 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests that displays can be correctly overridden via the user interface.
@@ -9,8 +9,8 @@ namespace Drupal\views_ui\Tests;
  */
 class OverrideDisplaysTest extends UITestBase {
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $this->drupalPlaceBlock('page_title_block');
   }
@@ -51,7 +51,7 @@ class OverrideDisplaysTest extends UITestBase {
 
     // Confirm that the view block is available in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
-    $this->clickLinkPartialName('Place block');
+    $this->clickLink('Place block');
     $this->assertText($view['label']);
 
     // Place the block.
@@ -111,7 +111,7 @@ class OverrideDisplaysTest extends UITestBase {
 
     // Confirm that the block is available in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
-    $this->clickLinkPartialName('Place block');
+    $this->clickLink('Place block');
     $this->assertText($view['label']);
 
     // Put the block into the first sidebar region, and make sure it will not
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/QueryTest.php
rename to web/core/modules/views_ui/tests/src/Functional/QueryTest.php
index 066be3e56daa3c08bae9efdac5b70d398b0af257..0eb58ce7102df7d0f35b6244ea7acff372e4a730 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 use Drupal\views\Entity\View;
similarity index 98%
rename from web/core/modules/views_ui/src/Tests/RearrangeFieldsTest.php
rename to web/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php
index 7d5eddf4308411a98134bcebed289dcd7868c542..125a7e928b8e1f88a89086d7f58d8e067304fdcb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/RedirectTest.php
rename to web/core/modules/views_ui/tests/src/Functional/RedirectTest.php
index cc5d2467ec01ef52aa991f8bdd5bda54eb19b2fc..4df38cee9e309a959a26dc44218df179f6c8cb17 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the redirecting after saving a views.
similarity index 97%
rename from web/core/modules/views_ui/src/Tests/ReportFieldsTest.php
rename to web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php
index 9b2245e2077ab92bd896c88ef984ac240b377381..d2527d0b9da43296fd9dd1b804319b852fde3c10 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
similarity index 72%
rename from web/core/modules/views_ui/src/Tests/ReportTest.php
rename to web/core/modules/views_ui/tests/src/Functional/ReportTest.php
index 0162519c15fcc9fd7e2d27e68c04b6e097e23201..e7979930c1f7a61b1957f05c4b517ee16ce3ed29 100644 (file)
@@ -1,14 +1,13 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
-use Drupal\simpletest\WebTestBase;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests existence of the views plugin report.
  *
  * @group views_ui
  */
-class ReportTest extends WebTestBase {
+class ReportTest extends UITestBase {
 
   /**
    * Modules to enable.
@@ -24,11 +23,6 @@ class ReportTest extends WebTestBase {
    */
   protected $adminUser;
 
-  protected function setUp() {
-    parent::setUp();
-    $this->adminUser = $this->drupalCreateUser(['administer views']);
-  }
-
   /**
    * Tests the existence of the views plugin report.
    */
similarity index 91%
rename from web/core/modules/views_ui/src/Tests/SettingsTest.php
rename to web/core/modules/views_ui/tests/src/Functional/SettingsTest.php
index f583185cdb576c8939da8dc375a34b1488199561..1ac98c6e634f702a7103865475829e3d2d6828b7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests all ui related settings under admin/structure/views/settings.
@@ -19,8 +19,8 @@ class SettingsTest extends UITestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
     $this->drupalPlaceBlock('local_tasks_block');
   }
 
@@ -82,7 +82,7 @@ class SettingsTest extends UITestBase {
 
     $view['id'] = strtolower($this->randomMachineName());
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
-    $this->assertFieldById('edit-displays-top-add-display-embed');
+    $this->assertFieldById('edit-displays-top-add-display-embed', NULL);
 
     $edit = [
       'ui_show_display_embed' => FALSE,
@@ -116,8 +116,8 @@ class SettingsTest extends UITestBase {
     $this->drupalPostForm(NULL, [], t('Update preview'));
     $xpath = $this->xpath('//div[@class="views-query-info"]//pre');
     $this->assertEqual(count($xpath), 1, 'The views sql is shown.');
-    $this->assertFalse(strpos($xpath[0], 'db_condition_placeholder') !== FALSE, 'No placeholders are shown in the views sql.');
-    $this->assertTrue(strpos($xpath[0], "node_field_data.status = '1'") !== FALSE, 'The placeholders in the views sql is replace by the actual value.');
+    $this->assertFalse(strpos($xpath[0]->getText(), 'db_condition_placeholder') !== FALSE, 'No placeholders are shown in the views sql.');
+    $this->assertTrue(strpos($xpath[0]->getText(), "node_field_data.status = '1'") !== FALSE, 'The placeholders in the views sql is replace by the actual value.');
 
     // Test the advanced settings form.
 
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/StorageTest.php
rename to web/core/modules/views_ui/tests/src/Functional/StorageTest.php
index fa33b8f00bc634be272f545bba83d4dade311115..df3d030e70133179ecf8b60852c2a454df7db288 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\views\Views;
similarity index 95%
rename from web/core/modules/views_ui/src/Tests/StyleTableTest.php
rename to web/core/modules/views_ui/tests/src/Functional/StyleTableTest.php
index d6b757e99593a2f83494404cc575fb82185741a5..d00df330227439f3d0641cf15eabf4c27e0bf449 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 98%
rename from web/core/modules/views_ui/src/Tests/StyleUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/StyleUITest.php
index 3fc2ae07628205ab549392e545c2eabdbf1a15af..1eb9c7862f4215e2af47a63ced3436f466ce6929 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\views\Views;
 
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/TokenizeAreaUITest.php
rename to web/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php
index 38eb47567cf99b1c234e6a1a05b1f7458f07aa19..df42d8e11d33193f9f0bde5f6a70cee1603f7125 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\views\Entity\View;
similarity index 90%
rename from web/core/modules/views_ui/src/Tests/TranslatedViewTest.php
rename to web/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php
index beaf5f1955a61e0e34fdeb9733b062c3cd311f64..7238ffad64f9a18ec663cf36dbea7e28bee3485a 100644 (file)
@@ -1,16 +1,15 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\simpletest\WebTestBase;
 
 /**
  * Tests that translated strings in views UI don't override original strings.
  *
  * @group views_ui
  */
-class TranslatedViewTest extends WebTestBase {
+class TranslatedViewTest extends UITestBase {
 
   /**
    * Modules to enable.
@@ -38,8 +37,8 @@ class TranslatedViewTest extends WebTestBase {
    */
   protected $adminUser;
 
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $permissions = [
       'administer site configuration',
diff --git a/web/core/modules/views_ui/tests/src/Functional/UITestBase.php b/web/core/modules/views_ui/tests/src/Functional/UITestBase.php
new file mode 100644 (file)
index 0000000..684b91f
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+
+namespace Drupal\Tests\views_ui\Functional;
+
+use Drupal\Tests\views\Functional\ViewTestBase;
+
+/**
+ * Provides a base class for testing the Views UI.
+ */
+abstract class UITestBase extends ViewTestBase {
+
+  /**
+   * An admin user with the 'administer views' permission.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $adminUser;
+
+  /**
+   * An admin user with administrative permissions for views, blocks, and nodes.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $fullAdminUser;
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['node', 'views_ui', 'block', 'taxonomy'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
+
+    $this->enableViewsTestModule();
+
+    $this->adminUser = $this->drupalCreateUser(['administer views']);
+
+    $this->fullAdminUser = $this->drupalCreateUser(['administer views',
+      'administer blocks',
+      'bypass node access',
+      'access user profiles',
+      'view all revisions',
+      'administer permissions',
+    ]);
+    $this->drupalLogin($this->fullAdminUser);
+  }
+
+  /**
+   * A helper method which creates a random view.
+   */
+  public function randomView(array $view = []) {
+    // Create a new view in the UI.
+    $default = [];
+    $default['label'] = $this->randomMachineName(16);
+    $default['id'] = strtolower($this->randomMachineName(16));
+    $default['description'] = $this->randomMachineName(16);
+    $default['page[create]'] = TRUE;
+    $default['page[path]'] = $default['id'];
+
+    $view += $default;
+
+    $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
+
+    return $default;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function drupalGet($path, array $options = [], array $headers = []) {
+    $url = $this->buildUrl($path, $options);
+
+    // Ensure that each nojs page is accessible via ajax as well.
+    if (strpos($url, 'nojs') !== FALSE) {
+      $url = str_replace('nojs', 'ajax', $url);
+      $result = $this->drupalGet($url, $options);
+      $this->assertSession()->statusCodeEquals(200);
+      $this->assertEquals('application/json', $this->getSession()->getResponseHeader('Content-Type'));
+      $this->assertTrue(json_decode($result), 'Ensure that the AJAX request returned valid content.');
+    }
+
+    return parent::drupalGet($path, $options, $headers);
+  }
+
+}
similarity index 92%
rename from web/core/modules/views_ui/src/Tests/UnsavedPreviewTest.php
rename to web/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php
index 6418fc08688f562e1fb58ec0e17663cee5c118b2..3265e1a2f564e5b7a72e7bcec42141cd143dcab2 100644 (file)
@@ -1,15 +1,13 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
-
-use Drupal\views\Tests\ViewTestBase;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests covering Preview of unsaved Views.
  *
  * @group views_ui
  */
-class UnsavedPreviewTest extends ViewTestBase {
+class UnsavedPreviewTest extends UITestBase {
 
   /**
     * Views used by this test.
@@ -33,7 +31,7 @@ class UnsavedPreviewTest extends ViewTestBase {
   /**
    * Sets up a Drupal site for running functional and integration tests.
    */
-  protected function setUp() {
+  protected function setUp($import_test_views = TRUE) {
     parent::setUp(FALSE);
 
     $this->adminUser = $this->drupalCreateUser(['administer views']);
similarity index 89%
rename from web/core/modules/views_ui/src/Tests/ViewsListTest.php
rename to web/core/modules/views_ui/tests/src/Functional/ViewsListTest.php
index 51786746c11f3eb4a37a6daefa024ce0b0fb0388..956ab9bc0cb9be3983eaf330a0f43dfcd14f6934 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
-use Drupal\simpletest\WebTestBase;
 use Drupal\views\Entity\View;
 use Drupal\views\Views;
 
@@ -11,7 +10,7 @@ use Drupal\views\Views;
  *
  * @group views_ui
  */
-class ViewsListTest extends WebTestBase {
+class ViewsListTest extends UITestBase {
 
   /**
    * Modules to enable.
@@ -30,8 +29,8 @@ class ViewsListTest extends WebTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    parent::setUp();
+  protected function setUp($import_test_views = TRUE) {
+    parent::setUp($import_test_views);
 
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/WizardTest.php
rename to web/core/modules/views_ui/tests/src/Functional/WizardTest.php
index 4e57e8f7b698d3d7b64838e55deac81c52047e63..81154817ef9933aeb6a8a18052418d8e9a7a77cf 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
-use Drupal\views\Tests\Wizard\WizardTestBase;
+use Drupal\Tests\views\Functional\Wizard\WizardTestBase;
 
 /**
  * Tests the wizard.
similarity index 96%
rename from web/core/modules/views_ui/src/Tests/XssTest.php
rename to web/core/modules/views_ui/tests/src/Functional/XssTest.php
index 1c3cef62cb2acf9a9f027e7b288491ce2885155d..cabb48ebcfe3a1ea82c54980d0b7787b6cb26b4d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 /**
  * Tests the Xss vulnerability.
diff --git a/web/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php b/web/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php
new file mode 100644 (file)
index 0000000..c8d37f2
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+
+namespace Drupal\Tests\views_ui\FunctionalJavascript;
+
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\simpletest\NodeCreationTrait;
+use Drupal\views\Entity\View;
+use Drupal\views\Tests\ViewTestData;
+
+/**
+ * Tests the display UI.
+ *
+ * @group views_ui
+ */
+class DisplayTest extends JavascriptTestBase {
+
+  use NodeCreationTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = [
+    'block',
+    'contextual',
+    'node',
+    'views',
+    'views_ui',
+    'views_test_config',
+  ];
+
+  public static $testViews = ['test_content_ajax', 'test_display'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    ViewTestData::createTestViews(self::class, ['views_test_config']);
+
+    $admin_user = $this->drupalCreateUser([
+      'administer site configuration',
+      'administer views',
+      'administer nodes',
+      'access content overview',
+      'access contextual links',
+    ]);
+
+    // 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);
+  }
+
+  /**
+   * Tests adding a display.
+   */
+  public function testAddDisplay() {
+    $this->drupalGet('admin/structure/views/view/test_content_ajax');
+    $page = $this->getSession()->getPage();
+
+    $page->find('css', '#views-display-menu-tabs .add')->click();
+
+    // Wait for the animation to complete.
+    $this->assertSession()->assertWaitOnAjaxRequest();
+
+    // Add the diplay.
+    $page->find('css', '#edit-displays-top-add-display-block')->click();
+
+    $element = $page->findById('views-display-menu-tabs')->findLink('Block');
+    $this->assertNotEmpty($element);
+  }
+
+  /**
+   * Tests contextual links on Views page displays.
+   */
+  public function testPageContextualLinks() {
+    $view = View::load('test_display');
+    $view->enable()->save();
+    $this->container->get('router.builder')->rebuildIfNeeded();
+
+    // Create node so the view has content and the contextual area is higher
+    // than 0 pixels.
+    $this->drupalCreateContentType(['type' => 'page']);
+    $this->createNode();
+
+    // When no "main content" block is placed, we find a contextual link
+    // placeholder for editing just the view.
+    $this->drupalGet('test-display');
+    $page = $this->getSession()->getPage();
+    $this->assertSession()->assertWaitOnAjaxRequest();
+
+    $selector = '.view-test-display';
+    $this->toggleContextualTriggerVisibility($selector);
+
+    $element = $this->getSession()->getPage()->find('css', $selector);
+    $element->find('css', '.contextual button')->press();
+
+    $contextual_container_id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1&langcode=en';
+    $contextual_container = $page->find('css', '[data-contextual-id="' . $contextual_container_id . '"]');
+    $this->assertNotEmpty($contextual_container);
+
+    $edit_link = $contextual_container->findLink('Edit view');
+    $this->assertNotEmpty($edit_link);
+
+    // When a "main content" is placed, we still find a contextual link
+    // placeholder for editing just the view (not the main content block).
+    // @see system_block_view_system_main_block_alter()
+    $this->drupalPlaceBlock('system_main_block', ['id' => 'main_content']);
+    $contextual_container = $page->find('css', '[data-contextual-id="' . $contextual_container_id . '"]');
+    $this->assertNotEmpty($contextual_container);
+  }
+
+  /**
+   * Toggles the visibility of a contextual trigger.
+   *
+   * @param string $selector
+   *   The selector for the element that contains the contextual Rink.
+   */
+  protected function toggleContextualTriggerVisibility($selector) {
+    // Hovering over the element itself with should be enough, but does not
+    // work. Manually remove the visually-hidden class.
+    $this->getSession()->executeScript("jQuery('{$selector} .contextual .trigger').toggleClass('visually-hidden');");
+  }
+
+}
index 3689dddbc6865396535646322996478ab6041337..3a0750113c561a11f4de3b007256a689d1281e87 100644 (file)
@@ -503,4 +503,18 @@ class BrowserTestBaseTest extends BrowserTestBase {
     $this->assertTrue(file_exists($htaccess_filename), "$htaccess_filename exists");
   }
 
+  /**
+   * Tests the assumption that local time is in 'Australia/Sydney'.
+   */
+  public function testLocalTimeZone() {
+    // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+    $this->assertEquals('Australia/Sydney', date_default_timezone_get());
+
+    // The 'Australia/Sydney' time zone is also set in
+    // FunctionalTestSetupTrait::initConfig().
+    $config_factory = $this->container->get('config.factory');
+    $value = $config_factory->get('system.date')->get('timezone.default');
+    $this->assertEquals('Australia/Sydney', $value);
+  }
+
 }
similarity index 94%
rename from web/core/modules/system/src/Tests/Image/ToolkitSetupFormTest.php
rename to web/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php
index 7dc9d33874a1cc70b9a446bd14b681254e3e9357..d501f1d98c2c95fc7ef346604edf54ac6abaca4f 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\system\Tests\Image;
+namespace Drupal\FunctionalTests\Image;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
 
 /**
  * Tests image toolkit setup form.
  *
  * @group Image
  */
-class ToolkitSetupFormTest extends WebTestBase {
+class ToolkitSetupFormTest extends BrowserTestBase {
 
   /**
    * Admin user account.
similarity index 98%
rename from web/core/modules/system/src/Tests/Image/ToolkitTest.php
rename to web/core/tests/Drupal/FunctionalTests/Image/ToolkitTest.php
index f70c261efb2909a53bb82cd85a4c2e224669a593..789369ceeb7f660557dc5527459119fc8da0c64b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Image;
+namespace Drupal\FunctionalTests\Image;
 
 /**
  * Tests image toolkit functions.
diff --git a/web/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php b/web/core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php
new file mode 100644 (file)
index 0000000..cf024e2
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+
+namespace Drupal\FunctionalTests\Image;
+
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Tests\BrowserTestBase;
+use Drupal\Tests\TestFileCreationTrait;
+
+
+/**
+ * Base class for image manipulation testing.
+ */
+abstract class ToolkitTestBase extends BrowserTestBase {
+
+  use TestFileCreationTrait {
+    getTestFiles as drupalGetTestFiles;
+  }
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['image_test'];
+
+  /**
+   * The URI for the file.
+   *
+   * @var string
+   */
+  protected $file;
+
+  /**
+   * The image factory service.
+   *
+   * @var \Drupal\Core\Image\ImageFactory
+   */
+  protected $imageFactory;
+
+  /**
+   * The image object for the test file.
+   *
+   * @var \Drupal\Core\Image\ImageInterface
+   */
+  protected $image;
+
+  protected function setUp() {
+    parent::setUp();
+
+    // Set the image factory service.
+    $this->imageFactory = $this->container->get('image.factory');
+
+    // Pick a file for testing.
+    $file = current($this->drupalGetTestFiles('image'));
+    $this->file = $file->uri;
+
+    // Setup a dummy image to work with.
+    $this->image = $this->getImage();
+
+    // Clear out any hook calls.
+    $this->imageTestReset();
+  }
+
+  /**
+   * Sets up an image with the custom toolkit.
+   *
+   * @return \Drupal\Core\Image\ImageInterface
+   *   The image object.
+   */
+  protected function getImage() {
+    $image = $this->imageFactory->get($this->file, 'test');
+    $this->assertTrue($image->isValid(), 'Image file was parsed.');
+    return $image;
+  }
+
+  /**
+   * Assert that all of the specified image toolkit operations were called
+   * exactly once once, other values result in failure.
+   *
+   * @param $expected
+   *   Array with string containing with the operation name, e.g. 'load',
+   *   'save', 'crop', etc.
+   */
+  public function assertToolkitOperationsCalled(array $expected) {
+    // If one of the image operations is expected, apply should be expected as
+    // well.
+    $operations = [
+      'resize',
+      'rotate',
+      'crop',
+      'desaturate',
+      'create_new',
+      'scale',
+      'scale_and_crop',
+      'my_operation',
+      'convert',
+    ];
+    if (count(array_intersect($expected, $operations)) > 0 && !in_array('apply', $expected)) {
+      $expected[] = 'apply';
+    }
+
+    // Determine which operations were called.
+    $actual = array_keys(array_filter($this->imageTestGetAllCalls()));
+
+    // Determine if there were any expected that were not called.
+    $uncalled = array_diff($expected, $actual);
+    if (count($uncalled)) {
+      $this->assertTrue(FALSE, SafeMarkup::format('Expected operations %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)]));
+    }
+    else {
+      $this->assertTrue(TRUE, SafeMarkup::format('All the expected operations were called: %expected', ['%expected' => implode(', ', $expected)]));
+    }
+
+    // Determine if there were any unexpected calls.
+    // If all unexpected calls are operations and apply was expected, we do not
+    // count it as an error.
+    $unexpected = array_diff($actual, $expected);
+    if (count($unexpected) && (!in_array('apply', $expected) || count(array_intersect($unexpected, $operations)) !== count($unexpected))) {
+      $this->assertTrue(FALSE, SafeMarkup::format('Unexpected operations were called: %unexpected.', ['%unexpected' => implode(', ', $unexpected)]));
+    }
+    else {
+      $this->assertTrue(TRUE, 'No unexpected operations were called.');
+    }
+  }
+
+  /**
+   * Resets/initializes the history of calls to the test toolkit functions.
+   */
+  protected function imageTestReset() {
+    // Keep track of calls to these operations
+    $results = [
+      'parseFile' => [],
+      'save' => [],
+      'settings' => [],
+      'apply' => [],
+      'resize' => [],
+      'rotate' => [],
+      'crop' => [],
+      'desaturate' => [],
+      'create_new' => [],
+      'scale' => [],
+      'scale_and_crop' => [],
+      'convert' => [],
+    ];
+    \Drupal::state()->set('image_test.results', $results);
+  }
+
+  /**
+   * Gets an array of calls to the test toolkit.
+   *
+   * @return array
+   *   An array keyed by operation name ('parseFile', 'save', 'settings',
+   *   'resize', 'rotate', 'crop', 'desaturate') with values being arrays of
+   *   parameters passed to each call.
+   */
+  protected function imageTestGetAllCalls() {
+    return \Drupal::state()->get('image_test.results') ?: [];
+  }
+
+}
index e55590e7edb5a93978dd42164171d6d3035195c7..d0439c5f104591b60b4e5001f5a67b530633d525 100644 (file)
@@ -4,7 +4,7 @@ namespace Drupal\KernelTests\Core\Database;
 
 use Drupal\Core\Database\RowCountException;
 use Drupal\Core\Database\StatementInterface;
-use Drupal\system\Tests\Database\FakeRecord;
+use Drupal\Tests\system\Functional\Database\FakeRecord;
 
 /**
  * Tests the Database system's various fetch capabilities.
@@ -69,7 +69,7 @@ class FetchTest extends DatabaseTestBase {
    */
   public function testQueryFetchClass() {
     $records = [];
-    $result = db_query('SELECT name FROM {test} WHERE age = :age', [':age' => 25], ['fetch' => 'Drupal\system\Tests\Database\FakeRecord']);
+    $result = db_query('SELECT name FROM {test} WHERE age = :age', [':age' => 25], ['fetch' => FakeRecord::class]);
     foreach ($result as $record) {
       $records[] = $record;
       if ($this->assertTrue($record instanceof FakeRecord, 'Record is an object of class FakeRecord.')) {
index d7644b205954c183012bb6d6905b5562f0440a7e..b3af27fba28b71f500fd3c4471c9c7c4a5a721a1 100644 (file)
@@ -9,7 +9,9 @@ use Drupal\Core\Entity\EntityAccessControlHandler;
 use Drupal\Core\Session\AnonymousUserSession;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\entity_test\Entity\EntityTestDefaultAccess;
+use Drupal\entity_test\Entity\EntityTestNoUuid;
 use Drupal\entity_test\Entity\EntityTestLabel;
+use Drupal\entity_test\Entity\EntityTestRev;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\user\Entity\User;
 
@@ -20,6 +22,16 @@ use Drupal\user\Entity\User;
  */
 class EntityAccessControlHandlerTest extends EntityLanguageTestBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    $this->installEntitySchema('entity_test_no_uuid');
+    $this->installEntitySchema('entity_test_rev');
+  }
+
   /**
    * Asserts entity access correctly grants or denies access.
    */
@@ -199,6 +211,64 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase {
     ], $translation);
   }
 
+  /**
+   * Ensures the static access cache works correctly in the absence of an UUID.
+   *
+   * @see entity_test_entity_access()
+   */
+  public function testEntityWithoutUuidAccessCache() {
+    $account = $this->createUser();
+
+    $entity1 = EntityTestNoUuid::create([
+      'name' => 'Accessible',
+    ]);
+    $entity1->save();
+
+    $entity2 = EntityTestNoUuid::create([
+      'name' => 'Inaccessible',
+    ]);
+    $entity2->save();
+
+    $this->assertTrue($entity1->access('delete', $account), 'Entity 1 can be deleted.');
+    $this->assertFalse($entity2->access('delete', $account), 'Entity 2 CANNOT be deleted.');
+
+    $entity1
+      ->setName('Inaccessible')
+      ->setNewRevision();
+    $entity1->save();
+
+    $this->assertFalse($entity1->access('delete', $account), 'Entity 1 revision 2 CANNOT be deleted.');
+  }
+
+  /**
+   * Ensures the static access cache works correctly with a UUID and revisions.
+   *
+   * @see entity_test_entity_access()
+   */
+  public function testEntityWithUuidAccessCache() {
+    $account = $this->createUser();
+
+    $entity1 = EntityTestRev::create([
+      'name' => 'Accessible',
+    ]);
+    $entity1->save();
+
+    $entity2 = EntityTestRev::create([
+      'name' => 'Inaccessible',
+    ]);
+    $entity2->save();
+
+    $this->assertTrue($entity1->access('delete', $account), 'Entity 1 can be deleted.');
+    $this->assertFalse($entity2->access('delete', $account), 'Entity 2 CANNOT be deleted.');
+
+    $entity1
+      ->setName('Inaccessible')
+      ->setNewRevision();
+    $entity1->save();
+
+    $this->assertFalse($entity1->access('delete', $account), 'Entity 1 revision 2 CANNOT be deleted.');
+  }
+
   /**
    * Tests hook invocations.
    */
index 9436115ff4799720f97a3a934a38ee0426d888b5..704863279f62295b618b082d6d84e2bfbde23b0d 100644 (file)
@@ -216,4 +216,62 @@ class AliasTest extends PathUnitTestBase {
     $this->assertEqual($memoryCounterBackend->getCounter('set', 'path_alias_whitelist'), 0);
   }
 
+  /**
+   * Tests situation where the whitelist cache is deleted mid-request.
+   */
+  public function testWhitelistCacheDeletionMidRequest() {
+    // Prepare database table.
+    $connection = Database::getConnection();
+    $this->fixtures->createTables($connection);
+
+    $memoryCounterBackend = new MemoryCounterBackend();
+
+    // Create AliasManager and Path object.
+    $aliasStorage = new AliasStorage($connection, $this->container->get('module_handler'));
+    $whitelist = new AliasWhitelist('path_alias_whitelist', $memoryCounterBackend, $this->container->get('lock'), $this->container->get('state'), $aliasStorage);
+    $aliasManager = new AliasManager($aliasStorage, $whitelist, $this->container->get('language_manager'), $memoryCounterBackend);
+
+    // Whitelist cache should not exist at all yet.
+    $this->assertFalse($memoryCounterBackend->get('path_alias_whitelist'));
+
+    // Add some aliases for both menu routes we have.
+    $aliasStorage->save('/admin/something', '/' . $this->randomMachineName());
+    $aliasStorage->save('/user/something', '/' . $this->randomMachineName());
+    $aliasManager->cacheClear();
+
+    // Lookup admin path in whitelist. It will query the DB and figure out
+    // that it indeed has an alias, and add it to the internal whitelist and
+    // flag it to be peristed to cache.
+    $this->assertTrue($whitelist->get('admin'));
+
+    // Destruct the whitelist so it persists its cache.
+    $whitelist->destruct();
+    $this->assertEquals($memoryCounterBackend->getCounter('set', 'path_alias_whitelist'), 1);
+    // Cache data should have data for 'user' and 'admin', even though just
+    // 'admin' was looked up. This is because the cache is primed with all
+    // menu router base paths.
+    $this->assertEquals(['user' => FALSE, 'admin' => TRUE], $memoryCounterBackend->get('path_alias_whitelist')->data);
+    $memoryCounterBackend->resetCounter();
+
+    // Re-initialize the the whitelist and lookup an alias for the 'user' path.
+    // Whitelist should load data from its cache, see that it hasn't done a
+    // check for 'user' yet, perform the check, then mark the result to be
+    // persisted to cache.
+    $whitelist = new AliasWhitelist('path_alias_whitelist', $memoryCounterBackend, $this->container->get('lock'), $this->container->get('state'), $aliasStorage);
+    $this->assertTrue($whitelist->get('user'));
+
+    // Delete the whitelist cache. This could happen from an outside process,
+    // like a code deployment that performs a cache rebuild.
+    $memoryCounterBackend->delete('path_alias_whitelist');
+
+    // Destruct whitelist so it attempts to save the whitelist data to cache.
+    // However it should recognize that the previous cache entry was deleted
+    // from underneath it and not save anything to cache, to protect from
+    // cache corruption.
+    $whitelist->destruct();
+    $this->assertEquals($memoryCounterBackend->getCounter('set', 'path_alias_whitelist'), 0);
+    $this->assertFalse($memoryCounterBackend->get('path_alias_whitelist'));
+    $memoryCounterBackend->resetCounter();
+  }
+
 }
index 8ec7c5497a107164c047d6e1a9b98a7e2904f07b..817d894d424c43c3f9f0a2e5bff57836ba859ebc 100644 (file)
@@ -214,6 +214,14 @@ class KernelTestBaseTest extends KernelTestBase {
     $this->assertEquals('public', \Drupal::config('system.file')->get('default_scheme'));
   }
 
+  /**
+   * Tests the assumption that local time is in 'Australia/Sydney'.
+   */
+  public function testLocalTimeZone() {
+    // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+    $this->assertEquals('Australia/Sydney', date_default_timezone_get());
+  }
+
   /**
    * {@inheritdoc}
    */
diff --git a/web/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php b/web/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php
new file mode 100644 (file)
index 0000000..1e9bb43
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+namespace Drupal\Tests\Core\Block;
+
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\Core\Block\BlockManager;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Block\BlockManager
+ *
+ * @group block
+ */
+class BlockManagerTest extends UnitTestCase {
+
+  /**
+   * The block manager under test.
+   *
+   * @var \Drupal\Core\Block\BlockManager
+   */
+  protected $blockManager;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $cache_backend = $this->prophesize(CacheBackendInterface::class);
+    $module_handler = $this->prophesize(ModuleHandlerInterface::class);
+    $this->blockManager = new BlockManager(new \ArrayObject(), $cache_backend->reveal(), $module_handler->reveal());
+    $this->blockManager->setStringTranslation($this->getStringTranslationStub());
+
+    $discovery = $this->prophesize(DiscoveryInterface::class);
+    // Specify the 'broken' block, as well as 3 other blocks with admin labels
+    // that are purposefully not in alphabetical order.
+    $discovery->getDefinitions()->willReturn([
+      'broken' => [
+        'admin_label' => 'Broken/Missing',
+        'category' => 'Block',
+      ],
+      'block1' => [
+        'admin_label' => 'Coconut',
+        'category' => 'Group 2',
+      ],
+      'block2' => [
+        'admin_label' => 'Apple',
+        'category' => 'Group 1',
+      ],
+      'block3' => [
+        'admin_label' => 'Banana',
+        'category' => 'Group 2',
+      ],
+    ]);
+    // Force the discovery object onto the block manager.
+    $property = new \ReflectionProperty(BlockManager::class, 'discovery');
+    $property->setAccessible(TRUE);
+    $property->setValue($this->blockManager, $discovery->reveal());
+  }
+
+  /**
+   * @covers ::getDefinitions
+   */
+  public function testDefinitions() {
+    $definitions = $this->blockManager->getDefinitions();
+    $this->assertSame(['broken', 'block1', 'block2', 'block3'], array_keys($definitions));
+  }
+
+  /**
+   * @covers ::getSortedDefinitions
+   */
+  public function testSortedDefinitions() {
+    $definitions = $this->blockManager->getSortedDefinitions();
+    $this->assertSame(['block2', 'block3', 'block1'], array_keys($definitions));
+  }
+
+  /**
+   * @covers ::getGroupedDefinitions
+   */
+  public function testGroupedDefinitions() {
+    $definitions = $this->blockManager->getGroupedDefinitions();
+    $this->assertSame(['Group 1', 'Group 2'], array_keys($definitions));
+    $this->assertSame(['block2'], array_keys($definitions['Group 1']));
+    $this->assertSame(['block3', 'block1'], array_keys($definitions['Group 2']));
+  }
+
+}
index 1ff662939ee64c83ae5f0a2b0d81c03e30e33119..0c06a4b8652898cd6faf71a89267efc86673c9cc 100644 (file)
@@ -327,7 +327,8 @@ class CacheCollectorTest extends UnitTestCase {
     // invalidation.
     $this->cacheBackend->expects($this->at(0))
       ->method('get')
-      ->with($this->cid, TRUE);
+      ->with($this->cid, TRUE)
+      ->will($this->returnValue($cache));
     $this->cacheBackend->expects($this->once())
       ->method('set')
       ->with($this->cid, [], Cache::PERMANENT, []);
index 0ba8143427771652fb38cd46cf2b386c6c097b7a..fa50e45d5bc97f4eab3d84162f80f6164f7f0fb5 100644 (file)
@@ -94,6 +94,14 @@ class TestSuiteBaseTest extends \PHPUnit_Framework_TestCase {
     $this->assertEmpty(array_diff_assoc($expected_tests, $stub->testFiles));
   }
 
+  /**
+   * Tests the assumption that local time is in 'Australia/Sydney'.
+   */
+  public function testLocalTimeZone() {
+    // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+    $this->assertEquals('Australia/Sydney', date_default_timezone_get());
+  }
+
 }
 
 /**