diff --git a/composer.lock b/composer.lock index 070408ff58948fd79d5bb53415ec098bc5c37f4b..143db1183a6b25681a4417eaca8d1ea3c5cda9f5 100644 --- a/composer.lock +++ b/composer.lock @@ -2958,16 +2958,16 @@ }, { "name": "drupal/core", - "version": "9.2.6", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "c51e9d9e28c08e284ff57ca42504cfe0ec9522db" + "reference": "ce3220458c7a744bb00e9436e48d8e644e134576" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/c51e9d9e28c08e284ff57ca42504cfe0ec9522db", - "reference": "c51e9d9e28c08e284ff57ca42504cfe0ec9522db", + "url": "https://api.github.com/repos/drupal/core/zipball/ce3220458c7a744bb00e9436e48d8e644e134576", + "reference": "ce3220458c7a744bb00e9436e48d8e644e134576", "shasum": "" }, "require": { @@ -3206,9 +3206,9 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.2.6" + "source": "https://github.com/drupal/core/tree/9.2.7" }, - "time": "2021-09-14T22:07:47+00:00" + "time": "2021-10-06T10:34:39+00:00" }, { "name": "drupal/core-composer-scaffold", @@ -3262,16 +3262,16 @@ }, { "name": "drupal/core-recommended", - "version": "9.2.6", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "e9bbd6d45dddc02157ea675b557c604feb31c80d" + "reference": "87c998e8d60d6b2452b21827fb7b16f77d02a38a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/e9bbd6d45dddc02157ea675b557c604feb31c80d", - "reference": "e9bbd6d45dddc02157ea675b557c604feb31c80d", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/87c998e8d60d6b2452b21827fb7b16f77d02a38a", + "reference": "87c998e8d60d6b2452b21827fb7b16f77d02a38a", "shasum": "" }, "require": { @@ -3280,7 +3280,7 @@ "doctrine/annotations": "1.13.1", "doctrine/lexer": "1.2.1", "doctrine/reflection": "1.2.2", - "drupal/core": "9.2.6", + "drupal/core": "9.2.7", "egulias/email-validator": "2.1.25", "guzzlehttp/guzzle": "6.5.5", "guzzlehttp/promises": "1.4.1", @@ -3343,9 +3343,9 @@ ], "description": "Locked core dependencies; require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/9.2.6" + "source": "https://github.com/drupal/core-recommended/tree/9.2.7" }, - "time": "2021-09-14T22:07:47+00:00" + "time": "2021-10-06T10:34:39+00:00" }, { "name": "drupal/crop", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 4bfc4c4a7279da2be82071e092091a0b81214acf..70c4702c7d50dd8ba610b35a02123c2b56ddcda4 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2258,6 +2258,8 @@ 'Drupal\\Core\\Language\\LanguageManager' => $baseDir . '/web/core/lib/Drupal/Core/Language/LanguageManager.php', 'Drupal\\Core\\Language\\LanguageManagerInterface' => $baseDir . '/web/core/lib/Drupal/Core/Language/LanguageManagerInterface.php', 'Drupal\\Core\\Layout\\Annotation\\Layout' => $baseDir . '/web/core/lib/Drupal/Core/Layout/Annotation/Layout.php', + 'Drupal\\Core\\Layout\\Icon\\IconBuilderInterface' => $baseDir . '/web/core/lib/Drupal/Core/Layout/Icon/IconBuilderInterface.php', + 'Drupal\\Core\\Layout\\Icon\\SvgIconBuilder' => $baseDir . '/web/core/lib/Drupal/Core/Layout/Icon/SvgIconBuilder.php', 'Drupal\\Core\\Layout\\LayoutDefault' => $baseDir . '/web/core/lib/Drupal/Core/Layout/LayoutDefault.php', 'Drupal\\Core\\Layout\\LayoutDefinition' => $baseDir . '/web/core/lib/Drupal/Core/Layout/LayoutDefinition.php', 'Drupal\\Core\\Layout\\LayoutInterface' => $baseDir . '/web/core/lib/Drupal/Core/Layout/LayoutInterface.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 812f71f45d020f5d1970cad8262aa2f5d59fa94f..78590937920054f93c09f467242886c74d81b33b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -3049,6 +3049,8 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Drupal\\Core\\Language\\LanguageManager' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Language/LanguageManager.php', 'Drupal\\Core\\Language\\LanguageManagerInterface' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Language/LanguageManagerInterface.php', 'Drupal\\Core\\Layout\\Annotation\\Layout' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/Annotation/Layout.php', + 'Drupal\\Core\\Layout\\Icon\\IconBuilderInterface' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/Icon/IconBuilderInterface.php', + 'Drupal\\Core\\Layout\\Icon\\SvgIconBuilder' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/Icon/SvgIconBuilder.php', 'Drupal\\Core\\Layout\\LayoutDefault' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/LayoutDefault.php', 'Drupal\\Core\\Layout\\LayoutDefinition' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/LayoutDefinition.php', 'Drupal\\Core\\Layout\\LayoutInterface' => __DIR__ . '/../..' . '/web/core/lib/Drupal/Core/Layout/LayoutInterface.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d63e3b3beab3ee7f9d5ee62c98b3c1992618afec..87ceb137906950eb00cd47f903e25c4be574bc49 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3039,17 +3039,17 @@ }, { "name": "drupal/core", - "version": "9.2.6", - "version_normalized": "9.2.6.0", + "version": "9.2.7", + "version_normalized": "9.2.7.0", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "c51e9d9e28c08e284ff57ca42504cfe0ec9522db" + "reference": "ce3220458c7a744bb00e9436e48d8e644e134576" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/c51e9d9e28c08e284ff57ca42504cfe0ec9522db", - "reference": "c51e9d9e28c08e284ff57ca42504cfe0ec9522db", + "url": "https://api.github.com/repos/drupal/core/zipball/ce3220458c7a744bb00e9436e48d8e644e134576", + "reference": "ce3220458c7a744bb00e9436e48d8e644e134576", "shasum": "" }, "require": { @@ -3214,7 +3214,7 @@ "drupal/workflows": "self.version", "drupal/workspaces": "self.version" }, - "time": "2021-09-14T22:07:47+00:00", + "time": "2021-10-06T10:34:39+00:00", "type": "drupal-core", "extra": { "drupal-scaffold": { @@ -3294,7 +3294,7 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.2.6" + "source": "https://github.com/drupal/core/tree/9.2.7" }, "install-path": "../../web/core" }, @@ -3350,17 +3350,17 @@ }, { "name": "drupal/core-recommended", - "version": "9.2.6", - "version_normalized": "9.2.6.0", + "version": "9.2.7", + "version_normalized": "9.2.7.0", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "e9bbd6d45dddc02157ea675b557c604feb31c80d" + "reference": "87c998e8d60d6b2452b21827fb7b16f77d02a38a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/e9bbd6d45dddc02157ea675b557c604feb31c80d", - "reference": "e9bbd6d45dddc02157ea675b557c604feb31c80d", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/87c998e8d60d6b2452b21827fb7b16f77d02a38a", + "reference": "87c998e8d60d6b2452b21827fb7b16f77d02a38a", "shasum": "" }, "require": { @@ -3369,7 +3369,7 @@ "doctrine/annotations": "1.13.1", "doctrine/lexer": "1.2.1", "doctrine/reflection": "1.2.2", - "drupal/core": "9.2.6", + "drupal/core": "9.2.7", "egulias/email-validator": "2.1.25", "guzzlehttp/guzzle": "6.5.5", "guzzlehttp/promises": "1.4.1", @@ -3425,7 +3425,7 @@ "conflict": { "webflo/drupal-core-strict": "*" }, - "time": "2021-09-14T22:07:47+00:00", + "time": "2021-10-06T10:34:39+00:00", "type": "metapackage", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3433,7 +3433,7 @@ ], "description": "Locked core dependencies; require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/9.2.6" + "source": "https://github.com/drupal/core-recommended/tree/9.2.7" }, "install-path": null }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 00ac08d532572f3fa9f2117af81c6af305763b4f..be9090159984a66b39153fed4caf30f02037120d 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '2bc2e7748e927bf884a27dc8ab9beca9910c1aad', + 'reference' => '1302399ef0325d509963157dd3e51fa3365d5b9f', 'name' => 'osu-asc-webservices/d8-upstream', 'dev' => true, ), @@ -271,7 +271,7 @@ 'drupal/action' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/addtocalendar' => array( @@ -304,7 +304,7 @@ 'drupal/aggregator' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/allowed_formats' => array( @@ -328,25 +328,25 @@ 'drupal/automated_cron' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/ban' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/bartik' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/basic_auth' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/better_exposed_filters' => array( @@ -361,19 +361,19 @@ 'drupal/big_pipe' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/block' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/block_content' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/block_field' => array( @@ -406,7 +406,7 @@ 'drupal/book' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/bootstrap' => array( @@ -421,7 +421,7 @@ 'drupal/breakpoint' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/cache_control_override' => array( @@ -445,7 +445,7 @@ 'drupal/ckeditor' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/ckeditor_indentblock' => array( @@ -460,31 +460,31 @@ 'drupal/claro' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/classy' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/color' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/comment' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/config' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/config_direct_save' => array( @@ -517,7 +517,7 @@ 'drupal/config_translation' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/config_update' => array( @@ -568,7 +568,7 @@ 'drupal/contact' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/content_access' => array( @@ -583,52 +583,52 @@ 'drupal/content_moderation' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/content_translation' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/contextual' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core' => array( - 'pretty_version' => '9.2.6', - 'version' => '9.2.6.0', + 'pretty_version' => '9.2.7', + 'version' => '9.2.7.0', 'type' => 'drupal-core', 'install_path' => __DIR__ . '/../../web/core', 'aliases' => array(), - 'reference' => 'c51e9d9e28c08e284ff57ca42504cfe0ec9522db', + 'reference' => 'ce3220458c7a744bb00e9436e48d8e644e134576', 'dev_requirement' => false, ), 'drupal/core-annotation' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-assertion' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-bridge' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-class-finder' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-composer-scaffold' => array( @@ -643,136 +643,136 @@ 'drupal/core-datetime' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-dependency-injection' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-diff' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-discovery' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-event-dispatcher' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-file-cache' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-file-security' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-filesystem' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-front-matter' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-gettext' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-graph' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-http-foundation' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-php-storage' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-plugin' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-proxy-builder' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-recommended' => array( - 'pretty_version' => '9.2.6', - 'version' => '9.2.6.0', + 'pretty_version' => '9.2.7', + 'version' => '9.2.7.0', 'type' => 'metapackage', 'install_path' => NULL, 'aliases' => array(), - 'reference' => 'e9bbd6d45dddc02157ea675b557c604feb31c80d', + 'reference' => '87c998e8d60d6b2452b21827fb7b16f77d02a38a', 'dev_requirement' => false, ), 'drupal/core-render' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-serialization' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-transliteration' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-utility' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/core-version' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/crop' => array( @@ -796,19 +796,19 @@ 'drupal/datetime' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/datetime_range' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/dblog' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/dropzonejs' => array( @@ -832,13 +832,13 @@ 'drupal/dynamic_page_cache' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/editor' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/editor_advanced_link' => array( @@ -907,7 +907,7 @@ 'drupal/entity_reference' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/entity_reference_revisions' => array( @@ -931,7 +931,7 @@ 'drupal/field' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/field_group' => array( @@ -946,7 +946,7 @@ 'drupal/field_layout' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/field_permissions' => array( @@ -961,13 +961,13 @@ 'drupal/field_ui' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/file' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/file_browser' => array( @@ -982,7 +982,7 @@ 'drupal/filter' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/focal_point' => array( @@ -997,7 +997,7 @@ 'drupal/forum' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/google_analytics' => array( @@ -1021,25 +1021,25 @@ 'drupal/hal' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/help' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/help_topics' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/history' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/honeypot' => array( @@ -1054,7 +1054,7 @@ 'drupal/image' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/inline_entity_form' => array( @@ -1069,7 +1069,7 @@ 'drupal/inline_form_errors' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/jquery_ui' => array( @@ -1111,25 +1111,25 @@ 'drupal/jsonapi' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/language' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/layout_builder' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/layout_discovery' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/libraries' => array( @@ -1144,7 +1144,7 @@ 'drupal/link' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/link_attributes' => array( @@ -1168,7 +1168,7 @@ 'drupal/locale' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/mathjax' => array( @@ -1183,7 +1183,7 @@ 'drupal/media' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/media_entity_browser' => array( @@ -1207,7 +1207,7 @@ 'drupal/media_library' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/menu_block' => array( @@ -1240,13 +1240,13 @@ 'drupal/menu_link_content' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/menu_ui' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/metatag' => array( @@ -1261,7 +1261,7 @@ 'drupal/migrate' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/migrate_devel' => array( @@ -1276,19 +1276,19 @@ 'drupal/migrate_drupal' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/migrate_drupal_multilingual' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/migrate_drupal_ui' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/migrate_plus' => array( @@ -1312,7 +1312,7 @@ 'drupal/minimal' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/mobile_detect' => array( @@ -1354,25 +1354,25 @@ 'drupal/node' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/olivero' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/options' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/page_cache' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/pantheon_advanced_page_cache' => array( @@ -1396,13 +1396,13 @@ 'drupal/path' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/path_alias' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/pathauto' => array( @@ -1426,13 +1426,13 @@ 'drupal/quickedit' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/rdf' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/rebuild_cache_access' => array( @@ -1474,13 +1474,13 @@ 'drupal/responsive_image' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/rest' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/roleassign' => array( @@ -1504,7 +1504,7 @@ 'drupal/search' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/search_api' => array( @@ -1528,25 +1528,25 @@ 'drupal/serialization' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/settings_tray' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/seven' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/shortcut' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/simple_gmap' => array( @@ -1615,19 +1615,19 @@ 'drupal/standard' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/stark' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/statistics' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/superfish' => array( @@ -1651,31 +1651,31 @@ 'drupal/syslog' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/system' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/taxonomy' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/telephone' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/text' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/token' => array( @@ -1690,19 +1690,19 @@ 'drupal/toolbar' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/tour' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/tracker' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/twig_tweak' => array( @@ -1735,13 +1735,13 @@ 'drupal/update' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/user' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/userprotect' => array( @@ -1774,7 +1774,7 @@ 'drupal/views' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/views_ajax_history' => array( @@ -1834,7 +1834,7 @@ 'drupal/views_ui' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/webform' => array( @@ -1849,13 +1849,13 @@ 'drupal/workflows' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drupal/workspaces' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '9.2.6', + 0 => '9.2.7', ), ), 'drush-ops/behat-drush-endpoint' => array( @@ -2104,7 +2104,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '2bc2e7748e927bf884a27dc8ab9beca9910c1aad', + 'reference' => '1302399ef0325d509963157dd3e51fa3365d5b9f', 'dev_requirement' => false, ), 'pantheon-systems/quicksilver-pushback' => array( diff --git a/web/core/MAINTAINERS.txt b/web/core/MAINTAINERS.txt index c168aab7a7cfb6cd111323727f04e107dad3347f..25bb42f761a5421c7297bdcb6b885198f6f788a2 100644 --- a/web/core/MAINTAINERS.txt +++ b/web/core/MAINTAINERS.txt @@ -32,10 +32,13 @@ Framework managers Frontend - Lauri Eskola 'lauriii' https://www.drupal.org/u/lauriii + - (provisional) Cristina Chumillas 'ckrina' https://www.drupal.org/u/ckrina + - (provisional) Ben Mullins 'bnjmnm' https://www.drupal.org/u/bnjmnm Release managers - Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch - Jess Myrbo 'xjm' https://www.drupal.org/u/xjm +- (provisional) Victoria Spagnolo 'quietone' https://www.drupal.org/u/quietone Core JavaScript packages - (provisional) Théodore Biadala 'nod_' https://www.drupal.org/u/nod_ @@ -311,7 +314,7 @@ Migrate - Adam Globus-Hoenich 'phenaproxima' https://www.drupal.org/u/phenaproxima - Lucas Hedding 'heddn' https://www.drupal.org/u/heddn - Michael Lutz 'mikelutz' https://www.drupal.org/u/mikelutz -- Vicki Spagnolo 'quietone' https://www.drupal.org/u/quietone +- Victoria Spagnolo 'quietone' https://www.drupal.org/u/quietone Node - ? diff --git a/web/core/core.api.php b/web/core/core.api.php index 93ad0576f29df03827c42fd92dbb497a01eb9e59..8962b55516da18cda5eb01ac7f14fd34948e9ad4 100644 --- a/web/core/core.api.php +++ b/web/core/core.api.php @@ -2413,8 +2413,8 @@ function hook_validation_constraint_alter(array &$definitions) { * @code * array('#type' => 'status_messages') * @endcode - * to a render array, use drupal_render() to render it, and add a command to - * place the messages in an appropriate location. + * to a render array, use \Drupal::service('renderer')->render() to render it, + * and add a command to place the messages in an appropriate location. * * @section sec_other Other methods for triggering Ajax * Here are some additional methods you can use to trigger Ajax responses in diff --git a/web/core/includes/common.inc b/web/core/includes/common.inc index f640a901219ea24c46857da51b2e459abb37d41d..e739a80e0a871b624b82716713a1c8c784ee196f 100644 --- a/web/core/includes/common.inc +++ b/web/core/includes/common.inc @@ -408,13 +408,13 @@ function render(&$element) { /** * Hides an element from later rendering. * - * The first time render() or drupal_render() is called on an element tree, - * as each element in the tree is rendered, it is marked with a #printed flag - * and the rendered children of the element are cached. Subsequent calls to - * render() or drupal_render() will not traverse the child tree of this element - * again: they will just use the cached children. So if you want to hide an - * element, be sure to call hide() on the element before its parent tree is - * rendered for the first time, as it will have no effect on subsequent + * The first time render() or RenderInterface::render() is called on an element + * tree, as each element in the tree is rendered, it is marked with a #printed + * flag and the rendered children of the element are cached. Subsequent calls to + * render() or RenderInterface::render() will not traverse the child tree of + * this element again: they will just use the cached children. So if you want to + * hide an element, be sure to call hide() on the element before its parent tree + * is rendered for the first time, as it will have no effect on subsequent * renderings of the parent tree. * * @param $element @@ -423,6 +423,7 @@ function render(&$element) { * @return * The element. * + * @see \Drupal\Core\Render\RendererInterface * @see render() * @see show() */ @@ -437,13 +438,13 @@ function hide(&$element) { * You can also use render($element), which shows the element while rendering * it. * - * The first time render() or drupal_render() is called on an element tree, - * as each element in the tree is rendered, it is marked with a #printed flag - * and the rendered children of the element are cached. Subsequent calls to - * render() or drupal_render() will not traverse the child tree of this element - * again: they will just use the cached children. So if you want to show an - * element, be sure to call show() on the element before its parent tree is - * rendered for the first time, as it will have no effect on subsequent + * The first time render() or RenderInterface::render() is called on an element + * tree, as each element in the tree is rendered, it is marked with a #printed + * flag and the rendered children of the element are cached. Subsequent calls to + * render() or RenderInterface::render() will not traverse the child tree of + * this element again: they will just use the cached children. So if you want to + * show an element, be sure to call show() on the element before its parent tree + * is rendered for the first time, as it will have no effect on subsequent * renderings of the parent tree. * * @param $element @@ -452,6 +453,7 @@ function hide(&$element) { * @return * The element. * + * @see \Drupal\Core\Render\RendererInterface * @see render() * @see hide() */ diff --git a/web/core/lib/Drupal.php b/web/core/lib/Drupal.php index aa6447eb1f012a3f500ffba8b403674659d2aa8f..286a13668d9ba9179ed253c2404502cdf6778375 100644 --- a/web/core/lib/Drupal.php +++ b/web/core/lib/Drupal.php @@ -75,7 +75,7 @@ class Drupal { /** * The current system version. */ - const VERSION = '9.2.6'; + const VERSION = '9.2.7'; /** * Core API compatibility. diff --git a/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 9ac0a6f557995066f98c1c326e3b659df3907773..90e56472cf8c7547a14597ed8036680194c34564 100644 --- a/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -246,8 +246,8 @@ public function build(array $build) { * This function is assigned as a #pre_render callback in ::viewMultiple(). * * By delaying the building of an entity until the #pre_render processing in - * drupal_render(), the processing cost of assembling an entity's renderable - * array is saved on cache-hit requests. + * \Drupal::service('renderer')->render(), the processing cost of assembling + * an entity's renderable array is saved on cache-hit requests. * * @param array $build_list * A renderable array containing build information and context for an diff --git a/web/core/lib/Drupal/Core/Entity/entity.api.php b/web/core/lib/Drupal/Core/Entity/entity.api.php index f31561d70c5d25a7324be4f4ba551500c0cbdf0f..b1c8c352038bf193137d85c03fde8cd57638b9a2 100644 --- a/web/core/lib/Drupal/Core/Entity/entity.api.php +++ b/web/core/lib/Drupal/Core/Entity/entity.api.php @@ -1537,7 +1537,7 @@ function hook_ENTITY_TYPE_view(array &$build, \Drupal\Core\Entity\EntityInterfac * the particular entity type template, if there is one (e.g., node.html.twig). * * See the @link themeable Default theme implementations topic @endlink and - * drupal_render() for details. + * \Drupal\Core\Render\RendererInterface::render() for details. * * @param array &$build * A renderable array representing the entity content. @@ -1576,7 +1576,7 @@ function hook_entity_view_alter(array &$build, \Drupal\Core\Entity\EntityInterfa * the particular entity type template, if there is one (e.g., node.html.twig). * * See the @link themeable Default theme implementations topic @endlink and - * drupal_render() for details. + * \Drupal\Core\Render\RendererInterface::render() for details. * * @param array &$build * A renderable array representing the entity content. @@ -1659,7 +1659,7 @@ function hook_entity_view_mode_alter(&$view_mode, \Drupal\Core\Entity\EntityInte } /** - * Alter entity renderable values before cache checking in drupal_render(). + * Alter entity renderable values before cache checking during rendering. * * Invoked for a specific entity type. * @@ -1685,7 +1685,7 @@ function hook_ENTITY_TYPE_build_defaults_alter(array &$build, \Drupal\Core\Entit } /** - * Alter entity renderable values before cache checking in drupal_render(). + * Alter entity renderable values before cache checking during rendering. * * The values in the #cache key of the renderable array are used to determine if * a cache entry exists for the entity's rendered output. Ideally only values diff --git a/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php b/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php index 011cc1af490ec750e6c976dcf6bc96488f9f01fa..f904bc5f7a2232d77f5b59810b9df3a2a36378a2 100644 --- a/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php +++ b/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php @@ -17,11 +17,11 @@ /** * Subscriber that wraps controllers, to handle early rendering. * - * When controllers call drupal_render() (RendererInterface::render()) outside - * of a render context, we call that "early rendering". Controllers should - * return only render arrays, but we cannot prevent controllers from doing early - * rendering. The problem with early rendering is that the bubbleable metadata - * (cacheability & attachments) are lost. + * When controllers call RendererInterface::render() outside of a render + * context, we call that "early rendering". Controllers should return + * only render arrays, but we cannot prevent controllers from doing + * early rendering. The problem with early rendering is that the + * bubbleable metadata (cacheability & attachments) are lost. * * This can lead to broken pages (missing assets), stale pages (missing cache * tags causing a page not to be invalidated) or even security problems (missing @@ -36,8 +36,8 @@ * ::renderPlain() methods. In that case, no bubbleable metadata is lost. * * If the render context is not empty, then the controller did use - * drupal_render(), and bubbleable metadata was collected. This bubbleable - * metadata is then merged onto the render array. + * RendererInterface::render(), and bubbleable metadata was collected. + * This bubbleable metadata is then merged onto the render array. * * In other words: this just exists to ease the transition to Drupal 8: it * allows controllers that return render arrays (the majority) and @@ -124,8 +124,8 @@ protected function wrapControllerExecutionInRenderContext($controller, array $ar }); // If early rendering happened, i.e. if code in the controller called - // drupal_render() outside of a render context, then the bubbleable metadata - // for that is stored in the current render context. + // RendererInterface::render() outside of a render context, then the + // bubbleable metadata for that is stored in the current render context. if (!$context->isEmpty()) { /** @var \Drupal\Core\Render\BubbleableMetadata $early_rendering_bubbleable_metadata */ $early_rendering_bubbleable_metadata = $context->pop(); diff --git a/web/core/lib/Drupal/Core/Form/FormBuilderInterface.php b/web/core/lib/Drupal/Core/Form/FormBuilderInterface.php index 66f75d80227912cc071dc74182d5798ba7ac101c..bcdc9b1a3b7ec1994b898cea20687ae02c76c4e4 100644 --- a/web/core/lib/Drupal/Core/Form/FormBuilderInterface.php +++ b/web/core/lib/Drupal/Core/Form/FormBuilderInterface.php @@ -245,10 +245,11 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state); * This is one of the three primary functions that recursively iterates a form * array. This one does it for completing the form building process. The other * two are self::doValidateForm() (invoked via self::validateForm() and used - * to invoke validation logic for each element) and drupal_render() (for - * rendering each element). Each of these three pipelines provides ample - * opportunity for modules to customize what happens. For example, during this - * function's life cycle, the following functions get called for each element: + * to invoke validation logic for each element) and + * RendererInterface::render() (for rendering each element). + * Each of these three pipelines provides ample opportunity for modules to + * customize what happens. For example, during this function's life cycle, + * the following functions get called for each element: * - $element['#value_callback']: A callable that implements how user input is * mapped to an element's #value property. This defaults to a function named * 'form_type_TYPE_value' where TYPE is $element['#type']. @@ -269,8 +270,8 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state); * called in postorder traversal, meaning they are called for the child * elements first, then for the parent element. * There are similar properties containing callback functions invoked by - * self::doValidateForm() and drupal_render(), appropriate for those - * operations. + * self::doValidateForm() and RendererInterface::render(), + * appropriate for those operations. * * Developers are strongly encouraged to integrate the functionality needed by * their form or module within one of these three pipelines, using the diff --git a/web/core/lib/Drupal/Core/Menu/MenuLinkTree.php b/web/core/lib/Drupal/Core/Menu/MenuLinkTree.php index b0399312fd565f81bc85ee495f7f7465b28a1450..52991cefa61ec8035044ed017817bfe4c8309365 100644 --- a/web/core/lib/Drupal/Core/Menu/MenuLinkTree.php +++ b/web/core/lib/Drupal/Core/Menu/MenuLinkTree.php @@ -171,7 +171,8 @@ public function build(array $tree) { $tree_cacheability->applyTo($build); if ($items) { - // Make sure drupal_render() does not re-order the links. + // Make sure Drupal\Core\Render\Element::children() does not re-order the + // links. $build['#sorted'] = TRUE; // Get the menu name from the last link. $item = end($items); diff --git a/web/core/lib/Drupal/Core/Render/Element.php b/web/core/lib/Drupal/Core/Render/Element.php index ed7a444980b37e0300ea3fb0ce63f8f2094953fc..dfd4eb099d36f2a052e1bd14f0455abedfb48294 100644 --- a/web/core/lib/Drupal/Core/Render/Element.php +++ b/web/core/lib/Drupal/Core/Render/Element.php @@ -57,7 +57,8 @@ public static function child($key) { * Identifies the children of an element array, optionally sorted by weight. * * The children of an element array are those key/value pairs whose key does - * not start with a '#'. See drupal_render() for details. + * not start with a '#'. See \Drupal\Core\Render\RendererInterface::render() + * for details. * * @param array $elements * The element array whose children are to be identified. Passed by diff --git a/web/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/web/core/lib/Drupal/Core/Render/Element/HtmlTag.php index 94a7ef18cecf320e73a8f029634bd1716c54cf5b..8105c487f94e31597c5f33201f020e54e8a07409 100644 --- a/web/core/lib/Drupal/Core/Render/Element/HtmlTag.php +++ b/web/core/lib/Drupal/Core/Render/Element/HtmlTag.php @@ -172,8 +172,8 @@ public static function preRenderConditionalComments($element) { // technique. See http://wikipedia.org/wiki/Conditional_comment // for details. - // Ensure what we are dealing with is safe. - // This would be done later anyway in drupal_render(). + // Ensure what we are dealing with is safe. This would be done later anyway + // in \Drupal::service('renderer')->render(). $prefix = isset($element['#prefix']) ? $element['#prefix'] : ''; if ($prefix && !($prefix instanceof MarkupInterface)) { $prefix = Xss::filterAdmin($prefix); diff --git a/web/core/lib/Drupal/Core/Render/Element/Link.php b/web/core/lib/Drupal/Core/Render/Element/Link.php index 8021a809120d4f37f1e547603e17e9dd544f5e32..2af8bf0b27aa583e88d2d80810eee5a42ee8110f 100644 --- a/web/core/lib/Drupal/Core/Render/Element/Link.php +++ b/web/core/lib/Drupal/Core/Render/Element/Link.php @@ -111,9 +111,10 @@ public static function preRenderLink($element) { * * The purpose of this is to allow links to be logically grouped into related * categories, so that each child group can be rendered as its own list of - * links if drupal_render() is called on it, but calling drupal_render() on - * the parent element will still produce a single list containing all the - * remaining links, regardless of what group they were in. + * links if RendererInterface::render() is called on it, but + * calling RendererInterface::render() on the parent element will + * still produce a single list containing all the remaining links, regardless + * of what group they were in. * * A typical example comes from node links, which are stored in a renderable * array similar to this: diff --git a/web/core/lib/Drupal/Core/Render/Renderer.php b/web/core/lib/Drupal/Core/Render/Renderer.php index 25b294c665e5cef69506f40f4dea6daea772b219..2ea2ca113c0b195864f2c4525a2854e44eb1b6f7 100644 --- a/web/core/lib/Drupal/Core/Render/Renderer.php +++ b/web/core/lib/Drupal/Core/Render/Renderer.php @@ -548,7 +548,7 @@ protected function doRender(&$elements, $is_root_call = FALSE) { $this->replacePlaceholders($elements); // @todo remove as part of https://www.drupal.org/node/2511330. if ($context->count() !== 1) { - throw new \LogicException('A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break.'); + throw new \LogicException('A stray RendererInterface::render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break.'); } } diff --git a/web/core/lib/Drupal/Core/Render/theme.api.php b/web/core/lib/Drupal/Core/Render/theme.api.php index 413449bef13961b96080030a51cc985a059f0045..93d48d93110987bda7626e6e3a06b12a77b0e109 100644 --- a/web/core/lib/Drupal/Core/Render/theme.api.php +++ b/web/core/lib/Drupal/Core/Render/theme.api.php @@ -17,11 +17,12 @@ * hierarchical arrays that include the data to be rendered into HTML (or XML or * another output format), and options that affect the markup. Render arrays * are ultimately rendered into HTML or other output formats by recursive calls - * to drupal_render(), traversing the depth of the render array hierarchy. At - * each level, the theme system is invoked to do the actual rendering. See the - * documentation of drupal_render() and the - * @link theme_render Theme system and Render API topic @endlink for more - * information about render arrays and rendering. + * to \Drupal\Core\Render\RendererInterface::render(), traversing the depth of + * the render array hierarchy. At each level, the theme system is invoked to do + * the actual rendering. See the documentation of + * \Drupal\Core\Render\RendererInterface::render() and the @link theme_render + * Theme system and Render API topic @endlink for more information about render + * arrays and rendering. * * @section sec_twig_theme Twig Templating Engine * Drupal 8 uses the templating engine Twig. Twig offers developers a fast, @@ -241,13 +242,16 @@ * hierarchical associative array containing data to be rendered and properties * describing how the data should be rendered. A render array that is returned * by a function to specify markup to be sent to the web browser or other - * services will eventually be rendered by a call to drupal_render(), which will - * recurse through the render array hierarchy if appropriate, making calls into - * the theme system to do the actual rendering. If a function or method actually - * needs to return rendered output rather than a render array, the best practice - * would be to create a render array, render it by calling drupal_render(), and - * return that result, rather than writing the markup directly. See the - * documentation of drupal_render() for more details of the rendering process. + * services will eventually be rendered by a call to + * \Drupal\Core\Render\RendererInterface::render(), which will recurse through + * the render array hierarchy if appropriate, making calls into the theme system + * to do the actual rendering. If a function or method actually needs to return + * rendered output rather than a render array, the best practice would be to + * create a render array, render it by calling + * \Drupal\Core\Render\RendererInterface::render(), and return that result, + * rather than writing the markup directly. See the documentation of + * \Drupal\Core\Render\RendererInterface::render() for more details of the + * rendering process. * * Each level in the hierarchy of a render array (including the outermost array) * has one or more array elements. Array elements whose names start with '#' are diff --git a/web/core/modules/action/tests/src/Functional/ActionListTest.php b/web/core/modules/action/tests/src/Functional/ActionListTest.php index f481bd42cd98569658c5acec7f7e5d1cf531bb87..0f0869280d7834b219e77dfc8ade31a9c16bebc4 100644 --- a/web/core/modules/action/tests/src/Functional/ActionListTest.php +++ b/web/core/modules/action/tests/src/Functional/ActionListTest.php @@ -36,7 +36,7 @@ public function testEmptyActionList() { $actions = $storage->loadMultiple(); $storage->delete($actions); $this->drupalGet('/admin/config/system/actions'); - $this->assertRaw('There are no actions yet.'); + $this->assertSession()->pageTextContains('There are no actions yet.'); } } diff --git a/web/core/modules/action/tests/src/Functional/ActionUninstallTest.php b/web/core/modules/action/tests/src/Functional/ActionUninstallTest.php index ed5ab041f8f4e1b560818f79c4c80715cef7cbdd..1d718f0c531d3c659a7c93abde2629595eb31db2 100644 --- a/web/core/modules/action/tests/src/Functional/ActionUninstallTest.php +++ b/web/core/modules/action/tests/src/Functional/ActionUninstallTest.php @@ -40,7 +40,7 @@ public function testActionUninstall() { $this->drupalGet('admin/people'); // Ensure we have the user_block_user_action listed. - $this->assertRaw('<option value="user_block_user_action">Block the selected user(s)</option>'); + $this->assertSession()->responseContains('<option value="user_block_user_action">Block the selected user(s)</option>'); } diff --git a/web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php b/web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php index 5e5ac32d06b4598dbbf3947cf183affff0d84f41..4ff2ca30abff6c4e9c69f65c0602da9d4fb7b5bf 100644 --- a/web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php +++ b/web/core/modules/aggregator/tests/src/Functional/AddFeedTest.php @@ -38,7 +38,7 @@ public function testAddFeed() { $this->assertSession()->statusCodeEquals(200); // Verify that the feed label is present in the page title. $this->assertSession()->pageTextContains($feed->label()); - $this->assertRaw($feed->getWebsiteUrl()); + $this->assertSession()->pageTextContains($feed->getWebsiteUrl()); // Try to add a duplicate. $edit = [ diff --git a/web/core/modules/aggregator/tests/src/Functional/FeedParserTest.php b/web/core/modules/aggregator/tests/src/Functional/FeedParserTest.php index 193a222145b276cf06368eae47fb81b0fee30df9..916510b706b315829af3ba9ccfd9e22081a32914 100644 --- a/web/core/modules/aggregator/tests/src/Functional/FeedParserTest.php +++ b/web/core/modules/aggregator/tests/src/Functional/FeedParserTest.php @@ -41,10 +41,10 @@ public function testRSS091Sample() { $this->assertSession()->pageTextContains('First example feed item title'); $this->assertSession()->linkByHrefExists('http://example.com/example-turns-one'); $this->assertSession()->pageTextContains('First example feed item description.'); - $this->assertRaw('<img src="http://example.com/images/druplicon.png"'); + $this->assertSession()->responseContains('<img src="http://example.com/images/druplicon.png"'); // Several additional items that include elements over 255 characters. - $this->assertRaw("Second example feed item title."); + $this->assertSession()->pageTextContains("Second example feed item title."); $this->assertSession()->pageTextContains('Long link feed item title'); $this->assertSession()->pageTextContains('Long link feed item description'); $this->assertSession()->linkByHrefExists('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing'); @@ -91,7 +91,7 @@ public function testHtmlEntitiesSample() { $feed->refreshItems(); $this->drupalGet('aggregator/sources/' . $feed->id()); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw("Quote" Amp&"); + $this->assertSession()->responseContains("Quote" Amp&"); } /** diff --git a/web/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php b/web/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php index c1340d0d94b56a93af031e01c460ad502678ae4a..0e41379c13b13be73ca1224ea970a92ebf23821c 100644 --- a/web/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php +++ b/web/core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php @@ -84,7 +84,7 @@ public function testSettingsForm() { ]); $test_processor = $this->getMockBuilder('Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor') - ->setMethods(['buildConfigurationForm', 'validateConfigurationForm', 'submitConfigurationForm']) + ->onlyMethods(['buildConfigurationForm', 'validateConfigurationForm', 'submitConfigurationForm']) ->setConstructorArgs([[], 'aggregator_test', ['description' => ''], $this->configFactory]) ->getMock(); $test_processor->expects($this->once()) diff --git a/web/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php b/web/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php index a76ec986e4b06b7ebe3eca5f9fc515faba72a6ad..d4beb97689b605a045b034200ac3f8921a4fc258 100644 --- a/web/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php +++ b/web/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php @@ -253,17 +253,17 @@ public function testControllerNotCalledBeforeAuth() { $this->assertSession()->statusCodeEquals(401); $this->drupalGet('/basic_auth_test/state/read'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('nope'); + $this->assertSession()->pageTextContains('nope'); $account = $this->drupalCreateUser(); $this->basicAuthGet('/basic_auth_test/state/modify', $account->getAccountName(), $account->pass_raw); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Done'); + $this->assertSession()->pageTextContains('Done'); $this->mink->resetSessions(); $this->drupalGet('/basic_auth_test/state/read'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('yep'); + $this->assertSession()->pageTextContains('yep'); } } diff --git a/web/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/web/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php index 634ecd744c573473791d2a023bfc86cf510be69a..beb9f2e9248e199b58d5c91543fc0d3802732313 100644 --- a/web/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +++ b/web/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php @@ -94,12 +94,12 @@ public function testNoJsDetection() { $this->drupalLogin($this->rootUser); $this->assertSessionCookieExists(TRUE); $this->assertBigPipeNoJsCookieExists(FALSE); - $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/1" />' . "\n" . '</noscript>'); + $this->assertSession()->responseContains('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/1" />' . "\n" . '</noscript>'); $this->assertSession()->responseNotContains($no_js_to_js_markup); $this->assertBigPipeNoJsMetaRefreshRedirect(); $this->assertBigPipeNoJsCookieExists(TRUE); $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL='); - $this->assertRaw($no_js_to_js_markup); + $this->assertSession()->responseContains($no_js_to_js_markup); $this->drupalLogout(); // Close the prior connection and remove the collected state. @@ -110,12 +110,12 @@ public function testNoJsDetection() { $this->drupalGet(Url::fromRoute('user.login')); $this->assertSessionCookieExists(TRUE); $this->assertBigPipeNoJsCookieExists(FALSE); - $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>'); + $this->assertSession()->responseContains('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>'); $this->assertSession()->responseNotContains($no_js_to_js_markup); $this->assertBigPipeNoJsMetaRefreshRedirect(); $this->assertBigPipeNoJsCookieExists(TRUE); $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL='); - $this->assertRaw($no_js_to_js_markup); + $this->assertSession()->responseContains($no_js_to_js_markup); // Close the prior connection and remove the collected state. $this->getSession()->reset(); @@ -184,7 +184,7 @@ public function testBigPipe() { 1 => $cases['html']->bigPipePlaceholderId, ]); - $this->assertRaw('</body>'); + $this->assertSession()->responseContains('</body>'); // Verifying BigPipe assets are present. $this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.'); @@ -211,8 +211,8 @@ public function testBigPipe() { $this->config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); $this->drupalGet(Url::fromRoute('big_pipe_test')); // The 'edge_case__html_exception' case throws an exception. - $this->assertRaw('The website encountered an unexpected error. Please try again later'); - $this->assertRaw('You are not allowed to say llamas are not cool!'); + $this->assertSession()->pageTextContains('The website encountered an unexpected error. Please try again later'); + $this->assertSession()->pageTextContains('You are not allowed to say llamas are not cool!'); // Check that stop signal and closing body tag are absent. $this->assertSession()->responseNotContains(BigPipe::STOP_SIGNAL); $this->assertSession()->responseNotContains('</body>'); @@ -271,7 +271,7 @@ public function testBigPipeNoJs() { // Verifying BigPipe assets are absent. $this->assertArrayNotHasKey('bigPipePlaceholderIds', $this->getDrupalSettings()); $this->assertArrayNotHasKey('ajaxPageState', $this->getDrupalSettings()); - $this->assertRaw('</body>'); + $this->assertSession()->responseContains('</body>'); // Verify that 4xx responses work fine. (4xx responses are handled by // subrequests to a route pointing to a controller with the desired output.) @@ -283,8 +283,8 @@ public function testBigPipeNoJs() { $this->config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); $this->drupalGet(Url::fromRoute('big_pipe_test')); // The 'edge_case__html_exception' case throws an exception. - $this->assertRaw('The website encountered an unexpected error. Please try again later'); - $this->assertRaw('You are not allowed to say llamas are not cool!'); + $this->assertSession()->pageTextContains('The website encountered an unexpected error. Please try again later'); + $this->assertSession()->pageTextContains('You are not allowed to say llamas are not cool!'); $this->assertSession()->responseNotContains('</body>'); // The exception is expected. Do not interpret it as a test failure. unlink($this->root . '/' . $this->siteDirectory . '/error.log'); @@ -307,7 +307,7 @@ public function testBigPipeMultiOccurrencePlaceholders() { $this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence')); $big_pipe_placeholder_id = 'callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages&args%5B0%5D&token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA'; $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">'; - $this->assertRaw('The count is 1.'); + $this->assertSession()->pageTextContains('The count is 1.'); $this->assertSession()->responseNotContains('The count is 2.'); $this->assertSession()->responseNotContains('The count is 3.'); $raw_content = $this->getSession()->getPage()->getContent(); @@ -321,7 +321,7 @@ public function testBigPipeMultiOccurrencePlaceholders() { $this->performMetaRefresh(); $this->assertBigPipeNoJsCookieExists(TRUE); $this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence')); - $this->assertRaw('The count is 1.'); + $this->assertSession()->pageTextContains('The count is 1.'); $this->assertSession()->responseNotContains('The count is 2.'); $this->assertSession()->responseNotContains('The count is 3.'); } @@ -347,7 +347,7 @@ protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_p // $big_pipe_nojs_placeholder is present. $this->assertSession()->responseNotContains($big_pipe_nojs_placeholder); if ($expected_replacement !== NULL) { - $this->assertRaw($expected_replacement); + $this->assertSession()->responseContains($expected_replacement); } } } @@ -368,7 +368,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde foreach ($expected_big_pipe_placeholders as $big_pipe_placeholder_id => $expected_ajax_response) { // Verify expected placeholder. $expected_placeholder_html = '<span data-big-pipe-placeholder-id="' . $big_pipe_placeholder_id . '"></span>'; - $this->assertRaw($expected_placeholder_html); + $this->assertSession()->responseContains($expected_placeholder_html); $pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_html); $placeholder_positions[$pos] = $big_pipe_placeholder_id; // Verify expected placeholder replacement. @@ -380,7 +380,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde continue; } $this->assertEquals($expected_ajax_response, trim($result[0]->getText())); - $this->assertRaw($expected_placeholder_replacement); + $this->assertSession()->responseContains($expected_placeholder_replacement); $pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_replacement); $placeholder_replacement_positions[$pos] = $big_pipe_placeholder_id; } @@ -399,8 +399,8 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde $this->assertSame(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="', '/') . '/', $this->getSession()->getPage()->getContent())); // Verifying BigPipe start/stop signals. - $this->assertRaw(BigPipe::START_SIGNAL); - $this->assertRaw(BigPipe::STOP_SIGNAL); + $this->assertSession()->responseContains(BigPipe::START_SIGNAL); + $this->assertSession()->responseContains(BigPipe::STOP_SIGNAL); $start_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::START_SIGNAL); $stop_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::STOP_SIGNAL); $this->assertTrue($start_signal_position < $stop_signal_position, 'BigPipe start signal appears before stop signal.'); diff --git a/web/core/modules/block/block.api.php b/web/core/modules/block/block.api.php index d9626c827289fd916ddd183c4273989d8436a97c..8c2e5b0b0bed092ac0d6e2636076bc8b25482764 100644 --- a/web/core/modules/block/block.api.php +++ b/web/core/modules/block/block.api.php @@ -72,8 +72,9 @@ * If the module wishes to act on the rendered HTML of the block rather than * the structured content array, it may use this hook to add a #post_render * callback. Alternatively, it could also implement hook_preprocess_HOOK() for - * block.html.twig. See drupal_render() documentation or the - * @link themeable Default theme implementations topic @endlink for details. + * block.html.twig. See \Drupal\Core\Render\RendererInterface::render() + * documentation or the @link themeable Default theme implementations topic + * @endlink for details. * * In addition to hook_block_view_alter(), which is called for all blocks, there * is hook_block_view_BASE_BLOCK_ID_alter(), which can be used to target a diff --git a/web/core/modules/block/tests/src/Functional/BlockUiTest.php b/web/core/modules/block/tests/src/Functional/BlockUiTest.php index 140821922bfce9f75114be8684a9f1be50171eb5..5618a05e5b7a0253718c83a27bbb91b977dd5bf6 100644 --- a/web/core/modules/block/tests/src/Functional/BlockUiTest.php +++ b/web/core/modules/block/tests/src/Functional/BlockUiTest.php @@ -243,7 +243,7 @@ public function testContextAwareBlocks() { $this->drupalGet(''); $this->assertSession()->pageTextContains('Test context-aware block'); $this->assertSession()->pageTextContains('User context found.'); - $this->assertRaw($expected_text); + $this->assertSession()->responseContains($expected_text); // Test context mapping form element is not visible if there are no valid // context options for the block (the test_context_aware_no_valid_context_options diff --git a/web/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/web/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index 22047ca23d435eccabd4c8bc6f59546a0ea7458f..5fd9490e58418287c4f1fb33102ec2bd395f1172 100644 --- a/web/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/web/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -386,8 +386,8 @@ public function testBlockContextualLinks() { $cached_id_token = Crypt::hmacBase64($cached_id, Settings::getHashSalt() . $this->container->get('private_key')->get()); // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder() // Check existence of the contextual link placeholders. - $this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>'); - $this->assertRaw('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>'); + $this->assertSession()->responseContains('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>'); + $this->assertSession()->responseContains('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>'); // Get server-rendered contextual links. // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks() diff --git a/web/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php b/web/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php index 7ae7b96bf8da184e38140b97121795efb9d1e3ba..77a8d59798e40f6dd842850b96225aa3aadb3917 100644 --- a/web/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php +++ b/web/core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php @@ -96,7 +96,7 @@ public function testCalculateDependencies() { // Mock the entity under test so that we can mock getPluginCollections(). $entity = $this->getMockBuilder('\Drupal\block\Entity\Block') ->setConstructorArgs([$values, $this->entityTypeId]) - ->setMethods(['getPluginCollections']) + ->onlyMethods(['getPluginCollections']) ->getMock(); // Create a configurable plugin that would add a dependency. $instance_id = $this->randomMachineName(); @@ -106,7 +106,7 @@ public function testCalculateDependencies() { // Create a plugin collection to contain the instance. $plugin_collection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection') ->disableOriginalConstructor() - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $plugin_collection->expects($this->atLeastOnce()) ->method('get') diff --git a/web/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/web/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php index f3175cb488b9b5626a6e8fb66f62cd75a06ef7f8..4528737fe22b6c2485938b814dd90726c54740ef 100644 --- a/web/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php +++ b/web/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @@ -47,9 +47,9 @@ class BlockPageVariantTest extends UnitTestCase { public function setUpDisplayVariant($configuration = [], $definition = []) { $container = new Container(); - $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() - ->setMethods(['assertValidTokens']) + ->onlyMethods(['assertValidTokens']) ->getMock(); $container->set('cache_contexts_manager', $cache_context_manager); $cache_context_manager->expects($this->any()) @@ -62,7 +62,7 @@ public function setUpDisplayVariant($configuration = [], $definition = []) { return $this->getMockBuilder('Drupal\block\Plugin\DisplayVariant\BlockPageVariant') ->setConstructorArgs([$configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, ['config:block_list']]) - ->setMethods(['getRegionNames']) + ->addMethods(['getRegionNames']) ->getMock(); } diff --git a/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php index 7cf77bda992e45281dcb58aa4081fe52c6eced4f..d0075ad869d926759295d5f2144616bd8054517f 100644 --- a/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php +++ b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php @@ -89,7 +89,7 @@ public function testTransformException() { $migrate_lookup = $this->prophesize(MigrateLookupInterface::class); $this->row = $this->getMockBuilder('Drupal\migrate\Row') ->disableOriginalConstructor() - ->setMethods(['getSourceProperty']) + ->onlyMethods(['getSourceProperty']) ->getMock(); $this->row->expects($this->exactly(2)) ->method('getSourceProperty') diff --git a/web/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/web/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 7179d9af5019bebce4dbba658c0c16bbd96eb4ff..4d46481bb1a04add5c9b108f95cf9c95f0d04631 100644 --- a/web/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/web/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -123,7 +123,7 @@ public function testBlockContentTypeEditing() { // Verify that title and body fields are displayed. $this->drupalGet('block/add/basic'); - $this->assertRaw('Block description'); + $this->assertSession()->pageTextContains('Block description'); $this->assertNotEmpty($this->cssSelect('#edit-body-0-value'), 'Body field was found.'); // Change the block type name. @@ -143,7 +143,7 @@ public function testBlockContentTypeEditing() { \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); $this->drupalGet('block/add'); - $this->assertRaw('Bar'); + $this->assertSession()->pageTextContains('Bar'); $this->clickLink('Bar'); // Verify that the original machine name was used in the URL. $this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic'])); diff --git a/web/core/modules/book/src/BookManager.php b/web/core/modules/book/src/BookManager.php index a79d7c2db8e2e686c8213e4de4b865343146407d..a3dda65506fc360fd95c2a86af0ec74f506cee0a 100644 --- a/web/core/modules/book/src/BookManager.php +++ b/web/core/modules/book/src/BookManager.php @@ -572,7 +572,8 @@ public function bookTreeOutput(array $tree) { $build = []; if ($items) { - // Make sure drupal_render() does not re-order the links. + // Make sure Drupal\Core\Render\Element::children() does not re-order the + // links. $build['#sorted'] = TRUE; // Get the book id from the last link. $item = end($items); diff --git a/web/core/modules/book/tests/src/Functional/BookTest.php b/web/core/modules/book/tests/src/Functional/BookTest.php index b3508a149ca746f19876a7724356bbba4b5c408a..15366c4f5a07d4bef6629834c21f59fa6aa174ad 100644 --- a/web/core/modules/book/tests/src/Functional/BookTest.php +++ b/web/core/modules/book/tests/src/Functional/BookTest.php @@ -130,23 +130,23 @@ public function testBookNavigationCacheContext() { // On non-node route. $this->drupalGet($this->adminUser->toUrl()); - $this->assertRaw('[route.book_navigation]=book.none'); + $this->assertSession()->responseContains('[route.book_navigation]=book.none'); // On non-book node route. $this->drupalGet($page->toUrl()); - $this->assertRaw('[route.book_navigation]=book.none'); + $this->assertSession()->responseContains('[route.book_navigation]=book.none'); // On book node route. $this->drupalGet($book_nodes[0]->toUrl()); - $this->assertRaw('[route.book_navigation]=0|2|3'); + $this->assertSession()->responseContains('[route.book_navigation]=0|2|3'); $this->drupalGet($book_nodes[1]->toUrl()); - $this->assertRaw('[route.book_navigation]=0|2|3|4'); + $this->assertSession()->responseContains('[route.book_navigation]=0|2|3|4'); $this->drupalGet($book_nodes[2]->toUrl()); - $this->assertRaw('[route.book_navigation]=0|2|3|5'); + $this->assertSession()->responseContains('[route.book_navigation]=0|2|3|5'); $this->drupalGet($book_nodes[3]->toUrl()); - $this->assertRaw('[route.book_navigation]=0|2|6'); + $this->assertSession()->responseContains('[route.book_navigation]=0|2|6'); $this->drupalGet($book_nodes[4]->toUrl()); - $this->assertRaw('[route.book_navigation]=0|2|7'); + $this->assertSession()->responseContains('[route.book_navigation]=0|2|7'); } /** @@ -256,7 +256,7 @@ public function testBookExport() { // Make sure each part of the book is there. foreach ($nodes as $node) { $this->assertSession()->pageTextContains($node->label()); - $this->assertRaw($node->body->processed); + $this->assertSession()->responseContains($node->body->processed); } // Make sure we can't export an unsupported format. diff --git a/web/core/modules/book/tests/src/Functional/BookTestTrait.php b/web/core/modules/book/tests/src/Functional/BookTestTrait.php index c2cb0a4d2c15cede8246286efb7fa6eea19b0ecb..508fafab4c138c9538b184766b4021fd1a5ea21d 100644 --- a/web/core/modules/book/tests/src/Functional/BookTestTrait.php +++ b/web/core/modules/book/tests/src/Functional/BookTestTrait.php @@ -104,14 +104,14 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne $url = $previous->toUrl(); $url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]); $text = new FormattableMarkup('<b>‹</b> @label', ['@label' => $previous->label()]); - $this->assertRaw(Link::fromTextAndUrl($text, $url)->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl($text, $url)->toString()); } if ($up) { /** @var \Drupal\Core\Url $url */ $url = $up->toUrl(); $url->setOptions(['attributes' => ['title' => t('Go to parent page')]]); - $this->assertRaw(Link::fromTextAndUrl('Up', $url)->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl('Up', $url)->toString()); } if ($next) { @@ -119,7 +119,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne $url = $next->toUrl(); $url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]); $text = new FormattableMarkup('@label <b>›</b>', ['@label' => $next->label()]); - $this->assertRaw(Link::fromTextAndUrl($text, $url)->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl($text, $url)->toString()); } // Compute the expected breadcrumb. @@ -142,7 +142,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne // Check printer friendly version. $this->drupalGet('book/export/html/' . $node->id()); $this->assertSession()->pageTextContains($node->label()); - $this->assertRaw($node->body->processed); + $this->assertSession()->responseContains($node->body->processed); $number++; } diff --git a/web/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php b/web/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php index bca2e9a3501c32abc006542c5dd12d4b92d20a46..382e778dffc550801a61b42d4cd32ee61daf9552 100644 --- a/web/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php +++ b/web/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php @@ -22,7 +22,7 @@ protected function setUp(): void { parent::setUp(); $this->bookUninstallValidator = $this->getMockBuilder('Drupal\book\BookUninstallValidator') ->disableOriginalConstructor() - ->setMethods(['hasBookOutlines', 'hasBookNodes']) + ->onlyMethods(['hasBookOutlines', 'hasBookNodes']) ->getMock(); $this->bookUninstallValidator->setStringTranslation($this->getStringTranslationStub()); } diff --git a/web/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/web/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index f101ed0a645ccf670f3cc74f90d5ba3a418aa4e1..686d7da6d6b4e1b9796e787e2708c93d71a08179 100644 --- a/web/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php +++ b/web/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -184,13 +184,13 @@ public function testExistingFormat() { return trim(Json::encode($html), '"'); }; // Check the Button separator. - $this->assertRaw($json_encode('<li data-drupal-ckeditor-button-name="-" class="ckeditor-button-separator ckeditor-multiple-button" data-drupal-ckeditor-type="separator"><a href="#" role="button" aria-label="Button separator" class="ckeditor-separator"></a></li>')); + $this->assertSession()->responseContains($json_encode('<li data-drupal-ckeditor-button-name="-" class="ckeditor-button-separator ckeditor-multiple-button" data-drupal-ckeditor-type="separator"><a href="#" role="button" aria-label="Button separator" class="ckeditor-separator"></a></li>')); // Check the Format dropdown. - $this->assertRaw($json_encode('<li data-drupal-ckeditor-button-name="Format" class="ckeditor-button"><a href="#" role="button" aria-label="Format"><span class="ckeditor-button-dropdown">Format<span class="ckeditor-button-arrow"></span></span></a></li>')); + $this->assertSession()->responseContains($json_encode('<li data-drupal-ckeditor-button-name="Format" class="ckeditor-button"><a href="#" role="button" aria-label="Format"><span class="ckeditor-button-dropdown">Format<span class="ckeditor-button-arrow"></span></span></a></li>')); // Check the Styles dropdown. - $this->assertRaw($json_encode('<li data-drupal-ckeditor-button-name="Styles" class="ckeditor-button"><a href="#" role="button" aria-label="Styles"><span class="ckeditor-button-dropdown">Styles<span class="ckeditor-button-arrow"></span></span></a></li>')); + $this->assertSession()->responseContains($json_encode('<li data-drupal-ckeditor-button-name="Styles" class="ckeditor-button"><a href="#" role="button" aria-label="Styles"><span class="ckeditor-button-dropdown">Styles<span class="ckeditor-button-arrow"></span></span></a></li>')); // Check strikethrough. - $this->assertRaw($json_encode('<li data-drupal-ckeditor-button-name="Strike" class="ckeditor-button"><a href="#" class="cke-icon-only cke_ltr" role="button" title="strike" aria-label="strike"><span class="cke_button_icon cke_button__strike_icon">strike</span></a></li>')); + $this->assertSession()->responseContains($json_encode('<li data-drupal-ckeditor-button-name="Strike" class="ckeditor-button"><a href="#" class="cke-icon-only cke_ltr" role="button" title="strike" aria-label="strike"><span class="cke_button_icon cke_button__strike_icon">strike</span></a></li>')); // Now enable the ckeditor_test module, which provides one configurable // CKEditor plugin — this should not affect the Editor config entity. diff --git a/web/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php b/web/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php index ff75d6e4aa5fbb92fc8fc82d35e9b0d9c468524f..8e7181b26451da365752177bbaac2aff48555ba5 100644 --- a/web/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php +++ b/web/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php @@ -77,7 +77,7 @@ public function testImageButtonDisplay() { return trim(Json::encode($html), '"'); }; $markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png'))); - $this->assertRaw($markup); + $this->assertSession()->responseContains($markup); } } diff --git a/web/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php b/web/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php index 7520cb5a5282f3d6123f500a4ed07df4618ed8cc..943cafcdf78b49c8fc0bbfbdff0688fda8572938 100644 --- a/web/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php +++ b/web/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php @@ -56,7 +56,7 @@ public function testColorPreview() { $this->assertSession()->pageTextContains('TEST COLOR PREVIEW'); $this->assertSession()->responseNotContains('<script>alert("security filter test");</script>'); - $this->assertRaw('<h2>TEST COLOR PREVIEW</h2>'); + $this->assertSession()->responseContains('<h2>TEST COLOR PREVIEW</h2>'); } } diff --git a/web/core/modules/color/tests/src/Functional/ColorTest.php b/web/core/modules/color/tests/src/Functional/ColorTest.php index c515bb19633fc0e957a6fb7a8fc9113dd4856b01..06d1e3eceb573ab1d2271a0bbb5eca975e652652 100644 --- a/web/core/modules/color/tests/src/Functional/ColorTest.php +++ b/web/core/modules/color/tests/src/Functional/ColorTest.php @@ -215,7 +215,7 @@ public function testOverrideAndResetScheme() { // Make sure the color logo is not being used. $this->assertSession()->responseNotContains('files/color/bartik-'); // Make sure the original bartik logo exists. - $this->assertRaw('bartik/logo.svg'); + $this->assertSession()->responseContains('bartik/logo.svg'); // Log in and set the color scheme to 'slate'. $this->drupalLogin($this->bigUser); @@ -227,7 +227,7 @@ public function testOverrideAndResetScheme() { $this->drupalLogout(); $this->drupalGet(''); // Make sure the color logo is being used. - $this->assertRaw('files/color/bartik-'); + $this->assertSession()->responseContains('files/color/bartik-'); // Make sure the original bartik logo does not exist. $this->assertSession()->responseNotContains('bartik/logo.svg'); @@ -243,7 +243,7 @@ public function testOverrideAndResetScheme() { // Make sure the color logo is not being used. $this->assertSession()->responseNotContains('files/color/bartik-'); // Make sure the original bartik logo exists. - $this->assertRaw('bartik/logo.svg'); + $this->assertSession()->responseContains('bartik/logo.svg'); } } diff --git a/web/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/web/core/modules/comment/tests/src/Functional/CommentAdminTest.php index cbc3991f7032d399aaea8697d9c2090c7a77551b..e82ec2ecab4ae05c138cac3e4e5e42c4222cf471 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentAdminTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentAdminTest.php @@ -279,8 +279,8 @@ public function testCommentedTranslationDeletion() { ]; $this->drupalGet('admin/content/comment'); $this->submitForm($edit, 'Update'); - $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()])); - $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()])); + $this->assertSession()->responseContains(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()])); + $this->assertSession()->responseContains(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()])); $this->assertSession()->pageTextContains('English'); $this->assertSession()->pageTextContains('Urdu'); $this->submitForm([], 'Delete'); diff --git a/web/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/web/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php index d9ae7a1a524173a9ec4aa28ebe5fc503c86b584d..203793118d835920108a52f9ccdffa21092ecbf4 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php @@ -137,22 +137,22 @@ public function testAnonymous() { // Make sure the user data appears correctly when editing the comment. $this->drupalLogin($this->adminUser); $this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit'); - $this->assertRaw($author_name); + $this->assertSession()->responseContains($author_name); // Check the author field is empty (i.e. anonymous) when editing the comment. $this->assertSession()->fieldValueEquals('uid', ''); - $this->assertRaw($author_mail); + $this->assertSession()->responseContains($author_mail); // Unpublish comment. $this->performCommentOperation($anonymous_comment3, 'unpublish'); $this->drupalGet('admin/content/comment/approval'); - $this->assertRaw('comments[' . $anonymous_comment3->id() . ']'); + $this->assertSession()->responseContains('comments[' . $anonymous_comment3->id() . ']'); // Publish comment. $this->performCommentOperation($anonymous_comment3, 'publish', TRUE); $this->drupalGet('admin/content/comment'); - $this->assertRaw('comments[' . $anonymous_comment3->id() . ']'); + $this->assertSession()->responseContains('comments[' . $anonymous_comment3->id() . ']'); // Delete comment. $this->performCommentOperation($anonymous_comment3, 'delete'); diff --git a/web/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/web/core/modules/comment/tests/src/Functional/CommentBlockTest.php index 1392b0556e9a61e9da4d270d9152c45a613f294c..ac72aeae0f8b8e6b0f9e9648fd0a2cc970df5dff 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentBlockTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentBlockTest.php @@ -87,7 +87,7 @@ public function testRecentCommentBlock() { for ($i = 0; $i < 10; $i++) { $this->clickLink($comments[$i]->getSubject()); $this->assertSession()->pageTextContains($comments[$i]->getSubject()); - $this->assertRaw('<link rel="canonical"'); + $this->assertSession()->responseContains('<link rel="canonical"'); } } diff --git a/web/core/modules/comment/tests/src/Functional/CommentCSSTest.php b/web/core/modules/comment/tests/src/Functional/CommentCSSTest.php index fb104b4f7ff2d2b67a0eea760d430ac0a6e163b6..7b9d0075ee1ab56aa5fbff130c923fb67de43847 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentCSSTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentCSSTest.php @@ -115,7 +115,7 @@ public function testCommentClasses() { // user (the viewer) was the author of the comment. We do this in Java- // Script to prevent breaking the render cache. $this->assertCount(1, $this->xpath('//*[contains(@class, "comment") and @data-comment-user-id="' . $case['comment_uid'] . '"]'), 'data-comment-user-id attribute is set on comment.'); - $this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js'); + $this->assertSession()->responseContains(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js'); } // Verify the unpublished class. diff --git a/web/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/web/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index 7a0b96dccad85f7d3a23a27627c587b61f571c96..1440743eb19a9d1de17276601fb0643c98b79803 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -318,7 +318,7 @@ public function testViewMode() { // Comment displayed in 'default' display mode found and has body text. $comment_element = $this->cssSelect('.comment-wrapper'); $this->assertTrue(!empty($comment_element)); - $this->assertRaw('<p>' . $comment_text . '</p>'); + $this->assertSession()->responseContains('<p>' . $comment_text . '</p>'); // Create a new comment entity view mode. $mode = mb_strtolower($this->randomMachineName()); diff --git a/web/core/modules/comment/tests/src/Functional/CommentLanguageTest.php b/web/core/modules/comment/tests/src/Functional/CommentLanguageTest.php index cc34d59fa75cf114e14b970decf6f24e04829158..4759e0f322ac7e50b0bb1689072592b20d932248 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentLanguageTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentLanguageTest.php @@ -156,7 +156,7 @@ public function testCommentLanguage() { $this->drupalGet('admin/content/comment'); foreach ($comment_values as $node_values) { foreach ($node_values as $value) { - $this->assertRaw($value); + $this->assertSession()->responseContains($value); } } } diff --git a/web/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/web/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php index 255a51d8d90ce3d6d49d89c24ec67d6d5f8cdc70..3ee86bb675524f360ecd1074c59f8fa6c3220feb 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php @@ -314,12 +314,12 @@ public function testCommentFunctionality() { // Unpublish the comment. $this->performCommentOperation($comment1, 'unpublish'); $this->drupalGet('admin/content/comment/approval'); - $this->assertRaw('comments[' . $comment1->id() . ']'); + $this->assertSession()->responseContains('comments[' . $comment1->id() . ']'); // Publish the comment. $this->performCommentOperation($comment1, 'publish', TRUE); $this->drupalGet('admin/content/comment'); - $this->assertRaw('comments[' . $comment1->id() . ']'); + $this->assertSession()->responseContains('comments[' . $comment1->id() . ']'); // Delete the comment. $this->performCommentOperation($comment1, 'delete'); @@ -332,7 +332,7 @@ public function testCommentFunctionality() { // Check that the comment was found. $this->drupalGet('admin/content/comment'); - $this->assertRaw('comments[' . $comment1->id() . ']'); + $this->assertSession()->responseContains('comments[' . $comment1->id() . ']'); // Check that entity access applies to administrative page. $this->assertSession()->pageTextContains($this->entity->label()); diff --git a/web/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/web/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 430a098f627e1b561121a5c273024c61424731b0..6e3d1b853378b227e99af34e3a59955ad2c9d90a 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -383,25 +383,25 @@ public function testTwoPagers() { // shown. $this->drupalGet('node/' . $node->id()); $this->assertSession()->pageTextContains('next'); - $this->assertRaw('Comment 1 on field comment'); - $this->assertRaw('Comment 1 on field comment_2'); + $this->assertSession()->pageTextContains('Comment 1 on field comment'); + $this->assertSession()->pageTextContains('Comment 1 on field comment_2'); // Navigate to next page of field 1. $this->clickLinkWithXPath('//h3/a[normalize-space(text())=:label]/ancestor::section[1]//a[@rel="next"]', [':label' => 'Comment 1 on field comment']); // Check only one pager updated. - $this->assertRaw('Comment 2 on field comment'); - $this->assertRaw('Comment 1 on field comment_2'); + $this->assertSession()->pageTextContains('Comment 2 on field comment'); + $this->assertSession()->pageTextContains('Comment 1 on field comment_2'); // Return to page 1. $this->drupalGet('node/' . $node->id()); // Navigate to next page of field 2. $this->clickLinkWithXPath('//h3/a[normalize-space(text())=:label]/ancestor::section[1]//a[@rel="next"]', [':label' => 'Comment 1 on field comment_2']); // Check only one pager updated. - $this->assertRaw('Comment 1 on field comment'); - $this->assertRaw('Comment 2 on field comment_2'); + $this->assertSession()->pageTextContains('Comment 1 on field comment'); + $this->assertSession()->pageTextContains('Comment 2 on field comment_2'); // Navigate to next page of field 1. $this->clickLinkWithXPath('//h3/a[normalize-space(text())=:label]/ancestor::section[1]//a[@rel="next"]', [':label' => 'Comment 1 on field comment']); // Check only one pager updated. - $this->assertRaw('Comment 2 on field comment'); - $this->assertRaw('Comment 2 on field comment_2'); + $this->assertSession()->pageTextContains('Comment 2 on field comment'); + $this->assertSession()->pageTextContains('Comment 2 on field comment_2'); } /** diff --git a/web/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/web/core/modules/comment/tests/src/Functional/CommentPreviewTest.php index a654f9637075ab32d2c86f7506f07c39e098ae27..a78b1af8a9474c236503c547b571559526eb3d5b 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentPreviewTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentPreviewTest.php @@ -58,7 +58,7 @@ public function testCommentPreview() { $this->submitForm($edit, 'Preview'); $this->assertInstanceOf(MarkupInterface::class, $this->webUser->getDisplayName()); $this->assertSession()->assertNoEscaped('<em>' . $this->webUser->id() . '</em>'); - $this->assertRaw('<em>' . $this->webUser->id() . '</em>'); + $this->assertSession()->responseContains('<em>' . $this->webUser->id() . '</em>'); // Add a user picture. $image = current($this->drupalGetTestFiles('image')); diff --git a/web/core/modules/comment/tests/src/Functional/CommentRssTest.php b/web/core/modules/comment/tests/src/Functional/CommentRssTest.php index 611a636d6103bb6626da6a66b9ba0c1910959130..3f2a244ac17848093ff9ea291b7325b6dd0845a0 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentRssTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentRssTest.php @@ -72,7 +72,7 @@ public function testCommentRss() { ])); $raw = '<comments>' . $this->node->toUrl('canonical', ['fragment' => 'comments', 'absolute' => TRUE])->toString() . '</comments>'; - $this->assertRaw($raw); + $this->assertSession()->responseContains($raw); // Hide comments from RSS feed and check presence. $this->node->set('comment', CommentItemInterface::HIDDEN); diff --git a/web/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/web/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 49a4eddc4dc9e8d5395412181e1c60290df9912b..d246b463edc6a8770f436cf5f7e65c753ad7b396 100644 --- a/web/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/web/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -114,7 +114,7 @@ public function testCommentTypeEditing() { $this->submitForm($edit, 'Save'); $this->drupalGet('admin/structure/comment'); - $this->assertRaw('Bar'); + $this->assertSession()->pageTextContains('Bar'); $this->clickLink('Manage fields'); // Verify that the original machine name was used in the URL. $this->assertSession()->addressEquals(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment'])); diff --git a/web/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php b/web/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php index 786c8e3dbbd5b667298c9ceaf74cade22fe788d7..304d2dd8555b6f3c86fb809510000f015dbd9876 100644 --- a/web/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php +++ b/web/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php @@ -51,7 +51,7 @@ public function testLocks() { $methods[] = 'invalidateTagsOnSave'; $comment = $this->getMockBuilder('Drupal\comment\Entity\Comment') ->disableOriginalConstructor() - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); $comment->expects($this->once()) ->method('isNew') diff --git a/web/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/web/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index 1a96f247f6d03d16a9cfd5dc368ee73fe3ba3212..aa58a411ec679c69a3d9be0f749eaf04eb9d38f3 100644 --- a/web/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/web/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -273,14 +273,14 @@ public function testPager() { $this->drupalGet('admin/structure/config_test'); // Item 51 should not be present. - $this->assertRaw('Test config entity 50'); + $this->assertSession()->pageTextContains('Test config entity 50'); $this->assertSession()->responseNotContains('Test config entity 51'); // Browse to the next page, test config entity 51 is on page 2. $this->clickLink('Page 2'); $this->assertSession()->responseNotContains('Test config entity 50'); - $this->assertRaw('dotted.default'); - $this->assertRaw('Test config entity 51'); + $this->assertSession()->responseContains('dotted.default'); + $this->assertSession()->pageTextContains('Test config entity 51'); } } diff --git a/web/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php b/web/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php index 73858fd7aaeee6aab852079a6684f748dcc458b8..3ea900bc6fcc5c4d1fe5712f4d4e4338ab775486 100644 --- a/web/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php +++ b/web/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php @@ -192,7 +192,7 @@ public function testExportImport() { $this->assertSession()->pageTextContains('The following items in your active configuration have changes since the last import that may be lost on the next import.'); // Ensure the item is displayed as part of a list (to avoid false matches // on the rest of the page) and that the list markup is not escaped. - $this->assertRaw('<li>system.site</li>'); + $this->assertSession()->responseContains('<li>system.site</li>'); // Remove everything from sync. The warning about differences between the // active and snapshot should no longer exist. \Drupal::service('config.storage.sync')->deleteAll(); @@ -213,7 +213,7 @@ public function testExportImport() { $this->assertSession()->pageTextContains('The following items in your active configuration have changes since the last import that may be lost on the next import.'); // Ensure the item is displayed as part of a list (to avoid false matches // on the rest of the page) and that the list markup is not escaped. - $this->assertRaw('<li>system.site</li>'); + $this->assertSession()->responseContains('<li>system.site</li>'); } /** diff --git a/web/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/web/core/modules/config/tests/src/Functional/ConfigImportUITest.php index 22d4b909c74bcca24635ba21aac83d21c34f3666..5d3ee5c3fd1a3e42457718cd77d6ba8da507cf37 100644 --- a/web/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/web/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -119,11 +119,11 @@ public function testImport() { // Verify that both appear as ready to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertRaw('<td>' . $name); - $this->assertRaw('<td>' . $dynamic_name); - $this->assertRaw('<td>core.extension'); - $this->assertRaw('<td>system.theme'); - $this->assertRaw('<td>automated_cron.settings'); + $this->assertSession()->responseContains('<td>' . $name); + $this->assertSession()->responseContains('<td>' . $dynamic_name); + $this->assertSession()->responseContains('<td>core.extension'); + $this->assertSession()->responseContains('<td>system.theme'); + $this->assertSession()->responseContains('<td>automated_cron.settings'); $this->assertSession()->buttonExists('Import all'); // Import and verify that both do not appear anymore. @@ -193,9 +193,9 @@ public function testImport() { // Verify that both appear as ready to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertRaw('<td>core.extension'); - $this->assertRaw('<td>system.theme'); - $this->assertRaw('<td>automated_cron.settings'); + $this->assertSession()->responseContains('<td>core.extension'); + $this->assertSession()->responseContains('<td>system.theme'); + $this->assertSession()->responseContains('<td>automated_cron.settings'); // Import and verify that both do not appear anymore. $this->submitForm([], 'Import all'); diff --git a/web/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php b/web/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php index 780542869620eac8453ba7fa4f89672cf576a1f7..fc27b7d9bd80323172b4a5fc0fa46dedca86503f 100644 --- a/web/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php +++ b/web/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php @@ -140,7 +140,7 @@ public function testPreExistingConfigInstall() { 'modules[config_test][enable]' => TRUE, 'modules[config_install_fail_test][enable]' => TRUE, ], 'Install'); - $this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.'); + $this->assertSession()->responseContains('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.'); // Uninstall the config_test module to test the confirm form. $this->drupalGet('admin/modules/uninstall'); @@ -154,7 +154,7 @@ public function testPreExistingConfigInstall() { $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_install_fail_test][enable]' => TRUE], 'Install'); $this->submitForm([], 'Continue'); - $this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.'); + $this->assertSession()->responseContains('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.'); // Test that collection configuration clashes during a module install are // reported correctly. @@ -168,7 +168,7 @@ public function testPreExistingConfigInstall() { $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_install_fail_test][enable]' => TRUE], 'Install'); - $this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'); + $this->assertSession()->responseContains('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'); // Test installing a theme through the UI that has existing configuration. // This relies on the fact the config_test has been installed and created @@ -177,7 +177,7 @@ public function testPreExistingConfigInstall() { $this->drupalGet('admin/appearance'); $url = $this->xpath("//a[contains(@href,'config_clash_test_theme') and contains(@href,'/install?')]/@href")[0]; $this->drupalGet($this->getAbsoluteUrl($url->getText())); - $this->assertRaw('Unable to install config_clash_test_theme, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'); + $this->assertSession()->responseContains('Unable to install config_clash_test_theme, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.'); // Test installing a theme through the API that has existing configuration. try { @@ -202,13 +202,13 @@ public function testUnmetDependenciesInstall() { $this->submitForm(['modules[config_test][enable]' => TRUE], 'Install'); $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_install_dependency_test][enable]' => TRUE], 'Install'); - $this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)</em>'); + $this->assertSession()->responseContains('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)</em>'); $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_test_language][enable]' => TRUE], 'Install'); $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_install_dependency_test][enable]' => TRUE], 'Install'); - $this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)</em>'); + $this->assertSession()->responseContains('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)</em>'); $this->drupalGet('admin/modules'); $this->submitForm(['modules[config_other_module_config_test][enable]' => TRUE], 'Install'); diff --git a/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php index 535f7e4e33dadbff8120609685bf2306c2fe81e4..c7815b65bac4617bd093e6e58071254246aec1a5 100644 --- a/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php +++ b/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php @@ -122,7 +122,7 @@ public function testMapperListPage() { $title = $test_entity->label() . ' ' . $entity_type->getSingularLabel(); $title = 'Translations for <em class="placeholder">' . Html::escape($title) . '</em>'; - $this->assertRaw($title); + $this->assertSession()->responseContains($title); $this->assertSession()->responseContains('<th>Language</th>'); $this->drupalGet($base_url); diff --git a/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index 0fa289de80d78af1f3d8e003bde46ca514414fe8..c67db412d1d3fbe68bc6095cd770f3904278b1d2 100644 --- a/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/web/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -161,8 +161,8 @@ public function testSiteInformationTranslationUi() { $this->clickLink('Add'); // Make sure original text is present on this page. - $this->assertRaw($site_name); - $this->assertRaw($site_slogan); + $this->assertSession()->pageTextContains($site_name); + $this->assertSession()->pageTextContains($site_slogan); // Update site name and slogan for French. $edit = [ @@ -189,8 +189,8 @@ public function testSiteInformationTranslationUi() { // Check French translation of site name and slogan are in place. $this->drupalGet('fr'); - $this->assertRaw($fr_site_name); - $this->assertRaw($fr_site_slogan); + $this->assertSession()->pageTextContains($fr_site_name); + $this->assertSession()->pageTextContains($fr_site_slogan); // Visit French site to ensure base language string present as source. $this->drupalGet("fr/$translation_base_url/fr/edit"); @@ -486,7 +486,7 @@ public function testDateFormatTranslation() { $this->assertSession()->pageTextContains($label); // Make sure that the date library is added. - $this->assertRaw('core/modules/system/js/system.date.js'); + $this->assertSession()->responseContains('core/modules/system/js/system.date.js'); // Update translatable fields. $edit = [ @@ -616,8 +616,8 @@ public function testViewsTranslationUI() { $this->clickLink('Add'); // Make sure original text is present on this page. - $this->assertRaw($description); - $this->assertRaw($human_readable_name); + $this->assertSession()->pageTextContains($description); + $this->assertSession()->pageTextContains($human_readable_name); // Update Views Fields for French. $edit = [ @@ -679,7 +679,7 @@ public function testPluralConfigStringsSourceElements() { // Check if the expected number of source elements are present. foreach ($data['expected'] as $index => $expected) { if ($expected) { - $this->assertRaw('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index); + $this->assertSession()->responseContains('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index); } else { $this->assertSession()->responseNotContains('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index); @@ -713,7 +713,7 @@ public function testPluralConfigStrings() { // Make sure original text is present on this page, in addition to 2 new // empty fields. - $this->assertRaw($description); + $this->assertSession()->pageTextContains($description); $this->assertSession()->fieldValueEquals('translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][0]', $field_value); $this->assertSession()->fieldValueEquals('translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][1]', $field_value_plural); $this->assertSession()->fieldValueEquals('translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][2]', ''); @@ -1088,7 +1088,7 @@ public function testNodeFieldTranslation() { // Check that the translations are saved. $this->clickLink('Add'); - $this->assertRaw('FR label'); + $this->assertSession()->responseContains('FR label'); } /** diff --git a/web/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/web/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index 6340c5e2424370d6b51a1a683f7ca6b6c34f0006..820201eea234c4bc5a7578bfa6afa56a3a3c333f 100644 --- a/web/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/web/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -114,7 +114,7 @@ public function testSendPersonalContactMessage() { '@sender_email' => $this->webUser->getEmail(), '@recipient_name' => $this->contactUser->getAccountName(), ]; - $this->assertRaw(new FormattableMarkup('@sender_name (@sender_email) sent @recipient_name an email.', $placeholders)); + $this->assertSession()->responseContains(new FormattableMarkup('@sender_name (@sender_email) sent @recipient_name an email.', $placeholders)); // Ensure an unescaped version of the email does not exist anywhere. $this->assertSession()->responseNotContains($this->webUser->getEmail()); diff --git a/web/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/web/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 1ed46eb4cfc58694eb858dbb89174da671ceda9b..d9511b7b90a2a92ce06521ed34f39e922cec4a93 100644 --- a/web/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/web/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -489,7 +489,7 @@ public function testAutoReply() { $this->assertCount(0, $captured_emails); $this->drupalLogin($admin_user); $this->drupalGet('admin/reports/dblog'); - $this->assertRaw('Error sending auto-reply, missing sender e-mail address in foo'); + $this->assertSession()->responseContains('Error sending auto-reply, missing sender e-mail address in foo'); } /** diff --git a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php index 21b9ddf8c37ce0a19ca30504657ab2731ca2e2c3..92206de3080cd957d6348f137c5e63117f2cf4bb 100644 --- a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php +++ b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php @@ -26,7 +26,7 @@ public function testNotModerated() { $this->assertSession()->pageTextContains('The content type Not moderated has been added.'); $this->grantUserPermissionToCreateContentOfType($this->adminUser, 'not_moderated'); $this->drupalGet('node/add/not_moderated'); - $this->assertRaw('Save'); + $this->assertSession()->pageTextContains('Save'); $this->submitForm([ 'title[0][value]' => 'Test', ], 'Save'); diff --git a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php index 4bcd1f8914a92b9f1b0bf82a9fde568b98a0cfed..a461f1a89817f842ae3d5a32b8463bc894efce18 100644 --- a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php +++ b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php @@ -70,7 +70,7 @@ public function testEnable() { $this->drupalGet('admin/structure/types/add'); $this->submitForm($edit, 'Save content type'); $this->drupalGet('admin/config/regional/content-language'); - $this->assertRaw('entity_types[node]'); + $this->assertSession()->responseContains('entity_types[node]'); } } diff --git a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php index 4276763b663cc27b16b7725ee6ce20018da09397..19382b412d4bcc5b6865d097b2250fadec11344e 100644 --- a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php +++ b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php @@ -141,7 +141,7 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax $node = $this->getNodeByTitle('english_title'); $this->drupalGet('node/' . $node->id() . '/edit'); // Test the expected title when loading the form. - $this->assertRaw('<title>Edit Article english_title | Drupal</title>'); + $this->assertSession()->titleEquals('Edit Article english_title | Drupal'); // Upload and image after changing the node language. $images = $this->drupalGetTestFiles('image')[1]; $edit = [ @@ -151,7 +151,7 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax $this->submitForm($edit, 'Upload'); // Test the expected title after triggering an ajax call with a new // language selected. - $this->assertRaw('<title>Edit Article english_title | Drupal</title>'); + $this->assertSession()->titleEquals('Edit Article english_title | Drupal'); $edit = [ 'langcode[0][value]' => 'en', 'field_image_field[0][alt]' => 'alternative_text', diff --git a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php index 93486ebe200551a57d2fbe08396d46827bf54406..0068f2bad21d3c21853185edb77b8a34ebf78b2a 100644 --- a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +++ b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php @@ -117,7 +117,7 @@ protected function doTestBasicTranslation() { // Assert that HTML is not escaped unexpectedly. if ($this->testHTMLEscapeForAllLanguages) { $this->assertSession()->responseNotContains('<span class="translation-entity-all-languages">(all languages)</span>'); - $this->assertRaw('<span class="translation-entity-all-languages">(all languages)</span>'); + $this->assertSession()->responseContains('<span class="translation-entity-all-languages">(all languages)</span>'); } // Ensure that the content language cache context is not yet added to the @@ -525,7 +525,7 @@ protected function doTestTranslationEdit() { $url = $entity->toUrl('edit-form', $options); $this->drupalGet($url); - $this->assertRaw($entity->getTranslation($langcode)->label()); + $this->assertSession()->responseContains($entity->getTranslation($langcode)->label()); } } } diff --git a/web/core/modules/contextual/src/Element/ContextualLinks.php b/web/core/modules/contextual/src/Element/ContextualLinks.php index 4e43de8e40a424aa01e1ccc86485c05f5ec08239..c4bd3b21f714c86d91e02bde1c61f6d6bac313cc 100644 --- a/web/core/modules/contextual/src/Element/ContextualLinks.php +++ b/web/core/modules/contextual/src/Element/ContextualLinks.php @@ -86,7 +86,8 @@ public static function preRenderLinks(array $element) { // Allow modules to alter the renderable contextual links element. static::moduleHandler()->alter('contextual_links_view', $element, $items); - // If there are no links, tell drupal_render() to abort rendering. + // If there are no links, tell \Drupal::service('renderer')->render() to + // abort rendering. if (empty($element['#links'])) { $element['#printed'] = TRUE; } diff --git a/web/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php b/web/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php index 546d950f197cf939a38e5b9ecd9fda231a51cbc5..34e3e61b2f800869a58b709445084d260d39deb9 100644 --- a/web/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php +++ b/web/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php @@ -157,7 +157,7 @@ public function testDifferentPermissions() { // Get a page where contextual links are directly rendered. $this->drupalGet(Url::fromRoute('menu_test.contextual_test')); $this->assertSession()->assertEscaped("<script>alert('Welcome to the jungle!')</script>"); - $this->assertRaw('<li class="menu-testcontextual-hidden-manage-edit"><a href="' . base_path() . 'menu-test-contextual/1/edit" class="use-ajax" data-dialog-type="modal" data-is-something>Edit menu - contextual</a></li>'); + $this->assertSession()->responseContains('<li class="menu-testcontextual-hidden-manage-edit"><a href="' . base_path() . 'menu-test-contextual/1/edit" class="use-ajax" data-dialog-type="modal" data-is-something>Edit menu - contextual</a></li>'); } /** diff --git a/web/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/web/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php index c4f5b021b2f1d17eb0a2f5de9272c976829fefe4..469155e84959c33c32b0d4560b637273c3e535e6 100644 --- a/web/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php +++ b/web/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php @@ -78,7 +78,7 @@ public function testDateField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($date->format($date_format)); + $this->assertSession()->responseContains($date->format($date_format)); $this->assertSession()->responseNotContains($date->format($time_format)); // Verify the date doesn't change if using a timezone that is UTC+12 when @@ -273,8 +273,8 @@ public function testDatetimeField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($date->format($date_format)); - $this->assertRaw($date->format($time_format)); + $this->assertSession()->responseContains($date->format($date_format)); + $this->assertSession()->responseContains($date->format($time_format)); /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ $display_repository = \Drupal::service('entity_display.repository'); diff --git a/web/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/web/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index 3f65bdb0fc8912e13d146ab4efc56db2b90c67cc..77a21941a1ea8e95ed1e07a2cce16122952f8914 100644 --- a/web/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/web/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -93,9 +93,9 @@ public function testDateRangeField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($start_date->format($date_format)); + $this->assertSession()->responseContains($start_date->format($date_format)); $this->assertSession()->responseNotContains($start_date->format($time_format)); - $this->assertRaw($end_date->format($date_format)); + $this->assertSession()->responseContains($end_date->format($date_format)); $this->assertSession()->responseNotContains($end_date->format($time_format)); // Verify the date doesn't change when entity is edited through the form. @@ -326,10 +326,10 @@ public function testDatetimeRangeField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($start_date->format($date_format)); - $this->assertRaw($start_date->format($time_format)); - $this->assertRaw($end_date->format($date_format)); - $this->assertRaw($end_date->format($time_format)); + $this->assertSession()->responseContains($start_date->format($date_format)); + $this->assertSession()->responseContains($start_date->format($time_format)); + $this->assertSession()->responseContains($end_date->format($date_format)); + $this->assertSession()->responseContains($end_date->format($time_format)); /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ $display_repository = \Drupal::service('entity_display.repository'); @@ -499,9 +499,9 @@ public function testAlldayRangeField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($start_date->format($date_format)); + $this->assertSession()->responseContains($start_date->format($date_format)); $this->assertSession()->responseNotContains($start_date->format($time_format)); - $this->assertRaw($end_date->format($date_format)); + $this->assertSession()->responseContains($end_date->format($date_format)); $this->assertSession()->responseNotContains($end_date->format($time_format)); /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ diff --git a/web/core/modules/dblog/tests/src/Functional/DbLogTest.php b/web/core/modules/dblog/tests/src/Functional/DbLogTest.php index ccfa1662219ea553395182bee45259f0498b507d..e3b7931519ae0760f2ece83724b6591dcb4470c8 100644 --- a/web/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/web/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -133,10 +133,10 @@ public function testLogEventPage() { $this->assertSession()->linkByHrefExists($context['referer']); // Verify hostname. - $this->assertRaw($context['ip']); + $this->assertSession()->pageTextContains($context['ip']); // Verify location. - $this->assertRaw($context['request_uri']); + $this->assertSession()->pageTextContains($context['request_uri']); // Verify severity. $this->assertSession()->pageTextContains('Notice'); @@ -402,7 +402,7 @@ private function verifyLinkEscaping() { $this->drupalGet('admin/reports/dblog/event/' . $result->fetchField()); // Check if the link exists (unescaped). - $this->assertRaw($link); + $this->assertSession()->responseContains($link); } /** @@ -850,7 +850,7 @@ public function testOverviewLinks() { $this->drupalGet('admin/reports/dblog'); $this->assertSession()->statusCodeEquals(200); // Make sure HTML tags are filtered out. - $this->assertRaw('title="alert('foo');Lorem'); + $this->assertSession()->responseContains('title="alert('foo');Lorem'); $this->assertSession()->responseNotContains("<script>alert('foo');</script>"); // Make sure HTML tags are filtered out in admin/reports/dblog/event/ too. @@ -860,7 +860,7 @@ public function testOverviewLinks() { $wid = $query->execute()->fetchField(); $this->drupalGet('admin/reports/dblog/event/' . $wid); $this->assertSession()->responseNotContains("<script>alert('foo');</script>"); - $this->assertRaw("alert('foo'); <strong>Lorem ipsum</strong>"); + $this->assertSession()->responseContains("alert('foo'); <strong>Lorem ipsum</strong>"); } /** @@ -903,8 +903,8 @@ public function testBacktrace() { // Check if the full message displays on the details page and backtrace is a // pre-formatted text. $message = new FormattableMarkup('%type: @message in %function (line', $error_user_notice); - $this->assertRaw($message); - $this->assertRaw('<pre class="backtrace">'); + $this->assertSession()->responseContains($message); + $this->assertSession()->responseContains('<pre class="backtrace">'); } } diff --git a/web/core/modules/dynamic_page_cache/tests/src/Functional/DynamicPageCacheIntegrationTest.php b/web/core/modules/dynamic_page_cache/tests/src/Functional/DynamicPageCacheIntegrationTest.php index fcf640f67e421a0eb4a6348a22456844ca8715ec..3574e3bd9ca5c7f7f0d124ccd6386f71d6155077 100644 --- a/web/core/modules/dynamic_page_cache/tests/src/Functional/DynamicPageCacheIntegrationTest.php +++ b/web/core/modules/dynamic_page_cache/tests/src/Functional/DynamicPageCacheIntegrationTest.php @@ -81,10 +81,10 @@ public function testDynamicPageCache() { foreach (['llama', 'piggy', 'unicorn', 'kitten'] as $animal) { $url = Url::fromUri('route:dynamic_page_cache_test.html.with_cache_contexts', ['query' => ['animal' => $animal]]); $this->drupalGet($url); - $this->assertRaw($animal); + $this->assertSession()->pageTextContains($animal); $this->assertSession()->responseHeaderEquals(DynamicPageCacheSubscriber::HEADER, 'MISS'); $this->drupalGet($url); - $this->assertRaw($animal); + $this->assertSession()->pageTextContains($animal); $this->assertSession()->responseHeaderEquals(DynamicPageCacheSubscriber::HEADER, 'HIT'); // Finally, let's also verify that the 'dynamic_page_cache_test.html' diff --git a/web/core/modules/editor/tests/src/Functional/EditorAdminTest.php b/web/core/modules/editor/tests/src/Functional/EditorAdminTest.php index 4aa07e3320045f4312ecd80e730168c0d8e47f00..e8b278806b30b3c8e8cf58f7db8fbdc9ab00a6b4 100644 --- a/web/core/modules/editor/tests/src/Functional/EditorAdminTest.php +++ b/web/core/modules/editor/tests/src/Functional/EditorAdminTest.php @@ -71,7 +71,7 @@ public function testNoEditorAvailable() { $options = $select->findAll('css', 'option'); $this->assertCount(1, $options); $this->assertSame('None', $options[0]->getText(), 'Option 1 in the Text Editor select is "None".'); - $this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.'); + $this->assertSession()->pageTextContains('This option is disabled because no modules that provide a text editor are currently enabled.'); } /** @@ -143,14 +143,14 @@ public function testDisableFormatWithEditor() { // Go to node edit form. $this->drupalGet('node/' . $node->id() . '/edit'); - $this->assertRaw($text); + $this->assertSession()->responseContains($text); // Disable the format assigned to the 'body' field of the node. FilterFormat::load('monoceros')->disable()->save(); // Edit again the node. $this->drupalGet('node/' . $node->id() . '/edit'); - $this->assertRaw($text); + $this->assertSession()->responseContains($text); } /** diff --git a/web/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/web/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php index bc768e1327b5a03069938b0d5e0a111b1cf41d8f..76a398d622b35cbcfe13dcb146f196c6c6ce60ce 100644 --- a/web/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/web/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\editor\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\editor\Entity\Editor; use Drupal\filter\Entity\FilterFormat; use Drupal\Tests\BrowserTestBase; @@ -102,7 +101,7 @@ public function testEditorUploadImageScale() { list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); $this->assertEquals($max_width, $uploaded_image_file_width); $this->assertEquals($uploaded_image_file_height * ($uploaded_image_file_width / $max_width), $uploaded_image_file_height); - $this->assertRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); + $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); // Case 3: max height smaller than uploaded image: image scaled down. $test_image = $testing_image_list[2]; @@ -114,7 +113,7 @@ public function testEditorUploadImageScale() { list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); $this->assertEquals($uploaded_image_file_width * ($uploaded_image_file_height / $max_height), $uploaded_image_file_width); $this->assertEquals($max_height, $uploaded_image_file_height); - $this->assertRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height])); + $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); // Case 4: max dimensions greater than uploaded image: image not scaled. $test_image = $testing_image_list[3]; @@ -139,7 +138,7 @@ public function testEditorUploadImageScale() { list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); $this->assertEquals($max_width, $uploaded_image_file_width); $this->assertEquals($uploaded_image_file_height * ($uploaded_image_file_width / $max_width), $uploaded_image_file_height); - $this->assertRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed width of %width pixels.', ['%width' => $max_width])); + $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed width of {$max_width} pixels."); // Case 6: only max height dimension was provided and it was smaller than // uploaded image: image scaled down. @@ -152,7 +151,7 @@ public function testEditorUploadImageScale() { list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); $this->assertEquals($uploaded_image_file_width * ($uploaded_image_file_height / $max_height), $uploaded_image_file_width); $this->assertEquals($max_height, $uploaded_image_file_height); - $this->assertRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed height of %height pixels.', ['%height' => $max_height])); + $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed height of {$max_height} pixels."); } /** diff --git a/web/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/web/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php index fb431349b85974f62afb5b7ddb7838d4c9e5f297..136ce8b923e5b0f079ce6640e30adbc64fc7f62d 100644 --- a/web/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php +++ b/web/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php @@ -122,7 +122,7 @@ public function testBooleanField() { // Verify that boolean value is displayed. $entity = EntityTest::load($id); $this->drupalGet($entity->toUrl()); - $this->assertRaw('<div class="field__item">' . $on . '</div>'); + $this->assertSession()->responseContains('<div class="field__item">' . $on . '</div>'); // Test with "On" label option. $display_repository->getFormDisplay('entity_test', 'entity_test') @@ -136,7 +136,7 @@ public function testBooleanField() { $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[value]", ''); - $this->assertRaw($on); + $this->assertSession()->pageTextContains($on); $this->assertSession()->pageTextNotContains($this->field->label()); // Test if we can change the on label. @@ -148,7 +148,7 @@ public function testBooleanField() { $this->submitForm($edit, 'Save settings'); // Check if we see the updated labels in the creation form. $this->drupalGet('entity_test/add'); - $this->assertRaw($on); + $this->assertSession()->pageTextContains($on); // Go to the form display page and check if the default settings works as // expected. diff --git a/web/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php b/web/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php index 09ad6ff2481197374539fabfb7ec0884e3319681..31bf7daa97e4c973ccf4bde75216944e1b6a9f0f 100644 --- a/web/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php +++ b/web/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php @@ -90,7 +90,7 @@ public function testEmailField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); - $this->assertRaw('placeholder="example@example.com"'); + $this->assertSession()->responseContains('placeholder="example@example.com"'); // Submit a valid email address and ensure it is accepted. $value = 'test@example.com'; @@ -101,7 +101,7 @@ public function testEmailField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($value); + $this->assertSession()->responseContains($value); // Verify that a mailto link is displayed. $entity = EntityTest::load($id); diff --git a/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php index 7877ce87b56d772269f74221368d14ba26cc092a..a9b551084e8a2f9fa077a85700085f9cdf585845 100644 --- a/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php +++ b/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php @@ -156,8 +156,8 @@ public function testFieldAdminHandler() { $this->assertStringContainsString("/entity_reference_autocomplete/node/views/", $field->getAttribute('data-autocomplete-path')); $target_url = $this->getAbsoluteUrl($field->getAttribute('data-autocomplete-path')); $this->drupalGet($target_url, ['query' => ['q' => 'Foo']]); - $this->assertRaw($node1->getTitle() . ' (' . $node1->id() . ')'); - $this->assertRaw($node2->getTitle() . ' (' . $node2->id() . ')'); + $this->assertSession()->pageTextContains($node1->getTitle() . ' (' . $node1->id() . ')'); + $this->assertSession()->pageTextContains($node2->getTitle() . ' (' . $node2->id() . ')'); // Try to add a new node, fill the entity reference field and submit the // form. diff --git a/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php b/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php index 0b064554d4a7bec7a67f8826b4f071a9c18babb3..ec7c7b13217c65294b4cfca540f59d3daec46343 100644 --- a/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php +++ b/web/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php @@ -91,7 +91,7 @@ public function testEntityReferenceDefaultValue() { // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name); - $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')'); + $this->assertSession()->responseContains('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')'); // Check if the ID has been converted to UUID in config entity. $config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get(); diff --git a/web/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/web/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index 576510d9c67f9b4ba4879614c255917abbbd06e4..595aba8e22c801a39d23f39b6c14a5438327a3bf 100644 --- a/web/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/web/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -76,7 +76,7 @@ public function testNumberDecimalField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); - $this->assertRaw('placeholder="0.00"'); + $this->assertSession()->responseContains('placeholder="0.00"'); // Submit a signed decimal value within the allowed precision and scale. $value = '-1234.5678'; @@ -87,7 +87,7 @@ public function testNumberDecimalField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($value); + $this->assertSession()->responseContains($value); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = [ @@ -191,7 +191,7 @@ public function testNumberIntegerField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); - $this->assertRaw('placeholder="4"'); + $this->assertSession()->responseContains('placeholder="4"'); // Submit a valid integer $value = rand($minimum, $maximum); @@ -251,7 +251,7 @@ public function testNumberIntegerField() { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw($valid_entry); + $this->assertSession()->responseContains($valid_entry); // Verify that the "content" attribute is not present since the Prefix is // not being displayed. $this->assertSession()->elementNotExists('xpath', '//div[@content="' . $valid_entry . '"]'); @@ -320,7 +320,7 @@ public function testNumberFloatField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); - $this->assertRaw('placeholder="0.00"'); + $this->assertSession()->responseContains('placeholder="0.00"'); // Submit a signed decimal value within the allowed precision and scale. $value = '-1234.5678'; @@ -335,7 +335,7 @@ public function testNumberFloatField() { // Ensure that the 'number_decimal' formatter displays the number with the // expected rounding. $this->drupalGet('entity_test/' . $id); - $this->assertRaw(round($value, 2)); + $this->assertSession()->responseContains(round($value, 2)); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = [ diff --git a/web/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php b/web/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php index 7c30d465e5fd11c040569b845b55a1e80c0a9248..2e1b17cc9bb51ce63f3e8670d2a75a33c19553c5 100644 --- a/web/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php +++ b/web/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php @@ -92,7 +92,7 @@ public function testReEnabledField() { 'field_telephone[0][value]' => "123456789", ]; $this->submitForm($edit, 'Save'); - $this->assertRaw('<a href="tel:123456789">'); + $this->assertSession()->responseContains('<a href="tel:123456789">'); // Test that the module can't be uninstalled from the UI while there is data // for its fields. diff --git a/web/core/modules/field/tests/src/Functional/String/StringFieldTest.php b/web/core/modules/field/tests/src/Functional/String/StringFieldTest.php index a8140c4ad42e4fbe92a378eab9931fbe3c52a5ea..295169d4d2f0bd62571272562d8db4184142c125 100644 --- a/web/core/modules/field/tests/src/Functional/String/StringFieldTest.php +++ b/web/core/modules/field/tests/src/Functional/String/StringFieldTest.php @@ -92,7 +92,7 @@ public function _testTextfieldWidgets($field_type, $widget_type) { $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); $this->assertSession()->fieldNotExists("{$field_name}[0][format]"); - $this->assertRaw(new FormattableMarkup('placeholder="A placeholder on @widget_type"', ['@widget_type' => $widget_type])); + $this->assertSession()->responseContains(new FormattableMarkup('placeholder="A placeholder on @widget_type"', ['@widget_type' => $widget_type])); // Submit with some value. $value = $this->randomMachineName(); diff --git a/web/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php b/web/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php index 013182f08d9ace7f534215eb9edb5a19904a5d5e..78a565d0f81d79bc20cdc87ecbabff8beee9a9a0 100644 --- a/web/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php +++ b/web/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php @@ -151,8 +151,8 @@ public function testNumberFormatter() { // Check number_decimal and number_unformatted formatters behavior. $this->drupalGet('node/' . $node->id()); $float_formatted = number_format($random_float, $scale, $decimal_separator, $thousand_separator); - $this->assertRaw("$prefix$float_formatted$suffix"); - $this->assertRaw((string) $random_integer); + $this->assertSession()->responseContains("$prefix$float_formatted$suffix"); + $this->assertSession()->responseContains((string) $random_integer); // Configure the number_decimal formatter. \Drupal::service('entity_display.repository')->getViewDisplay('node', $type) @@ -182,7 +182,7 @@ public function testNumberFormatter() { $this->drupalGet('node/' . $node->id()); $integer_formatted = number_format($random_integer, 0, '', $thousand_separator); - $this->assertRaw($integer_formatted); + $this->assertSession()->responseContains($integer_formatted); } } diff --git a/web/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php b/web/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php index ccd4a38525403d32fee0092dfb1dc51e7ac12041..6bb7575f5172a5dc635b30e69dd459d607fe7f5a 100644 --- a/web/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php +++ b/web/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php @@ -29,7 +29,7 @@ protected function setUp(): void { parent::setUp(); $this->fieldUninstallValidator = $this->getMockBuilder('Drupal\field\FieldUninstallValidator') ->disableOriginalConstructor() - ->setMethods(['getFieldStoragesByModule', 'getFieldTypeLabel']) + ->onlyMethods(['getFieldStoragesByModule', 'getFieldTypeLabel']) ->getMock(); $this->fieldUninstallValidator->setStringTranslation($this->getStringTranslationStub()); } diff --git a/web/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php b/web/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php index 155190988b5d07a8b790ed2280dbab9f6ed4490f..fea239374b6f2cf97691f9cb77eeedc57aeb1d74 100644 --- a/web/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php +++ b/web/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php @@ -69,7 +69,7 @@ public function testEntityViewModeUI() { 'label' => $this->randomString(), ]; $this->submitForm($edit, 'Save'); - $this->assertRaw('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); + $this->assertSession()->pageTextContains('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); // Test adding a view mode. $edit = [ @@ -123,7 +123,7 @@ public function testEntityFormModeUI() { 'label' => $this->randomString(), ]; $this->submitForm($edit, 'Save'); - $this->assertRaw('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); + $this->assertSession()->pageTextContains('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); // Test adding a form mode. $edit = [ diff --git a/web/core/modules/field_ui/tests/src/Functional/FieldUIIndentationTest.php b/web/core/modules/field_ui/tests/src/Functional/FieldUIIndentationTest.php index 68813e4530c99259fa6046c3c7b5b3b470aa3bb6..f9a1756bffc9f9ff7177d3c9054a7833d16083e9 100644 --- a/web/core/modules/field_ui/tests/src/Functional/FieldUIIndentationTest.php +++ b/web/core/modules/field_ui/tests/src/Functional/FieldUIIndentationTest.php @@ -44,7 +44,7 @@ protected function setUp(): void { public function testIndentation() { $this->drupalGet('admin/structure/types/manage/page/display'); - $this->assertRaw('js-indentation indentation'); + $this->assertSession()->responseContains('js-indentation indentation'); } } diff --git a/web/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/web/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index b99e51f25f725f83c49a25d6fd8b0c95724dde68..17fca561265b2ea43c9cade7158ebd964401d9c4 100644 --- a/web/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/web/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -173,7 +173,7 @@ public function manageFieldsPage($type = '') { ]; foreach ($table_headers as $table_header) { // We check that the label appear in the table headings. - $this->assertRaw($table_header . '</th>'); + $this->assertSession()->responseContains($table_header . '</th>'); } // Test the "Add field" action link. @@ -750,7 +750,7 @@ public function testExternalDestinations() { // The external redirect should not fire. $this->assertSession()->addressEquals('admin/structure/types/manage/article/fields/node.article.body/storage?destinations%5B0%5D=http%3A//example.com'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Attempt to update field <em class="placeholder">Body</em> failed: <em class="placeholder">The internal path component 'http://example.com' is external. You are not allowed to specify an external URL together with internal:/.</em>.'); + $this->assertSession()->responseContains('Attempt to update field <em class="placeholder">Body</em> failed: <em class="placeholder">The internal path component 'http://example.com' is external. You are not allowed to specify an external URL together with internal:/.</em>.'); } /** @@ -812,8 +812,8 @@ public function testHelpDescriptions() { $this->submitForm($edit, 'Save settings'); $this->drupalGet('node/add/article'); - $this->assertRaw('<strong>Test with an upload field.</strong>'); - $this->assertRaw('<em>Test with a non upload field.</em>'); + $this->assertSession()->responseContains('<strong>Test with an upload field.</strong>'); + $this->assertSession()->responseContains('<em>Test with a non upload field.</em>'); } /** diff --git a/web/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/web/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php index d1e4ee39de2808934f5bfea5dafaf70bad39fe2d..000daddb3ffc614f67f323e5eb99c544704403e6 100644 --- a/web/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php +++ b/web/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php @@ -93,7 +93,7 @@ public function fieldUIAddExistingField($bundle_path, $existing_storage_name, $l $this->submitForm($initial_edit, 'Save and continue'); // Set the main content to only the content region because the label can // contain HTML which will be auto-escaped by Twig. - $this->assertRaw('field-config-edit-form'); + $this->assertSession()->responseContains('field-config-edit-form'); // Check that the page does not have double escaped HTML tags. $this->assertSession()->responseNotContains('&lt;'); diff --git a/web/core/modules/file/tests/src/Functional/DownloadTest.php b/web/core/modules/file/tests/src/Functional/DownloadTest.php index 8bcdac89bb3b5fc9965e3d04f33a6023b2196629..db8e98c1b53e957229b9d592f1188e9983155e86 100644 --- a/web/core/modules/file/tests/src/Functional/DownloadTest.php +++ b/web/core/modules/file/tests/src/Functional/DownloadTest.php @@ -178,7 +178,7 @@ private function checkUrl($scheme, $directory, $filename, $expected_url) { $this->drupalGet($url); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(file_get_contents($file->getFileUri())); + $this->assertSession()->responseContains(file_get_contents($file->getFileUri())); $file->delete(); } diff --git a/web/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/web/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index a597500c45d6881f653684ab29a17d5737709ad9..d4e2cf9f91c2267fc0a2ddee86e3de1b91428de1 100644 --- a/web/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/web/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -80,7 +80,7 @@ public function testNodeDisplay() { '#file' => $node_file, ]; $default_output = \Drupal::service('renderer')->renderRoot($file_link); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Turn the "display" option off and check that the file is no longer displayed. $edit = [$field_name . '[0][display]' => FALSE]; @@ -100,7 +100,7 @@ public function testNodeDisplay() { $this->assertSession()->pageTextContains($description); // Ensure the filename in the link's title attribute is escaped. - $this->assertRaw('title="escaped-&-text.txt"'); + $this->assertSession()->responseContains('title="escaped-&-text.txt"'); // Test that fields appear as expected after during the preview. // Add a second file. @@ -115,9 +115,9 @@ public function testNodeDisplay() { $this->submitForm($edit, 'Preview'); $this->clickLink('Back to content editing'); // First file. - $this->assertRaw($field_name . '[0][display]'); + $this->assertSession()->responseContains($field_name . '[0][display]'); // Second file. - $this->assertRaw($field_name . '[1][display]'); + $this->assertSession()->responseContains($field_name . '[1][display]'); $this->assertSession()->responseContains($field_name . '[1][description]'); // Check that the file fields don't contain duplicate HTML IDs. diff --git a/web/core/modules/file/tests/src/Functional/FileListingTest.php b/web/core/modules/file/tests/src/Functional/FileListingTest.php index 395ec3ec797d57954f92212d728002ef14a6371a..ea0a816c7b7dcd3eec802618a29381984361db74 100644 --- a/web/core/modules/file/tests/src/Functional/FileListingTest.php +++ b/web/core/modules/file/tests/src/Functional/FileListingTest.php @@ -131,11 +131,11 @@ public function testFileListingPages() { $this->drupalGet('admin/content/files'); $file = File::load($orphaned_file); $usage = $this->sumUsages($file_usage->listUsage($file)); - $this->assertRaw('admin/content/files/usage/' . $file->id() . '">' . $usage); + $this->assertSession()->responseContains('admin/content/files/usage/' . $file->id() . '">' . $usage); $file = File::load($used_file); $usage = $this->sumUsages($file_usage->listUsage($file)); - $this->assertRaw('admin/content/files/usage/' . $file->id() . '">' . $usage); + $this->assertSession()->responseContains('admin/content/files/usage/' . $file->id() . '">' . $usage); $result = $this->xpath("//td[contains(@class, 'views-field-status') and contains(text(), :value)]", [':value' => 'Temporary']); $this->assertCount(1, $result, 'Unused file marked as temporary.'); diff --git a/web/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/web/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php index c23d199c3a6e20cd48605a4ab9b065c55a11ba13..36f2d1e782d2efc2b528be8a7b498c9b04bfe9fe 100644 --- a/web/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php +++ b/web/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php @@ -161,7 +161,7 @@ public function testManagedFileRemoved() { $this->submitForm($edit, 'Upload'); // We expect the title 'Managed <em>file & butter</em>' which got escaped // via a t() call before. - $this->assertRaw('The file referenced by the Managed <em>file & butter</em> field does not exist.'); + $this->assertSession()->responseContains('The file referenced by the Managed <em>file & butter</em> field does not exist.'); } /** diff --git a/web/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php b/web/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php index 0424dc8286652597917f631ad2c1ae1af9fa74d1..cce9408ceb101d6bbd3ff6f86bcfc4c9802dcec4 100644 --- a/web/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php +++ b/web/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php @@ -115,7 +115,7 @@ public function testSyncedFiles() { $this->submitForm($edit, 'Save (this translation)'); // This inspects the HTML after the post of the translation, the file // should be displayed on the original node. - $this->assertRaw('file--mime-text-plain'); + $this->assertSession()->responseContains('file--mime-text-plain'); $second_fid = $this->getLastFileId(); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); @@ -149,7 +149,7 @@ public function testSyncedFiles() { $this->assertTrue($file->isPermanent(), 'First file still exists and is permanent.'); // This inspects the HTML after the post of the translation, the file // should be displayed on the original node. - $this->assertRaw('file--mime-text-plain'); + $this->assertSession()->responseContains('file--mime-text-plain'); // Ensure the file status of the second file is permanent. $file = File::load($second_fid); diff --git a/web/core/modules/file/tests/src/Functional/FilePrivateTest.php b/web/core/modules/file/tests/src/Functional/FilePrivateTest.php index 841fb7e86584acb678e29b83f2a57edf2bbbd048..e2fbd2d3a659cd261de5a828dd9e8545f3126e3f 100644 --- a/web/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/web/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -55,7 +55,7 @@ public function testPrivateFile() { $node_file = File::load($node->{$field_name}->target_id); // Ensure the file can be viewed. $this->drupalGet('node/' . $node->id()); - $this->assertRaw($node_file->getFilename()); + $this->assertSession()->responseContains($node_file->getFilename()); // Ensure the file can be downloaded. $this->drupalGet(file_create_url($node_file->getFileUri())); $this->assertSession()->statusCodeEquals(200); diff --git a/web/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/web/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index 6f101f21a891d741b84571988eb086ab5deee23d..eca962ae0190ddfbd831d297af6fd6a95fdfc9e5 100644 --- a/web/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/web/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -505,8 +505,8 @@ public function testErrorMessagesAreNotChanged() { // Ensure the expected error message is present and the counts before and // after calling _file_save_upload_from_form() are correct. $this->assertSession()->pageTextContains($error); - $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 1'); - $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 1'); + $this->assertSession()->pageTextContains('Number of error messages before _file_save_upload_from_form(): 1'); + $this->assertSession()->pageTextContains('Number of error messages after _file_save_upload_from_form(): 1'); // Test that error messages are preserved when an error occurs. $edit = [ @@ -522,8 +522,8 @@ public function testErrorMessagesAreNotChanged() { // Ensure the expected error message is present and the counts before and // after calling _file_save_upload_from_form() are correct. $this->assertSession()->pageTextContains($error); - $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 1'); - $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 1'); + $this->assertSession()->pageTextContains('Number of error messages before _file_save_upload_from_form(): 1'); + $this->assertSession()->pageTextContains('Number of error messages after _file_save_upload_from_form(): 1'); // Test a successful upload with no messages. $edit = [ @@ -537,8 +537,8 @@ public function testErrorMessagesAreNotChanged() { // Ensure the error message is not present and the counts before and after // calling _file_save_upload_from_form() are correct. $this->assertSession()->pageTextNotContains($error); - $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 0'); - $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 0'); + $this->assertSession()->pageTextContains('Number of error messages before _file_save_upload_from_form(): 0'); + $this->assertSession()->pageTextContains('Number of error messages after _file_save_upload_from_form(): 0'); } /** diff --git a/web/core/modules/filter/filter.filter_html.admin.es6.js b/web/core/modules/filter/filter.filter_html.admin.es6.js index e4b1d31beef93ea9d691cdddbb896e6985a59e4c..6b4c26a59521a86fe6f0ea1f2d70979e86ccac2c 100644 --- a/web/core/modules/filter/filter.filter_html.admin.es6.js +++ b/web/core/modules/filter/filter.filter_html.admin.es6.js @@ -267,26 +267,29 @@ * tag name. */ _parseSetting(setting) { - let node; let tag; let rule; let attributes; let attribute; + const allowedTags = setting.match(/(<[^>]+>)/g); - const sandbox = document.createElement('div'); const rules = {}; for (let t = 0; t < allowedTags.length; t++) { - // Let the browser do the parsing work for us. - sandbox.innerHTML = allowedTags[t]; - node = sandbox.firstChild; - tag = node.tagName.toLowerCase(); + // Create a jQuery object, making it possible to easily retrieve the + // tag name of the allowed tag, regardless of what attributes are set or + // what its required parent elements are. + const $tagObject = $(allowedTags[t]); + + // Parse the tag name from the jQuery object. + tag = $tagObject.prop('tagName').toLowerCase(); // Build the Drupal.FilterHtmlRule object. rule = new Drupal.FilterHTMLRule(); // We create one rule per allowed tag, so always one tag. rule.restrictedTags.tags = [tag]; + // Add the attribute restrictions. - attributes = node.attributes; + attributes = $tagObject.prop('attributes'); for (let i = 0; i < attributes.length; i++) { attribute = attributes.item(i); const attributeName = attribute.nodeName; diff --git a/web/core/modules/filter/filter.filter_html.admin.js b/web/core/modules/filter/filter.filter_html.admin.js index 8e99a488b6910ec0c14b621461740bff5ac5393d..44b665cdbd5caf4b85664001ad14079fee2f46b5 100644 --- a/web/core/modules/filter/filter.filter_html.admin.js +++ b/web/core/modules/filter/filter.filter_html.admin.js @@ -129,22 +129,19 @@ return autoAllowedTags; }, _parseSetting: function _parseSetting(setting) { - var node; var tag; var rule; var attributes; var attribute; var allowedTags = setting.match(/(<[^>]+>)/g); - var sandbox = document.createElement('div'); var rules = {}; for (var t = 0; t < allowedTags.length; t++) { - sandbox.innerHTML = allowedTags[t]; - node = sandbox.firstChild; - tag = node.tagName.toLowerCase(); + var $tagObject = $(allowedTags[t]); + tag = $tagObject.prop('tagName').toLowerCase(); rule = new Drupal.FilterHTMLRule(); rule.restrictedTags.tags = [tag]; - attributes = node.attributes; + attributes = $tagObject.prop('attributes'); for (var i = 0; i < attributes.length; i++) { attribute = attributes.item(i); diff --git a/web/core/modules/filter/filter.module b/web/core/modules/filter/filter.module index 70a603e8c5db12050f298591a477e3ab25c02b4b..fbe48755946aa86bca5c8817335002a29f7166d5 100644 --- a/web/core/modules/filter/filter.module +++ b/web/core/modules/filter/filter.module @@ -490,9 +490,12 @@ function _filter_url($text, $filter) { // Prepare domain name pattern. // The ICANN seems to be on track towards accepting more diverse top level - // domains, so this pattern has been "future-proofed" to allow for TLDs - // of length 2-64. + // domains (TLDs), so this pattern has been "future-proofed" to allow for + // TLDs of length 2-64. $domain = '(?:[\p{L}\p{M}\p{N}._+-]+\.)?[\p{L}\p{M}]{2,64}\b'; + // Mail domains differ from the generic domain pattern, specifically: + // A . character must be present in the string that follows the @ character. + $email_domain = '(?:[\p{L}\p{M}\p{N}._+-]+\.)+[\p{L}\p{M}]{2,64}\b'; $ip = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'; $auth = '[\p{L}\p{M}\p{N}:%_+*~#?&=.,/;-]+@'; $trail = '(' . $valid_url_path . '*)?(\\?' . $valid_url_query_chars . '*' . $valid_url_query_ending_chars . ')?'; @@ -503,7 +506,7 @@ function _filter_url($text, $filter) { $tasks['_filter_url_parse_full_links'] = $pattern; // Match email addresses. - $url_pattern = "[\p{L}\p{M}\p{N}._+-]{1,254}@(?:$domain)"; + $url_pattern = "[\p{L}\p{M}\p{N}._+-]{1,254}@(?:$email_domain)"; $pattern = "`($url_pattern)`u"; $tasks['_filter_url_parse_email_links'] = $pattern; diff --git a/web/core/modules/filter/tests/filter.url-input.txt b/web/core/modules/filter/tests/filter.url-input.txt index 92289dcfd16908428b36105b40560cda349b7be9..b41adb3f0392a02ba1de968bd3f02afc7e0ea189 100644 --- a/web/core/modules/filter/tests/filter.url-input.txt +++ b/web/core/modules/filter/tests/filter.url-input.txt @@ -9,6 +9,7 @@ This is just a www.test.com. paragraph with person@test.com. some http://www.tes http://www.test.com www.test.com person@test.com +person@test <code>www.test.com</code> http://test.com/?search=test http://test.com/?search=Test @@ -28,6 +29,7 @@ The old URL filter has problems with <a title="kind of link www.example.com with <dt>www.test.com</dt> <dd>http://www.test.com</dd> <dd>person@test.com</dd> +<dd>person@test</dd> <dt>check www.test.com</dt> <dd>this with some text around: http://www.test.com not so easy person@test.com now?</dd> </dl> diff --git a/web/core/modules/filter/tests/filter.url-output.txt b/web/core/modules/filter/tests/filter.url-output.txt index 814a4ed71766e5cff135c19bc690d30bdc050917..19acee24a7fbc99e84619304402be7b57ecb53f3 100644 --- a/web/core/modules/filter/tests/filter.url-output.txt +++ b/web/core/modules/filter/tests/filter.url-output.txt @@ -9,6 +9,7 @@ This is just a <a href="http://www.test.com">www.test.com</a>. paragraph with <a <a href="http://www.test.com">http://www.test.com</a> <a href="http://www.test.com">www.test.com</a> <a href="mailto:person@test.com">person@test.com</a> +person@test <code>www.test.com</code> <a href="http://test.com/?search=test">http://test.com/?search=test</a> <a href="http://test.com/?search=Test">http://test.com/?search=Test</a> @@ -28,6 +29,7 @@ The old URL filter has problems with <a title="kind of link www.example.com with <dt><a href="http://www.test.com">www.test.com</a></dt> <dd><a href="http://www.test.com">http://www.test.com</a></dd> <dd><a href="mailto:person@test.com">person@test.com</a></dd> +<dd>person@test</dd> <dt>check <a href="http://www.test.com">www.test.com</a></dt> <dd>this with some text around: <a href="http://www.test.com">http://www.test.com</a> not so easy <a href="mailto:person@test.com">person@test.com</a> now?</dd> </dl> diff --git a/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php index f063852405836c702fff3f5fd3a22b9f0ebc6cdf..ffec9a4f56dec47b31615e87bade0f3e0554712c 100644 --- a/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php +++ b/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -295,7 +295,7 @@ public function testFilterAdmin() { $this->drupalLogin($this->webUser); $this->drupalGet('node/add/page'); - $this->assertRaw('<option value="' . $full . '">Full HTML</option>'); + $this->assertSession()->responseContains('<option value="' . $full . '">Full HTML</option>'); // Use basic HTML and see if it removes tags that are not allowed. $body = '<em>' . $this->randomMachineName() . '</em>'; @@ -318,7 +318,7 @@ public function testFilterAdmin() { $this->drupalGet('node/' . $node->id()); // Check that filter removed invalid tag. - $this->assertRaw($body . $extra_text); + $this->assertSession()->responseContains($body . $extra_text); // Use plain text and see if it escapes all tags, whether allowed or not. // In order to test plain text, we have to enable the hidden variable for @@ -403,10 +403,10 @@ public function testFilterTipHtmlEscape() { $this->drupalGet('filter/tips'); - $this->assertRaw('<td class="type">' . $link_as_code . '</td>'); - $this->assertRaw('<td class="get">' . $link . '</td>'); - $this->assertRaw('<td class="type">' . $ampersand_as_code . '</td>'); - $this->assertRaw('<td class="get">' . $ampersand . '</td>'); + $this->assertSession()->responseContains('<td class="type">' . $link_as_code . '</td>'); + $this->assertSession()->responseContains('<td class="get">' . $link . '</td>'); + $this->assertSession()->responseContains('<td class="type">' . $ampersand_as_code . '</td>'); + $this->assertSession()->responseContains('<td class="get">' . $ampersand . '</td>'); } /** @@ -456,7 +456,7 @@ public function testDisabledFormat() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/reports/dblog'); // The correct message has been logged. - $this->assertRaw(sprintf('Disabled text format: %s.', $format_id)); + $this->assertSession()->pageTextContains(sprintf('Disabled text format: %s.', $format_id)); // Programmatically change the text format to something random so we trigger // the missing text format message. @@ -471,7 +471,7 @@ public function testDisabledFormat() { // Visit the dblog report page. $this->drupalGet('admin/reports/dblog'); // The missing text format message has been logged. - $this->assertRaw(sprintf('Missing text format: %s.', $format_id)); + $this->assertSession()->pageTextContains(sprintf('Missing text format: %s.', $format_id)); } } diff --git a/web/core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php b/web/core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e0979a267f693297468613d1c0713e75ad1bdd7b --- /dev/null +++ b/web/core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php @@ -0,0 +1,51 @@ +<?php + +namespace Drupal\Tests\filter\FunctionalJavascript; + +use Drupal\filter\Entity\FilterFormat; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; + +/** + * Tests the 'filter_html' plugin javascript functionality. + * + * @group filter + */ +class FilterHtmlTest extends WebDriverTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['editor', 'filter']; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * Tests restricting HTML to table tags. + */ + public function testTableTags() { + FilterFormat::create([ + 'format' => 'some_html', + 'filters' => [ + 'filter_html' => [ + 'status' => 1, + 'settings' => [ + 'allowed_html' => '<caption> <tbody> <thead> <tfoot> <th> <td> <tr>', + ], + ], + ], + ])->save(); + + $this->drupalLogin($this->drupalCreateUser(['administer filters'])); + $this->drupalGet('admin/config/content/formats/manage/some_html'); + + $js_condition = "Drupal.behaviors.filterFilterHtmlUpdating._parseSetting( + jQuery('#edit-filters-filter-html-settings-allowed-html').val() + )['td'].tags.length >= 0"; + + $this->assertJsCondition($js_condition); + } + +} diff --git a/web/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php b/web/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php index 8387f14e022e74df94028df5b4697fe17a5fbf21..2af37aa020138d01ef975c48fbe8f1f059b019cd 100644 --- a/web/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php +++ b/web/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php @@ -22,7 +22,7 @@ protected function setUp(): void { parent::setUp(); $this->filterUninstallValidator = $this->getMockBuilder('Drupal\filter\FilterUninstallValidator') ->disableOriginalConstructor() - ->setMethods(['getFilterDefinitionsByProvider', 'getEnabledFilterFormats']) + ->onlyMethods(['getFilterDefinitionsByProvider', 'getEnabledFilterFormats']) ->getMock(); $this->filterUninstallValidator->setStringTranslation($this->getStringTranslationStub()); } diff --git a/web/core/modules/forum/tests/src/Functional/ForumTest.php b/web/core/modules/forum/tests/src/Functional/ForumTest.php index 68c380efda5106eaea773d100d0c68f9112bcd6a..8480ab6706d5ed239bfb0c4c795713c53c058394 100644 --- a/web/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/web/core/modules/forum/tests/src/Functional/ForumTest.php @@ -135,7 +135,7 @@ public function testForum() { // Check that the basic forum install creates a default forum topic $this->drupalGet('/forum'); // Look for the "General discussion" default forum - $this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString()); + $this->assertSession()->responseContains(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString()); // Check the presence of expected cache tags. $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:forum.settings'); @@ -332,13 +332,13 @@ private function doAdminTests($user) { $this->assertSession()->linkExists('Add forum'); $this->assertSession()->linkExists('Add container'); $this->clickLink('edit container'); - $this->assertRaw('Edit container'); + $this->assertSession()->pageTextContains('Edit container'); // Create forum inside the forum container. $this->forum = $this->createForum('forum', $this->forumContainer['tid']); // Verify the "edit forum" link exists and functions correctly. $this->drupalGet('admin/structure/forum'); $this->clickLink('edit forum'); - $this->assertRaw('Edit forum'); + $this->assertSession()->pageTextContains('Edit forum'); // Navigate back to forum structure page. $this->drupalGet('admin/structure/forum'); // Create second forum in container, destined to be deleted below. @@ -604,8 +604,8 @@ public function createForumTopic($forum, $container = FALSE) { // View forum topic. $this->drupalGet('node/' . $node->id()); - $this->assertRaw($title); - $this->assertRaw($body); + $this->assertSession()->pageTextContains($title); + $this->assertSession()->pageTextContains($body); return $node; } @@ -652,7 +652,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { '#theme' => 'breadcrumb', '#links' => $breadcrumb_build, ]; - $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb)); + $this->assertSession()->responseContains(\Drupal::service('renderer')->renderRoot($breadcrumb)); // View forum edit node. $this->drupalGet('node/' . $node->id() . '/edit'); @@ -718,7 +718,7 @@ private function verifyForumView($forum, $parent = NULL) { '#theme' => 'breadcrumb', '#links' => $breadcrumb_build, ]; - $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb)); + $this->assertSession()->responseContains(\Drupal::service('renderer')->renderRoot($breadcrumb)); } /** diff --git a/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php b/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php index 39351231c5a44e34cd8fdc630449c48ba82605f3..a9b0ed436f472363961bb0afa4c60869148be188 100644 --- a/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php +++ b/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php @@ -59,7 +59,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $forum_manager, $translation_manager, ]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); diff --git a/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php b/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php index 1c37a806dff1e7cfc69eb22abd0b73ea97e4f761..c44f382d63a985b4a6daa8b7f00e641c3ee8d88e 100644 --- a/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php +++ b/web/core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php @@ -66,7 +66,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $translation_manager, ] ) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); diff --git a/web/core/modules/forum/tests/src/Unit/ForumManagerTest.php b/web/core/modules/forum/tests/src/Unit/ForumManagerTest.php index 969bb712193e4da494e96681883b9fcc193f15cc..c9208a70477d1247276994d29484ba963a881309 100644 --- a/web/core/modules/forum/tests/src/Unit/ForumManagerTest.php +++ b/web/core/modules/forum/tests/src/Unit/ForumManagerTest.php @@ -61,7 +61,7 @@ public function testGetIndex() { ->getMock(); $manager = $this->getMockBuilder('\Drupal\forum\ForumManager') - ->setMethods(['getChildren']) + ->onlyMethods(['getChildren']) ->setConstructorArgs([ $config_factory, $entity_type_manager, diff --git a/web/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php b/web/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php index 714cd9265328259f84483bfa3eabddfe1ba83b8d..c6c84c8fb84767234cbc715febdf318de8766188 100644 --- a/web/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php +++ b/web/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php @@ -23,7 +23,7 @@ protected function setUp(): void { parent::setUp(); $this->forumUninstallValidator = $this->getMockBuilder('Drupal\forum\ForumUninstallValidator') ->disableOriginalConstructor() - ->setMethods(['hasForumNodes', 'hasTermsForVocabulary', 'getForumVocabulary']) + ->onlyMethods(['hasForumNodes', 'hasTermsForVocabulary', 'getForumVocabulary']) ->getMock(); $this->forumUninstallValidator->setStringTranslation($this->getStringTranslationStub()); } diff --git a/web/core/modules/hal/src/LinkManager/RelationLinkManager.php b/web/core/modules/hal/src/LinkManager/RelationLinkManager.php index e56b20de6fad15033f82848e856a4be5e3b9c0cb..a8e90b4b929f3e302e571cec289510166ec699ff 100644 --- a/web/core/modules/hal/src/LinkManager/RelationLinkManager.php +++ b/web/core/modules/hal/src/LinkManager/RelationLinkManager.php @@ -129,7 +129,7 @@ public function getRelationInternalIds($relation_uri, $context = []) { * @see https://www.drupal.org/node/2877608 */ protected function getRelations($context = []) { - $cid = 'hal:links:relations'; + $cid = 'hal:links:relations:' . $this->getLinkDomain($context); $cache = $this->cache->get($cid); if (!$cache) { $data = $this->writeCache($context); @@ -174,7 +174,7 @@ protected function writeCache($context = []) { } // These URIs only change when field info changes, so cache it permanently // and only clear it when the fields cache is cleared. - $this->cache->set('hal:links:relations', $data, Cache::PERMANENT, ['entity_field_info']); + $this->cache->set('hal:links:relations:' . $this->getLinkDomain($context), $data, Cache::PERMANENT, ['entity_field_info']); return $data; } diff --git a/web/core/modules/hal/src/LinkManager/TypeLinkManager.php b/web/core/modules/hal/src/LinkManager/TypeLinkManager.php index 4996f8099ac858a79e9c05deb86b04b8a4b65aba..75475aa444061c03c3404cd6b32f588825d51ac0 100644 --- a/web/core/modules/hal/src/LinkManager/TypeLinkManager.php +++ b/web/core/modules/hal/src/LinkManager/TypeLinkManager.php @@ -108,7 +108,7 @@ public function getTypeInternalIds($type_uri, $context = []) { * corresponding type URI. */ protected function getTypes($context = []) { - $cid = 'hal:links:types'; + $cid = 'hal:links:types:' . $this->getLinkDomain($context); $cache = $this->cache->get($cid); if (!$cache) { $data = $this->writeCache($context); @@ -152,7 +152,7 @@ protected function writeCache($context = []) { } // These URIs only change when entity info changes, so cache it permanently // and only clear it when entity_info is cleared. - $this->cache->set('hal:links:types', $data, Cache::PERMANENT, ['entity_types']); + $this->cache->set('hal:links:types:' . $this->getLinkDomain($context), $data, Cache::PERMANENT, ['entity_types']); return $data; } diff --git a/web/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php b/web/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php index ee622c3d19092b62d0092010318be3b033e2e4b3..a0ede7a0daa4156e018bd3fb23f369fc814d1939 100644 --- a/web/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php +++ b/web/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php @@ -244,13 +244,27 @@ public function testHalLinkManagersSetLinkDomain() { /** @var \Drupal\hal\LinkManager\LinkManager $link_manager */ $link_manager = \Drupal::service('hal.link_manager'); - $link_manager->setLinkDomain('http://example.com/'); - $link = $link_manager->getTypeUri('node', 'page', $serialization_context); - $this->assertEquals('http://example.com/rest/type/node/page', $link); - $this->assertEquals($serialization_context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY], new CacheableMetadata()); - $link = $link_manager->getRelationUri('node', 'page', 'field_ref', $serialization_context); - $this->assertEquals('http://example.com/rest/relation/node/page/field_ref', $link); - $this->assertEquals($serialization_context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY], new CacheableMetadata()); + /** @var \Drupal\hal\LinkManager\TypeLinkManager $type_link_manager */ + $type_link_manager = \Drupal::service('hal.link_manager.type'); + /** @var \Drupal\hal\LinkManager\RelationLinkManager $relation_link_manager */ + $relation_link_manager = \Drupal::service('hal.link_manager.relation'); + + // One Drupal installation can serve multiple domains, protocols or ports. + foreach (['http://example.com/', 'https://example.com/', 'https://example.com:443/', 'http://drupal.org/'] as $domain) { + $link_manager->setLinkDomain($domain); + + $link = $link_manager->getTypeUri('node', 'page', $serialization_context); + $this->assertEquals($domain . 'rest/type/node/page', $link); + $this->assertEquals($serialization_context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY], new CacheableMetadata()); + $type_ids = $type_link_manager->getTypeInternalIds($link, $serialization_context); + $this->assertEquals(['entity_type' => 'node', 'bundle' => 'page'], $type_ids); + + $link = $link_manager->getRelationUri('node', 'page', 'field_ref', $serialization_context); + $this->assertEquals($domain . 'rest/relation/node/page/field_ref', $link); + $this->assertEquals($serialization_context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY], new CacheableMetadata()); + $relation_ids = $relation_link_manager->getRelationInternalIds($link, $serialization_context); + $this->assertEquals(['entity_type_id' => 'node', 'bundle' => 'page', 'field_name' => 'field_ref'], $relation_ids); + } } } diff --git a/web/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsTest.php b/web/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsTest.php index cec2a49eee37c0ca90aacd1c39d810d23ee8f36f..035932aa87b97d8132b660ac55116d06dfcdcaf4 100644 --- a/web/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsTest.php +++ b/web/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsTest.php @@ -52,7 +52,7 @@ public function testFieldItemNormalizerDenormalizeExceptions($context) { */ public function providerNormalizerDenormalizeExceptions() { $mock = $this->getMockBuilder('\Drupal\Core\Field\Plugin\DataType\FieldItem') - ->setMethods(['getParent']) + ->addMethods(['getParent']) ->getMock(); $mock->expects($this->any()) ->method('getParent') diff --git a/web/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/web/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php index 8f25358182baf4a8f9e8335849bfca25b693b97a..2800bfbd73de3cb1a6866e1966796fce55c96738 100644 --- a/web/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -491,7 +491,7 @@ public function testConfigImport() { // Test that image is displayed using newly created style. $this->drupalGet('node/' . $nid); - $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri))); + $this->assertSession()->responseContains(file_url_transform_relative($style->buildUrl($original_uri))); // Copy config to sync, and delete the image style. $sync = $this->container->get('config.storage.sync'); diff --git a/web/core/modules/image/tests/src/Functional/ImageDimensionsTest.php b/web/core/modules/image/tests/src/Functional/ImageDimensionsTest.php index 9fa6affb151ebdd5ba54923171e9d74acb801514..db56b318fea5ab7e4b191e2194a50fbb1d7c148f 100644 --- a/web/core/modules/image/tests/src/Functional/ImageDimensionsTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageDimensionsTest.php @@ -294,11 +294,12 @@ public function testImageDimensions() { /** * Render an image style element. * - * Function drupal_render() alters the passed $variables array by adding a new - * key '#printed' => TRUE. This prevents next call to re-render the element. - * We wrap drupal_render() in a helper protected method and pass each time a - * fresh array so that $variables won't get altered and the element is - * re-rendered each time. + * Function \Drupal\Core\Render\RendererInterface::render() alters the passed + * $variables array by adding a new key '#printed' => TRUE. This prevents next + * call to re-render the element. We wrap + * \Drupal\Core\Render\RendererInterface::render() in a helper protected + * method and pass each time a fresh array so that $variables won't get + * altered and the element is re-rendered each time. */ protected function getImageTag($variables) { return str_replace("\n", NULL, \Drupal::service('renderer')->renderRoot($variables)); diff --git a/web/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php b/web/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php index 7cc89b1af83e211b2420fb0e72392b878cfa5fbc..3acf4fa263ee6a84a1a8a26af19d19f30735d6b8 100644 --- a/web/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php @@ -200,7 +200,7 @@ public function testDefaultImages() { // Confirm the default image is shown on the node form. $file = File::load($default_images['field_new']->id()); $this->drupalGet('node/add/article'); - $this->assertRaw($file->getFilename()); + $this->assertSession()->responseContains($file->getFilename()); // Remove the field default from articles. $default_image_settings = $field->getSetting('default_image'); @@ -229,7 +229,7 @@ public function testDefaultImages() { // Confirm the default image is shown on the node form. $file = File::load($default_images['field_storage_new']->id()); $this->drupalGet('node/add/article'); - $this->assertRaw($file->getFilename()); + $this->assertSession()->responseContains($file->getFilename()); // Change the default image for the field storage and also change the upload // destination to the private filesystem at the same time. diff --git a/web/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/web/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index 2bfa95c0ca5b3f1840d0c23137fb24bb799d27cd..8858fef267bef0084ad098f325508fbadcafcbc4 100644 --- a/web/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -116,7 +116,7 @@ public function _testImageFieldFormatters($scheme) { '#alt' => $alt, ]; $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Test the image linked to file formatter. $display_options = [ @@ -142,7 +142,7 @@ public function _testImageFieldFormatters($scheme) { $this->assertCacheContext('url.site'); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Verify that the image can be downloaded. $this->assertEquals(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); if ($scheme == 'private') { @@ -207,7 +207,7 @@ public function _testImageFieldFormatters($scheme) { $this->drupalGet('node/' . $nid); $image_style = ImageStyle::load('thumbnail'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $image_style->getCacheTags()[0]); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); if ($scheme == 'private') { // Log out and ensure the file cannot be accessed. @@ -304,7 +304,7 @@ public function testImageFieldSettings() { $this->drupalGet('node/' . $nid . '/edit'); $this->submitForm($edit, 'Save'); $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Verify that alt/title longer than allowed results in a validation error. $test_size = 2000; @@ -401,7 +401,7 @@ public function testImageFieldDefaultImage() { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Create a node with an image attached and ensure that the default image // is not displayed. @@ -429,7 +429,7 @@ public function testImageFieldDefaultImage() { // Default image should not be displayed. $this->assertSession()->responseNotContains($default_output); // User supplied image should be displayed. - $this->assertRaw($image_output); + $this->assertSession()->responseContains($image_output); // Remove default image from the field and make sure it is no longer used. // Can't use fillField cause Mink can't fill hidden fields. @@ -482,7 +482,7 @@ public function testImageFieldDefaultImage() { $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); // Default private image should be displayed when no user supplied image // is present. - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); } } diff --git a/web/core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php b/web/core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php index ec2f6890e0f9a48bc5a0c8bcdb14aee20fc07f26..64d2f92c74774b1c9160a0f87a64c05862306c36 100644 --- a/web/core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php +++ b/web/core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php @@ -130,12 +130,12 @@ public function testSyncedImages() { $this->submitForm($edit, 'Save (this translation)'); // This inspects the HTML after the post of the translation, the image // should be displayed on the original node. - $this->assertRaw('alt="Lost in translation image"'); - $this->assertRaw('title="Lost in translation image title"'); + $this->assertSession()->responseContains('alt="Lost in translation image"'); + $this->assertSession()->responseContains('title="Lost in translation image title"'); $second_fid = $this->getLastFileId(); // View the translated node. $this->drupalGet('fr/node/' . $default_language_node->id()); - $this->assertRaw('alt="Scarlett Johansson image"'); + $this->assertSession()->responseContains('alt="Scarlett Johansson image"'); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); @@ -170,12 +170,12 @@ public function testSyncedImages() { $this->assertTrue($file->isPermanent(), 'First file still exists and is permanent.'); // This inspects the HTML after the post of the translation, the image // should be displayed on the original node. - $this->assertRaw('alt="Lost in translation image"'); - $this->assertRaw('title="Lost in translation image title"'); + $this->assertSession()->responseContains('alt="Lost in translation image"'); + $this->assertSession()->responseContains('title="Lost in translation image title"'); // View the translated node. $this->drupalGet('nl/node/' . $default_language_node->id()); - $this->assertRaw('alt="Akiko Takeshita image"'); - $this->assertRaw('title="Akiko Takeshita image title"'); + $this->assertSession()->responseContains('alt="Akiko Takeshita image"'); + $this->assertSession()->responseContains('title="Akiko Takeshita image title"'); // Ensure the file status of the second file is permanent. $file = File::load($second_fid); diff --git a/web/core/modules/image/tests/src/Unit/ImageStyleTest.php b/web/core/modules/image/tests/src/Unit/ImageStyleTest.php index 4a3f1830d65b99390424d8a4019a1da88da85631..94dcc28979de5239c1388b324700c18520ae9389 100644 --- a/web/core/modules/image/tests/src/Unit/ImageStyleTest.php +++ b/web/core/modules/image/tests/src/Unit/ImageStyleTest.php @@ -54,18 +54,13 @@ protected function getImageStyleMock($image_effect_id, $image_effect, $stubs = [ ->method('createInstance') ->with($image_effect_id) ->will($this->returnValue($image_effect)); - $default_stubs = [ - 'getImageEffectPluginManager', - 'fileUriScheme', - 'fileUriTarget', - 'fileDefaultScheme', - ]; + $default_stubs = ['getImageEffectPluginManager', 'fileDefaultScheme']; $image_style = $this->getMockBuilder('\Drupal\image\Entity\ImageStyle') ->setConstructorArgs([ ['effects' => [$image_effect_id => ['id' => $image_effect_id]]], $this->entityTypeId, ]) - ->setMethods(array_merge($default_stubs, $stubs)) + ->onlyMethods(array_merge($default_stubs, $stubs)) ->getMock(); $image_style->expects($this->any()) diff --git a/web/core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php b/web/core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php index b99a4e5cc13ffdba2891a02702245c9525a8c18c..d07b4562ec84168c794f3cf7d7a27d89949b6aa0 100644 --- a/web/core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php +++ b/web/core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php @@ -160,7 +160,8 @@ public function __construct(LoggerInterface $logger, FileSystemInterface $file_s */ public function handleFileUploadForField(FieldDefinitionInterface $field_definition, $filename, AccountInterface $owner) { assert(is_a($field_definition->getClass(), FileFieldItemList::class, TRUE)); - $destination = $this->getUploadLocation($field_definition->getSettings()); + $settings = $field_definition->getSettings(); + $destination = $this->getUploadLocation($settings); // Check the destination file path is writable. if (!$this->fileSystem->prepareDirectory($destination, FileSystemInterface::CREATE_DIRECTORY)) { @@ -173,6 +174,9 @@ public function handleFileUploadForField(FieldDefinitionInterface $field_definit // Create the file. $file_uri = "{$destination}/{$prepared_filename}"; + if ($destination === $settings['uri_scheme'] . '://') { + $file_uri = "{$destination}{$prepared_filename}"; + } $temp_file_path = $this->streamUploadData(); diff --git a/web/core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php b/web/core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php index aeadd2741a24c7f4d4a3cfa28117d4dadbe12d0f..a9a6e9604d4714ee6768843c0cd9d88cb9ab13ea 100644 --- a/web/core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php +++ b/web/core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php @@ -118,24 +118,27 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent */ public function all() { $cached = $this->cache->get('jsonapi.resource_types', FALSE); - if ($cached === FALSE) { - $resource_types = []; - foreach ($this->entityTypeManager->getDefinitions() as $entity_type) { - $bundles = array_keys($this->entityTypeBundleInfo->getBundleInfo($entity_type->id())); - $resource_types = array_reduce($bundles, function ($resource_types, $bundle) use ($entity_type) { - $resource_type = $this->createResourceType($entity_type, (string) $bundle); - return array_merge($resource_types, [ - $resource_type->getTypeName() => $resource_type, - ]); - }, $resource_types); - } - foreach ($resource_types as $resource_type) { - $relatable_resource_types = $this->calculateRelatableResourceTypes($resource_type, $resource_types); - $resource_type->setRelatableResourceTypes($relatable_resource_types); - } - $this->cache->set('jsonapi.resource_types', $resource_types, Cache::PERMANENT, $this->cacheTags); + if ($cached) { + return $cached->data; + } + + $resource_types = []; + foreach ($this->entityTypeManager->getDefinitions() as $entity_type) { + $bundles = array_keys($this->entityTypeBundleInfo->getBundleInfo($entity_type->id())); + $resource_types = array_reduce($bundles, function ($resource_types, $bundle) use ($entity_type) { + $resource_type = $this->createResourceType($entity_type, (string) $bundle); + return array_merge($resource_types, [ + $resource_type->getTypeName() => $resource_type, + ]); + }, $resource_types); } - return $cached ? $cached->data : $resource_types; + foreach ($resource_types as $resource_type) { + $relatable_resource_types = $this->calculateRelatableResourceTypes($resource_type, $resource_types); + $resource_type->setRelatableResourceTypes($relatable_resource_types); + } + $this->cache->set('jsonapi.resource_types', $resource_types, Cache::PERMANENT, $this->cacheTags); + + return $resource_types; } /** diff --git a/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php index 34e0ae2bbe92b8823a5d753c9fbc41b6689d779a..a7b3465c8d839c120e75580698745b6b8e09a9c1 100644 --- a/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -747,6 +747,27 @@ public function testFileUploadNoExtensionSetting() { $this->assertFileExists('public://foobar/example.txt'); } + /** + * Tests using the file upload POST route no directory configured. + */ + public function testFileUploadNoDirectorySetting() { + $this->setUpAuthorization('POST'); + $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); + + $uri = Url::fromUri('base:' . static::$postUri); + + $this->field->setSetting('file_directory', '') + ->save(); + + $response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'filename="example.txt"']); + $expected = $this->getExpectedDocument(1, 'example.txt', TRUE); + $expected['data']['attributes']['uri']['value'] = 'public://example.txt'; + $expected['data']['attributes']['uri']['url'] = base_path() . $this->siteDirectory . '/files/example.txt'; + + $this->assertResponseData($expected, $response); + $this->assertFileExists('public://example.txt'); + } + /** * {@inheritdoc} */ diff --git a/web/core/modules/language/tests/src/Functional/LanguageListTest.php b/web/core/modules/language/tests/src/Functional/LanguageListTest.php index 8cc17bfc15977102bb47e75acc71261191c74878..04c0c0831e4b104d2b1450412144fbe0f030f923 100644 --- a/web/core/modules/language/tests/src/Functional/LanguageListTest.php +++ b/web/core/modules/language/tests/src/Functional/LanguageListTest.php @@ -72,7 +72,7 @@ public function testLanguageList() { $this->drupalGet('admin/config/regional/language/add'); $this->submitForm($edit, 'Add custom language'); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection')); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); + $this->assertSession()->responseContains('"edit-languages-' . $langcode . '-weight"'); $this->assertSession()->pageTextContains($name); $language = \Drupal::service('language_manager')->getLanguage($langcode); @@ -106,7 +106,7 @@ public function testLanguageList() { ]; $this->drupalGet('admin/config/regional/language/edit/' . $langcode); $this->submitForm($edit, 'Save language'); - $this->assertRaw($name); + $this->assertSession()->pageTextContains($name); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language])); // Change back the default language. @@ -125,7 +125,7 @@ public function testLanguageList() { // First test the 'cancel' link. $this->clickLink('Cancel'); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english])); - $this->assertRaw($name); + $this->assertSession()->pageTextContains($name); // Delete the language for real. This a confirm form, we do not need any // fields changed. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); diff --git a/web/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php b/web/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php index f1f33104a44679e506b98c67565baa1e7ee39658..018ed621f7a36827df74d0635570ebf9493f540c 100644 --- a/web/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php +++ b/web/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php @@ -58,7 +58,7 @@ protected function setUp(): void { // Check that drupalSettings contains path prefix. $this->drupalGet('fr/admin/config/regional/language/detection'); - $this->assertRaw('"pathPrefix":"fr\/"'); + $this->assertSession()->responseContains('"pathPrefix":"fr\/"'); } /** diff --git a/web/core/modules/layout_builder/layout_builder.module b/web/core/modules/layout_builder/layout_builder.module index 4631de2547c14d8243ddacd8db45548f54c85917..4553f0cada2fd3d148e67b56947943a7ba07ee5c 100644 --- a/web/core/modules/layout_builder/layout_builder.module +++ b/web/core/modules/layout_builder/layout_builder.module @@ -334,7 +334,7 @@ function layout_builder_plugin_filter_layout_alter(array &$definitions, array $e */ function layout_builder_system_breadcrumb_alter(Breadcrumb &$breadcrumb, RouteMatchInterface $route_match, array $context) { // Remove the extra 'Manage display' breadcrumb for Layout Builder defaults. - if ($route_match->getRouteObject()->hasOption('_layout_builder') && $route_match->getParameter('section_storage_type') === 'defaults') { + if ($route_match->getRouteObject() && $route_match->getRouteObject()->hasOption('_layout_builder') && $route_match->getParameter('section_storage_type') === 'defaults') { $links = array_filter($breadcrumb->getLinks(), function (Link $link) use ($route_match) { $entity_type_id = $route_match->getParameter('entity_type_id'); if (!$link->getUrl()->isRouted()) { diff --git a/web/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php b/web/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..113adc2576da887cbdb303d87a20c56d8bb3168b --- /dev/null +++ b/web/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php @@ -0,0 +1,33 @@ +<?php + +namespace Drupal\Tests\layout_builder\Kernel; + +use Drupal\Core\Breadcrumb\Breadcrumb; +use Drupal\Core\Routing\NullRouteMatch; +use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; + +/** + * Tests layout_builder_system_breadcrumb_alter(). + * + * @group layout_builder + */ +class LayoutBuilderBreadcrumbAlterTest extends EntityKernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'layout_builder', + 'layout_discovery', + ]; + + /** + * Check that there are no errors when alter called with null route match. + */ + public function testBreadcrumbAlterNullRouteMatch() { + $breadcrumb = new Breadcrumb(); + $route_match = new NullRouteMatch(); + layout_builder_system_breadcrumb_alter($breadcrumb, $route_match, []); + } + +} diff --git a/web/core/modules/link/tests/src/Functional/LinkFieldTest.php b/web/core/modules/link/tests/src/Functional/LinkFieldTest.php index 22b03b0c08e5baf9a7e3817b0a24303bc03a811a..2e4044abfa934da65e1f00c9a442638b3d70fcc6 100644 --- a/web/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/web/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -105,7 +105,7 @@ public function testURLValidation() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[0][uri]", ''); - $this->assertRaw('placeholder="http://example.com"'); + $this->assertSession()->responseContains('placeholder="http://example.com"'); // Create a path alias. $this->createPathAlias('/admin', '/a/path/alias'); @@ -222,7 +222,7 @@ protected function assertValidEntries($field_name, array $valid_entries) { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.'); - $this->assertRaw('"' . $string . '"'); + $this->assertSession()->responseContains('"' . $string . '"'); } } @@ -296,14 +296,14 @@ public function testLinkTitle() { // Assert label is shown. $this->assertSession()->pageTextContains('Read more about this entity'); $this->assertSession()->fieldValueEquals("{$field_name}[0][uri]", ''); - $this->assertRaw('placeholder="http://example.com"'); + $this->assertSession()->responseContains('placeholder="http://example.com"'); if ($title_setting === DRUPAL_DISABLED) { $this->assertSession()->fieldNotExists("{$field_name}[0][title]"); $this->assertSession()->responseNotContains('placeholder="Enter the text for this link"'); } else { - $this->assertRaw('placeholder="Enter the text for this link"'); + $this->assertSession()->responseContains('placeholder="Enter the text for this link"'); $this->assertSession()->fieldValueEquals("{$field_name}[0][title]", ''); if ($title_setting === DRUPAL_OPTIONAL) { diff --git a/web/core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php b/web/core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php index 4b90208ec4e6724a8c32fc2c7191aaf005c3250a..ff5de02b91ef610928a47d767850c89253d97376 100644 --- a/web/core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php +++ b/web/core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php @@ -86,17 +86,17 @@ public function testLinkViewsTokens() { foreach ($uris as $uri => $title) { // Formatted link: {{ field_link }}<br /> - $this->assertRaw("Formatted: <a href=\"$uri\" class=\"test-link-class\">$title</a>"); + $this->assertSession()->responseContains("Formatted: <a href=\"$uri\" class=\"test-link-class\">$title</a>"); // Raw uri: {{ field_link__uri }}<br /> - $this->assertRaw("Raw uri: $uri"); + $this->assertSession()->responseContains("Raw uri: $uri"); // Raw title: {{ field_link__title }}<br /> - $this->assertRaw("Raw title: $title"); + $this->assertSession()->responseContains("Raw title: $title"); // Raw options: {{ field_link__options }}<br /> // Options is an array and should return empty after token replace. - $this->assertRaw("Raw options: ."); + $this->assertSession()->responseContains("Raw options: ."); } } diff --git a/web/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/web/core/modules/locale/tests/src/Functional/LocaleContentTest.php index e0026b825c851bf2399b2067bdd588b7c2c4e153..1f67248703c9cd7fac9c8e5d404556e398722575 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleContentTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleContentTest.php @@ -137,7 +137,7 @@ public function testContentTypeLanguageConfiguration() { // Edit the content and ensure correct language is selected. $path = 'node/' . $node->id() . '/edit'; $this->drupalGet($path); - $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>'); + $this->assertSession()->responseContains('<option value="' . $langcode . '" selected="selected">' . $name . '</option>'); // Ensure we can change the node language. $edit = [ 'langcode[0][value]' => 'en', diff --git a/web/core/modules/locale/tests/src/Functional/LocaleExportTest.php b/web/core/modules/locale/tests/src/Functional/LocaleExportTest.php index 4a6a99114684d234f66e1a5ac245bf7cdd22d933..6eadb93215de3ca2755f5f2d08a38ea119f002b4 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleExportTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleExportTest.php @@ -68,9 +68,9 @@ public function testExportTranslation() { $this->submitForm(['langcode' => 'fr'], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal'); + $this->assertSession()->pageTextContains('# French translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw('msgstr "lundi"'); + $this->assertSession()->pageTextContains('msgstr "lundi"'); // Import some more French translations which will be marked as customized. $name = $file_system->tempnam('temporary://', "po2_") . '.po'; @@ -100,9 +100,9 @@ public function testExportTranslation() { ], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal'); + $this->assertSession()->pageTextContains('# French translation of Drupal'); // Ensure the customized translations exist in the file. - $this->assertRaw('msgstr "janvier"'); + $this->assertSession()->pageTextContains('msgstr "janvier"'); // Ensure no untranslated strings exist in the file. $this->assertSession()->responseNotContains('msgid "February"'); @@ -116,11 +116,11 @@ public function testExportTranslation() { ], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal'); + $this->assertSession()->pageTextContains('# French translation of Drupal'); // Ensure no customized translations exist in the file. $this->assertSession()->responseNotContains('msgstr "janvier"'); // Ensure the untranslated strings exist in the file, and with right quotes. - $this->assertRaw($this->getUntranslatedString()); + $this->assertSession()->responseContains($this->getUntranslatedString()); } /** @@ -135,7 +135,7 @@ public function testExportTranslationTemplateFile() { $this->drupalGet('admin/config/regional/translate/export'); $this->submitForm([], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# LANGUAGE translation of PROJECT'); + $this->assertSession()->pageTextContains('# LANGUAGE translation of PROJECT'); } /** diff --git a/web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php b/web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php index 6f1110fa77936feed423d4aaf656170c16ea6338..2b1cfd8d726188d64765f700e72689ddd57031de 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php @@ -166,8 +166,8 @@ public function testLocaleTranslationJsDependencies() { $js_filename = $prefix . '_' . $js_translation_files[$prefix] . '.js'; $content = $this->getSession()->getPage()->getContent(); - $this->assertRaw('core/misc/drupal.js'); - $this->assertRaw($js_filename); + $this->assertSession()->responseContains('core/misc/drupal.js'); + $this->assertSession()->responseContains($js_filename); // Assert translations JS is included before drupal.js. $this->assertLessThan(strpos($content, 'core/misc/drupal.js'), strpos($content, $js_filename)); } diff --git a/web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php b/web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php index 160fe866b604eff809adbc4d2e1182f64e185780..d77e626ab3dd7703a65ee0c83d889c69488346cc 100644 --- a/web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php @@ -248,21 +248,21 @@ public function testPluralEditExport() { $this->drupalGet('admin/config/regional/translate/export'); $this->submitForm(['langcode' => 'fr'], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal'); + $this->assertSession()->pageTextContains('# French translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\""); + $this->assertSession()->responseContains("msgid \"Monday\"\nmsgstr \"lundi\""); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\""); + $this->assertSession()->responseContains("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\""); // Get the Croatian translations. $this->drupalGet('admin/config/regional/translate/export'); $this->submitForm(['langcode' => 'hr'], 'Export'); // Ensure we have a translation file. - $this->assertRaw('# Croatian translation of Drupal'); + $this->assertSession()->pageTextContains('# Croatian translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\""); + $this->assertSession()->responseContains("msgid \"Monday\"\nmsgstr \"Ponedjeljak\""); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\""); + $this->assertSession()->responseContains("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\""); // Check if the source appears on the translation page. $this->drupalGet('admin/config/regional/translate'); @@ -365,15 +365,15 @@ public function testPluralEditExport() { $this->drupalGet('admin/config/regional/translate/export'); $this->submitForm(['langcode' => 'fr'], 'Export'); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\""); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\""); + $this->assertSession()->responseContains("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\""); + $this->assertSession()->responseContains("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\""); // Get the Croatian translations. $this->drupalGet('admin/config/regional/translate/export'); $this->submitForm(['langcode' => 'hr'], 'Export'); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\""); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\""); + $this->assertSession()->responseContains("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\""); + $this->assertSession()->responseContains("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\""); } /** diff --git a/web/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php b/web/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php index c7c7b94909bf5bd8f778fc61ef85f03f97c156f4..d7e0ed530da2e8de01895edbc8ef8db5098b0070 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php @@ -93,7 +93,7 @@ public function testTranslatedUpdate() { $this->drupalGet($update_url . '/selection', ['external' => TRUE]); $this->updateRequirementsProblem(); $this->drupalGet($update_url . '/selection', ['external' => TRUE]); - $this->assertRaw('messages--status'); + $this->assertSession()->responseContains('messages--status'); $this->assertSession()->linkByHrefNotExists('fr/update.php/run', 'No link to run updates.'); } diff --git a/web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index 1c88b11302f69eab01281ecc0cb4476e366445ac..cdedb12cd35b163dae131f77411c16178bdc49fc 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -79,7 +79,7 @@ public function testStringTranslation() { t($name, [], ['langcode' => $langcode])->render(); // Reset locale cache. $this->container->get('string_translation')->reset(); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); + $this->assertSession()->responseContains('"edit-languages-' . $langcode . '-weight"'); // Ensure that test language was added. $this->assertSession()->pageTextContains($name); $this->drupalLogout(); @@ -132,7 +132,7 @@ public function testStringTranslation() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertRaw($translation); + $this->assertSession()->pageTextContains($translation); $search = [ 'string' => $name, @@ -155,7 +155,7 @@ public function testStringTranslation() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertRaw($translation_to_en); + $this->assertSession()->pageTextContains($translation_to_en); $this->assertNotEquals($translation, $name); $this->assertEquals($translation, t($name, [], ['langcode' => $langcode]), 't() works for non-English.'); @@ -232,7 +232,7 @@ public function testStringTranslation() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($edit, 'Save translations'); - $this->assertRaw($name); + $this->assertSession()->responseContains($name); $this->drupalLogin($translate_user); $search = [ 'string' => $name, diff --git a/web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php index 2ebba84e2ddb5b93b632cd0a41ee3448fbcf8cb4..bf19edd0961eb8cb5fe1244d24923849a18c5df8 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @@ -102,7 +102,7 @@ public function testInterface() { '@version' => '1.3-dev', '@info' => t('File not found at %local_path', ['%local_path' => 'core/modules/locale/tests/test.de.po']), ]); - $this->assertRaw($release_details->__toString()); + $this->assertSession()->responseContains($release_details->__toString()); // Override Drupal core translation status as 'no translations found'. $status = locale_translation_get_status(); diff --git a/web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php index a92a29712d6d98de4132c76163f83f42155b826f..a833b5be3d73a8abb8f2d07f8b80ee008467f24c 100644 --- a/web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php +++ b/web/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php @@ -130,7 +130,7 @@ public function testUpdateImportSourceRemote() { $this->drupalGet('admin/reports/translations/check'); // Check the status on the Available translation status page. - $this->assertRaw('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>'); + $this->assertSession()->responseContains('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>'); $this->assertSession()->pageTextContains('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test'); /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ $date_formatter = $this->container->get('date.formatter'); diff --git a/web/core/modules/locale/tests/src/Unit/LocaleLookupTest.php b/web/core/modules/locale/tests/src/Unit/LocaleLookupTest.php index c1999d19c54952a51e69160c7e7d3aa58a807a4b..de1409d523736e2c7cf18f9e9632e8e8dd6481c1 100644 --- a/web/core/modules/locale/tests/src/Unit/LocaleLookupTest.php +++ b/web/core/modules/locale/tests/src/Unit/LocaleLookupTest.php @@ -116,7 +116,7 @@ public function testResolveCacheMissWithoutFallback() { $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup') ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack]) - ->setMethods(['persist']) + ->onlyMethods(['persist']) ->getMock(); $locale_lookup->expects($this->never()) ->method('persist'); @@ -234,7 +234,7 @@ public function testResolveCacheMissWithPersist() { $this->configFactory = $this->getConfigFactoryStub(['locale.settings' => ['cache_strings' => TRUE]]); $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup') ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack]) - ->setMethods(['persist']) + ->onlyMethods(['persist']) ->getMock(); $locale_lookup->expects($this->once()) ->method('persist'); @@ -264,7 +264,7 @@ public function testResolveCacheMissNoTranslation() { $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup') ->setConstructorArgs(['en', 'irrelevant', $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack]) - ->setMethods(['persist']) + ->onlyMethods(['persist']) ->getMock(); $locale_lookup->expects($this->never()) ->method('persist'); diff --git a/web/core/modules/media/js/plugins/drupalmedia/plugin.es6.js b/web/core/modules/media/js/plugins/drupalmedia/plugin.es6.js index 7a4c22b564b249f4b9b3e28f9d5333f088980ebb..7a0c5a4213ec8cbddc728cfd6deb069942ff7544 100644 --- a/web/core/modules/media/js/plugins/drupalmedia/plugin.es6.js +++ b/web/core/modules/media/js/plugins/drupalmedia/plugin.es6.js @@ -473,7 +473,8 @@ }, dataType: 'html', headers: { - 'X-Drupal-MediaPreview-CSRF-Token': editor.config.drupalMedia_previewCsrfToken, + 'X-Drupal-MediaPreview-CSRF-Token': + editor.config.drupalMedia_previewCsrfToken, }, success: (previewHtml, textStatus, jqXhr) => { this.element.setHtml(previewHtml); diff --git a/web/core/modules/media/src/Controller/OEmbedIframeController.php b/web/core/modules/media/src/Controller/OEmbedIframeController.php index 2a6c0eb8fa51caaa51552e9e9d46f764f64e8996..a32533f5d31dc9d8a2e49b6e588e36f5c89979fb 100644 --- a/web/core/modules/media/src/Controller/OEmbedIframeController.php +++ b/web/core/modules/media/src/Controller/OEmbedIframeController.php @@ -5,6 +5,7 @@ use Drupal\Component\Utility\Crypt; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Render\HtmlResponse; use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\RendererInterface; @@ -133,7 +134,9 @@ public function render(Request $request) { // Return a response instead of a render array so that the frame content // will not have all the blocks and page elements normally rendered by // Drupal. - $response = new HtmlResponse(); + $response = new HtmlResponse('', HtmlResponse::HTTP_OK, [ + 'Content-Type' => 'text/html; charset=UTF-8', + ]); $response->addCacheableDependency(Url::createFromRequest($request)); try { @@ -167,7 +170,8 @@ public function render(Request $request) { ], '#placeholder_token' => $placeholder_token, ]; - $content = $this->renderer->executeInRenderContext(new RenderContext(), function () use ($resource, $element) { + $context = new RenderContext(); + $content = $this->renderer->executeInRenderContext($context, function () use ($resource, $element) { return $this->renderer->render($element); }); $response @@ -175,6 +179,18 @@ public function render(Request $request) { ->setAttachments($element['#attached']) ->addCacheableDependency($resource) ->addCacheableDependency(CacheableMetadata::createFromRenderArray($element)); + + // Modules and themes implementing hook_media_oembed_iframe_preprocess() + // can add additional #cache and #attachments to a render array. If this + // occurs, the render context won't be empty, and we need to ensure the + // added metadata is bubbled up to the response. + // @see \Drupal\Core\Theme\ThemeManager::render() + if (!$context->isEmpty()) { + $bubbleable_metadata = $context->pop(); + assert($bubbleable_metadata instanceof BubbleableMetadata); + $response->addCacheableDependency($bubbleable_metadata); + $response->addAttachments($bubbleable_metadata->getAttachments()); + } } catch (ResourceException $e) { // Prevent the response from being cached. diff --git a/web/core/modules/media/tests/modules/media_test_oembed/css/test.css b/web/core/modules/media/tests/modules/media_test_oembed/css/test.css new file mode 100644 index 0000000000000000000000000000000000000000..4903225ba0551d2d69f0f280d18e7888ebb74f6a --- /dev/null +++ b/web/core/modules/media/tests/modules/media_test_oembed/css/test.css @@ -0,0 +1,5 @@ +/** + * This is an empty file by design. + * @see \Drupal\Tests\media\Kernel\OEmbedIframeControllerTest::testResourcePassedToPreprocess() + * @see media_test_oembed_preprocess_media_oembed_iframe() + */ diff --git a/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.libraries.yml b/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.libraries.yml new file mode 100644 index 0000000000000000000000000000000000000000..65d7c52f8c8a32fada3bf107f6576cc04d645a54 --- /dev/null +++ b/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.libraries.yml @@ -0,0 +1,5 @@ +frame: + version: VERSION + css: + component: + css/test.css: { preprocess: false, minified: true } diff --git a/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.module b/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.module index 2e19d9faceb6335ce852e5be1715ae8d617a33c3..7ab7f12496896abc3332ed3777b0dae9091404a4 100644 --- a/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.module +++ b/web/core/modules/media/tests/modules/media_test_oembed/media_test_oembed.module @@ -14,6 +14,9 @@ function media_test_oembed_preprocess_media_oembed_iframe(array &$variables) { if ($variables['resource']->getProvider()->getName() === 'YouTube') { $variables['media'] = str_replace('?feature=oembed', '?feature=oembed&pasta=rigatoni', (string) $variables['media']); } + // @see \Drupal\Tests\media\Kernel\OEmbedIframeControllerTest + $variables['#attached']['library'][] = 'media_test_oembed/frame'; + $variables['#cache']['tags'][] = 'yo_there'; } /** diff --git a/web/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php b/web/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php index c40a11863bd65f54f915e2528e284a663ff3ebdc..b6a8fff68b2f9b768d70842af9532fa9f01d1ee6 100644 --- a/web/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php +++ b/web/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php @@ -201,7 +201,7 @@ public function testMediaOEmbedVideoSource() { // 'view media' permission. $this->drupalGet('media/oembed', ['query' => $query]); $assert_session->pageTextContains('By the power of Grayskull, Vimeo works!'); - $this->assertRaw('core/themes/stable/templates/content/media-oembed-iframe.html.twig'); + $this->assertSession()->responseContains('core/themes/stable/templates/content/media-oembed-iframe.html.twig'); $this->assertSession()->responseNotContains('core/modules/media/templates/media-oembed-iframe.html.twig'); // Test themes not inheriting from stable. @@ -210,7 +210,7 @@ public function testMediaOEmbedVideoSource() { $this->drupalGet('media/oembed', ['query' => $query]); $assert_session->pageTextContains('By the power of Grayskull, Vimeo works!'); $this->assertSession()->responseNotContains('core/themes/stable/templates/content/media-oembed-iframe.html.twig'); - $this->assertRaw('core/modules/media/templates/media-oembed-iframe.html.twig'); + $this->assertSession()->responseContains('core/modules/media/templates/media-oembed-iframe.html.twig'); // Remove the 'view media' permission to test that this restricts access. $role = Role::load(AccountInterface::ANONYMOUS_ROLE); diff --git a/web/core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php b/web/core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php index 3b702a6ef74a81de7e14042641d8175fb33162ed..1d618716a5aec809c49e4d8bd72b7bd5d7314d52 100644 --- a/web/core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php +++ b/web/core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\media\Kernel; +use Drupal\Core\Render\HtmlResponse; use Drupal\media\Controller\OEmbedIframeController; use Drupal\media\OEmbed\Provider; use Drupal\media\OEmbed\Resource; @@ -93,13 +94,18 @@ public function testResourcePassedToPreprocess() { 'url' => '', 'hash' => $hash, ]); - $content = OEmbedIframeController::create($this->container) - ->render($request) - ->getContent(); + $response = $this->container->get('html_response.attachments_processor') + ->processAttachments(OEmbedIframeController::create($this->container) + ->render($request)); + assert($response instanceof HtmlResponse); + $content = $response->getContent(); // This query parameter is added by // media_test_oembed_preprocess_media_oembed_iframe() for YouTube videos. $this->assertStringContainsString('&pasta=rigatoni', $content); + $this->assertStringContainsString('test.css', $content); + $this->assertContains('yo_there', $response->getCacheableMetadata()->getCacheTags()); + $this->assertStringContainsString('text/html', $response->headers->get('Content-Type')); } } diff --git a/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php b/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php index fd88781a4beaf0e34744236478b02b8edcf46e56..b57bc58d55c71a320ab70c17da4084fa5fa12013 100644 --- a/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php +++ b/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php @@ -86,7 +86,7 @@ public function testMenuLinkContentForm() { $option = $this->assertSession()->optionExists('edit-menu-parent', 'admin:'); $this->assertTrue($option->isSelected()); // Test that the field description is present. - $this->assertRaw('The location this menu link points to.'); + $this->assertSession()->pageTextContains('The location this menu link points to.'); $this->submitForm([ 'title[0][value]' => t('Front page'), diff --git a/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php b/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php index 0d5dbdac8a53d790e8e4229b44e6acb8d3f04823..a7ddeed92dd1bfb234d2174ea2656906b944b26d 100644 --- a/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php +++ b/web/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php @@ -100,10 +100,10 @@ public function testTranslationLinkTheme() { $this->submitForm($edit, 'Save configuration'); // Check that edit uses the admin theme. $this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit'); - $this->assertRaw('core/themes/seven/css/base/elements.css'); + $this->assertSession()->responseContains('core/themes/seven/css/base/elements.css'); // Check that translation uses admin theme as well. $this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit/translations'); - $this->assertRaw('core/themes/seven/css/base/elements.css'); + $this->assertSession()->responseContains('core/themes/seven/css/base/elements.css'); } /** diff --git a/web/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/web/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php index fd9d1328c5ea86b873f53b83d3b97fd8ca7dd012..2ded666bff89cd3ab9e338c53e098107f2c2ce64 100644 --- a/web/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/web/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -187,14 +187,14 @@ public function addCustomMenuCRUD() { // Assert the new menu. $this->drupalGet('admin/structure/menu/manage/' . $menu_name); - $this->assertRaw($label); + $this->assertSession()->pageTextContains($label); // Edit the menu. $new_label = $this->randomMachineName(16); $menu->set('label', $new_label); $menu->save(); $this->drupalGet('admin/structure/menu/manage/' . $menu_name); - $this->assertRaw($new_label); + $this->assertSession()->pageTextContains($new_label); } /** diff --git a/web/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/web/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php index 37c1c32b57d3d017c0942145123a89e54bf909f1..7ef370c820a7c27898f053229741ed04324913ce 100644 --- a/web/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/web/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -441,6 +441,7 @@ protected function ensureTables() { 'description' => 'Messages generated during a migration process', 'fields' => $fields, 'primary key' => ['msgid'], + 'indexes' => [$this::SOURCE_IDS_HASH => [$this::SOURCE_IDS_HASH]], ]; $this->getDatabase()->schema()->createTable($this->messageTableName(), $schema); } diff --git a/web/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php b/web/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php index 736361e2a765d493d25399aee5907fc6a56af17b..4f6c7940d070c81ac03b4862ccb89c4e28724f31 100644 --- a/web/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php +++ b/web/core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php @@ -176,14 +176,14 @@ public function testFieldProvidersExist() { public function testFieldProviderMissingRequiredProperty(array $definitions, $missing_property) { $discovery = $this->getMockBuilder(MigrateFieldPluginManager::class) ->disableOriginalConstructor() - ->setMethods(['getDefinitions']) + ->onlyMethods(['getDefinitions']) ->getMock(); $discovery->method('getDefinitions') ->willReturn($definitions); $plugin_manager = $this->getMockBuilder(MigrateFieldPluginManager::class) ->disableOriginalConstructor() - ->setMethods(['getDiscovery']) + ->onlyMethods(['getDiscovery']) ->getMock(); $plugin_manager->method('getDiscovery') ->willReturn($discovery); diff --git a/web/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/web/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php index c0d7295c6e5c40f4609786c1d55a94ae71dff4ab..b38e11c91e83c560581dc2e8441886981aed2bd1 100644 --- a/web/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php +++ b/web/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php @@ -483,7 +483,7 @@ protected function getMockSource() { $class = 'Drupal\migrate\Plugin\migrate\source\SourcePluginBase'; $source = $this->getMockBuilder($class) ->disableOriginalConstructor() - ->setMethods(get_class_methods($class)) + ->onlyMethods(get_class_methods($class)) ->getMockForAbstractClass(); $source->expects($this->once()) ->method('rewind') diff --git a/web/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/web/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php index f7579e658bc0142074a87da365a903baa02dc6ef..80b30895899ae1f0be9a90c278ada83de4276154 100644 --- a/web/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php +++ b/web/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php @@ -111,7 +111,7 @@ protected function getSource($configuration = [], $migrate_config = [], $status $constructor_args = [$configuration, 'd6_action', [], $this->migration]; $methods = ['getModuleHandler', 'fields', 'getIds', '__toString', 'prepareRow', 'initializeIterator']; $source_plugin = $this->getMockBuilder(SourcePluginBase::class) - ->setMethods($methods) + ->onlyMethods($methods) ->setConstructorArgs($constructor_args) ->getMock(); diff --git a/web/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php b/web/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php index 826087933c702c56dafa03d8bb2d39ddddd413ec..417342ad7dbf47784da05214c3eccac013a636ab 100644 --- a/web/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php +++ b/web/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php @@ -109,6 +109,9 @@ public function testEnsureTablesNotExist() { 'description' => 'Messages generated during a migration process', 'fields' => $fields, 'primary key' => ['msgid'], + 'indexes' => [ + 'source_ids_hash' => ['source_ids_hash'], + ], ]; $schema = $this->getMockBuilder('Drupal\Core\Database\Schema') diff --git a/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php b/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..12d2e362b3c2ddfde4b31ae76fbb0776fc175c9f --- /dev/null +++ b/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php @@ -0,0 +1,72 @@ +<?php + +namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source; + +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; +use Drupal\KernelTests\KernelTestBase; +use Drupal\migrate\Plugin\MigrationInterface; +use Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity; + +/** + * Tests the constructor of the entity content source plugin. + * + * @group migrate_drupal + */ +class ContentEntityConstructorTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'migrate', + 'migrate_drupal', + 'node', + 'system', + 'user', + ]; + + /** + * Tests the constructor. + * + * @dataProvider providerTestConstructor + */ + public function testConstructor($configuration, $plugin_definition, $exception_class, $expected) { + $migration = $this->prophesize(MigrationInterface::class)->reveal(); + $this->expectException($exception_class); + $this->expectExceptionMessage($expected); + ContentEntity::create($this->container, $configuration, 'content_entity', $plugin_definition, $migration); + } + + /** + * Provides data for constructor tests. + */ + public function providerTestConstructor() { + return [ + 'entity type missing' => [ + [], + ['entity_type' => ''], + InvalidPluginDefinitionException::class, + 'Missing required "entity_type" definition.', + ], + 'non content entity' => [ + [], + ['entity_type' => 'node_type'], + InvalidPluginDefinitionException::class, + 'The entity type (node_type) is not supported. The "content_entity" source plugin only supports content entities.', + ], + 'not bundleable' => [ + ['bundle' => 'foo'], + ['entity_type' => 'user'], + \InvalidArgumentException::class, + 'A bundle was provided but the entity type (user) is not bundleable.', + ], + 'invalid bundle' => [ + ['bundle' => 'foo'], + ['entity_type' => 'node'], + \InvalidArgumentException::class, + 'The provided bundle (foo) is not valid for the (node) entity type.', + ], + ]; + } + +} diff --git a/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php b/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php index 43a72dae91310a1a87e0cf1d8cd113c2be0111a5..34a486053512e3284bafd522a4d3d5aa439d96b1 100644 --- a/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php +++ b/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source; -use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Language\LanguageInterface; @@ -11,8 +10,6 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\media\Entity\Media; use Drupal\migrate\Plugin\MigrateSourceInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\taxonomy\Entity\Term; @@ -130,6 +127,7 @@ protected function setUp(): void { ['target_bundles' => [$this->vocabulary]], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); + // Create a term reference field on user. $this->createEntityReferenceField( 'user', @@ -142,7 +140,8 @@ protected function setUp(): void { FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); - // Create some data. + // Create a node, with data in a term reference field, and then add a French + // translation of the node. $this->user = User::create([ 'name' => 'user123', 'uid' => 1, @@ -150,11 +149,12 @@ protected function setUp(): void { ]); $this->user->save(); - $this->anon = User::create([ + // Add the anonymous user so we can test later that it is not provided in a + // source row. + User::create([ 'name' => 'anon', 'uid' => 0, - ]); - $this->anon->save(); + ])->save(); $term = Term::create([ 'vid' => $this->vocabulary, @@ -179,66 +179,6 @@ protected function setUp(): void { $this->migrationPluginManager = $this->container->get('plugin.manager.migration'); } - /** - * Tests the constructor for missing entity_type. - */ - public function testConstructorEntityTypeMissing() { - $migration = $this->prophesize(MigrationInterface::class)->reveal(); - $configuration = []; - $plugin_definition = [ - 'entity_type' => '', - ]; - $this->expectException(InvalidPluginDefinitionException::class); - $this->expectExceptionMessage('Missing required "entity_type" definition.'); - ContentEntity::create($this->container, $configuration, 'content_entity', $plugin_definition, $migration); - } - - /** - * Tests the constructor for non content entity. - */ - public function testConstructorNonContentEntity() { - $migration = $this->prophesize(MigrationInterface::class)->reveal(); - $configuration = []; - $plugin_definition = [ - 'entity_type' => 'node_type', - ]; - $this->expectException(InvalidPluginDefinitionException::class); - $this->expectExceptionMessage('The entity type (node_type) is not supported. The "content_entity" source plugin only supports content entities.'); - ContentEntity::create($this->container, $configuration, 'content_entity:node_type', $plugin_definition, $migration); - } - - /** - * Tests the constructor for not bundleable entity. - */ - public function testConstructorNotBundable() { - $migration = $this->prophesize(MigrationInterface::class)->reveal(); - $configuration = [ - 'bundle' => 'foo', - ]; - $plugin_definition = [ - 'entity_type' => 'user', - ]; - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('A bundle was provided but the entity type (user) is not bundleable'); - ContentEntity::create($this->container, $configuration, 'content_entity:user', $plugin_definition, $migration); - } - - /** - * Tests the constructor for invalid entity bundle. - */ - public function testConstructorInvalidBundle() { - $migration = $this->prophesize(MigrationInterface::class)->reveal(); - $configuration = [ - 'bundle' => 'foo', - ]; - $plugin_definition = [ - 'entity_type' => 'node', - ]; - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('The provided bundle (foo) is not valid for the (node) entity type.'); - ContentEntity::create($this->container, $configuration, 'content_entity:node', $plugin_definition, $migration); - } - /** * Helper to assert IDs structure. * @@ -279,7 +219,9 @@ public function testUserSource(array $configuration) { $user_source = $migration->getSourcePlugin(); $this->assertSame('users', $user_source->__toString()); if (!$configuration['include_translations']) { - // Confirm that the query does not return a row for the anonymous user. + // Confirm that the anonymous user is in the source database but not + // included in the rows returned by the content_entity. + $this->assertNotNull(User::load(0)); $this->assertEquals(1, $user_source->count()); } $this->assertIds($user_source, $configuration); diff --git a/web/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php b/web/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php index dc617655018bed71ed134fc18977a9ed36d1dc6a..08c567448c9fca452dbe6445494ca26a67ae8071 100644 --- a/web/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php @@ -118,7 +118,7 @@ public function testNodeAccessAdministerField() { // Confirm that the new default value appears when creating a new node. $this->drupalGet('node/add/page'); - $this->assertRaw($default); + $this->assertSession()->responseContains($default); } } diff --git a/web/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/web/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php index be68b22395c09506df7ff03dd56e11f65e0ca20e..c47c35dda157fa5cb9f869e97f82d7d408051f9a 100644 --- a/web/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php @@ -70,7 +70,7 @@ public function testCommentPager() { $this->drupalGet('node/' . $node->id()); $this->assertSession()->pageTextContains($node->label()); $this->assertSession()->pageTextContains('Comments'); - $this->assertRaw('page=1'); + $this->assertSession()->responseContains('page=1'); $this->assertSession()->responseNotContains('page=2'); } @@ -102,7 +102,7 @@ public function testForumPager() { // page there should be two pages for 30 nodes, no more. $this->drupalLogin($this->webUser); $this->drupalGet('forum/' . $tid); - $this->assertRaw('page=1'); + $this->assertSession()->responseContains('page=1'); $this->assertSession()->responseNotContains('page=2'); } diff --git a/web/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/web/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 1abadcb6fa28ec5ad03bfff859d339a969b08795..73311dbe78cf5969cea7cffcc4539e6eec7489b3 100644 --- a/web/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -86,7 +86,7 @@ public function testNodeEdit() { // Check that the title and body fields are displayed with the correct values. // @todo Ideally assertLink would support HTML, but it doesn't. - $this->assertRaw('Edit<span class="visually-hidden">(active tab)</span>'); + $this->assertSession()->responseContains('Edit<span class="visually-hidden">(active tab)</span>'); $this->assertSession()->fieldValueEquals($title_key, $edit[$title_key]); $this->assertSession()->fieldValueEquals($body_key, $edit[$body_key]); @@ -141,7 +141,7 @@ public function testNodeEdit() { $open_details_elements = count($this->cssSelect('details[open="open"]')); $this->submitForm($edit, 'Save'); // The node author details must be open. - $this->assertRaw('<details class="node-form-author js-form-wrapper form-wrapper" data-drupal-selector="edit-author" id="edit-author" open="open">'); + $this->assertSession()->responseContains('<details class="node-form-author js-form-wrapper form-wrapper" data-drupal-selector="edit-author" id="edit-author" open="open">'); // Only one extra details element should now be open. $open_details_elements++; $this->assertCount($open_details_elements, $this->cssSelect('details[open="open"]'), 'Exactly one extra open <details> element found.'); diff --git a/web/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php b/web/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php index fd917dc6b9a369a17c63b219e4281a4e013c0c6a..4939108c87c07603b76dfd1824b211f08e174cca 100644 --- a/web/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php @@ -109,12 +109,12 @@ public function testMultilingualNodeForm() { $this->drupalGet("it/node/{$node->id()}"); // Verify that body is correctly displayed using Italian as requested // language. - $this->assertRaw($body_value); + $this->assertSession()->pageTextContains($body_value); $this->drupalGet("node/{$node->id()}"); // Verify that body is correctly displayed using English as requested // language. - $this->assertRaw($body_value); + $this->assertSession()->pageTextContains($body_value); } /** diff --git a/web/core/modules/node/tests/src/Functional/NodeRSSContentTest.php b/web/core/modules/node/tests/src/Functional/NodeRSSContentTest.php index 1bc6e20c83b6a9350cd1ce9bee1535616f7ce615..184b43e6548f3e1a08a85e62d3355e8f74020731 100644 --- a/web/core/modules/node/tests/src/Functional/NodeRSSContentTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeRSSContentTest.php @@ -62,8 +62,8 @@ public function testNodeRSSContent() { // Check that extra RSS elements and namespaces are added to RSS feed. $test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>'; $test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"'; - $this->assertRaw($test_element); - $this->assertRaw($test_ns); + $this->assertSession()->responseContains($test_element); + $this->assertSession()->responseContains($test_ns); // Check that content added in 'rss' view mode doesn't appear when // viewing node. @@ -112,9 +112,9 @@ public function testUrlHandling() { // Verify that root-relative URL is transformed to absolute. $this->assertRaw(file_create_url('public://root-relative')); // Verify that protocol-relative URL is left untouched. - $this->assertRaw($protocol_relative_url); + $this->assertSession()->responseContains($protocol_relative_url); // Verify that absolute URL is left untouched. - $this->assertRaw($absolute_url); + $this->assertSession()->responseContains($absolute_url); } } diff --git a/web/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php b/web/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php index 5a79087328cba5414bae4ec54bfb469c75c8ccde..151bff2e03369dc0a7b844d8d04757bbae9ef98f 100644 --- a/web/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @@ -208,7 +208,7 @@ public function testRevisions() { $this->drupalGet('node/' . $node->id() . '/revisions'); // Check that the pager exists. - $this->assertRaw('page=1'); + $this->assertSession()->responseContains('page=1'); // Check that the last revision is displayed on the first page. $this->assertSession()->pageTextContains(end($logs)); diff --git a/web/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php b/web/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php index fb5961beda807fe72fbba4d89bdb48c1f92fbe75..833cef792df1c07ac291367a780725b6c3dcf17c 100644 --- a/web/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php @@ -122,11 +122,11 @@ public function testNodeRevisionDoubleEscapeFix() { // Assert the old revision message. $date = $this->container->get('date.formatter')->format($nodes[0]->revision_timestamp->value, 'short'); $url = new Url('entity.node.revision', ['node' => $nodes[0]->id(), 'node_revision' => $nodes[0]->getRevisionId()]); - $this->assertRaw(Link::fromTextAndUrl($date, $url)->toString() . ' by ' . $editor); + $this->assertSession()->responseContains(Link::fromTextAndUrl($date, $url)->toString() . ' by ' . $editor); // Assert the current revision message. $date = $this->container->get('date.formatter')->format($nodes[1]->revision_timestamp->value, 'short'); - $this->assertRaw($nodes[1]->toLink($date)->toString() . ' by ' . $editor . '<p class="revision-log">' . $revision_log . '</p>'); + $this->assertSession()->responseContains($nodes[1]->toLink($date)->toString() . ' by ' . $editor . '<p class="revision-log">' . $revision_log . '</p>'); } /** diff --git a/web/core/modules/node/tests/src/Functional/NodeTitleTest.php b/web/core/modules/node/tests/src/Functional/NodeTitleTest.php index ea3878aec96e1fd356a1e3b200a858d7845028cb..6ac592f63361a00d44c1333c07759aad84e0b59c 100644 --- a/web/core/modules/node/tests/src/Functional/NodeTitleTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeTitleTest.php @@ -103,11 +103,11 @@ public function testNodeTitle() { // the page. $edge_case_title_escaped = Html::escape($edge_case_title); $this->drupalGet('node/' . $node->id()); - $this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); + $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); // Test that the title appears as <title> when reloading the node page. $this->drupalGet('node/' . $node->id()); - $this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); + $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); } diff --git a/web/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php b/web/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php index 10cbb14c5ef02c59c720cb4d9116613b75e56388..dcbac6a1ef0a7cb64140b3b807e528dc29dfdc73 100644 --- a/web/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php +++ b/web/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php @@ -43,7 +43,7 @@ public function testNodeTitleXSS() { $this->drupalGet('node/' . $node->id()); // Titles should be escaped. - $this->assertRaw('<title>' . Html::escape($title) . ' | Drupal</title>'); + $this->assertSession()->responseContains('<title>' . Html::escape($title) . ' | Drupal</title>'); $this->assertSession()->responseNotContains($xss); $this->drupalGet('node/' . $node->id() . '/edit'); diff --git a/web/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/web/core/modules/node/tests/src/Functional/NodeTranslationUITest.php index e909f5db69ecce23698c2d725779c269dbdccbf9..624c70906c83139049af2c76197aaa9aefbd9866 100644 --- a/web/core/modules/node/tests/src/Functional/NodeTranslationUITest.php +++ b/web/core/modules/node/tests/src/Functional/NodeTranslationUITest.php @@ -261,7 +261,7 @@ public function testTranslationLinkTheme() { $this->submitForm($edit, 'Save configuration'); $this->drupalGet('node/' . $article->id() . '/translations'); // Verify that translation uses the admin theme if edit is admin. - $this->assertRaw('core/themes/seven/css/base/elements.css'); + $this->assertSession()->responseContains('core/themes/seven/css/base/elements.css'); // Turn off admin theme for editing, assert inheritance to translations. $edit['use_admin_theme'] = FALSE; diff --git a/web/core/modules/node/tests/src/Functional/PagePreviewTest.php b/web/core/modules/node/tests/src/Functional/PagePreviewTest.php index a9f22eed41e77432fa1514fd7430816f8d551acb..4eca2c42b381b8ae096df23e67f5069a03b91d80 100644 --- a/web/core/modules/node/tests/src/Functional/PagePreviewTest.php +++ b/web/core/modules/node/tests/src/Functional/PagePreviewTest.php @@ -230,7 +230,7 @@ public function testPagePreview() { $view_mode_edit = ['view_mode' => 'teaser']; $this->drupalGet('node/preview/' . $uuid . '/full'); $this->submitForm($view_mode_edit, 'Switch'); - $this->assertRaw('view-mode-teaser'); + $this->assertSession()->responseContains('view-mode-teaser'); $this->assertSession()->pageTextNotContains($edit[$body_key]); // Check that the title, body and term fields are displayed with the @@ -280,8 +280,8 @@ public function testPagePreview() { $edit[$term_key] = $this->term->getName() . ', ' . $newterm1 . ', ' . $newterm2; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Preview'); - $this->assertRaw('>' . $newterm1 . '<'); - $this->assertRaw('>' . $newterm2 . '<'); + $this->assertSession()->responseContains('>' . $newterm1 . '<'); + $this->assertSession()->responseContains('>' . $newterm2 . '<'); // The first term should be displayed as link, the others not. $this->assertSession()->linkExists($this->term->getName()); $this->assertSession()->linkNotExists($newterm1); @@ -297,9 +297,9 @@ public function testPagePreview() { $edit[$term_key] = $newterm1 . ', ' . $newterm3 . ', ' . $newterm2; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Preview'); - $this->assertRaw('>' . $newterm1 . '<'); - $this->assertRaw('>' . $newterm2 . '<'); - $this->assertRaw('>' . $newterm3 . '<'); + $this->assertSession()->responseContains('>' . $newterm1 . '<'); + $this->assertSession()->responseContains('>' . $newterm2 . '<'); + $this->assertSession()->responseContains('>' . $newterm3 . '<'); $this->assertSession()->pageTextNotContains($this->term->getName()); $this->assertSession()->linkExists($newterm1); $this->assertSession()->linkExists($newterm2); @@ -330,7 +330,7 @@ public function testPagePreview() { $this->drupalGet('node/add/page'); $this->submitForm([$title_key => 'Preview'], 'Preview'); $this->clickLink('Back to content editing'); - $this->assertRaw('edit-submit'); + $this->assertSession()->responseContains('edit-submit'); // Check that destination is remembered when clicking on preview. When going // back to the edit form and clicking save, we should go back to the @@ -383,10 +383,10 @@ public function testPagePreview() { 'title[0][value]' => $title, 'field_test_multi[0][value]' => $example_text_1, ]; - $this->assertRaw('Storage is not set'); + $this->assertSession()->pageTextContains('Storage is not set'); $this->submitForm($edit, 'Preview'); $this->clickLink('Back to content editing'); - $this->assertRaw('Storage is set'); + $this->assertSession()->pageTextContains('Storage is set'); $this->assertSession()->fieldExists('field_test_multi[0][value]'); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains('Basic page ' . $title . ' has been created.'); diff --git a/web/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php b/web/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php index aff2832b5fe50e16137360043f6377b658072a51..d3abb517febfe54e172ae86fbf119973168f8316 100644 --- a/web/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php +++ b/web/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\node\Functional\Views; -use Drupal\Component\Render\FormattableMarkup; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; @@ -94,11 +93,7 @@ public function testNodeEditAccess() { ]; $this->drupalGet('test-node-bulk-form'); $this->submitForm($edit, 'Apply to selected items'); - $this->assertRaw(new FormattableMarkup('No access to execute %action on the @entity_type_label %entity_label.', [ - '%action' => 'Unpublish content', - '@entity_type_label' => 'Content', - '%entity_label' => $node->label(), - ])); + $this->assertSession()->pageTextContains("No access to execute Unpublish content on the Content {$node->label()}."); // Re-load the node and check the status. $node = Node::load($node->id()); @@ -139,11 +134,7 @@ public function testNodeEditAccess() { $this->drupalGet('test-node-bulk-form'); $this->submitForm($edit, 'Apply to selected items'); // Test that the action message isn't shown. - $this->assertRaw(new FormattableMarkup('No access to execute %action on the @entity_type_label %entity_label.', [ - '%action' => 'Delete content', - '@entity_type_label' => 'Content', - '%entity_label' => $node->label(), - ])); + $this->assertSession()->pageTextContains("No access to execute Delete content on the Content {$node->label()}."); $this->assertNotEmpty($this->cssSelect('#views-form-test-node-bulk-form-page-1')); } diff --git a/web/core/modules/node/tests/src/Functional/Views/NodeFieldTokensTest.php b/web/core/modules/node/tests/src/Functional/Views/NodeFieldTokensTest.php index 2da46e73114aa1424eb4ae3a9ac97c9a5963cc95..4f69fd374c6d7505c6f4403823eff9a78086c66b 100644 --- a/web/core/modules/node/tests/src/Functional/Views/NodeFieldTokensTest.php +++ b/web/core/modules/node/tests/src/Functional/Views/NodeFieldTokensTest.php @@ -53,16 +53,16 @@ public function testViewsTokenReplacement() { $this->drupalGet('test_node_tokens'); // Body: {{ body }}<br /> - $this->assertRaw("Body: <p>$body</p>"); + $this->assertSession()->responseContains("Body: <p>$body</p>"); // Raw value: {{ body__value }}<br /> - $this->assertRaw("Raw value: $body"); + $this->assertSession()->responseContains("Raw value: $body"); // Raw summary: {{ body__summary }}<br /> - $this->assertRaw("Raw summary: $summary"); + $this->assertSession()->responseContains("Raw summary: $summary"); // Raw format: {{ body__format }}<br /> - $this->assertRaw("Raw format: plain_text"); + $this->assertSession()->responseContains("Raw format: plain_text"); } } diff --git a/web/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php b/web/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php index 8aa4df106c5ef5f5279cbbca520a417ff1c88103..486c0b21c96a90e86aaddb32af7ccf3aa3c31822 100644 --- a/web/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php +++ b/web/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php @@ -148,8 +148,8 @@ public function testRadioButtons() { $this->assertSession()->checkboxNotChecked('edit-card-1-0'); $this->assertSession()->checkboxNotChecked('edit-card-1-1'); $this->assertSession()->checkboxNotChecked('edit-card-1-2'); - $this->assertRaw('Some dangerous & unescaped <strong>markup</strong>'); - $this->assertRaw('Some HTML encoded markup with < & >'); + $this->assertSession()->responseContains('Some dangerous & unescaped <strong>markup</strong>'); + $this->assertSession()->responseContains('Some HTML encoded markup with < & >'); // Select first option. $edit = ['card_1' => 0]; @@ -206,7 +206,7 @@ public function testCheckBoxes() { $this->assertSession()->checkboxNotChecked('edit-card-2-0'); $this->assertSession()->checkboxNotChecked('edit-card-2-1'); $this->assertSession()->checkboxNotChecked('edit-card-2-2'); - $this->assertRaw('Some dangerous & unescaped <strong>markup</strong>'); + $this->assertSession()->responseContains('Some dangerous & unescaped <strong>markup</strong>'); // Submit form: select first and third options. $edit = [ @@ -303,7 +303,7 @@ public function testSelectListSingle() { $this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup'); + $this->assertSession()->responseContains('Some dangerous & unescaped markup'); // Submit form: select invalid 'none' option. $edit = ['card_1' => '_none']; @@ -349,9 +349,9 @@ public function testSelectListSingle() { $this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup'); - $this->assertRaw('More <script>dangerous</script> markup'); - $this->assertRaw('Group 1'); + $this->assertSession()->responseContains('Some dangerous & unescaped markup'); + $this->assertSession()->responseContains('More <script>dangerous</script> markup'); + $this->assertSession()->responseContains('Group 1'); // Submit form: select first option. $edit = ['card_1' => 0]; @@ -402,7 +402,7 @@ public function testSelectListMultiple() { $this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup'); + $this->assertSession()->responseContains('Some dangerous & unescaped markup'); // Submit form: select first and third options. $edit = ['card_2[]' => [0 => 0, 2 => 2]]; @@ -474,9 +474,9 @@ public function testSelectListMultiple() { $this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup'); - $this->assertRaw('More <script>dangerous</script> markup'); - $this->assertRaw('Group 1'); + $this->assertSession()->responseContains('Some dangerous & unescaped markup'); + $this->assertSession()->responseContains('More <script>dangerous</script> markup'); + $this->assertSession()->responseContains('Group 1'); // Submit form: select first option. $edit = ['card_2[]' => [0 => 0]]; diff --git a/web/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/web/core/modules/page_cache/tests/src/Functional/PageCacheTest.php index ab661775eb177eec3f3cf7db1cda8e60049ca18a..731ba040458916a004e20abfc7b12b0b5b2c387c 100644 --- a/web/core/modules/page_cache/tests/src/Functional/PageCacheTest.php +++ b/web/core/modules/page_cache/tests/src/Functional/PageCacheTest.php @@ -137,7 +137,7 @@ public function testQueryParameterFormatRequests() { // Verify that HTML page was cached. $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); // Verify that the correct HTML response was returned. - $this->assertRaw('<p>oh hai this is html.</p>'); + $this->assertSession()->responseContains('<p>oh hai this is html.</p>'); $this->drupalGet($accept_header_cache_url_with_json); // Verify that JSON response was not yet cached. @@ -146,7 +146,7 @@ public function testQueryParameterFormatRequests() { // Verify that JSON response was cached. $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); // Verify that the correct JSON response was returned. - $this->assertRaw('{"content":"oh hai this is json"}'); + $this->assertSession()->responseContains('{"content":"oh hai this is json"}'); // Enable REST support for nodes and hal+json. \Drupal::service('module_installer')->install(['node', 'rest', 'hal', 'basic_auth']); diff --git a/web/core/modules/quickedit/tests/src/Functional/EditorIntegrationLoadingTest.php b/web/core/modules/quickedit/tests/src/Functional/EditorIntegrationLoadingTest.php index 38ba7cd1d8a137ad708909c3f3fd66b5c281275a..bce74ceec80d74c33ea62462565bb40dafcb794e 100644 --- a/web/core/modules/quickedit/tests/src/Functional/EditorIntegrationLoadingTest.php +++ b/web/core/modules/quickedit/tests/src/Functional/EditorIntegrationLoadingTest.php @@ -87,7 +87,7 @@ public function testUsersWithoutPermission() { $this->drupalGet('node/1'); // Ensure the text is transformed. - $this->assertRaw('<p>Do you also love Drupal?</p><figure role="group" class="caption caption-img"><img src="druplicon.png" /><figcaption>Druplicon</figcaption></figure>'); + $this->assertSession()->responseContains('<p>Do you also love Drupal?</p><figure role="group" class="caption caption-img"><img src="druplicon.png" /><figcaption>Druplicon</figcaption></figure>'); $client = $this->getHttpClient(); @@ -125,7 +125,7 @@ public function testUserWithPermission() { $this->drupalGet('node/1'); // Ensure the text is transformed. - $this->assertRaw('<p>Do you also love Drupal?</p><figure role="group" class="caption caption-img"><img src="druplicon.png" /><figcaption>Druplicon</figcaption></figure>'); + $this->assertSession()->responseContains('<p>Do you also love Drupal?</p><figure role="group" class="caption caption-img"><img src="druplicon.png" /><figcaption>Druplicon</figcaption></figure>'); $client = $this->getHttpClient(); $response = $client->post($this->buildUrl('editor/node/1/body/en/full'), [ 'query' => http_build_query([MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']), diff --git a/web/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php b/web/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php index 3f49891713676f38404c0182b7f0ae15861ab8be..94d4e20fa8dc0f836338725e68e8eb4739325f22 100644 --- a/web/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php +++ b/web/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php @@ -128,6 +128,8 @@ public function testQuickEditIgnoresDuplicateFields() { * * @param bool $use_revisions * If revisions are used. + * @param bool $admin_permission + * Whether to assign admin permissions to the user created for testing. * * @dataProvider providerEnableDisableLayoutBuilder */ diff --git a/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php index 64131a273aed74297b9e0085033e449ea0905199..86e95b75e67da2c138ac6c340eabe4173302a295 100644 --- a/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php +++ b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php @@ -195,8 +195,8 @@ public function testWithPendingRevision() { $this->assertSession()->responseNotContains('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); $this->drupalGet('node/' . $this->testNode->id()); - $this->assertRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); - $this->assertRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); + $this->assertSession()->responseContains('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); + $this->assertSession()->responseContains('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); // Wait for the page to completely load before making any changes to the // node. This allows Quick Edit to fetch the metadata without causing @@ -335,7 +335,7 @@ public function testContentBlock() { // Check that the data- attribute is present. $this->drupalLogin($this->editorUser); $this->drupalGet(''); - $this->assertRaw('data-quickedit-entity-id="block_content/1"'); + $this->assertSession()->responseContains('data-quickedit-entity-id="block_content/1"'); } /** diff --git a/web/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php b/web/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php index 2aa5c15b0a2be70c1bfc5d1686f8b045e5a33b0f..1754fa0016ae414f8b19e085e126289978b71392 100644 --- a/web/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php +++ b/web/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php @@ -204,7 +204,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = '#alt' => $alt, ]; $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); // Test field not being configured. This should not cause a fatal error. $display_options = [ @@ -290,32 +290,32 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = // Output should contain all image styles and all breakpoints. $this->drupalGet('node/' . $nid); if (!$empty_styles) { - $this->assertRaw('/styles/medium/'); + $this->assertSession()->responseContains('/styles/medium/'); // Assert the empty image is present. - $this->assertRaw('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + $this->assertSession()->responseContains('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); $thumbnail_style = ImageStyle::load('thumbnail'); // Assert the output of the 'srcset' attribute (small multipliers first). - $this->assertRaw('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== 1x, ' . file_url_transform_relative($thumbnail_style->buildUrl($image_uri)) . ' 1.5x'); - $this->assertRaw('/styles/medium/'); + $this->assertSession()->responseContains('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== 1x, ' . file_url_transform_relative($thumbnail_style->buildUrl($image_uri)) . ' 1.5x'); + $this->assertSession()->responseContains('/styles/medium/'); // Assert the output of the original image. $this->assertRaw(file_url_transform_relative(file_create_url($image_uri)) . ' 3x'); // Assert the output of the breakpoints. - $this->assertRaw('media="(min-width: 0px)"'); - $this->assertRaw('media="(min-width: 560px)"'); + $this->assertSession()->responseContains('media="(min-width: 0px)"'); + $this->assertSession()->responseContains('media="(min-width: 560px)"'); // Assert the output of the 'sizes' attribute. - $this->assertRaw('sizes="(min-width: 700px) 700px, 100vw"'); + $this->assertSession()->responseContains('sizes="(min-width: 700px) 700px, 100vw"'); $this->assertSession()->responseMatches('/media="\(min-width: 560px\)".+?sizes="\(min-width: 700px\) 700px, 100vw"/'); // Assert the output of the 'srcset' attribute (small images first). $medium_style = ImageStyle::load('medium'); - $this->assertRaw(file_url_transform_relative($medium_style->buildUrl($image_uri)) . ' 220w, ' . file_url_transform_relative($large_style->buildUrl($image_uri)) . ' 360w'); - $this->assertRaw('media="(min-width: 851px)"'); + $this->assertSession()->responseContains(file_url_transform_relative($medium_style->buildUrl($image_uri)) . ' 220w, ' . file_url_transform_relative($large_style->buildUrl($image_uri)) . ' 360w'); + $this->assertSession()->responseContains('media="(min-width: 851px)"'); } - $this->assertRaw('/styles/large/'); + $this->assertSession()->responseContains('/styles/large/'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:responsive_image.styles.style_one'); if (!$empty_styles) { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:image.style.medium'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:image.style.thumbnail'); - $this->assertRaw('type="image/png"'); + $this->assertSession()->responseContains('type="image/png"'); } $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:image.style.large'); @@ -330,7 +330,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = // responsive-image.html.twig doesn't have one after the fallback image, so // we remove it here. $default_output = trim($renderer->renderRoot($fallback_image)); - $this->assertRaw($default_output); + $this->assertSession()->responseContains($default_output); if ($scheme == 'private') { // Log out and ensure the file cannot be accessed. diff --git a/web/core/modules/rest/tests/src/Unit/CollectRoutesTest.php b/web/core/modules/rest/tests/src/Unit/CollectRoutesTest.php index 4ede3332a430b40d0194e00713b1a7537bfe5834..faf3fda7316b1fd5799d49ee2af5417b513e9ee6 100644 --- a/web/core/modules/rest/tests/src/Unit/CollectRoutesTest.php +++ b/web/core/modules/rest/tests/src/Unit/CollectRoutesTest.php @@ -40,12 +40,12 @@ protected function setUp(): void { ->getMock(); $this->view = $this->getMockBuilder('\Drupal\views\Entity\View') - ->setMethods(['initHandlers']) + ->addMethods(['initHandlers']) ->setConstructorArgs([['id' => 'test_view'], 'view']) ->getMock(); $view_executable = $this->getMockBuilder('\Drupal\views\ViewExecutable') - ->setMethods(['initHandlers', 'getTitle']) + ->onlyMethods(['initHandlers', 'getTitle']) ->disableOriginalConstructor() ->getMock(); $view_executable->expects($this->any()) @@ -116,7 +116,7 @@ protected function setUp(): void { ->will($this->returnValue($none)); $style_plugin = $this->getMockBuilder('\Drupal\rest\Plugin\views\style\Serializer') - ->setMethods(['getFormats', 'init']) + ->onlyMethods(['getFormats', 'init']) ->disableOriginalConstructor() ->getMock(); diff --git a/web/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php b/web/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php index 972b00c39e07a8bb41202a832d6f3deee886b96e..17d512e41b684e4cc981e9b26e28aec43a7acda7 100644 --- a/web/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php +++ b/web/core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php @@ -51,7 +51,7 @@ public function testFailedValidate() { $violations = $this->getMockBuilder(EntityConstraintViolationList::class) ->setConstructorArgs([$entity->reveal(), [$violation1->reveal(), $violation2->reveal()]]) - ->setMethods(['filterByFieldAccess']) + ->onlyMethods(['filterByFieldAccess']) ->getMock(); $violations->expects($this->once()) diff --git a/web/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php b/web/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php index 2cd49c8a91091fe9087412030d12b0c682b04d9e..10f35c8ccd8661cf9b8bc1d46f12fc88ca31bfa7 100644 --- a/web/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php +++ b/web/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php @@ -96,7 +96,7 @@ public function testSearchUsingAdminTheme() { */ protected function assertAdminTheme($is_admin) { if ($is_admin) { - $this->assertRaw('core/themes/' . $this->adminTheme); + $this->assertSession()->responseContains('core/themes/' . $this->adminTheme); } else { $this->assertSession()->responseNotContains('core/themes/' . $this->adminTheme); diff --git a/web/core/modules/search/tests/src/Functional/SearchCommentTest.php b/web/core/modules/search/tests/src/Functional/SearchCommentTest.php index 974d494ee21c124b682bf410e160142a29e713ae..2c349779a59de31dd91a8a77d9e9235ee268909d 100644 --- a/web/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/web/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -189,7 +189,7 @@ public function testSearchResultsComment() { $this->submitForm($edit, 'Search'); // Verify the evil comment subject is escaped in search results. - $this->assertRaw('<script>alert('<strong>subjectkeyword</strong>');'); + $this->assertSession()->responseContains('<script>alert('<strong>subjectkeyword</strong>');'); $this->assertSession()->responseNotContains('<script>'); // Search for the keyword near the evil script tag in the comment body. @@ -201,7 +201,7 @@ public function testSearchResultsComment() { // Verify that nearby script tag in the evil comment body is stripped from // search results. - $this->assertRaw('<strong>nearbykeyword</strong>'); + $this->assertSession()->responseContains('<strong>nearbykeyword</strong>'); $this->assertSession()->responseNotContains('<script>'); // Search for contents inside the evil script tag in the comment body. diff --git a/web/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php b/web/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php index dbc42e2d3e3a53c9a4ce9796701f02df52c46ba6..ac6f7452297293a06ec6d7b424002c32ddb216e0 100644 --- a/web/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php +++ b/web/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php @@ -70,7 +70,7 @@ public function testSearchKeywordsConditions() { $keys = 'moving drop ' . $this->randomMachineName(); $this->drupalGet("search/dummy_path", ['query' => ['keys' => 'bike', 'search_conditions' => $keys]]); $this->assertSession()->pageTextContains("Dummy search snippet to display."); - $this->assertRaw(Html::escape(print_r(['keys' => 'bike', 'search_conditions' => $keys], TRUE))); + $this->assertSession()->responseContains(Html::escape(print_r(['keys' => 'bike', 'search_conditions' => $keys], TRUE))); } } diff --git a/web/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php b/web/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php index 87157b4736dd5b4a552619caccf290a97cbc9a11..09d9db2c7eb8624c503a2a335cf86d7b527052c0 100644 --- a/web/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php +++ b/web/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php @@ -63,31 +63,31 @@ public function testPhraseSearchPunctuation() { $edit = ['keys' => 'meklet']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>meklēt</strong>'); + $this->assertSession()->responseContains('<strong>meklēt</strong>'); $edit = ['keys' => 'meklēt']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>meklēt</strong>'); + $this->assertSession()->responseContains('<strong>meklēt</strong>'); $edit = ['keys' => 'cómmīŦŧęđ BɆĬŇĜ påŔťıçȉpǎǹţș']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>cómmīŦŧęđ</strong>'); - $this->assertRaw('<strong>BɆĬŇĜ</strong>'); - $this->assertRaw('<strong>påŔťıçȉpǎǹţș</strong>'); + $this->assertSession()->responseContains('<strong>cómmīŦŧęđ</strong>'); + $this->assertSession()->responseContains('<strong>BɆĬŇĜ</strong>'); + $this->assertSession()->responseContains('<strong>påŔťıçȉpǎǹţș</strong>'); $edit = ['keys' => 'committed being participants']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>cómmīŦŧęđ</strong>'); - $this->assertRaw('<strong>BɆĬŇĜ</strong>'); - $this->assertRaw('<strong>påŔťıçȉpǎǹţș</strong>'); + $this->assertSession()->responseContains('<strong>cómmīŦŧęđ</strong>'); + $this->assertSession()->responseContains('<strong>BɆĬŇĜ</strong>'); + $this->assertSession()->responseContains('<strong>påŔťıçȉpǎǹţș</strong>'); $edit = ['keys' => 'Enricþment']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>Enricþment</strong>'); + $this->assertSession()->responseContains('<strong>Enricþment</strong>'); $edit = ['keys' => 'Enritchment']; $this->drupalGet('search/node'); @@ -97,7 +97,7 @@ public function testPhraseSearchPunctuation() { $edit = ['keys' => 'æll']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertRaw('<strong>æll</strong>'); + $this->assertSession()->responseContains('<strong>æll</strong>'); $edit = ['keys' => 'all']; $this->drupalGet('search/node'); diff --git a/web/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php b/web/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php index b6404180ecbcca58b8272060d158dfb537e688c8..5f20476b74aadb9c9d785032195314e1dc60582b 100644 --- a/web/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php +++ b/web/core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php @@ -43,7 +43,7 @@ protected function setUp(): void { $this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() - ->setMethods(['normalize']) + ->onlyMethods(['normalize']) ->getMock(); $this->contentEntityNormalizer->setSerializer($this->serializer); } @@ -128,7 +128,7 @@ public function testNormalizeWithAccountContext() { public function createMockForContentEntity($definitions) { $content_entity_mock = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') ->disableOriginalConstructor() - ->setMethods(['getTypedData']) + ->onlyMethods(['getTypedData']) ->getMockForAbstractClass(); $typed_data = $this->prophesize(ComplexDataInterface::class); $typed_data->getProperties(TRUE) diff --git a/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php b/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php index fbe0c2edd38ac2f37be9b45c7b8592821971d595..06d280a9bd760bbaf9d5be6fff739ea9e49f5167 100644 --- a/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php +++ b/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php @@ -83,7 +83,7 @@ public function testNormalize() { $content_entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') ->disableOriginalConstructor() - ->setMethods(['getFields']) + ->onlyMethods(['getFields']) ->getMockForAbstractClass(); $content_entity->expects($this->once()) ->method('getFields') @@ -91,7 +91,7 @@ public function testNormalize() { $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() - ->setMethods(['normalize']) + ->onlyMethods(['normalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('normalize') @@ -217,7 +217,7 @@ public function testDenormalizeWithValidBundle() { // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() - ->setMethods(['denormalize']) + ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') @@ -366,7 +366,7 @@ public function testDenormalizeWithNoBundle() { // item. $serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer') ->disableOriginalConstructor() - ->setMethods(['denormalize']) + ->onlyMethods(['denormalize']) ->getMock(); $serializer->expects($this->exactly(2)) ->method('denormalize') diff --git a/web/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php b/web/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php index 3681a4923f021694098d64dcb2c164aa77a318e0..525d9cd40ff706cd535d3ddfdfbdd8499058252f 100644 --- a/web/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php +++ b/web/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php @@ -54,7 +54,7 @@ protected function setUp(): void { // Set up a mock container as ItemList() will call for the 'typed_data_manager' // service. $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $container->expects($this->any()) ->method('get') diff --git a/web/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php b/web/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php index 463340eedadfb786581222c2e973c67445b41c86..a3029053f4e2e9d1ec1160aca8aaf132fb9c7a7d 100644 --- a/web/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php +++ b/web/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php @@ -70,7 +70,7 @@ public function testShortcutLinkAdd() { // Test the add shortcut form UI. Test that the base field description is // there. $this->drupalGet('admin/config/user-interface/shortcut/manage/' . $set->id() . '/add-link'); - $this->assertRaw('The location this shortcut points to.'); + $this->assertSession()->pageTextContains('The location this shortcut points to.'); // Check that each new shortcut links where it should. foreach ($test_cases as $test_path) { @@ -219,14 +219,11 @@ public function testShortcutQuickLink() { ])->save(); // Test page with HTML tags in title. $this->drupalGet('admin/structure/block/block-content/manage/basic'); - $page_title = new FormattableMarkup('Edit %label custom block type', ['%label' => 'Basic block']); - $this->assertRaw($page_title); + $page_title = "Edit Basic block custom block type"; + $this->assertSession()->pageTextContains($page_title); // Add shortcut to this page. $this->clickLink('Add to Default shortcuts'); - $this->assertRaw(new FormattableMarkup('Added a shortcut for %title.', [ - '%title' => trim(strip_tags($page_title)), - ])); - + $this->assertSession()->pageTextContains("Added a shortcut for {$page_title}."); } /** diff --git a/web/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php b/web/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php index 73f95f671aec908d62f3aab71a2539983bad86a8..af98752abaee3a048624a57107e13c0c352604fa 100644 --- a/web/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php +++ b/web/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php @@ -56,7 +56,7 @@ public function testAttached() { $node->save(); $this->drupalGet('node/' . $node->id()); - $this->assertRaw('core/modules/statistics/statistics.js'); + $this->assertSession()->responseContains('core/modules/statistics/statistics.js'); } } diff --git a/web/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php b/web/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php index 53402fa890ec9868782a93179ce8a4c6d95f9e4f..be8c1481650a4aa6ea4c56b66b605b1d19629c2e 100644 --- a/web/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php +++ b/web/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php @@ -63,7 +63,7 @@ public function testPopularContentBlock() { $this->assertCacheContexts($contexts); // Check if the node link is displayed. - $this->assertRaw(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString()); } } diff --git a/web/core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module b/web/core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module index 6001e4fd00e504e8fa7acb5ca7afb1ca1b6dc092..8eb95efb2425b882215585ed92a40e4cb92ce3a7 100644 --- a/web/core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module +++ b/web/core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module @@ -63,12 +63,12 @@ function theme_theme_test_function_template_override($variables) { } /** - * Theme function for testing rendering of child elements via drupal_render(). + * Theme function for testing rendering of child elements. * * Theme hooks defining a 'render element' add an internal '#render_children' - * property. When this property is found, drupal_render() avoids calling - * the 'theme.manager' service 'render' method on the top-level element to - * prevent infinite recursion. + * property. When this property is found, \Drupal::service('renderer')->render() + * avoids calling the 'theme.manager' service's ThemeManagerInterface::render() + * method on the top-level element to prevent infinite recursion. * * @param array $variables * An associative array containing: diff --git a/web/core/modules/system/tests/src/Functional/Batch/PageTest.php b/web/core/modules/system/tests/src/Functional/Batch/PageTest.php index 5bc95543b51a09e34b08d14a9f4ed86d0551a453..1d1854dc094938334d01b42b0761657d3259f07a 100644 --- a/web/core/modules/system/tests/src/Functional/Batch/PageTest.php +++ b/web/core/modules/system/tests/src/Functional/Batch/PageTest.php @@ -78,13 +78,13 @@ public function testBatchProgressMessages() { $this->drupalGet('batch-test/test-title'); // Check that the initial progress message appears correctly and is not // double escaped. - $this->assertRaw('<div class="progress__description">Initializing.<br /> </div>'); + $this->assertSession()->responseContains('<div class="progress__description">Initializing.<br /> </div>'); $this->assertSession()->responseNotContains('&nbsp;'); // Now also go to the next step. $this->maximumMetaRefreshCount = 1; $this->drupalGet('batch-test/test-title'); // Check that the progress message for second step appears correctly. - $this->assertRaw('<div class="progress__description">Completed 1 of 1.</div>'); + $this->assertSession()->responseContains('<div class="progress__description">Completed 1 of 1.</div>'); } } diff --git a/web/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php b/web/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php index ff355952f7eaecf79c504966ac248941e6a034da..72dcca53be9cfb55f5a78ff0e1d788052168ba90 100644 --- a/web/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php +++ b/web/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php @@ -39,9 +39,9 @@ public function testDrupalMessengerService() { $this->assertSession()->pageTextMatchesCount(3, '/Duplicated message/'); // Ensure Markup objects are rendered as expected. - $this->assertRaw('Markup with <em>markup!</em>'); + $this->assertSession()->responseContains('Markup with <em>markup!</em>'); $this->assertSession()->pageTextMatchesCount(1, '/Markup with markup!/'); - $this->assertRaw('Markup2 with <em>markup!</em>'); + $this->assertSession()->responseContains('Markup2 with <em>markup!</em>'); // Ensure when the same message is of different types it is not duplicated. $this->assertSession()->pageTextMatchesCount(1, '$Non duplicate Markup / string.$'); diff --git a/web/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php b/web/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php index 0bc90014c5aea241eb5a7b197998f98875dd0a2c..e7561716cbb4926a248eddaa8ce124b44c9fd36f 100644 --- a/web/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php +++ b/web/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php @@ -34,30 +34,30 @@ public function testCacheContext() { $this->assertSessionCookieOnClient(FALSE); $this->drupalGet(Url::fromRoute('<front>')); $this->assertSessionCookieOnClient(FALSE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); + $this->assertSession()->pageTextContains('Session does not exist!'); + $this->assertSession()->responseContains('[session.exists]=0'); // 2. Session (authenticated). $this->assertSessionCookieOnClient(FALSE); $this->drupalLogin($this->rootUser); $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session exists!'); - $this->assertRaw('[session.exists]=1'); + $this->assertSession()->pageTextContains('Session exists!'); + $this->assertSession()->responseContains('[session.exists]=1'); $this->drupalLogout(); $this->assertSessionCookieOnClient(FALSE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); + $this->assertSession()->pageTextContains('Session does not exist!'); + $this->assertSession()->responseContains('[session.exists]=0'); // 3. Session (anonymous). $this->assertSessionCookieOnClient(FALSE); $this->drupalGet(Url::fromRoute('<front>', [], ['query' => ['trigger_session' => 1]])); $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); + $this->assertSession()->pageTextContains('Session does not exist!'); + $this->assertSession()->responseContains('[session.exists]=0'); $this->drupalGet(Url::fromRoute('<front>')); $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session exists!'); - $this->assertRaw('[session.exists]=1'); + $this->assertSession()->pageTextContains('Session exists!'); + $this->assertSession()->responseContains('[session.exists]=1'); } /** diff --git a/web/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php b/web/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php index afc04b784a6d1e8ed6dd861390dec8b72f11ffb1..fa91dc95d99c97a70a135960565904f353a51217 100644 --- a/web/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php +++ b/web/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php @@ -34,11 +34,11 @@ public function testEarlyRendering() { // Render array: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.render_array')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.render_array.early')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'foo'); // AjaxResponse: non-early & early. @@ -46,66 +46,66 @@ public function testEarlyRendering() { // https://www.drupal.org/node/956186. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.ajax_response')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.ajax_response.early')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); // Basic Response object: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.response')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.response.early')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); // Response object with attachments: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.response-with-attachments')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.response-with-attachments.early')); $this->assertSession()->statusCodeEquals(500); - $this->assertRaw('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\AttachmentsTestResponse.'); + $this->assertSession()->pageTextContains('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\AttachmentsTestResponse.'); // Cacheable Response object: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.cacheable-response')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('Hello world!'); + $this->assertSession()->pageTextContains('Hello world!'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.cacheable-response.early')); $this->assertSession()->statusCodeEquals(500); - $this->assertRaw('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\CacheableTestResponse.'); + $this->assertSession()->pageTextContains('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\CacheableTestResponse.'); // Basic domain object: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.domain-object')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('TestDomainObject'); + $this->assertSession()->pageTextContains('TestDomainObject'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.domain-object.early')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('TestDomainObject'); + $this->assertSession()->pageTextContains('TestDomainObject'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); // Basic domain object with attachments: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.domain-object-with-attachments')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('AttachmentsTestDomainObject'); + $this->assertSession()->pageTextContains('AttachmentsTestDomainObject'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.domain-object-with-attachments.early')); $this->assertSession()->statusCodeEquals(500); - $this->assertRaw('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\AttachmentsTestDomainObject.'); + $this->assertSession()->pageTextContains('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\AttachmentsTestDomainObject.'); // Cacheable Response object: non-early & early. $this->drupalGet(Url::fromRoute('early_rendering_controller_test.cacheable-domain-object')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('CacheableTestDomainObject'); + $this->assertSession()->pageTextContains('CacheableTestDomainObject'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'foo'); $this->drupalGet(Url::fromRoute('early_rendering_controller_test.cacheable-domain-object.early')); $this->assertSession()->statusCodeEquals(500); - $this->assertRaw('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\CacheableTestDomainObject.'); + $this->assertSession()->pageTextContains('The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\early_rendering_controller_test\CacheableTestDomainObject.'); // The exceptions are expected. Do not interpret them as a test failure. // Not using File API; a potential error must trigger a PHP warning. diff --git a/web/core/modules/system/tests/src/Functional/Common/RenderWebTest.php b/web/core/modules/system/tests/src/Functional/Common/RenderWebTest.php index 8c5c54db2961ff313b64879e0bbfc94431cf36fb..fce229cfbd184044c798ef945398ad0ab4cd0da8 100644 --- a/web/core/modules/system/tests/src/Functional/Common/RenderWebTest.php +++ b/web/core/modules/system/tests/src/Functional/Common/RenderWebTest.php @@ -8,7 +8,7 @@ use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; /** - * Performs integration tests on drupal_render(). + * Performs integration tests on \Drupal::service('renderer')->render(). * * @group Common */ diff --git a/web/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php b/web/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php index b71cdc27205087fa311cf1b2c05ad8065a4d8f96..b4c90a3419aadb87f66b5277d47c3fbde246ceff 100644 --- a/web/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php +++ b/web/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php @@ -49,13 +49,13 @@ public function testPager() { $this->drupalGet('entity_test/list'); // Item 51 should not be present. - $this->assertRaw('Test entity 50'); + $this->assertSession()->pageTextContains('Test entity 50'); $this->assertSession()->responseNotContains('Test entity 51'); // Browse to the next page, test entity 51 is shown. $this->clickLink('Page 2'); $this->assertSession()->responseNotContains('Test entity 50'); - $this->assertRaw('Test entity 51'); + $this->assertSession()->pageTextContains('Test entity 51'); } /** diff --git a/web/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php b/web/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php index ee865b06a0165402bbafe26e03c6c70dc8d28cb3..8ec23e044b3542745e33bcd2299e7b53fad486bd 100644 --- a/web/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php +++ b/web/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php @@ -55,17 +55,17 @@ public function testEntityViewController() { foreach ($this->entities as $entity) { $this->drupalGet('entity_test/' . $entity->id()); - $this->assertRaw($entity->label()); - $this->assertRaw($get_label_markup($entity->label())); - $this->assertRaw('full'); + $this->assertSession()->pageTextContains($entity->label()); + $this->assertSession()->responseContains($get_label_markup($entity->label())); + $this->assertSession()->pageTextContains('full'); $this->drupalGet('entity_test_converter/' . $entity->id()); - $this->assertRaw($entity->label()); - $this->assertRaw('full'); + $this->assertSession()->pageTextContains($entity->label()); + $this->assertSession()->pageTextContains('full'); $this->drupalGet('entity_test_no_view_mode/' . $entity->id()); - $this->assertRaw($entity->label()); - $this->assertRaw('full'); + $this->assertSession()->pageTextContains($entity->label()); + $this->assertSession()->pageTextContains('full'); } // Test viewing a revisionable entity. @@ -76,8 +76,8 @@ public function testEntityViewController() { $entity_test_rev->isDefaultRevision(TRUE); $entity_test_rev->save(); $this->drupalGet('entity_test_rev/' . $entity_test_rev->id() . '/revision/' . $entity_test_rev->revision_id->value . '/view'); - $this->assertRaw($entity_test_rev->label()); - $this->assertRaw($get_label_markup($entity_test_rev->label())); + $this->assertSession()->pageTextContains($entity_test_rev->label()); + $this->assertSession()->responseContains($get_label_markup($entity_test_rev->label())); // As entity_test IDs must be integers, make sure requests for non-integer // IDs return a page not found error. diff --git a/web/core/modules/system/tests/src/Functional/Form/ElementTest.php b/web/core/modules/system/tests/src/Functional/Form/ElementTest.php index d5c9bd4f4de1523e5d78e8e3baaf21fccc6fcce9..dc11b26093609bf2de58a6c19c920d0fd5dae764 100644 --- a/web/core/modules/system/tests/src/Functional/Form/ElementTest.php +++ b/web/core/modules/system/tests/src/Functional/Form/ElementTest.php @@ -52,10 +52,10 @@ public function testOptions() { } // Verify that the choices are admin filtered as expected. - $this->assertRaw("<em>Special Char</em>alert('checkboxes');"); - $this->assertRaw("<em>Special Char</em>alert('radios');"); - $this->assertRaw('<em>Bar - checkboxes</em>'); - $this->assertRaw('<em>Bar - radios</em>'); + $this->assertSession()->responseContains("<em>Special Char</em>alert('checkboxes');"); + $this->assertSession()->responseContains("<em>Special Char</em>alert('radios');"); + $this->assertSession()->responseContains('<em>Bar - checkboxes</em>'); + $this->assertSession()->responseContains('<em>Bar - radios</em>'); // Enable customized option sub-elements. $this->drupalGet('form-test/checkboxes-radios/customize'); @@ -178,7 +178,7 @@ public function testFormAutocomplete() { $this->drupalGet('form-test/autocomplete'); // Make sure that the autocomplete library is added. - $this->assertRaw('core/misc/autocomplete.js'); + $this->assertSession()->responseContains('core/misc/autocomplete.js'); // Ensure that the user does have access to the autocompletion. $this->assertSession()->elementExists('xpath', '//input[@id="edit-autocomplete-1" and contains(@data-autocomplete-path, "form-test/autocomplete-1")]'); diff --git a/web/core/modules/system/tests/src/Functional/Form/FormTest.php b/web/core/modules/system/tests/src/Functional/Form/FormTest.php index 97467c81aaad1a3660fb7dea33b62ac6f40cf727..75097b3954b4798bc62f22c9f2c66a5da28e8509 100644 --- a/web/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/web/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -232,7 +232,7 @@ public function testRequiredCheckboxesRadio() { // Verify that no error message is displayed when all required fields are // filled. $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "error")]'); - $this->assertRaw("The form_test_validate_required_form form was submitted successfully."); + $this->assertSession()->pageTextContains("The form_test_validate_required_form form was submitted successfully."); } /** @@ -367,7 +367,7 @@ public function testRequiredTextfieldNoTitle() { $this->submitForm($edit, 'Submit'); // Verify that no error input form element class is present. $this->assertSession()->elementNotExists('xpath', '//input[contains(@class, "error")]'); - $this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully."); + $this->assertSession()->pageTextContains("The form_test_validate_required_form_no_title form was submitted successfully."); } /** @@ -659,7 +659,7 @@ public function testNumber() { // Check if the error exists on the page, if the current message ID is // expected. Otherwise ensure that the error message is not present. if ($id === $error) { - $this->assertRaw(new FormattableMarkup($message, $placeholders)); + $this->assertSession()->responseContains(new FormattableMarkup($message, $placeholders)); } else { $this->assertSession()->responseNotContains(new FormattableMarkup($message, $placeholders)); diff --git a/web/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php b/web/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php index 1d2e31ae7c7c5186374dc9c630da783d937b3530..3dee461407e31c2e326f6cc67fc145bb4aba8b40 100644 --- a/web/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php +++ b/web/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php @@ -385,7 +385,7 @@ public function testBreadCrumbs() { // Ensure that the breadcrumb is safe against XSS. $this->drupalGet('menu-test/breadcrumb1/breadcrumb2/breadcrumb3'); - $this->assertRaw('<script>alert(12);</script>'); + $this->assertSession()->responseContains('<script>alert(12);</script>'); $this->assertSession()->assertEscaped('<script>alert(123);</script>'); } diff --git a/web/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/web/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php index 249a45c6bfac566a281b1fff945d2d2eac13b26e..2208cf5b19efdc2fd24717b34b3004b0db23be99 100644 --- a/web/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php +++ b/web/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php @@ -199,7 +199,7 @@ protected function doTestExoticPath() { // cSpell:disable-next-line "éøïвβ中國書۞"; $this->drupalGet($path); - $this->assertRaw('This is the menuTestCallback content.'); + $this->assertSession()->pageTextContains('This is the menuTestCallback content.'); $this->assertSession()->pageTextNotContains('The website encountered an unexpected error. Please try again later.'); } @@ -270,7 +270,7 @@ public function testThemeIntegration() { protected function doTestThemeCallbackAdministrative() { $this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->assertSession()->pageTextContains('Active theme: seven. Actual theme: seven.'); - $this->assertRaw('seven/css/base/elements.css'); + $this->assertSession()->responseContains('seven/css/base/elements.css'); } /** @@ -283,7 +283,7 @@ protected function doTestThemeCallbackMaintenanceMode() { // we expect the theme callback system to be bypassed entirely. $this->drupalGet('menu-test/theme-callback/use-admin-theme'); // Check that the maintenance theme's CSS appears on the page. - $this->assertRaw('bartik/css/base/elements.css'); + $this->assertSession()->responseContains('bartik/css/base/elements.css'); // An administrator, however, should continue to see the requested theme. $admin_user = $this->drupalCreateUser(['access site in maintenance mode']); @@ -291,7 +291,7 @@ protected function doTestThemeCallbackMaintenanceMode() { $this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->assertSession()->pageTextContains('Active theme: seven. Actual theme: seven.'); // Check that the administrative theme's CSS appears on the page. - $this->assertRaw('seven/css/base/elements.css'); + $this->assertSession()->responseContains('seven/css/base/elements.css'); $this->container->get('state')->set('system.maintenance_mode', FALSE); } @@ -304,7 +304,7 @@ protected function doTestThemeCallbackOptionalTheme() { $this->drupalGet('menu-test/theme-callback/use-test-theme'); $this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.'); // Check that the default theme's CSS appears on the page. - $this->assertRaw('bartik/css/base/elements.css'); + $this->assertSession()->responseContains('bartik/css/base/elements.css'); // Now install the theme and request it again. /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ @@ -314,7 +314,7 @@ protected function doTestThemeCallbackOptionalTheme() { $this->drupalGet('menu-test/theme-callback/use-test-theme'); $this->assertSession()->pageTextContains('Active theme: test_theme. Actual theme: test_theme.'); // Check that the optional theme's CSS appears on the page. - $this->assertRaw('test_theme/kitten.css'); + $this->assertSession()->responseContains('test_theme/kitten.css'); $theme_installer->uninstall(['test_theme']); } @@ -326,7 +326,7 @@ protected function doTestThemeCallbackFakeTheme() { $this->drupalGet('menu-test/theme-callback/use-fake-theme'); $this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.'); // Check that the default theme's CSS appears on the page. - $this->assertRaw('bartik/css/base/elements.css'); + $this->assertSession()->responseContains('bartik/css/base/elements.css'); } /** @@ -336,7 +336,7 @@ protected function doTestThemeCallbackNoThemeRequested() { $this->drupalGet('menu-test/theme-callback/no-theme-requested'); $this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.'); // Check that the default theme's CSS appears on the page. - $this->assertRaw('bartik/css/base/elements.css'); + $this->assertSession()->responseContains('bartik/css/base/elements.css'); } } diff --git a/web/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/web/core/modules/system/tests/src/Functional/Module/DependencyTest.php index b30550613cbc75d6a1c9a051ea7999fad5a7549b..7ec785f3f5919e688d1931ae4e8672497d1def4b 100644 --- a/web/core/modules/system/tests/src/Functional/Module/DependencyTest.php +++ b/web/core/modules/system/tests/src/Functional/Module/DependencyTest.php @@ -101,7 +101,7 @@ public function testIncompatibleCoreVersionDependency() { */ public function testIncompatiblePhpVersionDependency() { $this->drupalGet('admin/modules'); - $this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.'); + $this->assertSession()->pageTextContains('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.'); $this->assertSession()->fieldDisabled('modules[system_incompatible_php_version_test][enable]'); } diff --git a/web/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/web/core/modules/system/tests/src/Functional/Module/UninstallTest.php index bf8ad7c0c5ca030334f03464f12bc8b22cd6229c..452d3304e3af7fa7002ef5102798ea18f29687b4 100644 --- a/web/core/modules/system/tests/src/Functional/Module/UninstallTest.php +++ b/web/core/modules/system/tests/src/Functional/Module/UninstallTest.php @@ -75,7 +75,7 @@ public function testUninstallPage() { // Be sure labels are rendered properly. // @see regression https://www.drupal.org/node/2512106 - $this->assertRaw('<label for="edit-uninstall-node" class="module-name table-filter-text-source">Node</label>'); + $this->assertSession()->responseContains('<label for="edit-uninstall-node" class="module-name table-filter-text-source">Node</label>'); $this->assertSession()->pageTextContains('The following reason prevents Node from being uninstalled:'); $this->assertSession()->pageTextContains('There is content for the entity type: Content'); @@ -114,7 +114,7 @@ public function testUninstallPage() { $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); // Add h3's since the entity type label is often repeated in the entity // labels. - $this->assertRaw('<h3>' . $entity_type->getLabel() . '</h3>'); + $this->assertSession()->responseContains('<h3>' . $entity_type->getLabel() . '</h3>'); } // Set a unique cache entry to be able to test whether all caches are diff --git a/web/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php b/web/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php index 39db03a38700836deaa63918b18b1207a7ac6cf0..76e7e39fe9bb0c82fd2a42677ba80347c72b8516 100644 --- a/web/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php +++ b/web/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php @@ -37,19 +37,19 @@ public function testUpcasting() { // paramconverter_test/test_user_node_foo/{user}/{node}/{foo} $this->drupalGet("paramconverter_test/test_user_node_foo/" . $user->id() . '/' . $node->id() . "/$foo"); // Verify user and node upcast by entity name. - $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo"); + $this->assertSession()->pageTextContains("user: {$user->label()}, node: {$node->label()}, foo: $foo"); // paramconverter_test/test_node_user_user/{node}/{foo}/{user} // options.parameters.foo.type = entity:user $this->drupalGet("paramconverter_test/test_node_user_user/" . $node->id() . "/" . $user->id() . "/" . $user->id()); // Verify foo converted to user as well. - $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}"); + $this->assertSession()->pageTextContains("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}"); // paramconverter_test/test_node_node_foo/{user}/{node}/{foo} // options.parameters.user.type = entity:node $this->drupalGet("paramconverter_test/test_node_node_foo/" . $node->id() . "/" . $node->id() . "/$foo"); // Verify that user is upcast to node (rather than to user). - $this->assertRaw("user: {$node->label()}, node: {$node->label()}, foo: $foo"); + $this->assertSession()->pageTextContains("user: {$node->label()}, node: {$node->label()}, foo: $foo"); } /** @@ -61,7 +61,7 @@ public function testSameTypes() { // paramconverter_test/node/{node}/set/parent/{parent} // options.parameters.parent.type = entity:node $this->drupalGet("paramconverter_test/node/" . $node->id() . "/set/parent/" . $parent->id()); - $this->assertRaw("Setting '" . $parent->getTitle() . "' as parent of '" . $node->getTitle() . "'."); + $this->assertSession()->pageTextContains("Setting '" . $parent->getTitle() . "' as parent of '" . $node->getTitle() . "'."); } /** @@ -82,9 +82,9 @@ public function testEntityLanguage() { $translation->setTitle('Deutscher Titel')->save(); $this->drupalGet("/paramconverter_test/node/" . $node->id() . "/test_language"); - $this->assertRaw("English label"); + $this->assertSession()->pageTextContains("English label"); $this->drupalGet("paramconverter_test/node/" . $node->id() . "/test_language", ['language' => $language]); - $this->assertRaw("Deutscher Titel"); + $this->assertSession()->pageTextContains("Deutscher Titel"); } } diff --git a/web/core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php b/web/core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php index a7bebf645f7d9220650fcd083c3f3646505cd52a..c437115c6d32465f2cf0d7c6924639f15a4064cb 100644 --- a/web/core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php +++ b/web/core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php @@ -31,8 +31,8 @@ public function testPageDisplayVariantSelectionEvent() { // was passed correctly. If the configuration wasn't passed, we'd get an // error page here. $this->drupalGet('<front>'); - $this->assertRaw('A very important, required value.'); - $this->assertRaw('Explicitly passed in context.'); + $this->assertSession()->pageTextContains('A very important, required value.'); + $this->assertSession()->pageTextContains('Explicitly passed in context.'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'custom_cache_tag'); } diff --git a/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php b/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php index ad2f9774fed0c3f3b0d42e5119c153680a70d658..6d792472ff1959b3fac11b5884db023599b816d3 100644 --- a/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php +++ b/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php @@ -43,7 +43,7 @@ public function testUrlBubbleableMetadataBubbling() { $url = Url::fromRoute('cache_test.url_bubbling'); $this->drupalGet($url); $this->assertCacheContext('url.site'); - $this->assertRaw($url->setAbsolute()->toString()); + $this->assertSession()->responseContains($url->setAbsolute()->toString()); } } diff --git a/web/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php b/web/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php index 4f8937388ed0040105d7ac3d1f482b6357269547..016f9e46caa93d331f59e56db2e5eca013ce02ff 100644 --- a/web/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php +++ b/web/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php @@ -40,7 +40,7 @@ public function testPermissionAccess() { $this->drupalGet('router_test/test7'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseNotContains('Access denied'); - $this->assertRaw('test7text'); + $this->assertSession()->pageTextContains('test7text'); } } diff --git a/web/core/modules/system/tests/src/Functional/Routing/RouterTest.php b/web/core/modules/system/tests/src/Functional/Routing/RouterTest.php index d00a2f5bda633fa6e0768112c0f84e4e5839c44e..945cabddb3b97201aba6c8f2c922d2cdd31c1afd 100644 --- a/web/core/modules/system/tests/src/Functional/Routing/RouterTest.php +++ b/web/core/modules/system/tests/src/Functional/Routing/RouterTest.php @@ -37,7 +37,7 @@ public function testFinishResponseSubscriber() { // Confirm that the router can get to a controller. $this->drupalGet('router_test/test1'); - $this->assertRaw('test1'); + $this->assertSession()->pageTextContains('test1'); $session = $this->getSession(); // Check expected headers from FinishResponseSubscriber. @@ -48,7 +48,7 @@ public function testFinishResponseSubscriber() { $this->assertSession()->responseHeaderDoesNotExist('Vary'); $this->drupalGet('router_test/test2'); - $this->assertRaw('test2'); + $this->assertSession()->pageTextContains('test2'); // Check expected headers from FinishResponseSubscriber. $headers = $session->getResponseHeaders(); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Contexts', implode(' ', $expected_cache_contexts)); @@ -56,7 +56,7 @@ public function testFinishResponseSubscriber() { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Max-Age', '-1 (Permanent)'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('</html>'); + $this->assertSession()->responseContains('</html>'); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. $this->assertSession()->responseNotMatches('#</body>.*</body>#s'); @@ -120,22 +120,22 @@ public function testDuplicateRoutePaths() { // @see \Drupal\Core\Routing\RouteProvider::getRoutesByPath() $this->drupalGet('router-test/duplicate-path2'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('router_test.two_duplicate1'); + $this->assertSession()->responseContains('router_test.two_duplicate1'); // Tests three routes with same the path. One of the routes the path has a // different case. $this->drupalGet('router-test/case-sensitive-duplicate-path3'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('router_test.case_sensitive_duplicate1'); + $this->assertSession()->responseContains('router_test.case_sensitive_duplicate1'); // While case-insensitive matching works, exact matches are preferred. $this->drupalGet('router-test/case-sensitive-Duplicate-PATH3'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('router_test.case_sensitive_duplicate2'); + $this->assertSession()->responseContains('router_test.case_sensitive_duplicate2'); // Test that case-insensitive matching works, falling back to the first // route defined. $this->drupalGet('router-test/case-sensitive-Duplicate-Path3'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('router_test.case_sensitive_duplicate1'); + $this->assertSession()->responseContains('router_test.case_sensitive_duplicate1'); } /** @@ -147,12 +147,12 @@ public function testControllerPlaceholders() { foreach ($values as $value) { $this->drupalGet('router_test/test3/' . $value); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw($value); + $this->assertSession()->pageTextContains($value); } // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('</html>'); + $this->assertSession()->responseContains('</html>'); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -165,11 +165,11 @@ public function testControllerPlaceholders() { public function testControllerPlaceholdersDefaultValues() { $this->drupalGet('router_test/test4'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('narf'); + $this->assertSession()->pageTextContains('narf'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('</html>'); + $this->assertSession()->responseContains('</html>'); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -182,11 +182,11 @@ public function testControllerPlaceholdersDefaultValues() { public function testControllerPlaceholdersDefaultValuesProvided() { $this->drupalGet('router_test/test4/barf'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('barf'); + $this->assertSession()->pageTextContains('barf'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('</html>'); + $this->assertSession()->responseContains('</html>'); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -202,7 +202,7 @@ public function testDynamicRoutes() { // Test the altered route. $this->drupalGet('router_test/test6'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('test5'); + $this->assertSession()->pageTextContains('test5'); } /** @@ -211,11 +211,11 @@ public function testDynamicRoutes() { public function testControllerResolutionPage() { $this->drupalGet('/router_test/test10'); - $this->assertRaw('abcde'); + $this->assertSession()->pageTextContains('abcde'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('</html>'); + $this->assertSession()->responseContains('</html>'); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -294,7 +294,7 @@ public function testControllerResolutionAjax() { $this->assertSession()->responseHeaderEquals('Content-Type', 'application/json'); - $this->assertRaw('abcde'); + $this->assertSession()->pageTextContains('abcde'); } /** diff --git a/web/core/modules/system/tests/src/Functional/Session/SessionTest.php b/web/core/modules/system/tests/src/Functional/Session/SessionTest.php index acb5321b00a12ed4aa48f293f172fb437efefbde..8d3c49641d71274935ead5b2a1552129592d0331 100644 --- a/web/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/web/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -317,7 +317,7 @@ public function testEmptySessionID() { $this->mink->resetSessions(); $this->drupalGet('session-test/id-from-cookie'); // Verify that session ID is blank as sent from cookie header. - $this->assertRaw("session_id:\n"); + $this->assertSession()->responseContains("session_id:\n"); // Assert that we have an anonymous session now. $this->drupalGet('session-test/is-logged-in'); $this->assertSession()->statusCodeEquals(403); diff --git a/web/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php b/web/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php index 17a5343bb68192ead6dc62e2d1909a4cbe546a0d..c06d93aa1f46ad9f4b444ffb83e26cd915379768 100644 --- a/web/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php +++ b/web/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\System; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\user\RoleInterface; @@ -72,7 +71,7 @@ public function testAccessDenied() { ]; $this->drupalGet('admin/config/system/site-information'); $this->submitForm($edit, 'Save configuration'); - $this->assertRaw(new FormattableMarkup("The path '%path' has to start with a slash.", ['%path' => $edit['site_403']])); + $this->assertSession()->pageTextContains("The path '{$edit['site_403']}' has to start with a slash."); // Use a custom 403 page. $edit = [ diff --git a/web/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php b/web/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php index 82dd89780cbb85ca2ebcfc101de707e8f8534fa8..187a82c9857fc9e261c765af04cd55541b1d66d8 100644 --- a/web/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php +++ b/web/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php @@ -23,7 +23,7 @@ public function testMetaTag() { list($version,) = explode('.', \Drupal::VERSION); $string = '<meta name="Generator" content="Drupal ' . $version . ' (https://www.drupal.org)" />'; $this->drupalGet('node'); - $this->assertRaw($string); + $this->assertSession()->responseContains($string); } } diff --git a/web/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php b/web/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php index 295466bc2f9b293b184598d21437b6b5de3d578a..3bdb1922437c4e00792eb652b8ae983b61529a4f 100644 --- a/web/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php +++ b/web/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php @@ -36,7 +36,7 @@ protected function setUp(): void { public function testDefaultMetaTagsExist() { $this->drupalGet(''); foreach ($this->defaultMetaTags as $name => $metatag) { - $this->assertRaw($metatag); + $this->assertSession()->responseContains($metatag); } } diff --git a/web/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/web/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php index 1a6e826e1c478d04ab34ec778b88826d58dbb80d..3b65b623cd9ee5a23b5635cf317df10acf6aa6ab 100644 --- a/web/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php +++ b/web/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php @@ -55,9 +55,9 @@ public function testErrorHandler() { $this->assertErrorMessage($error_notice); $this->assertErrorMessage($error_warning); $this->assertErrorMessage($error_user_notice); - $this->assertRaw('<pre class="backtrace">'); + $this->assertSession()->responseContains('<pre class="backtrace">'); // Ensure we are escaping but not double escaping. - $this->assertRaw('&'); + $this->assertSession()->responseContains('&'); $this->assertSession()->responseNotContains('&amp;'); // Set error reporting to display verbose notices. @@ -131,7 +131,7 @@ public function testExceptionHandler() { // error message. $this->assertSession()->pageTextContains($error_pdo_exception['@message']); $error_details = new FormattableMarkup('in %function (line ', $error_pdo_exception); - $this->assertRaw($error_details); + $this->assertSession()->responseContains($error_details); $this->drupalGet('error-test/trigger-renderer-exception'); $this->assertSession()->statusCodeEquals(500); $this->assertErrorMessage($error_renderer_exception); @@ -153,7 +153,7 @@ public function testExceptionHandler() { */ public function assertErrorMessage(array $error) { $message = new FormattableMarkup('%type: @message in %function (line ', $error); - $this->assertRaw($message); + $this->assertSession()->responseContains($message); } /** diff --git a/web/core/modules/system/tests/src/Functional/System/FrontPageTest.php b/web/core/modules/system/tests/src/Functional/System/FrontPageTest.php index 7164f3365a15f05fe9c6e11eeac92eb824c16b99..d350dfe2d88b970bc0649d4e3548e61d9e335287 100644 --- a/web/core/modules/system/tests/src/Functional/System/FrontPageTest.php +++ b/web/core/modules/system/tests/src/Functional/System/FrontPageTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\System; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; /** @@ -78,7 +77,7 @@ public function testDrupalFrontPage() { $edit = ['site_frontpage' => $this->nodePath]; $this->drupalGet('admin/config/system/site-information'); $this->submitForm($edit, 'Save configuration'); - $this->assertRaw(new FormattableMarkup("The path '%path' has to start with a slash.", ['%path' => $edit['site_frontpage']])); + $this->assertSession()->pageTextContains("The path '{$edit['site_frontpage']}' has to start with a slash."); // Change the front page to a valid path. $edit['site_frontpage'] = '/' . $this->nodePath; diff --git a/web/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php b/web/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php index 634c3ebe964ee66ed558fcfcace8e45aea9cdd11..47afe0917d63bf8d8ef29f768e147a59c8cdf21f 100644 --- a/web/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php +++ b/web/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\System; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\user\RoleInterface; @@ -56,7 +55,7 @@ public function testPageNotFound() { ]; $this->drupalGet('admin/config/system/site-information'); $this->submitForm($edit, 'Save configuration'); - $this->assertRaw(new FormattableMarkup("The path '%path' has to start with a slash.", ['%path' => $edit['site_404']])); + $this->assertSession()->pageTextContains("The path '{$edit['site_404']}' has to start with a slash."); // Use a custom 404 page. $edit = [ diff --git a/web/core/modules/system/tests/src/Functional/System/PageTitleTest.php b/web/core/modules/system/tests/src/Functional/System/PageTitleTest.php index 5768af90b1c6450ed2d5c2e9451e0364f4cee0a8..ed7b2340120af6ba5fac59fcb9aee8b32da8440f 100644 --- a/web/core/modules/system/tests/src/Functional/System/PageTitleTest.php +++ b/web/core/modules/system/tests/src/Functional/System/PageTitleTest.php @@ -101,13 +101,13 @@ public function testTitleXSS() { $this->assertSession()->responseNotContains($title); // Add </title> to make sure we're checking the title tag, rather than the // first 'heading' on the page. - $this->assertRaw($title_filtered . '</title>'); + $this->assertSession()->responseContains($title_filtered . '</title>'); // Test the slogan. // Check the unfiltered version of the slogan is missing. $this->assertSession()->responseNotContains($slogan); // Check for the filtered version of the slogan. - $this->assertRaw($slogan_filtered); + $this->assertSession()->responseContains($slogan_filtered); } /** @@ -166,10 +166,10 @@ public function testRoutingTitle() { // controller does not escape them. $this->drupalGet('test-page-cached-controller'); $this->assertSession()->titleEquals('Cached title | Drupal'); - $this->assertRaw(Html::escape('<span>Cached title</span>') . '</h1>'); + $this->assertSession()->responseContains(Html::escape('<span>Cached title</span>') . '</h1>'); $this->drupalGet('test-page-cached-controller'); $this->assertSession()->titleEquals('Cached title | Drupal'); - $this->assertRaw(Html::escape('<span>Cached title</span>') . '</h1>'); + $this->assertSession()->responseContains(Html::escape('<span>Cached title</span>') . '</h1>'); } } diff --git a/web/core/modules/system/tests/src/Functional/System/ShutdownFunctionsTest.php b/web/core/modules/system/tests/src/Functional/System/ShutdownFunctionsTest.php index 8c8fccafa166185d279628aae4db8c96f62d09b2..2059714e9464ead60e02e2bde7de37bc3581a719 100644 --- a/web/core/modules/system/tests/src/Functional/System/ShutdownFunctionsTest.php +++ b/web/core/modules/system/tests/src/Functional/System/ShutdownFunctionsTest.php @@ -54,7 +54,7 @@ public function testShutdownFunctions() { // Make sure exceptions displayed through // \Drupal\Core\Utility\Error::renderExceptionSafe() are correctly // escaped. - $this->assertRaw('Drupal is <blink>awesome</blink>.'); + $this->assertSession()->responseContains('Drupal is <blink>awesome</blink>.'); } } diff --git a/web/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/web/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php index 6b9b6316e180251afa9a73ac197ca7b2185e4de9..1400fb0561ee27a954620a77ed4659beff7e10b9 100644 --- a/web/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php +++ b/web/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php @@ -166,7 +166,7 @@ public function testNonHtmlRequest() { foreach ($formats as $format) { $this->drupalGet('<front>', ['query' => ['_format' => $format]]); $this->assertSession()->statusCodeEquals(503); - $this->assertRaw('Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.'); + $this->assertSession()->pageTextContains('Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.'); $this->assertSession()->responseHeaderEquals('Content-Type', 'text/plain; charset=UTF-8'); } } diff --git a/web/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php b/web/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php index 8f42feb75a66e99dd72c5519dec7b8e817e975a8..376ae42482ac22b7f3b39b11b92fd1947686c7e6 100644 --- a/web/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php +++ b/web/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php @@ -57,12 +57,12 @@ public function testFileTransferHooks() { $this->assertSession()->pageTextNotContains('It appears you have reached this page in error.'); $this->assertSession()->pageTextContains('To continue, provide your server connection details'); // Make sure we see the new connection method added by system_test. - $this->assertRaw('System Test FileTransfer'); + $this->assertSession()->pageTextContains('System Test FileTransfer'); // Make sure the settings form callback works. $this->assertSession()->pageTextContains('System Test Username'); // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets as // expected to the first page of the authorize.php script. - $this->assertRaw('core/misc/states.js'); + $this->assertSession()->responseContains('core/misc/states.js'); } } diff --git a/web/core/modules/system/tests/src/Functional/System/ThemeTest.php b/web/core/modules/system/tests/src/Functional/System/ThemeTest.php index 22f2fa9bd502b588fa82d6e18da07cde5aaec7de..4f4877e5578e54db3165e47cf86af47bf1b8884b 100644 --- a/web/core/modules/system/tests/src/Functional/System/ThemeTest.php +++ b/web/core/modules/system/tests/src/Functional/System/ThemeTest.php @@ -288,19 +288,19 @@ public function testAdministrationTheme() { // Check that the administration theme is used on an administration page. $this->drupalGet('admin/config'); - $this->assertRaw('core/themes/seven'); + $this->assertSession()->responseContains('core/themes/seven'); // Check that the site default theme used on node page. $this->drupalGet('node/' . $this->node->id()); - $this->assertRaw('core/themes/classy'); + $this->assertSession()->responseContains('core/themes/classy'); // Check that the administration theme is used on the add content page. $this->drupalGet('node/add'); - $this->assertRaw('core/themes/seven'); + $this->assertSession()->responseContains('core/themes/seven'); // Check that the administration theme is used on the edit content page. $this->drupalGet('node/' . $this->node->id() . '/edit'); - $this->assertRaw('core/themes/seven'); + $this->assertSession()->responseContains('core/themes/seven'); // Disable the admin theme on the node admin pages. $edit = [ @@ -311,7 +311,7 @@ public function testAdministrationTheme() { // Check that the administration theme is used on an administration page. $this->drupalGet('admin/config'); - $this->assertRaw('core/themes/seven'); + $this->assertSession()->responseContains('core/themes/seven'); // Ensure that the admin theme is also visible on the 403 page. $normal_user = $this->drupalCreateUser(['view the administration theme']); @@ -319,12 +319,12 @@ public function testAdministrationTheme() { // Check that the administration theme is used on an administration page. $this->drupalGet('admin/config'); $this->assertSession()->statusCodeEquals(403); - $this->assertRaw('core/themes/seven'); + $this->assertSession()->responseContains('core/themes/seven'); $this->drupalLogin($this->adminUser); // Check that the site default theme used on the add content page. $this->drupalGet('node/add'); - $this->assertRaw('core/themes/classy'); + $this->assertSession()->responseContains('core/themes/classy'); // Reset to the default theme settings. $edit = [ @@ -336,11 +336,11 @@ public function testAdministrationTheme() { // Check that the site default theme used on administration page. $this->drupalGet('admin'); - $this->assertRaw('core/themes/classy'); + $this->assertSession()->responseContains('core/themes/classy'); // Check that the site default theme used on the add content page. $this->drupalGet('node/add'); - $this->assertRaw('core/themes/classy'); + $this->assertSession()->responseContains('core/themes/classy'); } /** @@ -430,7 +430,7 @@ public function testUninstallingThemes() { $this->submitForm($edit, 'Save configuration'); // Check that seven can be uninstalled now. - $this->assertRaw('Uninstall Seven theme'); + $this->assertSession()->responseContains('Uninstall Seven theme'); // Check that the classy theme still cannot be uninstalled as it is a // base theme of bartik. $this->assertSession()->responseNotContains('Uninstall Classy theme'); @@ -439,7 +439,7 @@ public function testUninstallingThemes() { $this->clickLink('Set as default', 1); // Check that bartik can be uninstalled now. - $this->assertRaw('Uninstall Bartik theme'); + $this->assertSession()->responseContains('Uninstall Bartik theme'); // Check that the classy theme still can't be uninstalled as neither of its // base themes have been. @@ -447,10 +447,10 @@ public function testUninstallingThemes() { // Uninstall each of the three themes starting with Bartik. $this->clickLink('Uninstall'); - $this->assertRaw('The <em class="placeholder">Bartik</em> theme has been uninstalled'); + $this->assertSession()->responseContains('The <em class="placeholder">Bartik</em> theme has been uninstalled'); // Seven is the second in the list. $this->clickLink('Uninstall'); - $this->assertRaw('The <em class="placeholder">Seven</em> theme has been uninstalled'); + $this->assertSession()->responseContains('The <em class="placeholder">Seven</em> theme has been uninstalled'); // Check that the classy theme still can't be uninstalled as it is hidden. $this->assertSession()->responseNotContains('Uninstall Classy theme'); diff --git a/web/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php b/web/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php index 470c28aab55b1eb31828ef4d5163950fb51b5396..562f800d961f8ddb2c7eacd744f956ffb33bec06 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php @@ -42,7 +42,7 @@ public function testTwigVariableDataTypes() { ->save(); $this->drupalGet('twig-theme-test/php-variables'); foreach (_test_theme_twig_php_values() as $type => $value) { - $this->assertRaw('<li>' . $type . ': ' . $value['expected'] . '</li>'); + $this->assertSession()->responseContains('<li>' . $type . ': ' . $value['expected'] . '</li>'); } } @@ -71,7 +71,7 @@ public function testTwigUrlGenerator() { $content = $this->getSession()->getPage()->getContent(); $this->assertFalse(empty($content), 'Page content is not empty'); foreach ($expected as $string) { - $this->assertRaw('<div>' . $string . '</div>'); + $this->assertSession()->responseContains('<div>' . $string . '</div>'); } } @@ -105,7 +105,7 @@ public function testTwigLinkGenerator() { $content = $this->getSession()->getPage()->getContent(); $this->assertFalse(empty($content), 'Page content is not empty'); foreach ($expected as $string) { - $this->assertRaw('<div>' . $string . '</div>'); + $this->assertSession()->responseContains('<div>' . $string . '</div>'); } } @@ -124,7 +124,7 @@ public function testTwigUrlToString() { $content = $this->getSession()->getPage()->getContent(); $this->assertFalse(empty($content), 'Page content is not empty'); foreach ($expected as $string) { - $this->assertRaw('<div>' . $string . '</div>'); + $this->assertSession()->responseContains('<div>' . $string . '</div>'); } } @@ -134,7 +134,7 @@ public function testTwigUrlToString() { public function testTwigFileUrls() { $this->drupalGet('/twig-theme-test/file-url'); $filepath = file_url_transform_relative(file_create_url('core/modules/system/tests/modules/twig_theme_test/twig_theme_test.js')); - $this->assertRaw('<div>file_url: ' . $filepath . '</div>'); + $this->assertSession()->responseContains('<div>file_url: ' . $filepath . '</div>'); } /** @@ -142,7 +142,7 @@ public function testTwigFileUrls() { */ public function testTwigAttachLibrary() { $this->drupalGet('/twig-theme-test/attach-library'); - $this->assertRaw('ckeditor.js'); + $this->assertSession()->responseContains('ckeditor.js'); } /** @@ -150,7 +150,7 @@ public function testTwigAttachLibrary() { */ public function testRenderable() { $this->drupalGet('/twig-theme-test/renderable'); - $this->assertRaw('<div>Example markup</div>'); + $this->assertSession()->responseContains('<div>Example markup</div>'); } } diff --git a/web/core/modules/system/tests/src/Functional/Theme/FastTest.php b/web/core/modules/system/tests/src/Functional/Theme/FastTest.php index ec6f3a9d38f9dd648e7d36dcc5fa2ce72f86d003..40475325869b0a5e3d2cf4381351625517e50342 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/FastTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/FastTest.php @@ -34,7 +34,7 @@ protected function setUp(): void { public function testUserAutocomplete() { $this->drupalLogin($this->account); $this->drupalGet('user/autocomplete', ['query' => ['q' => $this->account->getAccountName()]]); - $this->assertRaw($this->account->getAccountName()); + $this->assertSession()->responseContains($this->account->getAccountName()); $this->assertSession()->pageTextNotContains('registry initialized'); } diff --git a/web/core/modules/system/tests/src/Functional/Theme/ThemeEarlyInitializationTest.php b/web/core/modules/system/tests/src/Functional/Theme/ThemeEarlyInitializationTest.php index 2c8c5f9aad14b71519f3ef311ca605ae649fccee..d492ddc22850b6e7da9352030366565a1de64b2d 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/ThemeEarlyInitializationTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/ThemeEarlyInitializationTest.php @@ -30,10 +30,10 @@ class ThemeEarlyInitializationTest extends BrowserTestBase { public function testRequestListener() { $this->drupalGet('theme-test/request-listener'); // Verify that themed output generated in the request listener appears. - $this->assertRaw('Themed output generated in a KernelEvents::REQUEST listener'); + $this->assertSession()->responseContains('Themed output generated in a KernelEvents::REQUEST listener'); // Verify that the default theme's CSS still appears even though the theme // system was initialized early. - $this->assertRaw('classy/css/components/action-links.css'); + $this->assertSession()->responseContains('classy/css/components/action-links.css'); } } diff --git a/web/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php b/web/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php index 45de8f1efec81071afc2317839123ec9490d9a34..7442e53ecdcb1063aeff875e9967a3e84163a022 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php @@ -49,7 +49,7 @@ public function testTwigExtensionFilter() { $this->drupalGet('twig-extension-test/filter'); $this->assertSession()->pageTextContains('Every plant is not a mineral.'); // Test safe_join filter. - $this->assertRaw('<em>will be escaped</em><br/><em>will be markup</em><br/><strong>will be rendered</strong>'); + $this->assertSession()->responseContains('<em>will be escaped</em><br/><em>will be markup</em><br/><strong>will be rendered</strong>'); } /** diff --git a/web/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php b/web/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php index c68c1c9d7a16612180a770acecc81d0605b39802..cb292abf31d76471cef865d0e907db5a90854d15 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php @@ -148,15 +148,15 @@ protected function assertTwigTransTags() { // Assert that {{ token }} was successfully translated and prefixed // with "@". - $this->assertRaw('ESCAPEE: &"<>'); + $this->assertSession()->responseContains('ESCAPEE: &"<>'); // Assert that {{ token|placeholder }} was successfully translated and // prefixed with "%". - $this->assertRaw('PLAYSHOLDR: <em class="placeholder">&"<></em>'); + $this->assertSession()->responseContains('PLAYSHOLDR: <em class="placeholder">&"<></em>'); // Assert that {{ complex.tokens }} were successfully translated with // appropriate prefixes. - $this->assertRaw('DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: <em class="placeholder">12345</em> AN &"<>.'); + $this->assertSession()->responseContains('DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: <em class="placeholder">12345</em> AN &"<>.'); // Assert that {% trans %} with a context only msgid is excluded from // translation. @@ -200,7 +200,7 @@ protected function installLanguages() { // Install the language in Drupal. $this->drupalGet('admin/config/regional/language/add'); $this->submitForm($edit, 'Add custom language'); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); + $this->assertSession()->responseContains('"edit-languages-' . $langcode . '-weight"'); // Import the custom .po contents for the language. $filename = $file_system->tempnam('temporary://', "po_") . '.po'; diff --git a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php index 8f5b7709e42ee701151038f68b0e97d0c5eb2406..0b871ce26508f3d0fef707997e2edf47bb4da906 100644 --- a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php +++ b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php @@ -110,20 +110,20 @@ public function testUpdatedSite() { $this->assertSession()->pageTextContains('Test title'); $this->assertSession()->pageTextContains('Test body'); $this->assertSession()->checkboxChecked('edit-field-test-1-value'); - $this->assertRaw('2015-08-16'); - $this->assertRaw('test@example.com'); - $this->assertRaw('drupal.org'); + $this->assertSession()->responseContains('2015-08-16'); + $this->assertSession()->responseContains('test@example.com'); + $this->assertSession()->responseContains('drupal.org'); $this->assertSession()->pageTextContains('0.1'); $this->assertSession()->pageTextContains('0.2'); - $this->assertRaw('+31612345678'); - $this->assertRaw('+31612345679'); + $this->assertSession()->responseContains('+31612345678'); + $this->assertSession()->responseContains('+31612345679'); $this->assertSession()->pageTextContains('Test Article - New title'); $this->assertSession()->pageTextContains('test.txt'); $this->assertSession()->pageTextContains('druplicon.small'); - $this->assertRaw('General discussion'); + $this->assertSession()->responseContains('General discussion'); $this->assertSession()->pageTextContains('Test Article - New title'); $this->assertSession()->pageTextContains('Test 1'); - $this->assertRaw('0.01'); + $this->assertSession()->responseContains('0.01'); $this->drupalGet('node/8/edit'); $this->submitForm([], 'Save (this translation)'); $this->assertSession()->statusCodeEquals(200); @@ -134,7 +134,7 @@ public function testUpdatedSite() { // Make sure the user page is correct. $this->drupalGet('user/3'); $this->assertSession()->pageTextContains('usuario_test'); - $this->assertRaw('druplicon.small'); + $this->assertSession()->responseContains('druplicon.small'); $this->assertSession()->pageTextContains('Test file field'); $this->assertSession()->linkExists('test.txt'); @@ -155,14 +155,14 @@ public function testUpdatedSite() { $this->clickLink('Test Article - New title'); $this->assertSession()->pageTextContains('Body'); $this->assertSession()->pageTextContains('Tags'); - $this->assertRaw('Text format'); + $this->assertSession()->responseContains('Text format'); // Make sure that users still exist. $this->drupalGet('admin/people'); $this->assertSession()->pageTextContains('usuario_test'); $this->assertSession()->pageTextContains('drupal'); $this->drupalGet('user/1/edit'); - $this->assertRaw('drupal@example.com'); + $this->assertSession()->responseContains('drupal@example.com'); // Make sure the content view works. $this->drupalGet('admin/content'); @@ -185,7 +185,7 @@ public function testUpdatedSite() { // Make sure our block is still translated. $this->drupalGet('admin/structure/block/manage/testblock/translate/es/edit'); - $this->assertRaw('Test block spanish'); + $this->assertSession()->responseContains('Test block spanish'); // Make sure our custom text format exists. $this->drupalGet('admin/config/content/formats'); @@ -217,7 +217,7 @@ public function testUpdatedSite() { $this->clickLink('Admin'); // Make sure the translation for the menu is still correct. $this->drupalGet('admin/structure/menu/manage/test-menu/translate/es/edit'); - $this->assertRaw('Menu test'); + $this->assertSession()->responseContains('Menu test'); // Make sure our custom menu link exists. $this->drupalGet('admin/structure/menu/item/1/edit'); $this->assertSession()->checkboxChecked('edit-enabled-value'); @@ -314,7 +314,7 @@ public function testUpdatedSite() { $this->assertSession()->pageTextContains('Test action'); $this->drupalGet('admin/config/system/actions/configure/test_action'); $this->assertSession()->fieldValueEquals('id', 'test_action'); - $this->assertRaw('drupal.org'); + $this->assertSession()->responseContains('drupal.org'); // Make sure our ban still exists. $this->drupalGet('admin/config/people/ban'); @@ -341,7 +341,7 @@ public function testUpdatedSite() { $this->assertSession()->pageTextContains('Hello'); $this->drupalGet('admin/structure/contact/manage/test_contact_form/translate/es/edit'); $this->assertSession()->pageTextContains('Hola'); - $this->assertRaw('Test contact form Spanish'); + $this->assertSession()->responseContains('Test contact form Spanish'); // Make sure our modules are still enabled. $expected_enabled_modules = [ diff --git a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php index bebc7247a7a2f8f1fae334d4e4f3e456cd83cc47..3ae3b733615f3a33843547966e413ccea37a619a 100644 --- a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php +++ b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php @@ -84,16 +84,16 @@ protected function doSelectionTest() { public function testPostUpdate() { $this->runUpdates(); - $this->assertRaw('<h3>Update first</h3>'); - $this->assertRaw('First update'); - $this->assertRaw('<h3>Update second</h3>'); - $this->assertRaw('Second update'); - $this->assertRaw('<h3>Update test1</h3>'); - $this->assertRaw('Test1 update'); - $this->assertRaw('<h3>Update test0</h3>'); - $this->assertRaw('Test0 update'); - $this->assertRaw('<h3>Update test_batch</h3>'); - $this->assertRaw('Test post update batches'); + $this->assertSession()->responseContains('<h3>Update first</h3>'); + $this->assertSession()->pageTextContains('First update'); + $this->assertSession()->responseContains('<h3>Update second</h3>'); + $this->assertSession()->pageTextContains('Second update'); + $this->assertSession()->responseContains('<h3>Update test1</h3>'); + $this->assertSession()->pageTextContains('Test1 update'); + $this->assertSession()->responseContains('<h3>Update test0</h3>'); + $this->assertSession()->pageTextContains('Test0 update'); + $this->assertSession()->responseContains('<h3>Update test_batch</h3>'); + $this->assertSession()->pageTextContains('Test post update batches'); // Test state value set by each post update. $updates = [ diff --git a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php index 4402d5cc5f4ab5aff1d7967bc72a865ffc320011..fb3b5fa680d1dfc5737613e8c7df6f8faaeb9025 100644 --- a/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php +++ b/web/core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php @@ -69,7 +69,7 @@ public function testUpdateHooks() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); $this->clickLink('Continue'); - $this->assertRaw('Schema version 8001.'); + $this->assertSession()->pageTextContains('Schema version 8001.'); // Run the update hooks. $this->clickLink('Apply pending updates'); $this->checkForMetaRefresh(); diff --git a/web/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php b/web/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php index c9d1cdca98581261f3fba8d8f8e5fd3d66be4413..9c8330455629b37742b649982c8cf66c381e3667 100644 --- a/web/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php +++ b/web/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php @@ -7,7 +7,7 @@ use Drupal\KernelTests\KernelTestBase; /** - * Performs integration tests on drupal_render(). + * Performs integration tests on \Drupal::service('renderer')->render(). * * @group system */ diff --git a/web/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php b/web/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php index 932790d6b45a82506e4895984cfef654c13f18d1..78e9e2799fe62098a344a2257bef8357e2f930c5 100644 --- a/web/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php +++ b/web/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php @@ -135,7 +135,7 @@ public function testDrupalRenderChildren() { '#markup' => 'Foo', ], ]; - $this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', 'drupal_render() avoids #theme recursion loop when rendering a render element.'); + $this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', "\Drupal::service('renderer')->render() avoids #theme recursion loop when rendering a render element."); $element = [ '#theme_wrappers' => ['theme_test_render_element_children'], @@ -143,7 +143,7 @@ public function testDrupalRenderChildren() { '#markup' => 'Foo', ], ]; - $this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', 'drupal_render() avoids #theme_wrappers recursion loop when rendering a render element.'); + $this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', "\Drupal::service('renderer')->render() avoids #theme_wrappers recursion loop when rendering a render element."); } /** diff --git a/web/core/modules/taxonomy/tests/src/Functional/RssTest.php b/web/core/modules/taxonomy/tests/src/Functional/RssTest.php index 284f9f22b5e593bae0c1e762fd585d5ad776c07a..784df374750e79a06573b4da0dd091d3a3d5af94 100644 --- a/web/core/modules/taxonomy/tests/src/Functional/RssTest.php +++ b/web/core/modules/taxonomy/tests/src/Functional/RssTest.php @@ -112,7 +112,7 @@ public function testTaxonomyRss() { 'domain="' . $term1->toUrl('canonical', ['absolute' => TRUE])->toString() . '"', $term1->getName() ); - $this->assertRaw($test_element); + $this->assertSession()->responseContains($test_element); // Test that the feed icon exists for the term. $this->drupalGet("taxonomy/term/{$term1->id()}"); @@ -139,7 +139,7 @@ public function testTaxonomyRss() { $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $raw_xml = '<title>' . $node->label() . '</title>'; $this->drupalGet('taxonomy/term/all/feed'); - $this->assertRaw($raw_xml); + $this->assertSession()->responseContains($raw_xml); // Unpublish the article and check that it is not shown in the feed. $node->setUnpublished()->save(); $this->drupalGet('taxonomy/term/all/feed'); diff --git a/web/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php b/web/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php index 04d030f14844f0359059e39e0275fac95595ad90..cf011b157ef2f9b13c42d46da68a10a356ff7390 100644 --- a/web/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php +++ b/web/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php @@ -248,7 +248,7 @@ public function testTaxonomyTermHierarchyBreadcrumbs() { // Breadcrumbs are not rendered with a language, prevent the term // language from being added to the options. // Check that parent term link is displayed when viewing the node. - $this->assertRaw(Link::fromTextAndUrl($term2->getName(), $term2->toUrl('canonical', ['language' => NULL]))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl($term2->getName(), $term2->toUrl('canonical', ['language' => NULL]))->toString()); } } diff --git a/web/core/modules/taxonomy/tests/src/Functional/TermTest.php b/web/core/modules/taxonomy/tests/src/Functional/TermTest.php index f9a16956212d09b6876d8b3f2c1162c61f7c6c2e..9ea694faba8dd885ecf36e55cbf5ae75f007848f 100644 --- a/web/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/web/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -267,7 +267,7 @@ public function testNodeTermCreationAndDeletion() { // Verify the placeholder is there. $this->drupalGet('node/add/article'); - $this->assertRaw('placeholder="Start typing here."'); + $this->assertSession()->responseContains('placeholder="Start typing here."'); // Preview and verify the terms appear but are not created. $this->submitForm($edit, 'Preview'); @@ -356,7 +356,7 @@ public function testTermInterface() { $this->clickLink('Edit'); // Verify that the randomly generated term is present. - $this->assertRaw($edit['name[0][value]']); + $this->assertSession()->pageTextContains($edit['name[0][value]']); $this->assertSession()->pageTextContains($edit['description[0][value]']); $edit = [ @@ -592,9 +592,9 @@ public function testReSavingTags() { // Check that the term is displayed when editing and saving the node with no // changes. $this->clickLink('Edit'); - $this->assertRaw($term->getName()); + $this->assertSession()->responseContains($term->getName()); $this->submitForm([], 'Save'); - $this->assertRaw($term->getName()); + $this->assertSession()->responseContains($term->getName()); } /** diff --git a/web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php b/web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php index 985b1ce2bbb6c97c313b7b59a9bd949a64c9fcc9..532164353a55284f4923be3aa398b8d44705fe6a 100644 --- a/web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php +++ b/web/core/modules/taxonomy/tests/src/Functional/ThemeTest.php @@ -44,20 +44,20 @@ public function testTaxonomyTermThemes() { $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add'); // Check that the administrative theme's CSS appears on the page for adding // a taxonomy term. - $this->assertRaw('seven/css/base/elements.css'); + $this->assertSession()->responseContains('seven/css/base/elements.css'); // Viewing a taxonomy term should use the default theme. $term = $this->createTerm($vocabulary); $this->drupalGet('taxonomy/term/' . $term->id()); // Check that the default theme's CSS appears on the page for viewing // a taxonomy term. - $this->assertRaw('bartik/css/base/elements.css'); + $this->assertSession()->responseContains('bartik/css/base/elements.css'); // Editing a taxonomy term should use the same theme as adding one. $this->drupalGet('taxonomy/term/' . $term->id() . '/edit'); // Check that the administrative theme's CSS appears on the page for editing // a taxonomy term. - $this->assertRaw('seven/css/base/elements.css'); + $this->assertSession()->responseContains('seven/css/base/elements.css'); } } diff --git a/web/core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php b/web/core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php index 4e0a9b3aa21cbb44aa197d6e03cad88d1eca68ad..fcb5a4c0f0e452bfb6c90d3d59404177bd20e15d 100644 --- a/web/core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php +++ b/web/core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php @@ -89,7 +89,7 @@ protected function setUp(): void { public function testTelephoneWidget() { $this->drupalGet('node/add/article'); $this->assertSession()->fieldValueEquals("field_telephone[0][value]", ''); - $this->assertRaw('placeholder="123-456-7890"'); + $this->assertSession()->responseContains('placeholder="123-456-7890"'); } /** @@ -108,7 +108,7 @@ public function testTelephoneFormatter($input, $expected) { $this->drupalGet('node/add/article'); $this->submitForm($edit, 'Save'); - $this->assertRaw('<a href="tel:' . $expected . '">'); + $this->assertSession()->responseContains('<a href="tel:' . $expected . '">'); } /** diff --git a/web/core/modules/toolbar/src/Element/Toolbar.php b/web/core/modules/toolbar/src/Element/Toolbar.php index e2a9a7ff3bafe9862e245f2f71475c72c0385c0e..9546533fae63e8866f098b5d8654c23dec5813c9 100644 --- a/web/core/modules/toolbar/src/Element/Toolbar.php +++ b/web/core/modules/toolbar/src/Element/Toolbar.php @@ -50,7 +50,7 @@ public function getInfo() { } /** - * Builds the Toolbar as a structured array ready for drupal_render(). + * Builds the Toolbar as a structured array ready for rendering. * * Since building the toolbar takes some time, it is done just prior to * rendering to ensure that it is built only if it will be displayed. diff --git a/web/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/web/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php index 9c0022df7c3f1a9b0b29a2f0e053a00274eb9fb9..40a4b01c7b0d2788521dd48b2726cf0bf854d9ad 100644 --- a/web/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php +++ b/web/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php @@ -103,7 +103,7 @@ protected function setUp(): void { $this->assertSession()->statusCodeEquals(200); // Assert that the toolbar is present in the HTML. - $this->assertRaw('id="toolbar-administration"'); + $this->assertSession()->responseContains('id="toolbar-administration"'); // Store the adminUser admin menu subtrees hash for comparison later. $this->hash = $this->getSubtreesHash(); @@ -185,7 +185,7 @@ public function testUserRoleUpdateSubtreesHashCacheClear() { $this->assertSession()->statusCodeEquals(200); // Assert that the toolbar is present in the HTML. - $this->assertRaw('id="toolbar-administration"'); + $this->assertSession()->responseContains('id="toolbar-administration"'); $admin_user_2_hash = $this->getSubtreesHash(); @@ -195,7 +195,7 @@ public function testUserRoleUpdateSubtreesHashCacheClear() { $this->assertSession()->statusCodeEquals(200); // Assert that the toolbar is present in the HTML. - $this->assertRaw('id="toolbar-administration"'); + $this->assertSession()->responseContains('id="toolbar-administration"'); $this->hash = $this->getSubtreesHash(); @@ -293,7 +293,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() { t($name, [], ['langcode' => $langcode]); // Reset locale cache. $this->container->get('string_translation')->reset(); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); + $this->assertSession()->responseContains('"edit-languages-' . $langcode . '-weight"'); // Verify that the test language was added. $this->assertSession()->pageTextContains($name); @@ -422,7 +422,7 @@ public function testExternalLink() { $this->drupalGet(Url::fromRoute('<front>')); $this->assertSession()->pageTextContains('External URL'); // Ensure the description is escaped as expected. - $this->assertRaw('title="External URL & escaped"'); + $this->assertSession()->responseContains('title="External URL & escaped"'); } /** diff --git a/web/core/modules/toolbar/tests/src/Functional/ToolbarHookToolbarTest.php b/web/core/modules/toolbar/tests/src/Functional/ToolbarHookToolbarTest.php index fee6f2666bb2e5f51994d32910a00fb5a95178d2..d04042a9ef666ba70a027f79ba7ce4cea63b41da 100644 --- a/web/core/modules/toolbar/tests/src/Functional/ToolbarHookToolbarTest.php +++ b/web/core/modules/toolbar/tests/src/Functional/ToolbarHookToolbarTest.php @@ -46,19 +46,19 @@ public function testHookToolbar() { $this->assertSession()->statusCodeEquals(200); // Assert that the toolbar is present in the HTML. - $this->assertRaw('id="toolbar-administration"'); + $this->assertSession()->responseContains('id="toolbar-administration"'); // Assert that the tab registered by toolbar_test is present. - $this->assertRaw('id="toolbar-tab-testing"'); + $this->assertSession()->responseContains('id="toolbar-tab-testing"'); // Assert that the tab item descriptions are present. - $this->assertRaw('title="Test tab"'); + $this->assertSession()->responseContains('title="Test tab"'); // Assert that the tray registered by toolbar_test is present. - $this->assertRaw('id="toolbar-tray-testing"'); + $this->assertSession()->responseContains('id="toolbar-tray-testing"'); // Assert that tray item descriptions are present. - $this->assertRaw('title="Test link 1 title"'); + $this->assertSession()->responseContains('title="Test link 1 title"'); } } diff --git a/web/core/modules/tour/tests/src/Unit/Entity/TourTest.php b/web/core/modules/tour/tests/src/Unit/Entity/TourTest.php index 08944eef2a10e52b9a1e5366d707d1ea62b97a9f..2143175285de8d1d5d4c7f4334d4147e62db2d63 100644 --- a/web/core/modules/tour/tests/src/Unit/Entity/TourTest.php +++ b/web/core/modules/tour/tests/src/Unit/Entity/TourTest.php @@ -29,7 +29,7 @@ class TourTest extends UnitTestCase { public function testHasMatchingRoute($routes, $route_name, $route_params, $result) { $tour = $this->getMockBuilder('\Drupal\tour\Entity\Tour') ->disableOriginalConstructor() - ->setMethods(['getRoutes']) + ->onlyMethods(['getRoutes']) ->getMock(); $tour->expects($this->any()) diff --git a/web/core/modules/tracker/tests/src/Functional/TrackerTest.php b/web/core/modules/tracker/tests/src/Functional/TrackerTest.php index 0ac9a7c71215cca2648a44bcabf8888c8872831e..4c01a0d06dc14ebe3efd23972e4d3812380cfcf5 100644 --- a/web/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/web/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -237,7 +237,7 @@ public function testTrackerUser() { Cache::invalidateTags(['rendered']); $this->drupalGet('user/' . $this->user->id() . '/activity'); $this->assertSession()->assertNoEscaped('<em>' . $this->user->id() . '</em>'); - $this->assertRaw('<em>' . $this->user->id() . '</em>'); + $this->assertSession()->responseContains('<em>' . $this->user->id() . '</em>'); } /** diff --git a/web/core/modules/update/tests/src/Functional/UpdateContribTest.php b/web/core/modules/update/tests/src/Functional/UpdateContribTest.php index 38430d8fa8f484f7e0ec6554df56a895af1e3434..e9ea3f7fc00f5b5b22b1fddc4980aed71b3136b0 100644 --- a/web/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/web/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -69,7 +69,7 @@ public function testNoReleasesAvailable() { // Cannot use $this->standardTests() because we need to check for the // 'No available releases found' string. $this->assertSession()->responseContains('<h3>Drupal core</h3>'); - $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); $this->assertSession()->pageTextContains('Up to date'); $this->assertSession()->responseContains('<h3>Modules</h3>'); $this->assertSession()->pageTextNotContains('Update available'); @@ -106,7 +106,7 @@ public function testUpdateContribBasic() { $this->assertSession()->pageTextContains('Up to date'); $this->assertSession()->responseContains('<h3>Modules</h3>'); $this->assertSession()->pageTextNotContains('Update available'); - $this->assertRaw($project_link); + $this->assertSession()->responseContains($project_link); // Since aaa_update_test is installed the fact it is hidden and in the // Testing package means it should not appear. @@ -129,7 +129,7 @@ public function testUpdateContribBasic() { 'aaa_update_test' => '1_0', ] ); - $this->assertRaw($project_link); + $this->assertSession()->responseContains($project_link); } /** @@ -192,8 +192,8 @@ public function testUpdateContribOrder() { // its own project on the report. $this->assertSession()->responseNotContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // The other two should be listed as projects. - $this->assertRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString()); - $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); // We want to make sure we see the BBB project before the CCC project. // Instead of just searching for 'BBB Update test' or something, we want @@ -400,8 +400,8 @@ public function testUpdateShowDisabledThemes() { $this->assertSession()->pageTextNotMatches('/Themes/'); if ($check_disabled) { $this->assertSession()->pageTextContains('Uninstalled themes'); - $this->assertRaw($base_theme_project_link); - $this->assertRaw($sub_theme_project_link); + $this->assertSession()->responseContains($base_theme_project_link); + $this->assertSession()->responseContains($sub_theme_project_link); } else { $this->assertSession()->pageTextNotContains('Uninstalled themes'); @@ -496,9 +496,9 @@ public function testUpdateBrokenFetchURL() { $this->assertSession()->pageTextContainsOnce('Failed to get available update data for one project.'); // The other two should be listed as projects. - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); $this->assertSession()->responseNotContains(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString()); - $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); } /** @@ -543,7 +543,7 @@ public function testHookUpdateStatusAlter() { $this->drupalGet('admin/reports/updates'); $this->assertSession()->responseContains('<h3>Modules</h3>'); $this->assertSession()->pageTextContains('Security update required!'); - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Visit the reports page again without the altering and make sure the // status is back to normal. @@ -551,7 +551,7 @@ public function testHookUpdateStatusAlter() { $this->drupalGet('admin/reports/updates'); $this->assertSession()->responseContains('<h3>Modules</h3>'); $this->assertSession()->pageTextNotContains('Security update required!'); - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Turn the altering back on and visit the Update manager UI. $update_test_config->set('update_status', $update_status)->save(); diff --git a/web/core/modules/update/tests/src/Functional/UpdateTestBase.php b/web/core/modules/update/tests/src/Functional/UpdateTestBase.php index 40831dd4a2c1d9aae37738a0b6ab7ccca8da9cbc..cab5db30c4eaf9e5f0b67b2745b2314d1767c239 100644 --- a/web/core/modules/update/tests/src/Functional/UpdateTestBase.php +++ b/web/core/modules/update/tests/src/Functional/UpdateTestBase.php @@ -108,7 +108,7 @@ protected function refreshUpdateStatus($xml_map, $url = 'update-test') { protected function standardTests() { $this->assertSession()->responseContains('<h3>Drupal core</h3>'); // Verify that the link to the Drupal project appears. - $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); + $this->assertSession()->responseContains(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); $this->assertSession()->pageTextNotContains('No available releases found'); } diff --git a/web/core/modules/user/src/UserViewsData.php b/web/core/modules/user/src/UserViewsData.php index ae5d681094b2ede91b53be61f31b9d6b47b98b5b..60ddb7ce273a9e1c350acf4af46527ec58898ba0 100644 --- a/web/core/modules/user/src/UserViewsData.php +++ b/web/core/modules/user/src/UserViewsData.php @@ -233,7 +233,7 @@ public function getViewsData() { 'name field' => 'name', 'empty field name' => $this->t('No role'), 'zero is null' => TRUE, - 'numeric' => TRUE, + 'numeric' => FALSE, ]; $data['user__roles']['permission'] = [ diff --git a/web/core/modules/user/tests/src/Functional/UserAdminTest.php b/web/core/modules/user/tests/src/Functional/UserAdminTest.php index 65acd73caa310854a910934bea8212ce795291d5..ae93524c788a81556394eed9f42cbc213bf15b7b 100644 --- a/web/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/web/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -76,7 +76,7 @@ public function testUserAdmin() { // Test for existence of edit link in table. $link = $user_a->toLink(t('Edit'), 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString(); - $this->assertRaw($link); + $this->assertSession()->responseContains($link); // Test exposed filter elements. foreach (['user', 'role', 'permission', 'status'] as $field) { @@ -185,7 +185,7 @@ public function testNotificationEmailAddress() { ]); $this->drupalLogin($admin_user); $this->drupalGet('admin/config/people/accounts'); - $this->assertRaw('id="edit-mail-notification-address"'); + $this->assertSession()->responseContains('id="edit-mail-notification-address"'); $this->drupalLogout(); // Test custom user registration approval email address(es). diff --git a/web/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/web/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index 85c3e1986bece691b46abd86ee522adad2fcdfa7..515a149f4849ecbb4a3e507852a6978016974481 100644 --- a/web/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/web/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\user\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Database\Database; use Drupal\Core\Test\AssertMailTrait; use Drupal\Core\Url; @@ -331,10 +330,9 @@ public function testUserPasswordResetLoggedIn() { // Log in as a different user. $this->drupalLogin($this->account); $this->drupalGet($resetURL); - $this->assertRaw(new FormattableMarkup( - 'Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href=":logout">log out</a> and try using the link again.', - ['%other_user' => $this->account->getAccountName(), '%resetting_user' => $another_account->getAccountName(), ':logout' => Url::fromRoute('user.logout')->toString()] - )); + $this->assertSession()->pageTextContains("Another user ({$this->account->getAccountName()}) is already logged into the site on this computer, but you tried to use a one-time link for user {$another_account->getAccountName()}. Please log out and try using the link again."); + $this->assertSession()->linkExists('log out'); + $this->assertSession()->linkByHrefExists(Url::fromRoute('user.logout')->toString()); $another_account->delete(); $this->drupalGet($resetURL); diff --git a/web/core/modules/user/tests/src/Functional/UserPictureTest.php b/web/core/modules/user/tests/src/Functional/UserPictureTest.php index b510806189ac0e835649d3002ad8bc9cdad386b2..b6a66ce8464f15bbc618d1a97c3045854d0b5742 100644 --- a/web/core/modules/user/tests/src/Functional/UserPictureTest.php +++ b/web/core/modules/user/tests/src/Functional/UserPictureTest.php @@ -72,7 +72,7 @@ public function testCreateDeletePicture() { // Verify that the image is displayed on the user account page. $this->drupalGet('user'); - $this->assertRaw(StreamWrapperManager::getTarget($file->getFileUri())); + $this->assertSession()->responseContains(StreamWrapperManager::getTarget($file->getFileUri())); // Delete the picture. $edit = []; diff --git a/web/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/web/core/modules/user/tests/src/Functional/UserRegistrationTest.php index 465c74d3a2985015ed18f3322150cb922f62c422..4575ee9ba8e81db4c00aeb4b4d774d99522d0629 100644 --- a/web/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/web/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\user\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldConfig; @@ -293,12 +292,12 @@ public function testUniqueFields() { $edit = ['mail' => 'test@example.com', 'name' => $account->getAccountName()]; $this->drupalGet('user/register'); $this->submitForm($edit, 'Create new account'); - $this->assertRaw(new FormattableMarkup('The username %value is already taken.', ['%value' => $account->getAccountName()])); + $this->assertSession()->pageTextContains("The username {$account->getAccountName()} is already taken."); $edit = ['mail' => $account->getEmail(), 'name' => $this->randomString()]; $this->drupalGet('user/register'); $this->submitForm($edit, 'Create new account'); - $this->assertRaw(new FormattableMarkup('The email address %value is already taken.', ['%value' => $account->getEmail()])); + $this->assertSession()->pageTextContains("The email address {$account->getEmail()} is already taken."); } /** diff --git a/web/core/modules/user/tests/src/Functional/Views/BulkFormAccessTest.php b/web/core/modules/user/tests/src/Functional/Views/BulkFormAccessTest.php index 23617e027a11404d313748d5a494f895646a6070..a95f66724da0b27dbd8d98d6747c782f5f536398 100644 --- a/web/core/modules/user/tests/src/Functional/Views/BulkFormAccessTest.php +++ b/web/core/modules/user/tests/src/Functional/Views/BulkFormAccessTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\user\Functional\Views; -use Drupal\Component\Render\FormattableMarkup; use Drupal\user\Entity\User; /** @@ -60,11 +59,7 @@ public function testUserEditAccess() { $this->submitForm($edit, 'Apply to selected items'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(new FormattableMarkup('No access to execute %action on the @entity_type_label %entity_label.', [ - '%action' => 'Block the selected user(s)', - '@entity_type_label' => 'User', - '%entity_label' => $no_edit_user->label(), - ])); + $this->assertSession()->pageTextContains("No access to execute Block the selected user(s) on the User {$no_edit_user->label()}."); // Re-load the account "no_edit" and ensure it is not blocked. $no_edit_user = User::load($no_edit_user->id()); diff --git a/web/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/web/core/modules/user/tests/src/Functional/Views/BulkFormTest.php index 1ab4de22a8051abd748ae600434bcc9f68c8af4b..74650146e2f790459ff782734a8ebf0b199b489e 100644 --- a/web/core/modules/user/tests/src/Functional/Views/BulkFormTest.php +++ b/web/core/modules/user/tests/src/Functional/Views/BulkFormTest.php @@ -83,7 +83,7 @@ public function testBulkForm() { // Block a user using the bulk form. $this->assertTrue($account->isActive(), 'The user is not blocked.'); - $this->assertRaw($account->label()); + $this->assertSession()->pageTextContains($account->label()); $edit = [ 'user_bulk_form[1]' => TRUE, 'action' => 'user_block_user_action', diff --git a/web/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php b/web/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php index f2e87d53c9e4f24a15f1d51e52f28be48d5cef80..dde9328d752b843b0beea61b7f50ccc20f0b8990 100644 --- a/web/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php +++ b/web/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php @@ -155,7 +155,7 @@ public function testExposedFilter() { $this->drupalGet($path, $options); // The actual result should contain all of the user ids. foreach ($this->accounts as $account) { - $this->assertRaw($account->id()); + $this->assertSession()->pageTextContains($account->id()); } // Pass in an invalid username and a valid username. @@ -175,7 +175,7 @@ public function testExposedFilter() { $this->assertSession()->pageTextNotContains('Unable to find user'); // The actual result should contain all of the user ids. foreach ($this->accounts as $account) { - $this->assertRaw($account->id()); + $this->assertSession()->pageTextContains($account->id()); } // Pass in just valid user IDs in the entity_autocomplete target_id format. @@ -187,7 +187,7 @@ public function testExposedFilter() { $this->assertSession()->pageTextNotContains('Unable to find user'); // The actual result should contain all of the user ids. foreach ($this->accounts as $account) { - $this->assertRaw($account->id()); + $this->assertSession()->pageTextContains($account->id()); } } diff --git a/web/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php b/web/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php index 623203ee74db4d0d997a6b9d618153389a696632..966276bc426ceec30f7cb7ce5c1ccd4740045f8a 100644 --- a/web/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php +++ b/web/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php @@ -17,7 +17,7 @@ class UserTest extends UserSessionTest { protected function createUserSession(array $rids = [], $authenticated = FALSE) { $user = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['get', 'id']) + ->onlyMethods(['get', 'id']) ->getMock(); $user->expects($this->any()) ->method('id') diff --git a/web/core/modules/user/tests/src/Unit/UserAuthTest.php b/web/core/modules/user/tests/src/Unit/UserAuthTest.php index 06c92b9e7e0528e7fbeacd0f2761f06c26d88e4f..2ac6d0c05c1135d9c9688af988a9dd6f6a2b84a3 100644 --- a/web/core/modules/user/tests/src/Unit/UserAuthTest.php +++ b/web/core/modules/user/tests/src/Unit/UserAuthTest.php @@ -71,7 +71,7 @@ protected function setUp(): void { $this->testUser = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['id', 'setPassword', 'save', 'getPassword']) + ->onlyMethods(['id', 'setPassword', 'save', 'getPassword']) ->getMock(); $this->userAuth = new UserAuth($entity_type_manager, $this->passwordService); diff --git a/web/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php b/web/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php index 2fdd0ab6d529dfd4ff01447b85584df8f01619f8..abf16ebe8fbfdf13b7b051f88aee3b24e5496513 100644 --- a/web/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php +++ b/web/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php @@ -566,8 +566,8 @@ public function getSpecialBlocks(); /** * Renders the exposed form as block. * - * @return string|null - * The rendered exposed form as string or NULL otherwise. + * @return array|null + * The renderable exposed form as array or NULL otherwise. */ public function viewExposedFormBlocks(); diff --git a/web/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php b/web/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php index 2562b954c05fc8d26d1c6aed308a41369d5145d6..f332e4b7bd179b7a41fda52533c7d192b233d9f0 100644 --- a/web/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php +++ b/web/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php @@ -255,7 +255,7 @@ public function renderText($alter); public function getRenderTokens($item); /** - * Passes values to drupal_render() using $this->themeFunctions() as #theme. + * Renders row values using $this->themeFunctions() as #theme. * * @param \Drupal\views\ResultRow $values * Holds single row of a view's result set. diff --git a/web/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_user_role_contextual_filter.yml b/web/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_user_role_contextual_filter.yml new file mode 100644 index 0000000000000000000000000000000000000000..80ae8cc242a465f3eda914028685cd026872d00b --- /dev/null +++ b/web/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_user_role_contextual_filter.yml @@ -0,0 +1,192 @@ +langcode: en +status: true +dependencies: + module: + - user +id: test_user_role_contextual_filter +label: 'Test User Role Contextual Filter' +module: views +description: '' +tag: '' +base_table: users_field_data +base_field: uid +display: + default: + display_plugin: default + id: default + display_title: Default + position: 0 + display_options: + access: + type: perm + options: + perm: 'access user profiles' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: ‹‹ + next: ›› + style: + type: default + options: + grouping: { } + row_class: '' + default_row_class: true + uses_fields: false + row: + type: fields + options: + inline: { } + separator: '' + hide_empty: false + default_field_elements: true + fields: + name: + id: name + table: users_field_data + field: name + entity_type: user + entity_field: name + label: '' + alter: + alter_text: false + make_link: false + absolute: false + trim: false + word_boundary: false + ellipsis: false + strip_tags: false + html: false + hide_empty: false + empty_zero: false + plugin_id: field + relationship: none + group_type: group + admin_label: '' + exclude: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_alter_empty: true + click_sort_column: value + type: user_name + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + filters: + status: + value: '1' + table: users_field_data + field: status + plugin_id: boolean + entity_type: user + entity_field: status + id: status + expose: + operator: '' + operator_limit_selection: false + operator_list: { } + group: 1 + sorts: { } + header: { } + footer: { } + empty: { } + relationships: { } + arguments: + roles_target_id: + id: roles_target_id + table: user__roles + field: roles_target_id + relationship: none + group_type: group + admin_label: '' + default_action: ignore + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: fixed + default_argument_options: + argument: '' + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: true + add_table: false + require_value: false + reduce_duplicates: false + entity_type: user + entity_field: roles + plugin_id: user__roles_rid + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user.permissions + tags: { } diff --git a/web/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php b/web/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php index 494048fd786cd8052c3327293e92c84740437d3d..98c552c7fa553440831dbf55e2549f649e725a7a 100644 --- a/web/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php +++ b/web/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php @@ -65,11 +65,11 @@ public function testDropbutton() { // Check if the dropbutton.js library is available. $this->drupalGet('admin/content'); - $this->assertRaw('dropbutton.js'); + $this->assertSession()->responseContains('dropbutton.js'); // Check if the dropbutton.js library is available on a cached page to // ensure that bubbleable metadata is not lost in the views render workflow. $this->drupalGet('admin/content'); - $this->assertRaw('dropbutton.js'); + $this->assertSession()->responseContains('dropbutton.js'); } } diff --git a/web/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersStringTest.php b/web/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersStringTest.php new file mode 100644 index 0000000000000000000000000000000000000000..94849beda2af232990963bcc76415cc49fa920d4 --- /dev/null +++ b/web/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersStringTest.php @@ -0,0 +1,115 @@ +<?php + +namespace Drupal\Tests\views\Functional\Plugin; + +use Drupal\Tests\views\Functional\ViewTestBase; + +/** + * Test contextual filters with 'allow multiple values' setting for user roles. + * + * @group views + */ +class ContextualFiltersStringTest extends ViewTestBase { + + /** + * Modules to enable. + * + * @var array + */ + protected static $modules = [ + 'views_ui', + 'views_test_config', + ]; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'classy'; + + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = ['test_user_role_contextual_filter']; + + /** + * Role id of role 1. + * + * @var string + */ + public $role1; + + /** + * Role id of role 2. + * + * @var string + */ + public $role2; + + /** + * {@inheritdoc} + */ + protected function setUp($import_test_views = TRUE): void { + parent::setUp($import_test_views); + + // Create Roles and users. + $this->role1 = $this->drupalCreateRole(['access content'], 'editor', 'Editor'); + $this->role2 = $this->drupalCreateRole(['access content'], 'publisher', 'Publisher'); + + $this->createUser([], 'user1', FALSE, ['roles' => [$this->role1]]); + $this->createUser([], 'user2', FALSE, ['roles' => [$this->role2]]); + $this->createUser([], 'user3', FALSE, ['roles' => [$this->role1, $this->role2]]); + $this->createUser([], 'user4', FALSE, ['roles' => [$this->role2]]); + $this->createUser([], 'user5', FALSE, ['roles' => [$this->role1, $this->role2]]); + + $this->drupalLogin($this->rootUser); + } + + /** + * Tests contextual filter for the user roles. + */ + public function testUserRoleContextualFilter() { + $this->drupalGet('admin/structure/views/view/test_user_role_contextual_filter'); + $edit = [ + 'view_args' => $this->role1, + ]; + $this->submitForm($edit, 'Update preview'); + $this->assertSession()->pageTextContains('user1'); + $this->assertSession()->pageTextContains('user3'); + $this->assertSession()->pageTextContains('user5'); + $this->assertSession()->pageTextNotContains('user2'); + $this->assertSession()->pageTextNotContains('user4'); + + $edit = [ + 'view_args' => $this->role2, + ]; + $this->submitForm($edit, 'Update preview'); + $this->assertSession()->pageTextContains('user2'); + $this->assertSession()->pageTextContains('user3'); + $this->assertSession()->pageTextContains('user4'); + $this->assertSession()->pageTextContains('user5'); + $this->assertSession()->pageTextNotContains('user1'); + + $edit = [ + 'view_args' => "$this->role1,$this->role2", + ]; + $this->submitForm($edit, 'Update preview'); + $this->assertSession()->pageTextContains('user3'); + $this->assertSession()->pageTextContains('user5'); + $this->assertSession()->pageTextNotContains('user1'); + $this->assertSession()->pageTextNotContains('user2'); + $this->assertSession()->pageTextNotContains('user4'); + + $edit = [ + 'view_args' => "$this->role1+$this->role2", + ]; + $this->submitForm($edit, 'Update preview'); + $this->assertSession()->pageTextContains('user1'); + $this->assertSession()->pageTextContains('user2'); + $this->assertSession()->pageTextContains('user3'); + $this->assertSession()->pageTextContains('user4'); + $this->assertSession()->pageTextContains('user5'); + } + +} diff --git a/web/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php b/web/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php index 663df02fbdba765a37ce4a1a2469be354410413f..8eea7fb9faa658b98eaac1fba920db65c4ac4991 100644 --- a/web/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php +++ b/web/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php @@ -76,7 +76,7 @@ public function testFeedOutput() { $this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title')); $this->assertEquals($node_link, $this->getSession()->getDriver()->getText('//item/link')); // Verify HTML is properly escaped in the description field. - $this->assertRaw('<p>A paragraph</p>'); + $this->assertSession()->responseContains('<p>A paragraph</p>'); $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_display_feed'); $display = &$view->getDisplay('feed_1'); @@ -137,7 +137,7 @@ public function testFeedFieldOutput() { $this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title')); $this->assertEquals($node_link, $this->getSession()->getDriver()->getText('//item/link')); // Verify HTML is properly escaped in the description field. - $this->assertRaw('<p>A paragraph</p>'); + $this->assertSession()->responseContains('<p>A paragraph</p>'); // Change the display to use the nid field, which is rewriting output as // 'node/{{ nid }}' and make sure things are still working. diff --git a/web/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/web/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php index c77bd27c14019566d5a5dbf3a36219a13d67f541..457c4d8150faad73189b7cb7085d7c2115fa6243 100644 --- a/web/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php +++ b/web/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php @@ -222,7 +222,7 @@ public function testExposedBlock() { // Test that the custom block label is found. $this->drupalGet('test_exposed_block'); - $this->assertRaw('<strong>Custom</strong> titlealert("hacked!");'); + $this->assertSession()->responseContains('<strong>Custom</strong> titlealert("hacked!");'); // Set label to hidden on the exposed filter form block. $block->getPlugin()->setConfigurationValue('label_display', FALSE); @@ -356,7 +356,7 @@ public function testExposedSortAndItemsPerPage() { $escape_1 = Html::escape($expected_label); $escape_2 = Html::escape($escape_1); // Make sure we see the single-escaped string in the raw output. - $this->assertRaw($escape_1); + $this->assertSession()->responseContains($escape_1); // But no double-escaped string. $this->assertSession()->responseNotContains($escape_2); // And not the raw label, either. @@ -402,7 +402,7 @@ public function testFormErrorWithExposedForm() { $this->assertNotEmpty($form, 'The exposed form element was found.'); // Ensure the exposed form is rendered before submitting the normal form. $this->assertSession()->responseContains("Apply"); - $this->assertRaw('<div class="views-row">'); + $this->assertSession()->responseContains('<div class="views-row">'); $this->submitForm([], 'Submit'); $this->assertSession()->statusCodeEquals(200); @@ -410,7 +410,7 @@ public function testFormErrorWithExposedForm() { $this->assertNotEmpty($form, 'The exposed form element was found.'); // Ensure the exposed form is rendered after submitting the normal form. $this->assertSession()->responseContains("Apply"); - $this->assertRaw('<div class="views-row">'); + $this->assertSession()->responseContains('<div class="views-row">'); } /** diff --git a/web/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php b/web/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php index b98cdd824b804672cf5008b2ca7ee43b7e58e39d..a60ad0c314c19362b7cef9a7765f1ca815455fb4 100644 --- a/web/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php +++ b/web/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php @@ -58,7 +58,7 @@ public function testNumericFormatPlural() { // Assert that the value is displayed. $this->drupalGet('numeric-test'); - $this->assertRaw('<span class="field-content">0</span>'); + $this->assertSession()->responseContains('<span class="field-content">0</span>'); // Assert that the user interface has controls to change it. $this->drupalGet('admin/structure/views/nojs/handler/numeric_test/page_1/field/count'); @@ -82,7 +82,7 @@ public function testNumericFormatPlural() { } $this->drupalGet('numeric-test'); foreach ($numbers as $i => $number) { - $this->assertRaw('<span class="field-content">' . $number . ($number == 1 ? ' time' : ' times') . '</span>'); + $this->assertSession()->responseContains('<span class="field-content">' . $number . ($number == 1 ? ' time' : ' times') . '</span>'); } // Add Slovenian and set its plural formula to test multiple plural forms. @@ -121,12 +121,12 @@ public function testNumericFormatPlural() { // The view should now use the new plural configuration. $this->drupalGet('sl/numeric-test'); - $this->assertRaw('<span class="field-content">0 time3</span>'); - $this->assertRaw('<span class="field-content">1 time0</span>'); - $this->assertRaw('<span class="field-content">2 time1</span>'); - $this->assertRaw('<span class="field-content">3 time2</span>'); - $this->assertRaw('<span class="field-content">4 time2</span>'); - $this->assertRaw('<span class="field-content">42 time3</span>'); + $this->assertSession()->responseContains('<span class="field-content">0 time3</span>'); + $this->assertSession()->responseContains('<span class="field-content">1 time0</span>'); + $this->assertSession()->responseContains('<span class="field-content">2 time1</span>'); + $this->assertSession()->responseContains('<span class="field-content">3 time2</span>'); + $this->assertSession()->responseContains('<span class="field-content">4 time2</span>'); + $this->assertSession()->responseContains('<span class="field-content">42 time3</span>'); // Add an English configuration translation with English plurals. $english = \Drupal::languageManager()->getLanguageConfigOverride('en', 'views.view.numeric_test'); @@ -134,12 +134,12 @@ public function testNumericFormatPlural() { // The view displayed in English should use the English translation. $this->drupalGet('numeric-test'); - $this->assertRaw('<span class="field-content">0 times</span>'); - $this->assertRaw('<span class="field-content">1 time</span>'); - $this->assertRaw('<span class="field-content">2 times</span>'); - $this->assertRaw('<span class="field-content">3 times</span>'); - $this->assertRaw('<span class="field-content">4 times</span>'); - $this->assertRaw('<span class="field-content">42 times</span>'); + $this->assertSession()->responseContains('<span class="field-content">0 times</span>'); + $this->assertSession()->responseContains('<span class="field-content">1 time</span>'); + $this->assertSession()->responseContains('<span class="field-content">2 times</span>'); + $this->assertSession()->responseContains('<span class="field-content">3 times</span>'); + $this->assertSession()->responseContains('<span class="field-content">4 times</span>'); + $this->assertSession()->responseContains('<span class="field-content">42 times</span>'); } /** diff --git a/web/core/modules/views/tests/src/Functional/Plugin/PagerTest.php b/web/core/modules/views/tests/src/Functional/Plugin/PagerTest.php index 71d2b97ba28f33bdcfe982453bd9392697187db5..686e06b68277c811a346a5f81c2d2ada87e8d72a 100644 --- a/web/core/modules/views/tests/src/Functional/Plugin/PagerTest.php +++ b/web/core/modules/views/tests/src/Functional/Plugin/PagerTest.php @@ -484,7 +484,7 @@ public function testPagerConfigTranslation() { ]; foreach ($labels as $label => $translation) { // Check if we can find the translation. - $this->assertRaw($translation); + $this->assertSession()->pageTextContains($translation); } } @@ -531,7 +531,7 @@ public function testPagerLocale() { $this->drupalGet('nl/test_pager_full', ['query' => ['page' => 1]]); foreach ($labels as $label => $translation) { // Check if we can find the translation. - $this->assertRaw($translation); + $this->assertSession()->pageTextContains($translation); } } diff --git a/web/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php b/web/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php index dcbaf6c165a6d54bd35041f0895a658ba7a4f047..902f985d2ee0ffd05893e435787f0bce5c765c3c 100644 --- a/web/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php +++ b/web/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php @@ -60,7 +60,7 @@ public function testSummaryView() { $this->drupalGet('test-summary'); // Ensure styles are properly added for summary views. - $this->assertRaw('stable/css/views/views.module.css'); + $this->assertSession()->responseContains('stable/css/views/views.module.css'); $summary_list = $this->cssSelect('ul.views-summary li'); $this->assertCount(4, $summary_list); diff --git a/web/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php b/web/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php index a8e0c36ed31dab3fb24be3d58a6b313e27ce8b35..db99f7a6d2752c8c50718a6749ceb29b516abd81 100644 --- a/web/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php +++ b/web/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php @@ -61,8 +61,8 @@ public function testThemedViewPage() { // Make sure a views rendered page is touched. $this->drupalGet('test_page_display_200'); - $this->assertRaw("test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render"); + $this->assertSession()->responseContains("test_basetheme_views_pre_render"); + $this->assertSession()->responseContains("test_basetheme_views_post_render"); // Make sub theme default to test for hook invocation // from both sub and base theme. @@ -74,14 +74,14 @@ public function testThemedViewPage() { // Make sure a views rendered page is touched. $this->drupalGet('test_page_display_200'); - $this->assertRaw("test_subtheme_views_pre_render"); - $this->assertRaw("test_subtheme_views_post_render"); + $this->assertSession()->responseContains("test_subtheme_views_pre_render"); + $this->assertSession()->responseContains("test_subtheme_views_post_render"); - $this->assertRaw("test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render"); + $this->assertSession()->responseContains("test_basetheme_views_pre_render"); + $this->assertSession()->responseContains("test_basetheme_views_post_render"); // Verify that the views group title is added. - $this->assertRaw('<em class="placeholder">' . count($this->dataSet()) . '</em> items found.'); + $this->assertSession()->responseContains('<em class="placeholder">' . count($this->dataSet()) . '</em> items found.'); } } diff --git a/web/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/web/core/modules/views/tests/src/Functional/Wizard/BasicTest.php index 5e48df6338925facd932e485d9929b7720c45a54..75812cecf54d7afad04faf5418624a1b26e68591 100644 --- a/web/core/modules/views/tests/src/Functional/Wizard/BasicTest.php +++ b/web/core/modules/views/tests/src/Functional/Wizard/BasicTest.php @@ -92,9 +92,9 @@ public function testViewsWizardAndListing() { $this->assertEquals('2.0', $this->getSession()->getDriver()->getAttribute('//rss', 'version')); // The feed should have the same title and nodes as the page. $this->assertSession()->responseContains($view2['page[title]']); - $this->assertRaw($node1->toUrl('canonical', ['absolute' => TRUE])->toString()); + $this->assertSession()->responseContains($node1->toUrl('canonical', ['absolute' => TRUE])->toString()); $this->assertSession()->responseContains($node1->label()); - $this->assertRaw($node2->toUrl('canonical', ['absolute' => TRUE])->toString()); + $this->assertSession()->responseContains($node2->toUrl('canonical', ['absolute' => TRUE])->toString()); $this->assertSession()->responseContains($node2->label()); // Go back to the views page and check if this view is there. diff --git a/web/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/web/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index 81b15bb0d11d0b9c8a13efc59161efdde8680c0e..859243f6873b87b5f63b7b04a8617529944ed213 100644 --- a/web/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/web/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -110,7 +110,7 @@ protected function setUp(): void { ]; $this->renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer') ->setConstructorArgs($args) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $container = new ContainerBuilder(); $container->set('renderer', $this->renderer); diff --git a/web/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/web/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php index b3dcbdc2617b58148088ff584729a1453d69bf89..446dbc8be73170fc9465072c098e531260951448 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php @@ -70,7 +70,7 @@ protected function setUp(): void { $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() - ->setMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage', 'getShowAdminLinks']) + ->onlyMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage', 'getShowAdminLinks']) ->getMock(); $this->executable->expects($this->any()) ->method('setDisplay') @@ -82,7 +82,7 @@ protected function setUp(): void { $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->view = $this->getMockBuilder('Drupal\views\Entity\View') diff --git a/web/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php b/web/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php index 1bc802d1cbaf8becea438a5c86d5fa5e088d2e70..de5e12ef28d3e85a55faab29acad1e5451502dbe 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php @@ -78,7 +78,7 @@ public function testGetDerivativeDefinitionsWithoutLocalTask() { ->disableOriginalConstructor() ->getMock(); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') - ->setMethods(['getOption']) + ->onlyMethods(['getOption']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $display_plugin->expects($this->once()) @@ -133,7 +133,7 @@ public function testGetDerivativeDefinitionsWithLocalTask() { ->willReturn($storage); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') - ->setMethods(['getOption']) + ->onlyMethods(['getOption']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $display_plugin->expects($this->once()) @@ -186,7 +186,7 @@ public function testGetDerivativeDefinitionsWithOverrideRoute() { ->willReturn($storage); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') - ->setMethods(['getOption']) + ->onlyMethods(['getOption']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $display_plugin->expects($this->once()) @@ -235,7 +235,7 @@ public function testGetDerivativeDefinitionsWithDefaultLocalTask() { ->willReturn($storage); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') - ->setMethods(['getOption']) + ->onlyMethods(['getOption']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $display_plugin->expects($this->exactly(2)) @@ -304,7 +304,7 @@ public function testGetDerivativeDefinitionsWithExistingLocalTask() { ->willReturn($storage); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') - ->setMethods(['getOption', 'getPath']) + ->onlyMethods(['getOption', 'getPath']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $display_plugin->expects($this->exactly(2)) diff --git a/web/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php b/web/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php index 212f249696018f43424d7cf41c2997ee6c02f72c..8d7aa0f02e9c707c4e4321d0cd3a6597a8b8d417 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php @@ -21,7 +21,7 @@ class QueryParameterTest extends UnitTestCase { public function testGetArgument($options, Request $request, $expected) { $view = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $view->setRequest($request); $display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') diff --git a/web/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php b/web/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php index f3531e97256c7aeb08a4cd4816e6f4266cd90f70..7429aefb8a6cf06868890a9fe6a60d851293247b 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php @@ -56,7 +56,7 @@ protected function setUp(): void { $this->state = $this->createMock('\Drupal\Core\State\StateInterface'); $this->pathPlugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') ->setConstructorArgs([[], 'path_base', [], $this->routeProvider, $this->state]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->setupContainer(); } @@ -127,7 +127,7 @@ public function testCollectRoutesWithDisplayReturnResponse() { ]; $this->pathPlugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') ->setConstructorArgs([[], 'path_base', ['returns_response' => TRUE], $this->routeProvider, $this->state]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->pathPlugin->initDisplay($view, $display); diff --git a/web/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php b/web/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php index cbfe00c19b9af11d512263599822024ba511bd1a..aeb8cae4d0683454212ff25a209f6ce5bdba0574 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php @@ -79,7 +79,7 @@ protected function setUp(): void { $this->pager = $this->getMockBuilder('Drupal\views\Plugin\views\pager\Full') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->view->display_handler = $this->display; diff --git a/web/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/web/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php index b72947321c5232854696076a280f3f5bfdfc2499..15c4e5b4d98bf2b5eec6cdb55424f1474732fd2d 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php @@ -653,7 +653,7 @@ public function providerTestRenderAsExternalLinkWithPathAndTokens() { protected function setupTestField(array $options = []) { /** @var \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField $field */ $field = $this->getMockBuilder('Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTestField') - ->setMethods(['l']) + ->addMethods(['l']) ->setConstructorArgs([$this->configuration, $this->pluginId, $this->pluginDefinition]) ->getMock(); $field->init($this->executable, $this->display, $options); diff --git a/web/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php b/web/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php index 83ce7efae9c21995446df9d5dd3d7201a7bebc5e..5cea3d915fa063e3f1b42918cb1f75d43b8acbfa 100644 --- a/web/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php +++ b/web/core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php @@ -39,7 +39,7 @@ protected function setUp(): void { $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() - ->setMethods(['executeDisplay', 'setDisplay', 'setItemsPerPage']) + ->onlyMethods(['executeDisplay', 'setDisplay', 'setItemsPerPage']) ->getMock(); $this->executable->expects($this->any()) ->method('setDisplay') @@ -48,7 +48,7 @@ protected function setUp(): void { $this->blockDisplay = $this->executable->display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\Block') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->blockDisplay->view = $this->executable; diff --git a/web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php index 1c79b478c218c8646f83dad06f102e914f1a812b..012841d2c1669fc3d69e326684a2b27bd6fd28fc 100644 --- a/web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php @@ -214,7 +214,7 @@ public function testPathDestination() { $this->assertSession()->linkByHrefExists('test_page_display_menu/local'); // Check that a dynamic path is shown as text. - $this->assertRaw('test_route_with_suffix/%/suffix'); + $this->assertSession()->responseContains('test_route_with_suffix/%/suffix'); $this->assertSession()->linkByHrefNotExists(Url::fromUri('base:test_route_with_suffix/%/suffix')->toString()); } diff --git a/web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php b/web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php index 90d9e68155a208693220d069f21cced3fde0317b..84e691c3db4d95960609df4249877e91d47dc996 100644 --- a/web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php @@ -94,8 +94,8 @@ public function doPathXssFilterTest() { $this->assertSession()->assertEscaped('/<script>alert("hello");</script>'); $this->assertSession()->assertEscaped('/<script>alert("hello I have placeholders %");</script>'); // Links should be url-encoded. - $this->assertRaw('/%3Cobject%3Emalformed_path%3C/object%3E'); - $this->assertRaw('/%3Cscript%3Ealert%28%22hello%22%29%3B%3C/script%3E'); + $this->assertSession()->responseContains('/%3Cobject%3Emalformed_path%3C/object%3E'); + $this->assertSession()->responseContains('/%3Cscript%3Ealert%28%22hello%22%29%3B%3C/script%3E'); } /** diff --git a/web/core/modules/views_ui/tests/src/Functional/FilterUITest.php b/web/core/modules/views_ui/tests/src/Functional/FilterUITest.php index a6c265bb3153aa89c3a39fae5e8388bbac69be9e..33231e49922ac1d09eaa320efd4adfe7bb06b7f8 100644 --- a/web/core/modules/views_ui/tests/src/Functional/FilterUITest.php +++ b/web/core/modules/views_ui/tests/src/Functional/FilterUITest.php @@ -90,7 +90,7 @@ public function testFiltersUI() { $this->submitForm([], 'Remove group 3'); // Verify that the group 4 is now named as 3. - $this->assertRaw('<span>Group 3</span>'); + $this->assertSession()->responseContains('<span>Group 3</span>'); // Remove the group 3 again. $this->submitForm([], 'Remove group 3'); diff --git a/web/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/web/core/modules/views_ui/tests/src/Functional/HandlerTest.php index e9b4458b2be6e5398d46a16b458656166ee58f63..3815a9ec678fdf136d623098cafcecd8f6da9992 100644 --- a/web/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -280,7 +280,7 @@ public function testErrorMissingHelp() { // description field is shown instead. $this->drupalGet('admin/structure/views/nojs/add-handler/test_node_view/default/field'); $this->assertSession()->pageTextNotContains('Error: missing help'); - $this->assertRaw('<td class="description"></td>'); + $this->assertSession()->responseContains('<td class="description"></td>'); // Test that no error message is shown for other fields. $this->drupalGet('admin/structure/views/nojs/add-handler/test_view_empty/default/field'); diff --git a/web/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/web/core/modules/views_ui/tests/src/Functional/PreviewTest.php index dc69eed2d5cf5df4c2d0e150599c0be72a807257..8b8add01a9cb118fa7328408f0b105460ba733d6 100644 --- a/web/core/modules/views_ui/tests/src/Functional/PreviewTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/PreviewTest.php @@ -101,7 +101,7 @@ public function testPreviewUI() { $this->assertSession()->pageTextContains('Query build time'); $this->assertSession()->pageTextContains('Query execute time'); $this->assertSession()->pageTextContains('View render time'); - $this->assertRaw('<strong>Query</strong>'); + $this->assertSession()->responseContains('<strong>Query</strong>'); $query_string = <<<SQL SELECT "views_test_data"."name" AS "views_test_data_name" FROM @@ -143,7 +143,7 @@ public function testPreviewAdditionalInfo() { $this->assertSession()->elementsCount('xpath', '//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()="Test row count"]', 1); // Check that additional assets are attached. $this->assertStringContainsString('views_ui_test/views_ui_test.test', $this->getDrupalSettings()['ajaxPageState']['libraries'], 'Attached library found.'); - $this->assertRaw('css/views_ui_test.test.css'); + $this->assertSession()->responseContains('css/views_ui_test.test.css'); } /** diff --git a/web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php b/web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php index 98d0077c51e4589f9d13960884eb20e5c439f428..6b37b8004f4f43df7575abcbb69ffebd78e3cb67 100644 --- a/web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php @@ -32,8 +32,8 @@ class ReportFieldsTest extends UITestBase { */ public function testReportFields() { $this->drupalGet('admin/reports/fields/views-fields'); - $this->assertRaw('Used in views'); - $this->assertRaw('No fields have been used in views yet.'); + $this->assertSession()->pageTextContains('Used in views'); + $this->assertSession()->pageTextContains('No fields have been used in views yet.'); // Set up the field_test field. $field_storage = FieldStorageConfig::create([ @@ -52,9 +52,9 @@ public function testReportFields() { // Assert that the newly created field appears in the overview. $this->drupalGet('admin/reports/fields/views-fields'); - $this->assertRaw('<td>field_test</td>'); - $this->assertRaw('>test_field_field_test</a>'); - $this->assertRaw('Used in views'); + $this->assertSession()->responseContains('<td>field_test</td>'); + $this->assertSession()->responseContains('>test_field_field_test</a>'); + $this->assertSession()->pageTextContains('Used in views'); } } diff --git a/web/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/web/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php index 39467130ee4cea89e0ebe1a3d27192dc0660c2ce..ff6e34ceca80a1554b78a9e89aa6170553578e47 100644 --- a/web/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php +++ b/web/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php @@ -76,14 +76,14 @@ public function testBuildRowEntityList() { ]); $default_display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DefaultDisplay') - ->setMethods(['initDisplay']) + ->onlyMethods(['initDisplay']) ->setConstructorArgs([[], 'default', $display_manager->getDefinition('default')]) ->getMock(); $route_provider = $this->createMock('Drupal\Core\Routing\RouteProviderInterface'); $state = $this->createMock('\Drupal\Core\State\StateInterface'); $menu_storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $page_display = $this->getMockBuilder('Drupal\views\Plugin\views\display\Page') - ->setMethods(['initDisplay', 'getPath']) + ->onlyMethods(['initDisplay', 'getPath']) ->setConstructorArgs([[], 'default', $display_manager->getDefinition('page'), $route_provider, $state, $menu_storage]) ->getMock(); $page_display->expects($this->any()) @@ -94,7 +94,7 @@ public function testBuildRowEntityList() { $this->returnValue('<script>alert("placeholder_page/%")</script>'))); $embed_display = $this->getMockBuilder('Drupal\views\Plugin\views\display\Embed') - ->setMethods(['initDisplay']) + ->onlyMethods(['initDisplay']) ->setConstructorArgs([[], 'default', $display_manager->getDefinition('embed')]) ->getMock(); diff --git a/web/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php b/web/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php index c45c85a1dc4d0818d8b4bccc28fb9415dec5b0f2..480b679537d745157454eb417e77c98cc1a9b9a2 100644 --- a/web/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php +++ b/web/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php @@ -45,7 +45,7 @@ public function testEntityDecoration() { } $storage = $this->getMockBuilder('Drupal\views\Entity\View') - ->setMethods($interface_methods) + ->onlyMethods($interface_methods) ->setConstructorArgs([[], 'view']) ->getMock(); $executable = $this->getMockBuilder('Drupal\views\ViewExecutable') diff --git a/web/core/profiles/standard/tests/src/Functional/StandardTest.php b/web/core/profiles/standard/tests/src/Functional/StandardTest.php index fdc7d5a64f1401f8c28798e5d7d2a859da860e1a..4a8f92ac3332cabdf864b3cc7240bfae6f73f22f 100644 --- a/web/core/profiles/standard/tests/src/Functional/StandardTest.php +++ b/web/core/profiles/standard/tests/src/Functional/StandardTest.php @@ -83,7 +83,7 @@ public function testStandard() { $this->drupalLogin($this->adminUser); $this->drupalGet('node/1'); // Verify that a line break is present. - $this->assertRaw('Then she picked out two somebodies,<br />Sally and me'); + $this->assertSession()->responseContains('Then she picked out two somebodies,<br />Sally and me'); $this->submitForm([ 'subject[0][value]' => 'Barfoo', 'comment_body[0][value]' => 'Then she picked out two somebodies, Sally and me', diff --git a/web/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php b/web/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php index 2add2c5aa8441b6e530bf42887132f9bb355aef2..29388641174e757a293572a373080ccb65c55acc 100644 --- a/web/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php +++ b/web/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php @@ -95,7 +95,7 @@ public function testCopyCodebaseExclude() { // Mock BuildTestBase so that it thinks our VFS is the Drupal root. /** @var \PHPUnit\Framework\MockObject\MockBuilder|\Drupal\BuildTests\Framework\BuildTestBase $base */ $base = $this->getMockBuilder(BuildTestBase::class) - ->setMethods(['getDrupalRoot']) + ->onlyMethods(['getDrupalRoot']) ->getMockForAbstractClass(); $base->expects($this->exactly(2)) ->method('getDrupalRoot') diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php index fe2ece56b179f70658a6828afa00f4ed8a299a00..7e19154118cedff2716f06cc31583cf95b0cae02 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php @@ -86,9 +86,9 @@ protected function setUpLanguage() { chmod($filename, 0444); // Verify that the distribution name appears. - $this->assertRaw($this->info['distribution']['name']); + $this->assertSession()->pageTextContains($this->info['distribution']['name']); // Verify that the requested theme is used. - $this->assertRaw($this->info['distribution']['install']['theme']); + $this->assertSession()->responseContains($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. $this->assertSession()->pageTextNotContains('profile'); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php index a5388abc08cb29c604df1cdfd7d16988fc255ac9..d8efca525c1f0d5b89917ac8878bfae41a6c247f 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @@ -49,11 +49,11 @@ protected function prepareEnvironment() { */ protected function setUpLanguage() { // Verify that the distribution name appears. - $this->assertRaw($this->info['distribution']['name']); + $this->assertSession()->pageTextContains($this->info['distribution']['name']); // Verify that the distribution name is used in the site title. $this->assertSession()->titleEquals('Choose language | ' . $this->info['distribution']['name']); // Verify that the requested theme is used. - $this->assertRaw($this->info['distribution']['install']['theme']); + $this->assertSession()->responseContains($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. $this->assertSession()->pageTextNotContains('profile'); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php index ebc9b62b619d0e2c7d03ab1bcd53be72ca3f6d2a..a83452e3399b002104d9a80afa50d4054f5c118b 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php @@ -97,9 +97,9 @@ protected function setUpSettings() { $this->assertEquals('ltr', $direction); // Verify that the distribution name appears. - $this->assertRaw($this->info['distribution']['name']); + $this->assertSession()->pageTextContains($this->info['distribution']['name']); // Verify that the requested theme is used. - $this->assertRaw($this->info['distribution']['install']['theme']); + $this->assertSession()->responseContains($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. $this->assertSession()->pageTextNotContains('profile'); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php index e43d7b39217606142ae2d829aa2020a6b19d0b3a..90c8c4c62c519f50021b93cbdcbb72d09bea29ab 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php @@ -88,9 +88,9 @@ protected function setUpSettings() { $this->assertEquals('ltr', $direction); // Verify that the distribution name appears. - $this->assertRaw($this->info['distribution']['name']); + $this->assertSession()->pageTextContains($this->info['distribution']['name']); // Verify that the requested theme is used. - $this->assertRaw($this->info['distribution']['install']['theme']); + $this->assertSession()->responseContains($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. $this->assertSession()->pageTextNotContains('profile'); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php index 036196471e11eb43679cb5667a557bd7b6ab4bc0..b47c6d33a20af716a9c91e4c62a4e994c41a788c 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php @@ -49,7 +49,7 @@ protected function setUpSite() { * Verifies that the error message in the settings step is correct. */ public function testSetUpSettingsErrorMessage() { - $this->assertRaw('<ul><li>Failed to <strong>CREATE</strong> a test table'); + $this->assertSession()->responseContains('<ul><li>Failed to <strong>CREATE</strong> a test table'); } } diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php index 1c8bfb9e5cec60b842f1a0d3402f6d240ce24143..663bad70f25faf86463b24fe8bf70ee9bd448193 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php @@ -21,7 +21,7 @@ class InstallerExistingInstallationTest extends InstallerTestBase { public function testInstaller() { // Verify that Drupal can't be immediately reinstalled. $this->visitInstaller(); - $this->assertRaw('Drupal already installed'); + $this->assertSession()->pageTextContains('Drupal already installed'); // Delete settings.php and attempt to reinstall again. unlink($this->siteDirectory . '/settings.php'); @@ -30,7 +30,7 @@ public function testInstaller() { $this->setUpProfile(); $this->setUpRequirementsProblem(); $this->setUpSettings(); - $this->assertRaw('Drupal already installed'); + $this->assertSession()->pageTextContains('Drupal already installed'); } } diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php index 73bc4551b38a1954ddad2e741be28790ecd977e5..7e17ec16fb9821ae75e401b423bc2e9af1d51aea 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php @@ -28,12 +28,12 @@ protected function setUpLanguage() { $this->visitInstaller(); foreach (LanguageManager::getStandardLanguageList() as $langcode => $names) { $this->assertSession()->optionExists('edit-langcode', $langcode); - $this->assertRaw('>' . $names[1] . '<'); + $this->assertSession()->responseContains('>' . $names[1] . '<'); } // Check that our custom one shows up with the file name indicated language. $this->assertSession()->optionExists('edit-langcode', 'xoxo'); - $this->assertRaw('>xoxo<'); + $this->assertSession()->responseContains('>xoxo<'); parent::setUpLanguage(); } diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php index 92c402e7c3f3eab2043e4abfaa4f129342363789..4b3f1c605e01f64b37828d09e4280c1c0d74fa60 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @@ -51,8 +51,8 @@ public function testInstaller() { protected function setUpLanguage() { // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets and // metatags as expected to the first page of the installer. - $this->assertRaw("core/themes/seven/css/components/buttons.css"); - $this->assertRaw('<meta charset="utf-8" />'); + $this->assertSession()->responseContains("core/themes/seven/css/components/buttons.css"); + $this->assertSession()->responseContains('<meta charset="utf-8" />'); // Assert that the expected title is present. $this->assertEquals('Choose language', $this->cssSelect('main h2')[0]->getText()); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php index a67ac13782c5f500283508a8d2b5ae8df8580c09..b8c6aa378f5fdc035da9d30370d65006af32fb3b 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php @@ -67,8 +67,8 @@ protected function setUpSettings() { // Ensure that the error message translation is working. // cSpell:disable - $this->assertRaw('Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der <a href="https://www.drupal.org/docs/8/install">Installationshandbuch</a>, oder kontaktieren Sie Ihren Hosting-Anbieter.'); - $this->assertRaw('<strong>CREATE</strong> ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl <em class="placeholder">CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)</em> fehlgeschlagen.'); + $this->assertSession()->responseContains('Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der <a href="https://www.drupal.org/docs/8/install">Installationshandbuch</a>, oder kontaktieren Sie Ihren Hosting-Anbieter.'); + $this->assertSession()->responseContains('<strong>CREATE</strong> ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl <em class="placeholder">CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)</em> fehlgeschlagen.'); // cSpell:enable // Now do it successfully. @@ -108,7 +108,7 @@ public function testInstaller() { $this->drupalGet('admin/config/development/performance'); $this->submitForm($edit, 'Save configuration'); $this->drupalGet('<front>'); - $this->assertRaw('classy/css/components/action-links.css'); + $this->assertSession()->responseContains('classy/css/components/action-links.css'); // Verify the strings from the translation files were imported. $test_samples = ['Save and continue', 'Anonymous']; diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php index 1c03b84049261b974854c51521a87673ab92a4c2..ca71d7fb04270d053b65c47edab5563a93be044d 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php @@ -55,9 +55,9 @@ protected function prepareEnvironment() { */ protected function setUpLanguage() { // Verify that the distribution name appears. - $this->assertRaw('distribution_one'); + $this->assertSession()->pageTextContains('distribution_one'); // Verify that the requested theme is used. - $this->assertRaw('bartik'); + $this->assertSession()->responseContains('bartik'); // Verify that the "Choose profile" step does not appear. $this->assertSession()->pageTextNotContains('profile'); diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php index 48cafa3d99c84a374ca429dd907d9ede7b784429..a828dda00f372fb0a38b41f034c9aae301603b77 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php @@ -38,7 +38,7 @@ protected function installParameters() { */ public function testSiteName() { $this->drupalGet(''); - $this->assertRaw($this->siteName); + $this->assertSession()->pageTextContains($this->siteName); } } diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php index c6747386f500a7bb2c3828e445fab747a945857e..466c5373592961cd9ad4e702cf7cc1967799f4ef 100644 --- a/web/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php @@ -19,7 +19,7 @@ class StandardInstallerTest extends ConfigAfterInstallerTestBase { */ public function testInstaller() { // Verify that the Standard install profile's default frontpage appears. - $this->assertRaw('No front page content has been created yet.'); + $this->assertSession()->pageTextContains('No front page content has been created yet.'); // Ensure that the contact link enabled in standard_install() works as // expected. $this->clickLink('Contact'); @@ -33,7 +33,7 @@ public function testInstaller() { protected function setUpSite() { // Test that the correct theme is being used. $this->assertSession()->responseNotContains('bartik'); - $this->assertRaw('themes/seven/css/theme/install-page.css'); + $this->assertSession()->responseContains('themes/seven/css/theme/install-page.css'); parent::setUpSite(); } diff --git a/web/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php b/web/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php index 9b3ad74784b9d974efa3fdf583d2fd798e27fe3c..1badabf54067af99d518190e3dea87a5e66c435c 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php @@ -158,7 +158,7 @@ public function testGetLoggingWrongKey() { public function testContribDriverLog($driver_namespace, $stack, array $expected_entry) { $mock_builder = $this->getMockBuilder(Log::class); $log = $mock_builder - ->setMethods(['getDebugBacktrace']) + ->onlyMethods(['getDebugBacktrace']) ->setConstructorArgs(['test']) ->getMock(); $log->expects($this->once()) diff --git a/web/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/web/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php index fe68e84a35057f08c53691256ed042f283e6fdfe..61ffb8dd1602bdba533956b17e35847458faa889 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php @@ -45,7 +45,7 @@ public function testEntityViewBuilderCache() { $cache_contexts_manager = \Drupal::service("cache_contexts_manager"); $cache = \Drupal::cache(); - // Force a request via GET so we can get drupal_render() cache working. + // Force a request via GET so cache is rendered. $request = \Drupal::request(); $request_method = $request->server->get('REQUEST_METHOD'); $request->setMethod('GET'); @@ -99,7 +99,8 @@ public function testEntityViewBuilderCacheWithReferences() { $renderer = $this->container->get('renderer'); $cache_contexts_manager = \Drupal::service("cache_contexts_manager"); - // Force a request via GET so we can get drupal_render() cache working. + // Force a request via GET so we can get + // \Drupal::service('renderer')->render() cache working. $request = \Drupal::request(); $request_method = $request->server->get('REQUEST_METHOD'); $request->setMethod('GET'); diff --git a/web/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php b/web/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php index 1a24edaffe62615877bd68e3d6ddf4e3f751d39c..44ebd36187166b1e9275236eb1102b0e1755f1c8 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php @@ -73,7 +73,7 @@ public function testShouldRedirectToInstaller($expected, $exception, $connection catch (\Exception $e) { // Mock the trait. $trait = $this->getMockBuilder(InstallerRedirectTrait::class) - ->setMethods(['isCli']) + ->onlyMethods(['isCli']) ->getMockForTrait(); // Make sure that the method thinks we are not using the cli. @@ -95,14 +95,14 @@ public function testShouldRedirectToInstaller($expected, $exception, $connection // Mock the database connection. $connection = $this->getMockBuilder(Connection::class) ->disableOriginalConstructor() - ->setMethods(['schema']) + ->onlyMethods(['schema']) ->getMockForAbstractClass(); if ($connection_info) { // Mock the database schema class. $schema = $this->getMockBuilder(Schema::class) ->disableOriginalConstructor() - ->setMethods(['tableExists']) + ->onlyMethods(['tableExists']) ->getMockForAbstractClass(); $schema->expects($this->any()) diff --git a/web/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php b/web/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php index 2205e7c0715ecc42643adac66500406fcd397d07..28b762ffcc328781a6ad2e11134ff22fa1e05408 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php @@ -43,7 +43,7 @@ public function setUp(): void { $plugin_definition->addContextDefinition('nato_letter', ContextDefinition::create('string')); $this->plugin = $this->getMockBuilder(ContextAwarePluginBase::class) ->setConstructorArgs([$configuration, 'the_sisko', $plugin_definition]) - ->setMethods(['setContext']) + ->onlyMethods(['setContext']) ->getMockForAbstractClass(); } diff --git a/web/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/web/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php index 286ea3554ed0ac8b346f6bd38f50661f8a1a424b..b589d0e5f6995450651e08b0fdb728b85d3d2f14 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php @@ -7,7 +7,7 @@ use Drupal\KernelTests\KernelTestBase; /** - * Tests the markup of core render element types passed to drupal_render(). + * Tests the rendered markup of core render element types. * * @group Common */ @@ -182,7 +182,7 @@ public function testMoreLink() { foreach ($elements as $element) { $xml = new \SimpleXMLElement(\Drupal::service('renderer')->renderRoot($element['value'])); $result = $xml->xpath($element['expected']); - $this->assertNotEmpty($result, '"' . $element['name'] . '" input rendered correctly by drupal_render().'); + $this->assertNotEmpty($result, '"' . $element['name'] . '" input rendered correctly.'); } } @@ -213,7 +213,7 @@ public function testSystemCompactLink() { foreach ($elements as $element) { $xml = new \SimpleXMLElement(\Drupal::service('renderer')->renderRoot($element['value'])); $result = $xml->xpath($element['expected']); - $this->assertNotEmpty($result, '"' . $element['name'] . '" is rendered correctly by drupal_render().'); + $this->assertNotEmpty($result, '"' . $element['name'] . '" is rendered correctly.'); } // Set admin compact mode on for additional tests. @@ -229,7 +229,7 @@ public function testSystemCompactLink() { $xml = new \SimpleXMLElement(\Drupal::service('renderer')->renderRoot($element['value'])); $result = $xml->xpath($element['expected']); - $this->assertNotEmpty($result, '"' . $element['name'] . '" is rendered correctly by drupal_render().'); + $this->assertNotEmpty($result, '"' . $element['name'] . '" is rendered correctly.'); } } diff --git a/web/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php b/web/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php index ad1d112e68a1406a7fc2f9f196375520028846c6..db369a238cdc66b6c8c82003a1032e713312ca3c 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php @@ -5,7 +5,7 @@ use Drupal\KernelTests\KernelTestBase; /** - * Performs functional tests on drupal_render(). + * Performs functional tests on \Drupal::service('renderer')->render(). * * @group Common */ diff --git a/web/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php b/web/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php index bdcaaad680812b25311a245bb31882c58a4778c5..03c12363a47c616daa38977249ba262ba25fc7b9 100644 --- a/web/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php +++ b/web/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php @@ -30,7 +30,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da // Mock a Context object. $mock_context = $this->getMockBuilder('Drupal\Component\Plugin\Context\Context') ->disableOriginalConstructor() - ->setMethods(['getContextDefinition']) + ->onlyMethods(['getContextDefinition']) ->getMock(); // If the context value exists, getContextValue() behaves like a normal @@ -49,7 +49,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da else { // Create a mock definition. $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface') - ->setMethods(['isRequired', 'getDataType']) + ->onlyMethods(['isRequired', 'getDataType']) ->getMockForAbstractClass(); // Set expectation for isRequired(). @@ -85,7 +85,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da */ public function testDefaultValue() { $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface') - ->setMethods(['getDefaultValue']) + ->onlyMethods(['getDefaultValue']) ->getMockForAbstractClass(); $mock_definition->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php index bbcf25b2832a6e4c1bf836f4f8402bb3aaf20460..4668eda810a1fb15eb59bcb327c33a50134f0c54 100644 --- a/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php +++ b/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php @@ -130,7 +130,7 @@ public function providerHasDefinition() { */ public function testHasDefinition($expected, $plugin_id) { $trait = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryTrait') - ->setMethods(['getDefinition']) + ->onlyMethods(['getDefinition']) ->getMockForTrait(); // Set up our mocked getDefinition() to return TRUE for 'valid' and FALSE // for 'not_valid'. diff --git a/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php index 4961ee118a8a7867a97ee5ec285ccba7ce66b439..9f7423f66139fcf358c9b70ac97d9f3722ca7f2c 100644 --- a/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php +++ b/web/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php @@ -23,7 +23,7 @@ class StaticDiscoveryDecoratorTest extends TestCase { */ public function getRegisterDefinitionsCallback() { $mock_callable = $this->getMockBuilder('\stdClass') - ->setMethods(['registerDefinitionsCallback']) + ->addMethods(['registerDefinitionsCallback']) ->getMock(); // Set expectations for the callback method. $mock_callable->expects($this->once()) @@ -62,7 +62,7 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti // Mock our StaticDiscoveryDecorator. $mock_decorator = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator') ->disableOriginalConstructor() - ->setMethods(['registeredDefinitionCallback']) + ->addMethods(['registeredDefinitionCallback']) ->getMock(); // Set up the ::$registerDefinitions property. @@ -87,7 +87,7 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti // Mock a decorated object. $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface') - ->setMethods(['getDefinitions']) + ->onlyMethods(['getDefinitions']) ->getMockForAbstractClass(); // Return our definitions from getDefinitions(). $mock_decorated->expects($this->once()) @@ -132,7 +132,7 @@ public function testGetDefinitions($has_register_definitions, $definitions) { // Mock our StaticDiscoveryDecorator. $mock_decorator = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator') ->disableOriginalConstructor() - ->setMethods(['registeredDefinitionCallback']) + ->addMethods(['registeredDefinitionCallback']) ->getMock(); // Set up the ::$registerDefinitions property. @@ -157,7 +157,7 @@ public function testGetDefinitions($has_register_definitions, $definitions) { // Mock a decorated object. $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface') - ->setMethods(['getDefinitions']) + ->onlyMethods(['getDefinitions']) ->getMockForAbstractClass(); // Our mocked method will return any arguments sent to it. $mock_decorated->expects($this->once()) @@ -199,7 +199,7 @@ public function providerCall() { public function testCall($method, $args) { // Mock a decorated object. $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface') - ->setMethods([$method]) + ->addMethods([$method]) ->getMockForAbstractClass(); // Our mocked method will return any arguments sent to it. $mock_decorated->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/web/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php index 1e40e69e74ddb4290ce18850680b75db4d49f11d..45d27708fa924dfbda60db63636ea6813b6f0233 100644 --- a/web/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php +++ b/web/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php @@ -88,7 +88,7 @@ public function providerGetInstanceArguments() { public function testCreateInstance($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration) { // Create a mock DiscoveryInterface which can return our plugin definition. $mock_discovery = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface') - ->setMethods(['getDefinition', 'getDefinitions', 'hasDefinition']) + ->onlyMethods(['getDefinition', 'getDefinitions', 'hasDefinition']) ->getMock(); $mock_discovery->expects($this->never())->method('getDefinitions'); $mock_discovery->expects($this->never())->method('hasDefinition'); diff --git a/web/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php b/web/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php index e8192fcac5a5b9683f8772d3d128bef6efc66355..38d47ea3456afd5f8a973b11b99aa5b42608b6c2 100644 --- a/web/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php +++ b/web/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php @@ -37,7 +37,7 @@ public function createInstanceCallback() { */ public function getMockFactoryInterface($expects_count) { $mock_factory = $this->getMockBuilder('Drupal\Component\Plugin\Factory\FactoryInterface') - ->setMethods(['createInstance']) + ->onlyMethods(['createInstance']) ->getMockForAbstractClass(); $mock_factory->expects($this->exactly($expects_count)) ->method('createInstance') diff --git a/web/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/web/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php index f3fc2232e9517c164391e812702d592fcddffce1..f4f1d0ab14f05dbe4c9319831d319b4bdccd5292 100644 --- a/web/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php +++ b/web/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php @@ -23,7 +23,7 @@ class YamlTest extends TestCase { public function setUp(): void { parent::setUp(); $this->mockParser = $this->getMockBuilder('\stdClass') - ->setMethods(['encode', 'decode', 'getFileExtension']) + ->addMethods(['encode', 'decode', 'getFileExtension']) ->getMock(); YamlParserProxy::setMock($this->mockParser); } diff --git a/web/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php b/web/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php index 936a2a0d70ff9fc10cbd83849be53517d1b630f2..ba7077fa9516af39116a66b2ad55d509b2a6fdc3 100644 --- a/web/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php +++ b/web/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php @@ -60,7 +60,7 @@ public function provideGetMessageText() { public function testGetMessageText($expected, $config) { // Root package has our config. $root = $this->getMockBuilder(RootPackageInterface::class) - ->setMethods(['getExtra']) + ->onlyMethods(['getExtra']) ->getMockForAbstractClass(); $root->expects($this->once()) ->method('getExtra') @@ -77,7 +77,7 @@ public function testGetMessageText($expected, $config) { public function testDefaultFile() { // Root package has no extra field. $root = $this->getMockBuilder(RootPackageInterface::class) - ->setMethods(['getExtra']) + ->onlyMethods(['getExtra']) ->getMockForAbstractClass(); $root->expects($this->once()) ->method('getExtra') @@ -87,7 +87,7 @@ public function testDefaultFile() { // config to try that. $message = $this->getMockBuilder(Message::class) ->setConstructorArgs([$root, 'event-name']) - ->setMethods(['getMessageFromFile']) + ->onlyMethods(['getMessageFromFile']) ->getMock(); $message->expects($this->once()) ->method('getMessageFromFile') diff --git a/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php b/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php index da79d8d2b1da80338b851ec6b5d6bd4827ba1230..47eedd822c6eaf4365129d37c8a997c054e5aa14 100644 --- a/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php +++ b/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php @@ -20,7 +20,7 @@ class ConfigTest extends TestCase { */ public function testGetPathsForPackageMixedCase() { $config = $this->getMockBuilder(Config::class) - ->setMethods(['getAllCleanupPaths']) + ->onlyMethods(['getAllCleanupPaths']) ->disableOriginalConstructor() ->getMock(); @@ -37,7 +37,7 @@ public function testGetPathsForPackageMixedCase() { public function testNoRootMergeConfig() { // Root package has no extra field. $root = $this->getMockBuilder(RootPackageInterface::class) - ->setMethods(['getExtra']) + ->onlyMethods(['getExtra']) ->getMockForAbstractClass(); $root->expects($this->once()) ->method('getExtra') @@ -62,7 +62,7 @@ public function testNoRootMergeConfig() { public function testRootMergeConfig() { // Root package has configuration in extra. $root = $this->getMockBuilder(RootPackageInterface::class) - ->setMethods(['getExtra']) + ->onlyMethods(['getExtra']) ->getMockForAbstractClass(); $root->expects($this->once()) ->method('getExtra') @@ -90,7 +90,7 @@ public function testRootMergeConfig() { public function testMixedCaseConfigCleanupPackages() { // Root package has configuration in extra. $root = $this->getMockBuilder(RootPackageInterface::class) - ->setMethods(['getExtra']) + ->onlyMethods(['getExtra']) ->getMockForAbstractClass(); $root->expects($this->once()) ->method('getExtra') diff --git a/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php b/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php index f73242e88917d99b9053835835c263e5f821c84e..12d45b4fe454e4a4fbb748a1d7272268d7fbdc1f 100644 --- a/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php +++ b/web/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php @@ -48,7 +48,7 @@ public function testCleanPackage() { ->willReturn(['tests']); $plugin = $this->getMockBuilder(VendorHardeningPlugin::class) - ->setMethods(['getInstallPathForPackage']) + ->onlyMethods(['getInstallPathForPackage']) ->getMock(); $plugin->expects($this->once()) ->method('getInstallPathForPackage') @@ -78,7 +78,7 @@ public function testCleanPackage() { */ public function testCleanPathsForPackage() { $plugin = $this->getMockBuilder(VendorHardeningPlugin::class) - ->setMethods(['getInstallPathForPackage']) + ->onlyMethods(['getInstallPathForPackage']) ->getMock(); $plugin->expects($this->once()) ->method('getInstallPathForPackage') @@ -119,7 +119,7 @@ public function testCleanAllPackages() { ->willReturn('drupal/package'); $plugin = $this->getMockBuilder(VendorHardeningPlugin::class) - ->setMethods(['getInstalledPackages', 'getInstallPathForPackage']) + ->onlyMethods(['getInstalledPackages', 'getInstallPathForPackage']) ->getMock(); $plugin->expects($this->once()) ->method('getInstalledPackages') @@ -153,7 +153,7 @@ public function testWriteAccessRestrictionFiles() { // Set up mocks so that writeAccessRestrictionFiles() can eventually use // the IOInterface object. $composer = $this->getMockBuilder(Composer::class) - ->setMethods(['getPackage']) + ->onlyMethods(['getPackage']) ->getMock(); $composer->expects($this->once()) ->method('getPackage') diff --git a/web/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/web/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php index 3ac2051c09ccbccc1ab5edb07831e39af99a546d..8db48fe84ffa66196484e5fe3dadfa7f39b08d11 100644 --- a/web/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php +++ b/web/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php @@ -44,7 +44,7 @@ protected function setUp(): void { $this->privateKey = $this->getMockBuilder('Drupal\Core\PrivateKey') ->disableOriginalConstructor() - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $this->sessionMetadata = $this->getMockBuilder('Drupal\Core\Session\MetadataBag') diff --git a/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php index 2a5cc4faf3877ead91177c7ba916cf916cb5aa7f..fcaa36913353b5844fcb1277eb9c749505c38a93 100644 --- a/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php +++ b/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php @@ -386,7 +386,7 @@ public function testOpenModalDialogCommand() { 'width' => 500, ], ]) - ->setMethods(['getRenderedContent']) + ->onlyMethods(['getRenderedContent']) ->getMock(); // This method calls the render service, which isn't available. We want it diff --git a/web/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php b/web/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php index 73ff4100421e90f4b5b99a46c8ce7a8dcceb5281..05e7a51cbcf19d913cd9ffdbbef078e1214fdf25 100644 --- a/web/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php +++ b/web/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php @@ -67,6 +67,7 @@ public function testAssertTextHelper() { * @covers ::assertRaw */ public function testAssertRaw() { + $this->expectDeprecation('AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738'); $this->expectDeprecation('Calling AssertLegacyTrait::assertRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738'); $this->page->getText()->willReturn('foo bar bar'); $this->assertRaw('foo', '\'foo\' should be present.'); diff --git a/web/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php b/web/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php index a917aac10e00c5e9ecf5ac98c769f6a5c99c97bf..f9c7ae651d9d50f89ab96e74aaa58edbe69f02ce 100644 --- a/web/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php +++ b/web/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php @@ -55,7 +55,7 @@ class LibraryDependencyResolverTest extends UnitTestCase { protected function setUp(): void { $this->libraryDiscovery = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscovery') ->disableOriginalConstructor() - ->setMethods(['getLibrariesByExtension']) + ->onlyMethods(['getLibrariesByExtension']) ->getMock(); $this->libraryDiscovery->expects($this->any()) ->method('getLibrariesByExtension') diff --git a/web/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php b/web/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php index 2903c341a091ed9f7f59c62c21876db8c6881352..996ebf22bc3cfea2594ee9ad8b8903a5462bde40 100644 --- a/web/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php +++ b/web/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php @@ -27,7 +27,7 @@ public function testGetMachineNameSuggestion($label, $expected) { $module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'); $transliteration = $this->getMockBuilder('Drupal\Core\Transliteration\PhpTransliteration') ->setConstructorArgs([NULL, $module_handler]) - ->setMethods(['readLanguageOverrides']) + ->onlyMethods(['readLanguageOverrides']) ->getMock(); $config = []; diff --git a/web/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/web/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php index 07c07d01d915d2b75ac690a653a0075494e36f44..ccdd71975a354d3bd83007278f61394cddad41f2 100644 --- a/web/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php +++ b/web/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php @@ -255,7 +255,7 @@ public function testCalculateDependenciesWithPluginCollections($definition, $exp $values = []; $this->entity = $this->getMockBuilder('\Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections') ->setConstructorArgs([$values, $this->entityTypeId]) - ->setMethods(['getPluginCollections']) + ->onlyMethods(['getPluginCollections']) ->getMock(); // Create a configurable plugin that would add a dependency. @@ -265,7 +265,7 @@ public function testCalculateDependenciesWithPluginCollections($definition, $exp // Create a plugin collection to contain the instance. $pluginCollection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection') ->disableOriginalConstructor() - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $pluginCollection->expects($this->atLeastOnce()) ->method('get') diff --git a/web/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php b/web/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php index aa621dfb52f2025211f966c871d0c4716f42b84d..03ec70375ad2f8f458e070887328c76ff7dc7df2 100644 --- a/web/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php +++ b/web/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php @@ -90,7 +90,7 @@ public function testCalculateDependencies() { $this->entity = $this->getMockBuilder('\Drupal\Core\Entity\EntityDisplayModeBase') ->setConstructorArgs([$values, $this->entityType]) - ->setMethods(['getFilterFormat']) + ->addMethods(['getFilterFormat']) ->getMock(); $dependencies = $this->entity->calculateDependencies()->getDependencies(); @@ -103,7 +103,7 @@ public function testCalculateDependencies() { public function testSetTargetType() { // Generate mock. $mock = $this->getMockBuilder('Drupal\Core\Entity\EntityDisplayModeBase') - ->setMethods(NULL) + ->onlyMethods([]) ->setConstructorArgs([['something' => 'nothing'], 'test_type']) ->getMock(); @@ -131,7 +131,7 @@ public function testSetTargetType() { public function testGetTargetType() { // Generate mock. $mock = $this->getMockBuilder('Drupal\Core\Entity\EntityDisplayModeBase') - ->setMethods(NULL) + ->onlyMethods([]) ->setConstructorArgs([['something' => 'nothing'], 'test_type']) ->getMock(); diff --git a/web/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php b/web/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php index 3f73187a77c7960da493f2529c60f5ada8c23e10..97c6a34c80685f31198a5a56f34bfd71219b9123 100644 --- a/web/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php +++ b/web/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php @@ -128,7 +128,7 @@ public function testGetKeysWildCardEnd() { protected function getConfigObject($name) { $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() - ->setMethods(['save', 'delete']) + ->onlyMethods(['save', 'delete']) ->getMock(); return $config->setName($name); } diff --git a/web/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/web/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php index a60923b15a1892f4c51e20094518c1567cec5c3e..fc4792fe098b34198e9348c255eba9c747f76290 100644 --- a/web/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php +++ b/web/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php @@ -667,7 +667,7 @@ public function testStatementDeprecation() { */ public function testQueryTrim($expected, $query, $options) { $mock_pdo = $this->getMockBuilder(StubPdo::class) - ->setMethods(['execute', 'prepare', 'setAttribute']) + ->onlyMethods(['prepare']) ->getMock(); $mock_statement = $this->getMockBuilder(StatementWrapper::class) ->disableOriginalConstructor() diff --git a/web/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/web/core/tests/Drupal/Tests/Core/Datetime/DateTest.php index 735c1fe8a907552630e69c595e9470e9b5c42d4f..a1ca78a6d53d813d3b61e72aeb70287cf6918e4f 100644 --- a/web/core/tests/Drupal/Tests/Core/Datetime/DateTest.php +++ b/web/core/tests/Drupal/Tests/Core/Datetime/DateTest.php @@ -80,7 +80,7 @@ protected function setUp(): void { $this->dateFormatterStub = $this->getMockBuilder('\Drupal\Core\Datetime\DateFormatter') ->setConstructorArgs([$this->entityTypeManager, $this->languageManager, $this->stringTranslation, $this->getConfigFactoryStub(), $this->requestStack]) - ->setMethods(['formatDiff']) + ->onlyMethods(['formatDiff']) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/web/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php index 7ca410f1205484e8b423afb47901e59d5626c416..bfc7dee4ab2e9a9d6b485095411a98f7e84d2a0d 100644 --- a/web/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php +++ b/web/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php @@ -123,7 +123,7 @@ protected function getSqliteContainer($service) { $container = new ContainerBuilder(); $container->setDefinition('service', $service); $container->setDefinition('sqlite.service', new Definition(__NAMESPACE__ . '\\ServiceClassSqlite')); - $mock = $this->getMockBuilder('Drupal\Core\Database\Driver\sqlite\Connection')->setMethods(NULL)->disableOriginalConstructor()->getMock(); + $mock = $this->getMockBuilder('Drupal\Core\Database\Driver\sqlite\Connection')->onlyMethods([])->disableOriginalConstructor()->getMock(); $container->set('database', $mock); return $container; } @@ -158,7 +158,7 @@ protected function getMysqlContainer($service) { protected function getDrivertestMysqlContainer($service) { $container = new ContainerBuilder(); $container->setDefinition('service', $service); - $mock = $this->getMockBuilder('Drupal\driver_test\Driver\Database\DrivertestMysql\Connection')->setMethods(NULL)->disableOriginalConstructor()->getMock(); + $mock = $this->getMockBuilder('Drupal\driver_test\Driver\Database\DrivertestMysql\Connection')->onlyMethods([])->disableOriginalConstructor()->getMock(); $container->set('database', $mock); return $container; } diff --git a/web/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php b/web/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php index 6c930984d6d9cd3ac04d38ed579190c5b5321fd7..b4fa731ae39905ce992390d1ab21be9c92039adc 100644 --- a/web/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php +++ b/web/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php @@ -25,7 +25,7 @@ class DisplayVariantTest extends UnitTestCase { public function setUpDisplayVariant($configuration = [], $definition = []) { return $this->getMockBuilder('Drupal\Core\Display\VariantBase') ->setConstructorArgs([$configuration, 'test', $definition]) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/DrupalTest.php b/web/core/tests/Drupal/Tests/Core/DrupalTest.php index 93617a3ccb0eab4b8dda29567064420d3b482e91..4c2b8f2ad6ffebf75eacbbf0fcb457ad3ac029df 100644 --- a/web/core/tests/Drupal/Tests/Core/DrupalTest.php +++ b/web/core/tests/Drupal/Tests/Core/DrupalTest.php @@ -32,7 +32,7 @@ class DrupalTest extends UnitTestCase { protected function setUp(): void { parent::setUp(); $this->container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/web/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 05207266c87cdb3955e2bc496d8f6937ac0101f7..a762ed4dad2172acc71944216774de47cee6341c 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -340,7 +340,7 @@ public function testValidate() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $non_empty_violation_list = clone $empty_violation_list; $violation = $this->createMock('\Symfony\Component\Validator\ConstraintViolationInterface'); @@ -369,7 +369,7 @@ public function testRequiredValidation() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $validator->expects($this->once()) ->method('validate') @@ -470,7 +470,7 @@ public function testGet($expected, $field_name, $active_langcode, $fields) { // Mock ContentEntityBase. $mock_base = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') ->disableOriginalConstructor() - ->setMethods(['getTranslatedField']) + ->onlyMethods(['getTranslatedField']) ->getMockForAbstractClass(); // Set up expectations for getTranslatedField() method. In get(), @@ -532,14 +532,14 @@ public function testGetFields($expected, $include_computed, $is_computed, $field // Mock ContentEntityBase. $mock_base = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') ->disableOriginalConstructor() - ->setMethods(['getFieldDefinitions', 'get']) + ->onlyMethods(['getFieldDefinitions', 'get']) ->getMockForAbstractClass(); // Mock field definition objects for each element of $field_definitions. $mocked_field_definitions = []; foreach ($field_definitions as $name) { $mock_definition = $this->getMockBuilder('Drupal\Core\Field\FieldDefinitionInterface') - ->setMethods(['isComputed']) + ->onlyMethods(['isComputed']) ->getMockForAbstractClass(); // Set expectations for isComputed(). isComputed() gets called whenever // $include_computed is FALSE, but not otherwise. It returns the value of diff --git a/web/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php b/web/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php index 736d5bf1a6b4e490b92c0442e5982c7154fbfb64..efa591ad37041d6380aa36a290d40d1e70a71309 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php @@ -113,7 +113,7 @@ public function testCopyFormValuesToEntity() { $values = ['id' => $entity_id]; $entity = $this->getMockBuilder('\Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections') ->setConstructorArgs([$values, 'test_config_entity']) - ->setMethods(['getPluginCollections']) + ->onlyMethods(['getPluginCollections']) ->getMock(); $entity->expects($this->atLeastOnce()) ->method('getPluginCollections') diff --git a/web/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/web/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index 16ef3d1c68f6ca901651b1de803f5944359282f7..0929d25a74ea0af7dc24bb46664f8bc1341e91c1 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -235,7 +235,7 @@ public function setupTestLoad() { unset($methods[array_search('create', $methods)]); $this->entity = $this->getMockBuilder(EntityTestMul::class) ->disableOriginalConstructor() - ->setMethods($methods) + ->onlyMethods($methods) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/web/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index 6a39d8b9c13ffe5afef1852958a3dd1037f9681e..0084e4ecba1ae1292e960385789488ddda39b364 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -433,7 +433,7 @@ protected function getEntity($class, array $values, array $methods = []) { // add method prophecies later while still revealing the prophecy now. $entity = $this->getMockBuilder($class) ->setConstructorArgs([$values, $this->entityTypeId]) - ->setMethods($methods) + ->onlyMethods($methods) ->getMockForAbstractClass(); $this->entityType = $this->prophesize(EntityTypeInterface::class); diff --git a/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php index 1db5beddb688ac1e868f2b3b40726740d3f79f6d..7ae6eeba57183d8d91bf1eeba2e90757068ff7dd 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -417,7 +417,7 @@ public function testGetSchemaRevisionable() { ], ], ]) - ->setMethods(['getRevisionMetadataKeys']) + ->onlyMethods(['getRevisionMetadataKeys']) ->getMock(); $this->entityType->expects($this->any()) @@ -635,7 +635,7 @@ public function testGetSchemaRevisionableTranslatable() { 'revision_data_table' => 'entity_test_revision_field_data', ], ]) - ->setMethods(['isRevisionable', 'isTranslatable', 'getRevisionMetadataKeys']) + ->onlyMethods(['isRevisionable', 'isTranslatable', 'getRevisionMetadataKeys']) ->getMock(); $this->entityType->expects($this->any()) @@ -1221,7 +1221,7 @@ public function testRequiresEntityDataMigration($updated_entity_type_definition, $this->storageSchema = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema') ->setConstructorArgs([$this->entityTypeManager, $this->entityType, $this->storage, $connection, $this->entityFieldManager, $this->entityLastInstalledSchemaRepository]) - ->setMethods(['installedStorageSchema', 'hasSharedTableStructureChange']) + ->onlyMethods(['installedStorageSchema', 'hasSharedTableStructureChange']) ->getMock(); $this->storageSchema->expects($this->any()) @@ -1418,7 +1418,7 @@ protected function setUpStorageSchema(array $expected = []) { $this->storageSchema = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema') ->setConstructorArgs([$this->entityTypeManager, $this->entityType, $this->storage, $connection, $this->entityFieldManager, $this->entityLastInstalledSchemaRepository]) - ->setMethods(['installedStorageSchema', 'loadEntitySchemaData', 'hasSharedTableNameChanges', 'isTableEmpty', 'getTableMapping']) + ->onlyMethods(['installedStorageSchema', 'loadEntitySchemaData', 'hasSharedTableNameChanges', 'isTableEmpty', 'getTableMapping']) ->getMock(); $this->storageSchema ->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index ded18bbed68b811b25ac273c57371be8af5c2ec3..342a5b4722cd43e78ca32f2a6830c95dbe72ce1d 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -428,13 +428,13 @@ public function testOnEntityTypeCreate() { $storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs([$this->entityType, $this->connection, $this->entityFieldManager, $this->cache, $this->languageManager, new MemoryCache(), $this->entityTypeBundleInfo, $this->entityTypeManager]) - ->setMethods(['getStorageSchema']) + ->onlyMethods(['getStorageSchema']) ->getMock(); $key_value = $this->createMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface'); $schema_handler = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema') ->setConstructorArgs([$this->entityTypeManager, $this->entityType, $storage, $this->connection, $this->entityFieldManager]) - ->setMethods(['installedStorageSchema', 'createSharedTableSchema']) + ->onlyMethods(['installedStorageSchema', 'createSharedTableSchema']) ->getMock(); $schema_handler ->expects($this->any()) @@ -1073,7 +1073,7 @@ public function testCreate() { $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') ->disableOriginalConstructor() - ->setMethods(['id']) + ->onlyMethods(['id']) ->getMockForAbstractClass(); $this->entityType->expects($this->atLeastOnce()) @@ -1256,7 +1256,7 @@ public function testLoadMultipleNoPersistentCache() { $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs([$this->entityType, $this->connection, $this->entityFieldManager, $this->cache, $this->languageManager, new MemoryCache(), $this->entityTypeBundleInfo, $this->entityTypeManager]) - ->setMethods(['getFromStorage', 'invokeStorageLoadHook', 'initTableLayout']) + ->onlyMethods(['getFromStorage', 'invokeStorageLoadHook', 'initTableLayout']) ->getMock(); $entity_storage->method('invokeStorageLoadHook') ->willReturn(NULL); @@ -1314,7 +1314,7 @@ public function testLoadMultiplePersistentCacheMiss() { $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs([$this->entityType, $this->connection, $this->entityFieldManager, $this->cache, $this->languageManager, new MemoryCache(), $this->entityTypeBundleInfo, $this->entityTypeManager]) - ->setMethods(['getFromStorage', 'invokeStorageLoadHook', 'initTableLayout']) + ->onlyMethods(['getFromStorage', 'invokeStorageLoadHook', 'initTableLayout']) ->getMock(); $entity_storage->method('invokeStorageLoadHook') ->willReturn(NULL); diff --git a/web/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/web/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php index 0a55bfdc8d772d4d48b656d90ae8550b04dd947b..4d75e43a47c5c282192c83e73cc5cbe7807bb178 100644 --- a/web/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php +++ b/web/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php @@ -111,7 +111,7 @@ public function testModuleReloading() { ], ], $this->cacheBackend, ]) - ->setMethods(['load']) + ->onlyMethods(['load']) ->getMock(); $module_handler->expects($this->exactly(3)) ->method('load') @@ -178,7 +178,7 @@ public function testSetModuleList() { ->setConstructorArgs([ $this->root, [], $this->cacheBackend, ]) - ->setMethods(['resetImplementations']) + ->onlyMethods(['resetImplementations']) ->getMock(); // Ensure we reset implementations when settings a new modules list. @@ -206,7 +206,7 @@ public function testAddModule() { ->setConstructorArgs([ $this->root, [], $this->cacheBackend, ]) - ->setMethods(['resetImplementations']) + ->onlyMethods(['resetImplementations']) ->getMock(); // Ensure we reset implementations when settings a new modules list. @@ -228,7 +228,7 @@ public function testAddProfile() { ->setConstructorArgs([ $this->root, [], $this->cacheBackend, ]) - ->setMethods(['resetImplementations']) + ->onlyMethods(['resetImplementations']) ->getMock(); // Ensure we reset implementations when settings a new modules list. @@ -266,7 +266,7 @@ public function testLoadAllIncludes() { ], ], $this->cacheBackend, ]) - ->setMethods(['loadInclude']) + ->onlyMethods(['loadInclude']) ->getMock(); // Ensure we reset implementations when settings a new modules list. @@ -355,7 +355,7 @@ public function testCachedGetImplementations() { ], ], $this->cacheBackend, ]) - ->setMethods(['buildImplementationInfo', 'loadInclude']) + ->onlyMethods(['buildImplementationInfo', 'loadInclude']) ->getMock(); $module_handler->load('module_handler_test'); @@ -393,7 +393,7 @@ public function testCachedGetImplementationsMissingMethod() { ], ], $this->cacheBackend, ]) - ->setMethods(['buildImplementationInfo']) + ->onlyMethods(['buildImplementationInfo']) ->getMock(); $module_handler->load('module_handler_test'); diff --git a/web/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php b/web/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php index 4baaa19f54c26bd9bb92cc595c5ec14856a04835..9bd41d040dff5f92003c72646e8e20a9c8c58fbe 100644 --- a/web/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php +++ b/web/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php @@ -22,7 +22,7 @@ protected function setUp(): void { parent::setUp(); $this->uninstallValidator = $this->getMockBuilder('Drupal\Core\Extension\RequiredModuleUninstallValidator') ->disableOriginalConstructor() - ->setMethods(['getModuleInfoByModule']) + ->onlyMethods(['getModuleInfoByModule']) ->getMock(); $this->uninstallValidator->setStringTranslation($this->getStringTranslationStub()); } diff --git a/web/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php b/web/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php index 0fc8e36b993fafcfe2ca22d32dc7b228c8eaeed9..b213a2076f32430d3142471991e51f37915e94ea 100644 --- a/web/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php +++ b/web/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php @@ -296,7 +296,7 @@ public function testDefaultValuesForm() { ->willReturn('field_type'); /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */ $field_list = $this->getMockBuilder(FieldItemList::class) - ->setMethods(['defaultValueWidget']) + ->onlyMethods(['defaultValueWidget']) ->setConstructorArgs([$field_definition]) ->getMock(); $field_list->expects($this->any()) @@ -317,7 +317,7 @@ public function testDefaultValuesFormValidate() { $field_definition = $this->createMock(FieldDefinitionInterface::class); /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */ $field_list = $this->getMockBuilder(FieldItemList::class) - ->setMethods(['defaultValueWidget', 'validate']) + ->onlyMethods(['defaultValueWidget', 'validate']) ->setConstructorArgs([$field_definition]) ->getMock(); $field_list->expects($this->any()) @@ -338,7 +338,7 @@ public function testDefaultValuesFormSubmit() { $field_definition = $this->createMock(FieldDefinitionInterface::class); /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */ $field_list = $this->getMockBuilder(FieldItemList::class) - ->setMethods(['defaultValueWidget', 'getValue']) + ->onlyMethods(['defaultValueWidget', 'getValue']) ->setConstructorArgs([$field_definition]) ->getMock(); $field_list->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/web/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index 5a233ea9c70832d7109fe95866c5b0ffc3cb9a8a..ee723020f64a9ca8ca91a129532d54d1f99b3ca2 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -166,7 +166,7 @@ public function testOnExceptionBrokenPostRequest() { $this->getStringTranslationStub(), $this->messenger, ]) - ->setMethods(['formatSize']) + ->onlyMethods(['formatSize']) ->getMock(); $this->subscriber->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/web/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php index 7ec676ef8583aaac9fce566ea168173636b355a7..ae287334bec7e9a1f3742a86929395b473fa1b7b 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php @@ -569,7 +569,7 @@ public function testExceededFileSize() { $request_stack->push($request); $this->formBuilder = $this->getMockBuilder('\Drupal\Core\Form\FormBuilder') ->setConstructorArgs([$this->formValidator, $this->formSubmitter, $this->formCache, $this->moduleHandler, $this->eventDispatcher, $request_stack, $this->classResolver, $this->elementInfo, $this->themeManager, $this->csrfToken]) - ->setMethods(['getFileUploadMaxSize']) + ->onlyMethods(['getFileUploadMaxSize']) ->getMock(); $this->formBuilder->expects($this->once()) ->method('getFileUploadMaxSize') diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php b/web/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php index 8087c3e4a416df95ae4235397a113098aead85eb..237050d1b735be52c2e046c7db47241cf68c3298 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php @@ -35,7 +35,7 @@ protected function setUp(): void { $this->messenger = $this->createMock(MessengerInterface::class); $this->formErrorHandler = $this->getMockBuilder('Drupal\Core\Form\FormErrorHandler') - ->setMethods(['messenger']) + ->onlyMethods(['messenger']) ->getMock(); $this->formErrorHandler->expects($this->atLeastOnce()) diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php index 0a222ccaabcf25c72960294014c94842515eab01..9e8d552e0c3e913657fdfcd369655b4ef37db0ba 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php @@ -181,7 +181,7 @@ public function testLoadInclude() { $module = 'some_module'; $name = 'some_name'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['moduleLoadInclude']) + ->onlyMethods(['moduleLoadInclude']) ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') @@ -197,7 +197,7 @@ public function testLoadIncludeNoName() { $type = 'some_type'; $module = 'some_module'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['moduleLoadInclude']) + ->onlyMethods(['moduleLoadInclude']) ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') @@ -213,7 +213,7 @@ public function testLoadIncludeNotFound() { $type = 'some_type'; $module = 'some_module'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['moduleLoadInclude']) + ->onlyMethods(['moduleLoadInclude']) ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') @@ -230,7 +230,7 @@ public function testLoadIncludeAlreadyLoaded() { $module = 'some_module'; $name = 'some_name'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['moduleLoadInclude']) + ->onlyMethods(['moduleLoadInclude']) ->getMock(); $form_state->addBuildInfo('files', [ diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php b/web/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php index 668452d16e6fca215d3aa6511b9f457975f2cca3..a50b728b9994ccadd4077263eed9d43d792af695 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php @@ -256,7 +256,7 @@ protected function getFormSubmitter() { $request_stack->push(Request::create('/test-path')); return $this->getMockBuilder('Drupal\Core\Form\FormSubmitter') ->setConstructorArgs([$request_stack, $this->urlGenerator]) - ->setMethods(['batchGet', 'drupalInstallationAttempted']) + ->onlyMethods(['batchGet']) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormTestBase.php b/web/core/tests/Drupal/Tests/Core/Form/FormTestBase.php index ac01e8872cfe9188e5fd1060b5762f4901ee1590..222e5a6bcaa2e0b582d020b1865eaf9033313010 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormTestBase.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormTestBase.php @@ -181,11 +181,11 @@ protected function setUp() { $form_error_handler = $this->createMock('Drupal\Core\Form\FormErrorHandlerInterface'); $this->formValidator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([$this->requestStack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $form_error_handler]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->formSubmitter = $this->getMockBuilder('Drupal\Core\Form\FormSubmitter') ->setConstructorArgs([$this->requestStack, $this->urlGenerator]) - ->setMethods(['batchGet', 'drupalInstallationAttempted']) + ->onlyMethods(['batchGet']) ->getMock(); $this->root = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2); diff --git a/web/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php b/web/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php index 7eb5524a690429f0d1a4251c81513229288f740a..fd1362e2f16ff931dd134ca9833ea756cf47dbc4 100644 --- a/web/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php +++ b/web/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php @@ -55,7 +55,7 @@ protected function setUp(): void { public function testValidationComplete() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $form = []; @@ -73,7 +73,7 @@ public function testValidationComplete() { public function testPreventDuplicateValidation() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['doValidateForm']) + ->onlyMethods(['doValidateForm']) ->getMock(); $form_validator->expects($this->never()) ->method('doValidateForm'); @@ -93,7 +93,7 @@ public function testPreventDuplicateValidation() { public function testMustValidate() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['doValidateForm']) + ->onlyMethods(['doValidateForm']) ->getMock(); $form_validator->expects($this->once()) ->method('doValidateForm'); @@ -120,14 +120,14 @@ public function testValidateInvalidFormToken() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([$request_stack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['doValidateForm']) + ->onlyMethods(['doValidateForm']) ->getMock(); $form_validator->expects($this->never()) ->method('doValidateForm'); $form['#token'] = 'test_form_id'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['setErrorByName']) + ->onlyMethods(['setErrorByName']) ->getMock(); $form_state->expects($this->once()) ->method('setErrorByName') @@ -148,14 +148,14 @@ public function testValidateValidFormToken() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([$request_stack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['doValidateForm']) + ->onlyMethods(['doValidateForm']) ->getMock(); $form_validator->expects($this->once()) ->method('doValidateForm'); $form['#token'] = 'test_form_id'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['setErrorByName']) + ->onlyMethods(['setErrorByName']) ->getMock(); $form_state->expects($this->never()) ->method('setErrorByName'); @@ -172,7 +172,7 @@ public function testValidateValidFormToken() { public function testHandleErrorsWithLimitedValidation($sections, $triggering_element, $values, $expected) { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $triggering_element['#limit_validation_errors'] = $sections; @@ -268,10 +268,10 @@ public function providerTestHandleErrorsWithLimitedValidation() { public function testExecuteValidateHandlers() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $mock = $this->getMockBuilder('stdClass') - ->setMethods(['validate_handler', 'hash_validate']) + ->addMethods(['validate_handler', 'hash_validate']) ->getMock(); $mock->expects($this->once()) ->method('validate_handler') @@ -301,7 +301,7 @@ public function testExecuteValidateHandlers() { public function testRequiredErrorMessage($element, $expected_message) { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['executeValidateHandlers']) + ->onlyMethods(['executeValidateHandlers']) ->getMock(); $form_validator->expects($this->once()) ->method('executeValidateHandlers'); @@ -315,7 +315,7 @@ public function testRequiredErrorMessage($element, $expected_message) { '#parents' => ['test'], ]; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['setError']) + ->onlyMethods(['setError']) ->getMock(); $form_state->expects($this->once()) ->method('setError') @@ -349,12 +349,12 @@ public function providerTestRequiredErrorMessage() { public function testElementValidate() { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['executeValidateHandlers']) + ->onlyMethods(['executeValidateHandlers']) ->getMock(); $form_validator->expects($this->once()) ->method('executeValidateHandlers'); $mock = $this->getMockBuilder('stdClass') - ->setMethods(['element_validate']) + ->addMethods(['element_validate']) ->getMock(); $mock->expects($this->once()) ->method('element_validate') @@ -379,7 +379,7 @@ public function testElementValidate() { public function testPerformRequiredValidation($element, $expected_message, $call_watchdog) { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) - ->setMethods(['setError']) + ->addMethods(['setError']) ->getMock(); if ($call_watchdog) { @@ -396,7 +396,7 @@ public function testPerformRequiredValidation($element, $expected_message, $call '#parents' => ['test'], ]; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') - ->setMethods(['setError']) + ->onlyMethods(['setError']) ->getMock(); $form_state->expects($this->once()) ->method('setError') diff --git a/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php index 1d614705645610dd5ebd3945c7f814d34fa93ed5..30c37e966996827ba4f06b80369a64c3e113faf3 100644 --- a/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -64,7 +64,7 @@ protected function getToolkitMock(array $stubs = []) { $stubs = array_merge(['getPluginId', 'save'], $stubs); return $mock_builder ->disableOriginalConstructor() - ->setMethods($stubs) + ->onlyMethods($stubs) ->getMock(); } @@ -82,7 +82,7 @@ protected function getToolkitOperationMock($class_name, ImageToolkitInterface $t $mock_builder = $this->getMockBuilder('Drupal\system\Plugin\ImageToolkit\Operation\gd\\' . $class_name); $logger = $this->createMock('Psr\Log\LoggerInterface'); return $mock_builder - ->setMethods(['execute']) + ->onlyMethods(['execute']) ->setConstructorArgs([[], '', [], $toolkit, $logger]) ->getMock(); } @@ -211,7 +211,7 @@ public function testSave() { ->will($this->returnValue(TRUE)); $image = $this->getMockBuilder('Drupal\Core\Image\Image') - ->setMethods(['chmod']) + ->onlyMethods([]) ->setConstructorArgs([$toolkit, $this->image->getSource()]) ->getMock(); @@ -220,7 +220,7 @@ public function testSave() { ->willReturn(TRUE); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $container->expects($this->once()) ->method('get') @@ -256,7 +256,7 @@ public function testChmodFails() { ->will($this->returnValue(TRUE)); $image = $this->getMockBuilder('Drupal\Core\Image\Image') - ->setMethods(['chmod']) + ->onlyMethods([]) ->setConstructorArgs([$toolkit, $this->image->getSource()]) ->getMock(); @@ -265,7 +265,7 @@ public function testChmodFails() { ->willReturn(FALSE); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $container->expects($this->once()) ->method('get') diff --git a/web/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/web/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php index 920bd6bc68b868fe7f1f0fdc3e2f09f3e959e801..d5275cd61e07bd1a8ac0ef67b14b0a57e74b5d84 100644 --- a/web/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php +++ b/web/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @@ -107,7 +107,7 @@ public function providerTestLog() { ->will($this->returnValue(1)); $request_mock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') - ->setMethods(['getClientIp']) + ->onlyMethods(['getClientIp']) ->getMock(); $request_mock->expects($this->any()) ->method('getClientIp') diff --git a/web/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php b/web/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php index 30a7971233d3f14514f3b1559f0f77689aa3c31d..751605d3c1fd7472913e095120393063da8d300f 100644 --- a/web/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php +++ b/web/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php @@ -76,7 +76,7 @@ protected function setUp(): void { $this->contextualLinkManager = $this ->getMockBuilder('Drupal\Core\Menu\ContextualLinkManager') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $this->controllerResolver = $this->createMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface'); diff --git a/web/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php b/web/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php index b419db2676d591bb39187d68aeae8e0a7defa8a3..c60db3312603445056790f07dd1f11b9120006b3 100644 --- a/web/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php +++ b/web/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php @@ -58,7 +58,7 @@ protected function getLocalTaskManager($module_dirs, $route_name, $route_params) $manager = $this ->getMockBuilder('Drupal\Core\Menu\LocalTaskManager') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); $argumentResolver = $this->createMock('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface'); diff --git a/web/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php b/web/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php index 223a1909cbcdbf0289129b18f1bca26f27484a0d..c4eff946859f9ff44b25b9abac2ea35f81f5d5ad 100644 --- a/web/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php +++ b/web/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php @@ -23,7 +23,7 @@ protected function setUp(): void { // Note that it is necessary to partially mock the class under test in // order to disable the isCli-check. $this->policy = $this->getMockBuilder('Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod') - ->setMethods(['isCli']) + ->onlyMethods(['isCli']) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php b/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php index 603678cb93d1e06b85d8c406871f0a8b297e4baf..c9ffdcfb61de0400bdffb458d76c1eb919afc073 100644 --- a/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php +++ b/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php @@ -33,11 +33,13 @@ public function providerGetDataDefinition() { public function testGetDataDefinition($is_multiple) { $data_type = 'valid'; $mock_data_definition = $this->getMockBuilder('\Drupal\Core\TypedData\ListDataDefinitionInterface') - ->setMethods([ + ->onlyMethods([ + 'getConstraints', + ]) + ->addMethods([ 'setLabel', 'setDescription', 'setRequired', - 'getConstraints', 'setConstraints', ]) ->getMockForAbstractClass(); @@ -76,7 +78,7 @@ public function testGetDataDefinition($is_multiple) { // methods. $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition') ->disableOriginalConstructor() - ->setMethods([ + ->onlyMethods([ 'isMultiple', 'getTypedDataManager', 'getDataType', @@ -137,7 +139,7 @@ public function testGetDataDefinitionInvalidType($is_multiple) { // that will be called before the expected exception. $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition') ->disableOriginalConstructor() - ->setMethods([ + ->onlyMethods([ 'isMultiple', 'getTypedDataManager', 'getDataType', @@ -181,7 +183,7 @@ public function providerGetConstraint() { public function testGetConstraint($expected, $constraint_array, $constraint) { $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition') ->disableOriginalConstructor() - ->setMethods([ + ->onlyMethods([ 'getConstraints', ]) ->getMock(); diff --git a/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php b/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php index c315753c2b496d99dcd671dbc7ef15b155a951fd..5db4b9690f9002b5a7983830d81afc77a824ad34 100644 --- a/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php +++ b/web/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php @@ -89,7 +89,7 @@ public function testNullDataValue() { public function testSetContextValueTypedData() { $this->contextDefinition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinitionInterface') - ->setMethods(['getDefaultValue', 'getDataDefinition']) + ->onlyMethods(['getDefaultValue', 'getDataDefinition']) ->getMockForAbstractClass(); $typed_data = $this->createMock('Drupal\Core\TypedData\TypedDataInterface'); @@ -102,9 +102,9 @@ public function testSetContextValueTypedData() { */ public function testSetContextValueCacheableDependency() { $container = new Container(); - $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() - ->setMethods(['validateTokens']) + ->onlyMethods(['validateTokens']) ->getMock(); $container->set('cache_contexts_manager', $cache_context_manager); $cache_context_manager->expects($this->any()) @@ -145,7 +145,7 @@ protected function setUpDefaultValue($default_value = NULL) { $mock_data_definition = $this->createMock('Drupal\Core\TypedData\DataDefinitionInterface'); $this->contextDefinition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinitionInterface') - ->setMethods(['getDefaultValue', 'getDataDefinition']) + ->onlyMethods(['getDefaultValue', 'getDataDefinition']) ->getMockForAbstractClass(); $this->contextDefinition->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/web/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php index 50e8ebcb1fa2495a7c3a6e61e8ed837937713d6c..fbdec9e677a9ea11a2c77795a38cfdf63d38b38c 100644 --- a/web/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php +++ b/web/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php @@ -17,7 +17,7 @@ class ContainerDerivativeDiscoveryDecoratorTest extends UnitTestCase { public function testGetDefinitions() { $example_service = $this->createMock('Symfony\Contracts\EventDispatcher\EventDispatcherInterface'); $example_container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $example_container->expects($this->once()) ->method('get') diff --git a/web/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/web/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 84acf154bb1305cd8303caa4dbec32a2a35bf624..d0787d15f7a231c408deef96d31780f84d9d6d82 100644 --- a/web/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/web/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -38,16 +38,13 @@ public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, Bubbleabl if (!$b instanceof BubbleableMetadata) { $renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer') ->disableOriginalConstructor() - ->setMethods(['mergeAttachments']) ->getMock(); - $renderer->expects($this->never()) - ->method('mergeAttachments'); } // Otherwise, let the original ::mergeAttachments() method be executed. else { $renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer') ->disableOriginalConstructor() - ->setMethods(NULL) + ->onlyMethods([]) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/web/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php index 7e31ab6d93c0fc2c9416944820b810a9c9ee3dce..ed06974eec193746800ef4242068cb6233cfa9ac 100644 --- a/web/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php +++ b/web/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php @@ -91,7 +91,7 @@ public function testGetInfoElementPlugin($plugin_class, $expected_info) { $element_info = $this->getMockBuilder('Drupal\Core\Render\ElementInfoManager') ->setConstructorArgs([new \ArrayObject(), $this->cache, $this->cacheTagsInvalidator, $this->moduleHandler, $this->themeManager]) - ->setMethods(['getDefinitions', 'createInstance']) + ->onlyMethods(['getDefinitions', 'createInstance']) ->getMock(); $this->themeManager->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/web/core/tests/Drupal/Tests/Core/Render/RendererTest.php index 7d519335c7d68a0f7615bd7c827b075ec125cac4..c3310efead234a70479d74075f18fe64066de4de 100644 --- a/web/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/web/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -507,8 +507,9 @@ public function testRenderSorting() { $this->assertTrue($elements['#sorted'], "'#sorted' => TRUE was added to the array"); // Pass $elements through \Drupal\Core\Render\Element::children() and - // ensure it remains sorted in the correct order. drupal_render() will - // return an empty string if used on the same array in the same request. + // ensure it remains sorted in the correct order. + // \Drupal::service('renderer')->render() will return an empty string if + // used on the same array in the same request. $children = Element::children($elements); $this->assertSame('first', array_shift($children), 'Child found in the correct order.'); $this->assertSame('second', array_shift($children), 'Child found in the correct order.'); diff --git a/web/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/web/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php index 1908fbe03175c121eee640f157bad178046699bb..40a24620f0713926125788ee2c756a8581b16d17 100644 --- a/web/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php +++ b/web/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php @@ -127,7 +127,7 @@ public function testCall() { $this->router = $this->getMockBuilder('Drupal\Core\Routing\Router') ->disableOriginalConstructor() - ->setMethods(['add']) + ->addMethods(['add']) ->getMock(); $this->router->expects($this->once()) ->method('add') diff --git a/web/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php b/web/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php index d3e6d80d370e04943b4265091ce4df1acef3ed4c..f2e5ebbb119260f104f2d17ed8a0637a9a377131 100644 --- a/web/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php +++ b/web/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php @@ -25,7 +25,7 @@ public function testGetSerialization() { $this->assertEquals(YamlParserProxy::class, Settings::get('yaml_parser_class')); $mock = $this->getMockBuilder('\stdClass') - ->setMethods(['encode', 'decode', 'getFileExtension']) + ->addMethods(['encode', 'decode', 'getFileExtension']) ->getMock(); $mock ->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php b/web/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php index 128f325fb9b68e674541a08186954cfe8b4aa702..8bd979a81c0fa0e27ced95a947da095c1f311a46 100644 --- a/web/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php +++ b/web/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php @@ -80,7 +80,7 @@ protected function setUp(): void { // The mocked super user account, with the same roles as Account 2. $this->account1 = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['getRoles', 'id']) + ->onlyMethods(['getRoles', 'id']) ->getMock(); $this->account1->expects($this->any()) ->method('id') @@ -92,7 +92,7 @@ protected function setUp(): void { $roles_1 = ['administrator', 'authenticated']; $this->account2 = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['getRoles', 'id']) + ->onlyMethods(['getRoles', 'id']) ->getMock(); $this->account2->expects($this->any()) ->method('getRoles') @@ -105,7 +105,7 @@ protected function setUp(): void { $roles_3 = ['authenticated', 'administrator']; $this->account3 = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['getRoles', 'id']) + ->onlyMethods(['getRoles', 'id']) ->getMock(); $this->account3->expects($this->any()) ->method('getRoles') @@ -118,7 +118,7 @@ protected function setUp(): void { $roles_2_updated = ['editor', 'administrator', 'authenticated']; $this->account2Updated = $this->getMockBuilder('Drupal\user\Entity\User') ->disableOriginalConstructor() - ->setMethods(['getRoles', 'id']) + ->onlyMethods(['getRoles', 'id']) ->getMock(); $this->account2Updated->expects($this->any()) ->method('getRoles') @@ -131,7 +131,7 @@ protected function setUp(): void { $random = Crypt::randomBytesBase64(55); $this->privateKey = $this->getMockBuilder('Drupal\Core\PrivateKey') ->disableOriginalConstructor() - ->setMethods(['get']) + ->onlyMethods(['get']) ->getMock(); $this->privateKey->expects($this->any()) ->method('get') diff --git a/web/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php b/web/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php index e39913caffe6c41ad3b41b941116eb7b7ce11300..ac6b0a769748b3aa7f60b891a62c9a1c2edaf106 100644 --- a/web/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php +++ b/web/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php @@ -18,7 +18,7 @@ class SessionConfigurationTest extends UnitTestCase { */ protected function createSessionConfiguration($options = []) { return $this->getMockBuilder('Drupal\Core\Session\SessionConfiguration') - ->setMethods(['drupalValidTestUa']) + ->onlyMethods(['drupalValidTestUa']) ->setConstructorArgs([$options]) ->getMock(); } diff --git a/web/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/web/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php index e161d41cd2fbbeaeb8e257520d025bfb89e4a3cf..236b31b39b9e773b05b6ad12e7807fe68847717e 100644 --- a/web/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php +++ b/web/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php @@ -60,7 +60,7 @@ protected function setUp(): void { $roles = []; $roles['role_one'] = $this->getMockBuilder('Drupal\user\Entity\Role') ->disableOriginalConstructor() - ->setMethods(['hasPermission']) + ->onlyMethods(['hasPermission']) ->getMock(); $roles['role_one']->expects($this->any()) ->method('hasPermission') @@ -72,7 +72,7 @@ protected function setUp(): void { $roles['role_two'] = $this->getMockBuilder('Drupal\user\Entity\Role') ->disableOriginalConstructor() - ->setMethods(['hasPermission']) + ->onlyMethods(['hasPermission']) ->getMock(); $roles['role_two']->expects($this->any()) ->method('hasPermission') @@ -84,7 +84,7 @@ protected function setUp(): void { $roles['anonymous'] = $this->getMockBuilder('Drupal\user\Entity\Role') ->disableOriginalConstructor() - ->setMethods(['hasPermission']) + ->onlyMethods(['hasPermission']) ->getMock(); $roles['anonymous']->expects($this->any()) ->method('hasPermission') @@ -97,7 +97,7 @@ protected function setUp(): void { $role_storage = $this->getMockBuilder('Drupal\user\RoleStorage') ->setConstructorArgs(['role', new MemoryCache()]) ->disableOriginalConstructor() - ->setMethods(['loadMultiple']) + ->onlyMethods(['loadMultiple']) ->getMock(); $role_storage->expects($this->any()) ->method('loadMultiple') diff --git a/web/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/web/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php index da8f674d455ab125e12590e8e252c6301644306a..01f220fef7f7d715e8ce57b20d377c6b0c67e6f8 100644 --- a/web/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php +++ b/web/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php @@ -36,7 +36,7 @@ public function testNoProxy() { $middleware = new ReverseProxyMiddleware($this->mockHttpKernel, $settings); // Mock a request object. $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') - ->setMethods(['setTrustedProxies']) + ->onlyMethods(['setTrustedProxies']) ->getMock(); // setTrustedProxies() should never fire. $request->expects($this->never()) diff --git a/web/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/web/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php index 8fffaac69dccfdc075b1e49606ba9773ef2dad6a..1c25ed65d74a89876e85f5ddce127fe6161977e7 100644 --- a/web/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php +++ b/web/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php @@ -57,7 +57,7 @@ public function testToString() { $string = 'May I have an exception please?'; $text = $this->getMockBuilder(TranslatableMarkup::class) ->setConstructorArgs([$string, [], [], $translation]) - ->setMethods(['_die']) + ->onlyMethods(['_die']) ->getMock(); $text ->expects($this->once()) diff --git a/web/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php b/web/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php index b377393c264e3bc2dee16219c4522d1831cfe88d..1721984de8dd93b07745bf8f69ae6926c3ebb3f9 100644 --- a/web/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php +++ b/web/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php @@ -19,7 +19,7 @@ class BrowserTestBaseTest extends UnitTestCase { protected function mockBrowserTestBaseWithDriver($driver) { $session = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() - ->setMethods(['getDriver']) + ->onlyMethods(['getDriver']) ->getMock(); $session->expects($this->any()) ->method('getDriver') @@ -27,7 +27,7 @@ protected function mockBrowserTestBaseWithDriver($driver) { $btb = $this->getMockBuilder(BrowserTestBase::class) ->disableOriginalConstructor() - ->setMethods(['getSession']) + ->onlyMethods(['getSession']) ->getMockForAbstractClass(); $btb->expects($this->any()) ->method('getSession') @@ -44,7 +44,7 @@ public function testGetHttpClient() { $expected = new \stdClass(); $browserkit_client = $this->getMockBuilder(DrupalTestBrowser::class) - ->setMethods(['getClient']) + ->onlyMethods(['getClient']) ->getMockForAbstractClass(); $browserkit_client->expects($this->once()) ->method('getClient') @@ -112,7 +112,7 @@ public function testTearDownWithoutSetUp() { $this->assertTrue(method_exists(BrowserTestBase::class, $method)); $btb = $this->getMockBuilder(BrowserTestBase::class) ->disableOriginalConstructor() - ->setMethods([$method]) + ->onlyMethods([$method]) ->getMockForAbstractClass(); $btb->expects($this->never())->method($method); $ref_tearDown = new \ReflectionMethod($btb, 'tearDown'); diff --git a/web/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php b/web/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php index ec34f8fb77820d9867d47265b17872a6368add0f..cc372deb1df662fadba48c58e341c2642dbcaad5 100644 --- a/web/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php +++ b/web/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php @@ -26,7 +26,7 @@ public function testRunTestsError() { // Create a mock runner. $runner = $this->getMockBuilder(PhpUnitTestRunner::class) ->disableOriginalConstructor() - ->setMethods(['xmlLogFilepath', 'runCommand']) + ->onlyMethods(['xmlLogFilepath', 'runCommand']) ->getMock(); // Set some expectations for xmlLogFilepath(). diff --git a/web/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php b/web/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php index 2a76f05476aa7f74347921bea4852d5c23af4f71..51eb801daf8f310a7ce8117821bb2492cd15726f 100644 --- a/web/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php +++ b/web/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php @@ -422,7 +422,7 @@ protected function getTestDiscoveryMock($app_root, $extensions) { $test_discovery = $this->getMockBuilder(TestDiscovery::class) ->setConstructorArgs([$app_root, $class_loader->reveal(), $module_handler->reveal()]) - ->setMethods(['getExtensions']) + ->onlyMethods(['getExtensions']) ->getMock(); $test_discovery->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/Core/Theme/RegistryLegacyTest.php b/web/core/tests/Drupal/Tests/Core/Theme/RegistryLegacyTest.php index 638a0b1a7ce05a3b432c87665e285c1e3fb7f60a..6572653f4b19d262a7b527480eeb45ffc123bd65 100644 --- a/web/core/tests/Drupal/Tests/Core/Theme/RegistryLegacyTest.php +++ b/web/core/tests/Drupal/Tests/Core/Theme/RegistryLegacyTest.php @@ -132,7 +132,7 @@ public function testGetLegacyThemeFunctionRegistryForModule() { protected function setupTheme() { $this->registry = $this->getMockBuilder(Registry::class) - ->setMethods(['getPath']) + ->onlyMethods(['getPath']) ->setConstructorArgs([$this->root, $this->cache, $this->lock, $this->moduleHandler, $this->themeHandler, $this->themeInitialization]) ->getMock(); $this->registry->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/web/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php index 41e95e4283470af6c61fb2913229c60c8f9d2a9e..1d2d9001c02e5ee15dce7a64bab01077fdb5b674 100644 --- a/web/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php +++ b/web/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php @@ -472,7 +472,7 @@ public function providerTestPostProcessExtension() { protected function setupTheme() { $this->registry = $this->getMockBuilder(Registry::class) - ->setMethods(['getPath']) + ->onlyMethods(['getPath']) ->setConstructorArgs([$this->root, $this->cache, $this->lock, $this->moduleHandler, $this->themeHandler, $this->themeInitialization]) ->getMock(); $this->registry->expects($this->any()) diff --git a/web/core/tests/Drupal/Tests/EntityViewTrait.php b/web/core/tests/Drupal/Tests/EntityViewTrait.php index e2891b9498dd45c8fda2f25a59cc32939c2b52eb..6f7fad2946757c28e149b2b481882f15f9a651a2 100644 --- a/web/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/web/core/tests/Drupal/Tests/EntityViewTrait.php @@ -15,11 +15,11 @@ trait EntityViewTrait { * * Entities postpone the composition of their renderable arrays to #pre_render * functions in order to maximize cache efficacy. This means that the full - * renderable array for an entity is constructed in drupal_render(). Some - * tests require the complete renderable array for an entity outside of the - * drupal_render process in order to verify the presence of specific values. - * This method isolates the steps in the render process that produce an - * entity's renderable array. + * renderable array for an entity is constructed in + * \Drupal::service('renderer')->render(). Some tests require the complete + * renderable array for an entity outside of the render process in order to + * verify the presence of specific values. This method isolates the steps in + * the render process that produce an entity's renderable array. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to prepare a renderable array for. diff --git a/web/core/themes/claro/claro.theme b/web/core/themes/claro/claro.theme index dd4497f1699be7f05b56ac0de4823afe2e823ab1..5916898c02c8bd99e8308fc6c3e4534625db3633 100644 --- a/web/core/themes/claro/claro.theme +++ b/web/core/themes/claro/claro.theme @@ -42,9 +42,8 @@ function claro_theme_suggestions_details_alter(&$suggestions, $variables) { /** * Implements hook_preprocess_HOOK() for menu-local-tasks templates. * - * Use preprocess hook to set #attached to child elements - * because they will be processed by Twig and drupal_render will - * be invoked. + * Use preprocess hook to set #attached to child elements because they will be + * processed by Twig and \Drupal::service('renderer')->render() will be invoked. */ function claro_preprocess_menu_local_tasks(&$variables) { if (!empty($variables['primary'])) { diff --git a/web/core/themes/claro/css/base/elements.css b/web/core/themes/claro/css/base/elements.css index e1ecf0e103f5da18a69f13c4a721694c6dcaae8e..fcdef88c83ad3b1bb7a529df767665e6f8da9d53 100644 --- a/web/core/themes/claro/css/base/elements.css +++ b/web/core/themes/claro/css/base/elements.css @@ -139,7 +139,7 @@ address { u, ins { - text-decoration: none; + text-decoration: underline; } s, diff --git a/web/core/themes/claro/css/base/elements.pcss.css b/web/core/themes/claro/css/base/elements.pcss.css index 27c2148d3224cd034f95d69c94416aa2d32fe9c5..3bf522deba37798d18ce3063b28d4681274ec025 100644 --- a/web/core/themes/claro/css/base/elements.pcss.css +++ b/web/core/themes/claro/css/base/elements.pcss.css @@ -116,7 +116,7 @@ address { } u, ins { - text-decoration: none; + text-decoration: underline; } s, strike, diff --git a/web/core/themes/claro/css/components/pager.css b/web/core/themes/claro/css/components/pager.css index 3fd0f09b5a4acb37d274d2278415879a3f5269f5..f9b9f70dbdd1613e50b322428dc60d1645f9b823 100644 --- a/web/core/themes/claro/css/components/pager.css +++ b/web/core/themes/claro/css/components/pager.css @@ -81,6 +81,7 @@ .pager__link.is-active, .pager__item--current { color: #fff; + border: 0.125rem solid transparent; background: #003cc5; } @@ -161,7 +162,4 @@ .pager__item a:hover { text-decoration: underline; } - .pager__link.is-active { - border: 0.125rem solid #fff; - } } diff --git a/web/core/themes/claro/css/components/pager.pcss.css b/web/core/themes/claro/css/components/pager.pcss.css index 4e7b41a1b9d7b3bb691b91de08103407b39b939f..2a3190e5b0b175235d32e4da49e17c49a41d5e30 100644 --- a/web/core/themes/claro/css/components/pager.pcss.css +++ b/web/core/themes/claro/css/components/pager.pcss.css @@ -79,6 +79,7 @@ .pager__link.is-active, .pager__item--current { color: var(--pager--active-fg-color); + border: var(--pager-border-width) solid transparent; background: var(--pager--active-bg-color); } .pager__item--first .pager__link::before { @@ -149,7 +150,4 @@ .pager__item a:hover { text-decoration: underline; } - .pager__link.is-active { - border: var(--pager-border-width) solid var(--color-white); - } } diff --git a/web/core/themes/olivero/css/base/variables.pcss.css b/web/core/themes/olivero/css/base/variables.pcss.css index 73936db0da3e7e2a6ddfe0aac503f37513b2f008..3f449eb948acd3808397303a2c26b58b419ce8ed 100644 --- a/web/core/themes/olivero/css/base/variables.pcss.css +++ b/web/core/themes/olivero/css/base/variables.pcss.css @@ -132,6 +132,7 @@ --color--gray-80: #e7edf1; /* Gray light 1 */ --color--gray-90: #f1f4f7; --color--gray-95: #f7f9fa; /* Gray light 2 */ + --color--blue-10: #0f6292; --color--blue-20: #0d77b5; /* Blue dark */ --color--blue-30: #3d92c4; /* Blue dark 2 */ --color--blue-50: #2494db; /* Blue medium */ diff --git a/web/core/themes/olivero/css/components/button.css b/web/core/themes/olivero/css/components/button.css index 008818bbb9e7bf7c785ca0ccef5dc30e38c9f6fa..b6b38eaf0cd4eecd16eebcdc7d1d28c170edec48 100644 --- a/web/core/themes/olivero/css/components/button.css +++ b/web/core/themes/olivero/css/components/button.css @@ -54,8 +54,10 @@ .button:hover, .button:focus { text-decoration: none; - color: #2494db; - border-color: #2494db; + color: #0f6292; + border: solid 2px #0f6292; + background: none; + font-weight: 700; } .button:focus { @@ -139,7 +141,8 @@ .button--primary:hover, .button--primary:focus { color: #fff; - background-color: #2494db; + border-color: #0f6292; + background-color: #0f6292; } .button--primary:active { diff --git a/web/core/themes/olivero/css/components/button.pcss.css b/web/core/themes/olivero/css/components/button.pcss.css index c9b838f3fee1e09226c6a5b6ab6266b9fa5ad83b..1bb849c592723bb07ec4f9be06386b84a3d69f9e 100644 --- a/web/core/themes/olivero/css/components/button.pcss.css +++ b/web/core/themes/olivero/css/components/button.pcss.css @@ -29,8 +29,10 @@ &:hover, &:focus { text-decoration: none; - color: var(--color--blue-50); - border-color: var(--color--blue-50); + color: var(--color--blue-10); + border: solid 2px var(--color--blue-10); + background: none; + font-weight: 700; } &:focus { @@ -87,7 +89,8 @@ &:hover, &:focus { color: var(--color--white); - background-color: var(--color--blue-50); + border-color: var(--color--blue-10); + background-color: var(--color--blue-10); } &:active { diff --git a/web/core/themes/olivero/css/components/header-search-narrow.css b/web/core/themes/olivero/css/components/header-search-narrow.css index ba69c83440ef0d936b0a3a25dd532f0de90eb3fc..a6dbf8b06b22745fcce82a497c89d4a952db3650 100644 --- a/web/core/themes/olivero/css/components/header-search-narrow.css +++ b/web/core/themes/olivero/css/components/header-search-narrow.css @@ -107,8 +107,7 @@ } .block-search-narrow input[type="search"] { - padding-top: 2.25rem; - padding-bottom: 2.25rem + height: 4.5rem } } diff --git a/web/core/themes/olivero/css/components/header-search-narrow.pcss.css b/web/core/themes/olivero/css/components/header-search-narrow.pcss.css index fdc0b99fa5c118dcfa5cd43d4af7241c5f782489..4c32e22b41636cb91be7a2259040c818d1653c58 100644 --- a/web/core/themes/olivero/css/components/header-search-narrow.pcss.css +++ b/web/core/themes/olivero/css/components/header-search-narrow.pcss.css @@ -62,7 +62,7 @@ } @media (--md) { - padding-block: var(--sp2); + height: calc(4 * var(--sp)); padding-inline-start: var(--sp2); padding-inline-end: var(--sp2); } diff --git a/web/core/themes/olivero/css/components/header-site-branding.css b/web/core/themes/olivero/css/components/header-site-branding.css index 2128511f761a85f98d08fdf755f0cd1cdc42b6eb..66ab2f0ea39409a1ba35d5be028a061f6f73477d 100644 --- a/web/core/themes/olivero/css/components/header-site-branding.css +++ b/web/core/themes/olivero/css/components/header-site-branding.css @@ -41,7 +41,7 @@ flex-shrink: 1; align-items: flex-end; min-width: calc(33.33333vw + 0.75rem); - height: 3.375rem; + min-height: 3.375rem; padding-top: 0; padding-bottom: 0.5625rem; @@ -52,14 +52,14 @@ @media (min-width: 31.25rem) { .site-branding { - height: 4.5rem + min-height: 4.5rem } } @media (min-width: 43.75rem) { .site-branding { - height: 6.75rem; + min-height: 6.75rem; padding-bottom: 1.125rem } } @@ -99,7 +99,7 @@ .site-branding { min-width: calc(14.28571vw + 0.99107rem); - height: 11.25rem; + min-height: 11.25rem; padding-top: 0; padding-bottom: 0 } diff --git a/web/core/themes/olivero/css/components/header-site-branding.pcss.css b/web/core/themes/olivero/css/components/header-site-branding.pcss.css index b3d7089396709804e32a05087b853ef515d6202b..5bb4827e76da37eeeab5a11ac96bc965de2f3ef2 100644 --- a/web/core/themes/olivero/css/components/header-site-branding.pcss.css +++ b/web/core/themes/olivero/css/components/header-site-branding.pcss.css @@ -10,7 +10,7 @@ flex-shrink: 1; align-items: flex-end; min-width: calc((2 * var(--grid-col-width)) + (2 * var(--grid-gap)) + var(--container-padding)); - height: var(--sp3); + min-height: var(--sp3); margin-inline: calc(-1 * var(--container-padding)) var(--sp); padding-block: 0 var(--sp0-5); padding-inline-start: var(--container-padding); @@ -20,11 +20,11 @@ background-image: linear-gradient(160deg, var(--color--blue-50) 0%, #0d7ab8 78.66%); @media (--sm) { - height: var(--sp4); + min-height: var(--sp4); } @media (--md) { - height: var(--sp6); + min-height: var(--sp6); padding-block-end: var(--sp); } @@ -34,7 +34,7 @@ @media (--nav) { min-width: calc((2 * var(--grid-col-width--nav)) + (2 * var(--grid-gap--nav)) + var(--container-padding-nav)); - height: var(--site-header-height-wide); + min-height: var(--site-header-height-wide); margin-inline-start: calc(-1 * var(--container-padding-nav)); padding-block: 0; padding-inline-start: var(--container-padding-nav); diff --git a/web/core/themes/olivero/css/components/navigation/nav-primary-wide.css b/web/core/themes/olivero/css/components/navigation/nav-primary-wide.css index 336d82a2ca00e862c024eb73a976eccd8b5d2ea1..7a36e1bb06536fc987fb438f50faf683698f7b3e 100644 --- a/web/core/themes/olivero/css/components/navigation/nav-primary-wide.css +++ b/web/core/themes/olivero/css/components/navigation/nav-primary-wide.css @@ -23,7 +23,7 @@ /* Remove hover state if submenu exists. */ } - body:not(.is-always-mobile-nav) .primary-nav__menu-item.primary-nav__menu-item--has-children .primary-nav__menu-link-inner:after { + body:not(.is-always-mobile-nav) .primary-nav__menu-item.primary-nav__menu-item--has-children .primary-nav__menu-link--level-1 .primary-nav__menu-link-inner:after { content: none; } diff --git a/web/core/themes/olivero/css/components/navigation/nav-primary-wide.pcss.css b/web/core/themes/olivero/css/components/navigation/nav-primary-wide.pcss.css index 63a2b19cb5b633b86e44ba76d9edc4240550a5cb..65c7019c0d7a4ced7297a95f713d5d42ccb1681a 100644 --- a/web/core/themes/olivero/css/components/navigation/nav-primary-wide.pcss.css +++ b/web/core/themes/olivero/css/components/navigation/nav-primary-wide.pcss.css @@ -17,7 +17,7 @@ body:not(.is-always-mobile-nav) { } /* Remove hover state if submenu exists. */ - & .primary-nav__menu-link-inner:after { + & .primary-nav__menu-link--level-1 .primary-nav__menu-link-inner:after { content: none; } } diff --git a/web/core/themes/olivero/css/components/navigation/nav-primary.css b/web/core/themes/olivero/css/components/navigation/nav-primary.css index b36f3cdb591f1f2246a6353b2202f2fbbc288640..6d7acd3b391622ea2191d624c31da5061fb2ba49 100644 --- a/web/core/themes/olivero/css/components/navigation/nav-primary.css +++ b/web/core/themes/olivero/css/components/navigation/nav-primary.css @@ -196,15 +196,10 @@ border-top: solid 5px #2494db; } -.primary-nav__menu-link-inner:hover, - .primary-nav__menu-link-inner:focus { - outline: 0 +.primary-nav__menu-link:hover .primary-nav__menu-link-inner:after { + transform: scaleX(1) } -.primary-nav__menu-link-inner:hover:after, .primary-nav__menu-link-inner:focus:after { - transform: scaleX(1); - } - /* Top level specific styles. */ diff --git a/web/core/themes/olivero/css/components/navigation/nav-primary.pcss.css b/web/core/themes/olivero/css/components/navigation/nav-primary.pcss.css index a0610f59ec499853420c1938aa7fa3b978c1632b..b897d9f770bd95ce38b0e675968695d7acbbffb1 100644 --- a/web/core/themes/olivero/css/components/navigation/nav-primary.pcss.css +++ b/web/core/themes/olivero/css/components/navigation/nav-primary.pcss.css @@ -114,11 +114,8 @@ border-top: solid 5px var(--color--blue-50); } - &:hover, - &:focus { - outline: 0; - - &:after { + &:after { + @nest .primary-nav__menu-link:hover & { transform: scaleX(1); } } diff --git a/web/core/themes/olivero/css/components/node-teaser.css b/web/core/themes/olivero/css/components/node-teaser.css index 8704b31f2fa924d45d52fe111bc9de0c20f9e0d5..273f61723a9ecbfd95a25ff54c29482cf5be8ce7 100644 --- a/web/core/themes/olivero/css/components/node-teaser.css +++ b/web/core/themes/olivero/css/components/node-teaser.css @@ -36,16 +36,15 @@ .node--view-mode-teaser .node__top-wrapper { display: flex; + flex-wrap: wrap; align-items: center; - margin: 0; - margin-bottom: 1.125rem + margin: 0 } @media (min-width: 62.5rem) { .node--view-mode-teaser .node__top-wrapper { - position: relative; /* Anchor the image */ - margin: 0 + position: relative /* Anchor the image */ } } @@ -59,9 +58,23 @@ .node--view-mode-teaser .primary-image { flex-shrink: 0; - margin: 0 + margin: 0; + margin-bottom: 1.125rem + + /* Ensure title does not wrap under image until necessary. */ } +.node--view-mode-teaser .primary-image + .node__title { + flex-basis: calc(100% - 5.0625rem) + } + +@media (min-width: 62.5rem) { + +.node--view-mode-teaser .primary-image + .node__title { + flex-basis: auto + } + } + .node--view-mode-teaser .primary-image a { display: block; } @@ -139,6 +152,7 @@ .node--view-mode-teaser .node__title { margin: 0; + margin-bottom: 1.125rem; color: #0d1214; font-size: 1.5rem; line-height: 1.6875rem @@ -147,7 +161,6 @@ @media (min-width: 62.5rem) { .node--view-mode-teaser .node__title { - margin-bottom: 1.125rem; font-size: 2.25rem; line-height: 3.375rem } diff --git a/web/core/themes/olivero/css/components/node-teaser.pcss.css b/web/core/themes/olivero/css/components/node-teaser.pcss.css index 29ec28bbca10d709086d3f9f64b9a1eccd10b34b..82335fa89a44f8d7c2a09169af6acd78ca8b8e7b 100644 --- a/web/core/themes/olivero/css/components/node-teaser.pcss.css +++ b/web/core/themes/olivero/css/components/node-teaser.pcss.css @@ -30,21 +30,30 @@ & .node__top-wrapper { display: flex; + flex-wrap: wrap; align-items: center; margin: 0; - margin-block-end: var(--sp1); @media (--lg) { position: relative; /* Anchor the image */ - margin: 0; } } & .primary-image { flex-shrink: 0; margin: 0; + margin-block-end: var(--sp1); margin-inline-end: var(--sp1); + /* Ensure title does not wrap under image until necessary. */ + & + .node__title { + flex-basis: calc(100% - calc(4.5 * var(--sp))); + + @media (--lg) { + flex-basis: auto; + } + } + & a { display: block; } @@ -89,12 +98,12 @@ & .node__title { margin: 0; + margin-block-end: var(--sp1); color: var(--color--gray-0); font-size: 24px; line-height: var(--line-height-base); @media (--lg) { - margin-block-end: var(--sp1); font-size: var(--sp2); line-height: var(--sp3); } diff --git a/web/core/themes/olivero/css/components/skip-link.css b/web/core/themes/olivero/css/components/skip-link.css index 1fc54e28e6411d2a88076c12f2f6366d53a47bcc..258a7271fe775f72bae272947e62362b5e23d49f 100644 --- a/web/core/themes/olivero/css/components/skip-link.css +++ b/web/core/themes/olivero/css/components/skip-link.css @@ -40,6 +40,11 @@ background-color: #0d1214 } +.skip-link:hover { + text-decoration: underline; + color: #fff; + } + .skip-link:after { content: "\0020 ➔"; } diff --git a/web/core/themes/olivero/css/components/skip-link.pcss.css b/web/core/themes/olivero/css/components/skip-link.pcss.css index dfd5330f82d883768ae5b99096a382ab86c3ed28..ca8a0dc7acacdc4dfe8cd5f854f5f8c2c26046fb 100644 --- a/web/core/themes/olivero/css/components/skip-link.pcss.css +++ b/web/core/themes/olivero/css/components/skip-link.pcss.css @@ -19,6 +19,11 @@ outline: 0; background-color: var(--color--gray-0); + &:hover { + text-decoration: underline; + color: var(--color--white); + } + &:after { content: "\0020 ➔"; } diff --git a/web/core/themes/seven/seven.theme b/web/core/themes/seven/seven.theme index f82c38d23294cecbc1c378e0e5ee77e59cc42d01..8aa5ed8f717fb9db1f2565250284238a6bedae68 100644 --- a/web/core/themes/seven/seven.theme +++ b/web/core/themes/seven/seven.theme @@ -30,9 +30,8 @@ function seven_preprocess_html(&$variables) { /** * Implements hook_preprocess_HOOK() for menu-local-tasks templates. * - * Use preprocess hook to set #attached to child elements - * because they will be processed by Twig and drupal_render will - * be invoked. + * Use preprocess hook to set #attached to child elements because they will be + * processed by Twig and \Drupal::service('renderer')->render() will be invoked. */ function seven_preprocess_menu_local_tasks(&$variables) { if (!empty($variables['primary'])) {