diff --git a/core/includes/common.inc b/core/includes/common.inc index 67b181281ca2d474994c74a502b4351b2d2e430b..bed7adc49b03aabce6fe3eef766fd112403daa2a 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1117,7 +1117,6 @@ function drupal_flush_all_caches() { // to reset the theme manager. \Drupal::theme()->resetActiveTheme(); - // Rebuild and reboot a new kernel. A simple DrupalKernel reboot is not // sufficient, since the list of enabled modules might have been adjusted // above due to changed code. diff --git a/core/includes/file.inc b/core/includes/file.inc index 0288c83204bd3813b5050f91ee1b976bdeaeb910..b6ab267e4f6e103ac38e373a66f0131d4d8fbeb9 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -526,7 +526,6 @@ function file_unmanaged_prepare($source, &$destination = NULL, $replace = FILE_E $destination = file_build_uri(drupal_basename($source)); } - // Prepare the destination directory. if (file_prepare_directory($destination)) { // The destination is already a directory, so append the source basename. diff --git a/core/lib/Drupal/Component/Diff/Diff.php b/core/lib/Drupal/Component/Diff/Diff.php index 8135b1582563d793c8780307a879291901251676..289bab5f0e7c542822d52a11c1e0631aa9c59cdf 100644 --- a/core/lib/Drupal/Component/Diff/Diff.php +++ b/core/lib/Drupal/Component/Diff/Diff.php @@ -148,7 +148,6 @@ public function check($from_lines, $to_lines) { trigger_error("Reversed closing doesn't match", E_USER_ERROR); } - $prevtype = 'none'; foreach ($this->edits as $edit) { if ( $prevtype == $edit->type ) { diff --git a/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php b/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php index bf49e540ed8166341cd465448d15218f65d27b45..2025fbbf61cad423076b892f4f436fb33f3ab83c 100644 --- a/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php @@ -36,7 +36,6 @@ public function process(ContainerBuilder $container) { } } - $container->setParameter('cache_contexts', $cache_contexts); } diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php index a14a83f07787b75847ed17d6b14121339a712526..a7c1496c7a8f64ecbdd95f24c4467e4f21d7c43e 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php @@ -124,7 +124,6 @@ public static function open(array &$connection_options = []) { throw $e; } - // Create functions needed by SQLite. $pdo->sqliteCreateFunction('if', [__CLASS__, 'sqlFunctionIf']); $pdo->sqliteCreateFunction('greatest', [__CLASS__, 'sqlFunctionGreatest']); diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php index 80533fdfef2cb4aeccf340f885b1776eba93de11..ee4ed848ab3f8d35eb45889a9a8cdb82f42c7e14 100644 --- a/core/lib/Drupal/Core/Database/Query/Select.php +++ b/core/lib/Drupal/Core/Database/Query/Select.php @@ -825,7 +825,6 @@ public function __toString() { } $query .= implode(', ', $fields); - // FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway. $query .= "\nFROM "; foreach ($this->tables as $table) { diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php index 1578cef1532cd0a1ae150106eb371f15a26f7747..52e5c2b4bd354d23c036a4fc271288bace89ecea 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/BackendCompilerPass.php @@ -56,7 +56,6 @@ public function process(ContainerBuilder $container) { } } - foreach ($container->findTaggedServiceIds('backend_overridable') as $id => $attributes) { // If the service is already an alias it is not the original backend, so // we don't want to fallback to other storages any longer. diff --git a/core/lib/Drupal/Core/Extension/ThemeInstaller.php b/core/lib/Drupal/Core/Extension/ThemeInstaller.php index db1226fa982ae6ae69908c7f8c9c3a396d5f917b..5472d3efeab826e9deee20a17af465305aaa0265 100644 --- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php +++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php @@ -265,7 +265,6 @@ public function uninstall(array $theme_list) { $extension_config->save(TRUE); $this->state->set('system.theme.data', $current_theme_data); - // @todo Remove system_list(). $this->themeHandler->refreshInfo(); $this->resetSystem(); diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index 46c6f297e3c8e4cd71859ab7cf06e1d983f6ee6a..5a26db0c005abf21696a448a7325fec9c4bcd990 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -269,7 +269,6 @@ public static function preRenderAjaxForm($element) { $element['#attributes']['data-disable-refocus'] = "true"; } - // Add a reasonable default event handler if none was specified. if (isset($element['#ajax']) && !isset($element['#ajax']['event'])) { switch ($element['#type']) { diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php index 0de728892fd13b8746d8857085e987ee70a2190a..f19b0eed8df277f560bc28ed754f4209d8f59ade 100644 --- a/core/lib/Drupal/Core/Routing/MatcherDumper.php +++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php @@ -141,7 +141,6 @@ public function dump(array $options = []) { $insert->execute(); } - } catch (\Exception $e) { $transaction->rollBack(); diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index b312d7633d315ab6894f04ebc0b73add38b0b379..ef658c275023b26dddc05b79c4edb8df99422f53 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -446,7 +446,6 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse } } - // Create a new HtmlResponse. Ensure the CSS and (non-bottom) JS is sent // before the HTML they're associated with. In other words: ensure the // critical assets for this placeholder's markup are loaded first. @@ -483,7 +482,6 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse } } - // Send this embedded HTML response. $this->sendChunk($html_response); diff --git a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php index 51b19763960ada4622f0c596d3305489f9a14346..e3da529ea46d6cda33df3bef2b7e2865ab610ff6 100644 --- a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php +++ b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php @@ -45,7 +45,6 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf 'contexts' => ['session.exists', 'cookies:big_pipe_nojs'], ]; - // 1. Real-world example of HTML placeholder. $status_messages = new BigPipePlaceholderTestCase( ['#type' => 'status_messages'], @@ -96,7 +95,6 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf $status_messages->embeddedHtmlResponse = '' . "\n \n"; } - // 2. Real-world example of HTML attribute value placeholder: form action. $form_action = new BigPipePlaceholderTestCase( $container ? $container->get('form_builder')->getForm('Drupal\big_pipe_test\Form\BigPipeTestForm') : [], @@ -119,7 +117,6 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf $form_action->embeddedHtmlResponse = '
embeddedHtmlResponse = $container->get('csrf_token')->get('admin/appearance/default'); } - // 4. Edge case: custom string to be considered as a placeholder that // happens to not be valid HTML. $hello = new BigPipePlaceholderTestCase( @@ -182,7 +178,6 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf ]; $hello->embeddedHtmlResponse = 'Yarhar llamas forever!'; - // 5. Edge case: non-#lazy_builder placeholder. $current_time = new BigPipePlaceholderTestCase( [ @@ -239,7 +234,6 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf ]; $current_time->embeddedHtmlResponse = ''; - // 6. Edge case: #lazy_builder that throws an exception. $exception = new BigPipePlaceholderTestCase( [ diff --git a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php index cff22ba22c0a10e6fa4ff0711a75f0ff34071e2a..9fe7aea09bae809071fbd1e6d2542911d5ea09a2 100644 --- a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php +++ b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php @@ -54,7 +54,6 @@ public function testCommentThreading() { // Confirm that there is a link to the parent comment. $this->assertParentLink($comment1_3->id(), $comment1->id()); - // Reply to comment #1_3 creating comment #1_3_4. $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment1_3->id()); $comment1_3_4 = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE); diff --git a/core/modules/datetime/src/Plugin/views/filter/Date.php b/core/modules/datetime/src/Plugin/views/filter/Date.php index 0da78f0e598e6041ea48c35b313730299e2fc975..378f33fe84c80366cfe18f3faf4f5d8dcfb6dbb7 100644 --- a/core/modules/datetime/src/Plugin/views/filter/Date.php +++ b/core/modules/datetime/src/Plugin/views/filter/Date.php @@ -97,7 +97,6 @@ protected function opBetween($field) { // Formatting will vary on date storage. - // Convert to ISO format and format for query. UTC timezone is used since // dates are stored in UTC. $a = $this->query->getDateFormat("'" . $this->dateFormatter->format($a, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, DateTimeItemInterface::STORAGE_TIMEZONE) . "'", $this->dateFormat, TRUE); diff --git a/core/modules/editor/src/Tests/EditorSecurityTest.php b/core/modules/editor/src/Tests/EditorSecurityTest.php index cf9ab8f6a2adee9cff0bbb9e04b06eb65e58cfbe..f3c2995b40595fdcf9f101735a82f080cf5ca355 100644 --- a/core/modules/editor/src/Tests/EditorSecurityTest.php +++ b/core/modules/editor/src/Tests/EditorSecurityTest.php @@ -158,7 +158,6 @@ protected function setUp() { ]); $editor->save(); - // Create node type. $this->drupalCreateContentType([ 'type' => 'article', diff --git a/core/modules/editor/tests/src/Functional/Update/EditorUpdateTest.php b/core/modules/editor/tests/src/Functional/Update/EditorUpdateTest.php index a143c053d3d3de15ddb015afdc3d87402dabe112..ad364844edc707fd9db9379eb86437212436d4cc 100644 --- a/core/modules/editor/tests/src/Functional/Update/EditorUpdateTest.php +++ b/core/modules/editor/tests/src/Functional/Update/EditorUpdateTest.php @@ -46,7 +46,6 @@ public function testEditorUpdate8001() { $this->assertTrue($editor_full_html->get('status')); $this->assertNotIdentical($format_full_html->get('status'), $editor_full_html->get('status')); - // Run updates. $this->runUpdates(); diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php index 19575840f29e343c425075879c22151b9e9e20c8..ca36950ce84bdc444c724e39a2a92e7a3cd7652c 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php @@ -77,7 +77,6 @@ protected function setUp() { ], ])->save(); - // Create a file field. $file_field_name = 'file_field'; $field_storage = FieldStorageConfig::create([ diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php index 2c4cdab752e39f295e3ac2ecb18bf212e33fb799..24d4116f666385f94ebacf399b312e3d732a7781 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php @@ -128,7 +128,6 @@ public function testFieldInstances() { $this->assertEntity('comment.comment_node_test_content_type.field_integer', 'Integer', 'integer', FALSE, FALSE); $this->assertEntity('user.user.field_file', 'File', 'file', FALSE, FALSE); - $this->assertLinkFields('node.test_content_type.field_link', DRUPAL_OPTIONAL); $this->assertLinkFields('node.article.field_link', DRUPAL_DISABLED); $this->assertLinkFields('node.blog.field_link', DRUPAL_REQUIRED); diff --git a/core/modules/forum/forum.views.inc b/core/modules/forum/forum.views.inc index 6f2425912b5d7b3b72cb3d597e57b578fce7106c..5f67af59a0fa8fb83cbda397bf5ab6897749de43 100644 --- a/core/modules/forum/forum.views.inc +++ b/core/modules/forum/forum.views.inc @@ -86,7 +86,6 @@ function forum_views_data() { ], ]; - $data['forum_index']['created'] = [ 'title' => t('Post date'), 'help' => t('The date the content was posted.'), diff --git a/core/modules/forum/tests/src/Functional/ForumBlockTest.php b/core/modules/forum/tests/src/Functional/ForumBlockTest.php index 2914e94e8a27b3bed23e6dfa2106709f420497cb..b231f6d0eace0ca786cec3667e3a6552694c5316 100644 --- a/core/modules/forum/tests/src/Functional/ForumBlockTest.php +++ b/core/modules/forum/tests/src/Functional/ForumBlockTest.php @@ -52,7 +52,6 @@ public function testNewForumTopicsBlock() { // Create 5 forum topics. $topics = $this->createForumTopics(); - $this->assertLink(t('More'), 0, 'New forum topics block has a "more"-link.'); $this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.'); diff --git a/core/modules/forum/tests/src/Functional/ForumIndexTest.php b/core/modules/forum/tests/src/Functional/ForumIndexTest.php index e3d904d368f72ba6f09509828a92b4fe16c030a9..5d0ccdff3a70a723234611347e8e401807c44050 100644 --- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php +++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php @@ -71,7 +71,6 @@ public function testForumIndexStatus() { $this->assertCacheTag('taxonomy_term:' . $tid); $this->assertCacheTag('taxonomy_term:' . $tid_child); - // Unpublish the node. $edit = ['status[value]' => FALSE]; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); diff --git a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php index fb9da660b36e1d23dfa87f802f81af28c3b87858..9849084c6cd642a39237caa8256ee0c89faacff0 100644 --- a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php +++ b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php @@ -61,7 +61,6 @@ public function testForumNodeAccess() { $public_node = $this->drupalGetNodeByTitle($public_node_title); $this->assertTrue(!empty($public_node), 'New public forum node found in database.'); - // Enable the new and active forum blocks. $this->drupalPlaceBlock('forum_active_block'); $this->drupalPlaceBlock('forum_new_block'); diff --git a/core/modules/hal/tests/src/Functional/EntityResource/HalEntityNormalizationTrait.php b/core/modules/hal/tests/src/Functional/EntityResource/HalEntityNormalizationTrait.php index b64de679574e935e7028e196dd270091eb1fa065..1fc23291b57759d2f9dd8b59ac3dac9ce457249d 100644 --- a/core/modules/hal/tests/src/Functional/EntityResource/HalEntityNormalizationTrait.php +++ b/core/modules/hal/tests/src/Functional/EntityResource/HalEntityNormalizationTrait.php @@ -97,7 +97,6 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques if ($this->entity->getEntityType()->hasKey('bundle')) { $normalization = $this->getNormalizedPostEntity(); - $normalization['_links']['type'] = Url::fromUri('base:rest/type/' . static::$entityTypeId . '/bad_bundle_name'); $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); @@ -105,11 +104,9 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(422, 'No entity type(s) specified', $response); - unset($normalization['_links']['type']); $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 422 when no entity type bundle is specified. $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(422, 'The type link relation must be specified.', $response); diff --git a/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php b/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php index b9d345e1db8d071de4e17e57bc8a5d10adba0371..5aebaf43a1df251277425b4ced2799f3b8475e6c 100644 --- a/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php +++ b/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php @@ -81,7 +81,6 @@ public function testHandlers() { 'timestamp' => REQUEST_TIME + 100, ])->execute(); - $column_map = [ 'nid' => 'nid', ]; diff --git a/core/modules/image/src/Tests/ImageDimensionsTest.php b/core/modules/image/src/Tests/ImageDimensionsTest.php index b3e100dd9f5ba28fdb18ae6fb3b4f76478a628f4..d81c04dc903f9f43d34eaba1c3734ceb776a7136 100644 --- a/core/modules/image/src/Tests/ImageDimensionsTest.php +++ b/core/modules/image/src/Tests/ImageDimensionsTest.php @@ -173,7 +173,6 @@ public function testImageDimensions() { $this->assertResponse(200, 'Image was generated at the URL.'); $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); - // Add a crop effect. $effect = [ 'id' => 'image_crop', diff --git a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php index 41ecd4a87d80091fca4d185c3de7ae8a4dd727bf..2842df84830327d042ca1bf95ad93bcbaa955d8f 100644 --- a/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php @@ -31,7 +31,6 @@ public function testValidate($value, $valid) { ->method('addViolation'); } - $constraint = new LinkNotExistingInternalConstraint(); $validator = new LinkNotExistingInternalConstraintValidator(); diff --git a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php index c7689d9631c6c29d5a3a7006959a0d099b794701..414ecdeb0df1b1329d5975303cfff09780ea9300 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php @@ -59,7 +59,6 @@ public function testOutboundPathAndRouteProcessing() { $menu_tree = \Drupal::menuTree(); $renderer = \Drupal::service('renderer'); - $default_menu_cacheability = (new BubbleableMetadata()) ->setCacheMaxAge(Cache::PERMANENT) ->setCacheTags(['config:system.menu.tools']) diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php index f238504495306d862daaa04fc9ad0faa24e9a220..6bfaf42f1dcbcee7749066a4d046e3b75db50235 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -260,7 +260,6 @@ public function buildCredentialForm(array $form, FormStateInterface $form_state) $default_options = []; - $form['version'] = [ '#type' => 'radios', '#default_value' => 7, diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index efb4011d9a9f66d4eb63fb03712f2f6139f201de..da5b260537794623e43f1e8f7f5e5a557ed5a2be 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -166,7 +166,6 @@ public function testRevisions() { $expected = '
  • Delete
  • '; $this->assertTrue(strstr($json[$ids[0]], $expected), 'The "Delete" contextual link is shown for the default revision.'); - // Confirm that revisions revert properly. $this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionid() . "/revert", [], t('Revert')); $this->assertRaw(t('@type %title has been reverted to the revision from %revision-date.', [ @@ -191,7 +190,6 @@ public function testRevisions() { $this->assertFalse(strstr($json[$ids[0]], '
  • '), 'The "Edit" contextual link is not shown for a non-default revision.'); $this->assertFalse(strstr($json[$ids[0]], '
  • '), 'The "Delete" contextual link is not shown for a non-default revision.'); - // Confirm revisions delete properly. $this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", [], t('Delete')); $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', [ diff --git a/core/modules/path/src/Form/PathFormBase.php b/core/modules/path/src/Form/PathFormBase.php index c1b3dfdf566422e109cedd74b961bf0341422c0f..5a54c08b482deb5a9bbb9e2aa0eff64ab37d4ffe 100644 --- a/core/modules/path/src/Form/PathFormBase.php +++ b/core/modules/path/src/Form/PathFormBase.php @@ -191,7 +191,6 @@ public function validateForm(array &$form, FormStateInterface $form_state) { } } - if (!$this->pathValidator->isValid(trim($source, '/'))) { $form_state->setErrorByName('source', t("Either the path '@link_path' is invalid or you do not have access to it.", ['@link_path' => $source])); } diff --git a/core/modules/rest/src/RequestHandler.php b/core/modules/rest/src/RequestHandler.php index 4b7020c128cbc8d0652e6ee9431a221dfd86e8ee..95deeaab8cefefcf145ec862de8c3bb2e159ae2e 100644 --- a/core/modules/rest/src/RequestHandler.php +++ b/core/modules/rest/src/RequestHandler.php @@ -76,7 +76,6 @@ public function handle(RouteMatchInterface $route_match, Request $request) { $method = strtolower($route_match->getRouteObject()->getMethods()[0]); assert(count($route_match->getRouteObject()->getMethods()) === 1); - $resource_config_id = $route_match->getRouteObject()->getDefault('_rest_resource_config'); /** @var \Drupal\rest\RestResourceConfigInterface $resource_config */ $resource_config = $this->resourceStorage->load($resource_config_id); diff --git a/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php b/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php index 3b7c3b48626f25cd7f6fd1f6086ed93f7e39460b..a63e41aa72fe0c9f7d397ce7462badab64eaa2b3 100644 --- a/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php +++ b/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php @@ -109,23 +109,18 @@ protected function assertAuthenticationEdgeCases($method, Url $url, array $reque return; } - unset($request_options[RequestOptions::HEADERS]['X-CSRF-Token']); - // DX: 403 when missing X-CSRF-Token request header. $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(403, 'X-CSRF-Token request header is missing', $response); - $request_options[RequestOptions::HEADERS]['X-CSRF-Token'] = 'this-is-not-the-token-you-are-looking-for'; - // DX: 403 when invalid X-CSRF-Token request header. $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(403, 'X-CSRF-Token request header is invalid', $response); - $request_options[RequestOptions::HEADERS]['X-CSRF-Token'] = $this->csrfToken; } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 9a4527fee0ede9e837b523abaf5f8f7bf8f9b0a5..71969403503ec34c2d1ef61e12d20d0a7265641f 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -306,17 +306,14 @@ public function testGet() { $url = $this->getEntityResourceUrl(); $request_options = []; - // DX: 404 when resource not provisioned, 403 if canonical route. HTML // response because missing ?_format query string. $response = $this->request('GET', $url, $request_options); $this->assertSame($has_canonical_url ? 403 : 404, $response->getStatusCode()); $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); - $url->setOption('query', ['_format' => static::$format]); - // DX: 404 when resource not provisioned, 403 if canonical route. Non-HTML // response because ?_format query string is present. $response = $this->request('GET', $url, $request_options); @@ -327,12 +324,10 @@ public function testGet() { $this->assertResourceErrorResponse(404, 'No route found for "GET ' . str_replace($this->baseUrl, '', $this->getEntityResourceUrl()->setAbsolute()->toString()) . '"', $response); } - $this->provisionEntityResource(); // Simulate the developer again forgetting the ?_format query string. $url->setOption('query', []); - // DX: 406 when ?_format is missing, except when requesting a canonical HTML // route. $response = $this->request('GET', $url, $request_options); @@ -343,10 +338,8 @@ public function testGet() { $this->assert406Response($response); } - $url->setOption('query', ['_format' => static::$format]); - // DX: forgetting authentication: authentication provider-specific error // response. if (static::$auth) { @@ -370,16 +363,13 @@ public function testGet() { unset($request_options[RequestOptions::HEADERS]['REST-test-auth-global']); $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions('GET')); - // DX: 403 when unauthorized. $response = $this->request('GET', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('GET'), $response); $this->assertArrayNotHasKey('Link', $response->getHeaders()); - $this->setUpAuthorization('GET'); - // 200 for well-formed HEAD request. $response = $this->request('HEAD', $url, $request_options); $this->assertResourceResponse(200, '', $response); @@ -506,11 +496,9 @@ public function testGet() { // PrimitiveDataNormalizer. $this->rebuildAll(); - $response = $this->request('GET', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - // Again do an identical comparison, but this time transform the expected // normalized entity's values to strings. This ensures the BC layer for // bc_primitives_as_strings works as expected. @@ -540,11 +528,9 @@ public function testGet() { // TimestampItemNormalizer. $this->rebuildAll(); - $response = $this->request('GET', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - // This ensures the BC layer for bc_timestamp_normalizer_unix works as // expected. This method should be using // ::formatExpectedTimestampValue() to generate the timestamp value. This @@ -562,75 +548,59 @@ public function testGet() { $this->rebuildAll(); } - // BC: rest_update_8203(). $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); $this->refreshTestStateAfterRestConfigChange(); - // DX: 403 when unauthorized. $response = $this->request('GET', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('GET'), $response); - $this->grantPermissionsToTestedRole(['restful get entity:' . static::$entityTypeId]); - // 200 for well-formed request. $response = $this->request('GET', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - $this->resourceConfigStorage->load(static::$resourceConfigId)->disable()->save(); $this->refreshTestStateAfterRestConfigChange(); - // DX: upon disabling a resource, it's immediately no longer available. $this->assertResourceNotAvailable($url, $request_options); - $this->resourceConfigStorage->load(static::$resourceConfigId)->enable()->save(); $this->refreshTestStateAfterRestConfigChange(); - // DX: upon re-enabling a resource, immediate 200. $response = $this->request('GET', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - $this->resourceConfigStorage->load(static::$resourceConfigId)->delete(); $this->refreshTestStateAfterRestConfigChange(); - // DX: upon deleting a resource, it's immediately no longer available. $this->assertResourceNotAvailable($url, $request_options); - $this->provisionEntityResource(); $url->setOption('query', ['_format' => 'non_existing_format']); - // DX: 406 when requesting unsupported format. $response = $this->request('GET', $url, $request_options); $this->assert406Response($response); $this->assertSame(['text/plain; charset=UTF-8'], $response->getHeader('Content-Type')); - $request_options[RequestOptions::HEADERS]['Accept'] = static::$mimeType; - // DX: 406 when requesting unsupported format but specifying Accept header: // should result in a text/plain response. $response = $this->request('GET', $url, $request_options); $this->assert406Response($response); $this->assertSame(['text/plain; charset=UTF-8'], $response->getHeader('Content-Type')); - $url = Url::fromRoute('rest.entity.' . static::$entityTypeId . '.GET.' . static::$format); $url->setRouteParameter(static::$entityTypeId, 987654321); $url->setOption('query', ['_format' => static::$format]); - // DX: 404 when GETting non-existing entity. $response = $this->request('GET', $url, $request_options); $path = str_replace('987654321', '{' . static::$entityTypeId . '}', $url->setAbsolute()->setOptions(['base_url' => '', 'query' => []])->toString()); @@ -712,27 +682,22 @@ public function testPost() { $url = $this->getEntityResourcePostUrl(); $request_options = []; - // DX: 404 when resource not provisioned. HTML response because missing // ?_format query string. $response = $this->request('POST', $url, $request_options); $this->assertSame(404, $response->getStatusCode()); $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); - $url->setOption('query', ['_format' => static::$format]); - // DX: 404 when resource not provisioned. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(404, 'No route found for "POST ' . str_replace($this->baseUrl, '', $this->getEntityResourcePostUrl()->setAbsolute()->toString()) . '"', $response); - $this->provisionEntityResource(); // Simulate the developer again forgetting the ?_format query string. $url->setOption('query', []); - // DX: 415 when no Content-Type request header. HTML response because // missing ?_format query string. $response = $this->request('POST', $url, $request_options); @@ -740,34 +705,26 @@ public function testPost() { $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); $this->assertContains('A client error happened', (string) $response->getBody()); - $url->setOption('query', ['_format' => static::$format]); - // DX: 415 when no Content-Type request header. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(415, 'No "Content-Type" request header specified', $response); - $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType; - // DX: 400 when no request body. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(400, 'No entity content received.', $response); - $request_options[RequestOptions::BODY] = $unparseable_request_body; - // DX: 400 when unparseable request body. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(400, 'Syntax error', $response); - $request_options[RequestOptions::BODY] = $parseable_invalid_request_body; - if (static::$auth) { // DX: forgetting authentication: authentication provider-specific error // response. @@ -775,28 +732,22 @@ public function testPost() { $this->assertResponseWhenMissingAuthentication($response); } - $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions('POST')); - // DX: 403 when unauthorized. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('POST'), $response); - $this->setUpAuthorization('POST'); - // DX: 422 when invalid entity: multiple values sent for single-value field. $response = $this->request('POST', $url, $request_options); $label_field = $this->entity->getEntityType()->hasKey('label') ? $this->entity->getEntityType()->getKey('label') : static::$labelFieldName; $label_field_capitalized = $this->entity->getFieldDefinition($label_field)->getLabel(); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\n$label_field: $label_field_capitalized: this field cannot hold more than 1 values.\n", $response); - $request_options[RequestOptions::BODY] = $parseable_invalid_request_body_2; - // DX: 422 when invalid entity: UUID field too long. // @todo Fix this in https://www.drupal.org/node/2149851. if ($this->entity->getEntityType()->hasKey('uuid')) { @@ -804,35 +755,27 @@ public function testPost() { $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\nuuid.0.value: UUID: may not be longer than 128 characters.\n", $response); } - $request_options[RequestOptions::BODY] = $parseable_invalid_request_body_3; - // DX: 403 when entity contains field without 'edit' access. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(403, "Access denied on creating field 'field_rest_test'.", $response); - $request_options[RequestOptions::BODY] = $parseable_valid_request_body; - // Before sending a well-formed request, allow the normalization and // authentication provider edge cases to also be tested. $this->assertNormalizationEdgeCases('POST', $url, $request_options); $this->assertAuthenticationEdgeCases('POST', $url, $request_options); - $request_options[RequestOptions::HEADERS]['Content-Type'] = 'text/xml'; - // DX: 415 when request body in existing but not allowed format. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(415, 'No route found that matches "Content-Type: text/xml"', $response); - $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType; - // 201 for well-formed request. $response = $this->request('POST', $url, $request_options); $this->assertResourceResponse(201, FALSE, $response); @@ -868,20 +811,16 @@ public function testPost() { } } - $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); $this->refreshTestStateAfterRestConfigChange(); $request_options[RequestOptions::BODY] = $parseable_valid_request_body_2; - // DX: 403 when unauthorized. $response = $this->request('POST', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('POST'), $response); - $this->grantPermissionsToTestedRole(['restful post entity:' . static::$entityTypeId]); - // 201 for well-formed request. // If the entity is stored, delete the first created entity (in case there // is a uniqueness constraint). @@ -939,7 +878,6 @@ public function testPatch() { $url = $this->getEntityResourceUrl(); $request_options = []; - // DX: 404 when resource not provisioned, 405 if canonical route. Plain text // or HTML response because missing ?_format query string. $response = $this->request('PATCH', $url, $request_options); @@ -954,10 +892,8 @@ public function testPatch() { $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); } - $url->setOption('query', ['_format' => static::$format]); - // DX: 404 when resource not provisioned, 405 if canonical route. $response = $this->request('PATCH', $url, $request_options); if ($has_canonical_url) { @@ -967,46 +903,36 @@ public function testPatch() { $this->assertResourceErrorResponse(404, 'No route found for "PATCH ' . str_replace($this->baseUrl, '', $this->getEntityResourceUrl()->setAbsolute()->toString()) . '"', $response); } - $this->provisionEntityResource(); // Simulate the developer again forgetting the ?_format query string. $url->setOption('query', []); - // DX: 415 when no Content-Type request header. $response = $this->request('PATCH', $url, $request_options); $this->assertSame(415, $response->getStatusCode()); $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); $this->assertContains('A client error happened', (string) $response->getBody()); - $url->setOption('query', ['_format' => static::$format]); - // DX: 415 when no Content-Type request header. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(415, 'No "Content-Type" request header specified', $response); - $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType; - // DX: 400 when no request body. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(400, 'No entity content received.', $response); - $request_options[RequestOptions::BODY] = $unparseable_request_body; - // DX: 400 when unparseable request body. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(400, 'Syntax error', $response); - $request_options[RequestOptions::BODY] = $parseable_invalid_request_body; - if (static::$auth) { // DX: forgetting authentication: authentication provider-specific error // response. @@ -1014,33 +940,26 @@ public function testPatch() { $this->assertResponseWhenMissingAuthentication($response); } - $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions('PATCH')); - // DX: 403 when unauthorized. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('PATCH'), $response); - $this->setUpAuthorization('PATCH'); - // DX: 422 when invalid entity: multiple values sent for single-value field. $response = $this->request('PATCH', $url, $request_options); $label_field = $this->entity->getEntityType()->hasKey('label') ? $this->entity->getEntityType()->getKey('label') : static::$labelFieldName; $label_field_capitalized = $this->entity->getFieldDefinition($label_field)->getLabel(); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\n$label_field: $label_field_capitalized: this field cannot hold more than 1 values.\n", $response); - $request_options[RequestOptions::BODY] = $parseable_invalid_request_body_2; - // DX: 403 when entity contains field without 'edit' access. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(403, "Access denied on updating field 'field_rest_test'.", $response); - // DX: 403 when sending PATCH request with read-only fields. // First send all fields (the "maximum normalization"). Assert the expected // error message for the first PATCH-protected field. Remove that field from @@ -1060,27 +979,21 @@ public function testPatch() { $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - $request_options[RequestOptions::BODY] = $parseable_valid_request_body; - // Before sending a well-formed request, allow the normalization and // authentication provider edge cases to also be tested. $this->assertNormalizationEdgeCases('PATCH', $url, $request_options); $this->assertAuthenticationEdgeCases('PATCH', $url, $request_options); - $request_options[RequestOptions::HEADERS]['Content-Type'] = 'text/xml'; - // DX: 415 when request body in existing but not allowed format. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(415, 'No route found that matches "Content-Type: text/xml"', $response); - $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType; - // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); @@ -1105,20 +1018,16 @@ public function testPatch() { // is not sent in the PATCH request. $this->assertSame('All the faith he had had had had no effect on the outcome of his life.', $updated_entity->get('field_rest_test')->value); - $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); $this->refreshTestStateAfterRestConfigChange(); $request_options[RequestOptions::BODY] = $parseable_valid_request_body_2; - // DX: 403 when unauthorized. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('PATCH'), $response); - $this->grantPermissionsToTestedRole(['restful patch entity:' . static::$entityTypeId]); - // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); @@ -1146,7 +1055,6 @@ public function testDelete() { $url = $this->getEntityResourceUrl(); $request_options = []; - // DX: 404 when resource not provisioned, but 405 if canonical route. Plain // text or HTML response because missing ?_format query string. $response = $this->request('DELETE', $url, $request_options); @@ -1161,10 +1069,8 @@ public function testDelete() { $this->assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); } - $url->setOption('query', ['_format' => static::$format]); - // DX: 404 when resource not provisioned, 405 if canonical route. $response = $this->request('DELETE', $url, $request_options); if ($has_canonical_url) { @@ -1177,7 +1083,6 @@ public function testDelete() { $this->provisionEntityResource(); - if (static::$auth) { // DX: forgetting authentication: authentication provider-specific error // response. @@ -1185,23 +1090,18 @@ public function testDelete() { $this->assertResponseWhenMissingAuthentication($response); } - $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions('PATCH')); - // DX: 403 when unauthorized. $response = $this->request('DELETE', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('DELETE'), $response); - $this->setUpAuthorization('DELETE'); - // Before sending a well-formed request, allow the authentication provider's // edge cases to also be tested. $this->assertAuthenticationEdgeCases('DELETE', $url, $request_options); - // 204 for well-formed request. $response = $this->request('DELETE', $url, $request_options); $this->assertSame(204, $response->getStatusCode()); @@ -1213,21 +1113,17 @@ public function testDelete() { $this->assertSame('', (string) $response->getBody()); $this->assertFalse($response->hasHeader('X-Drupal-Cache')); - $this->config('rest.settings')->set('bc_entity_resource_permissions', TRUE)->save(TRUE); $this->refreshTestStateAfterRestConfigChange(); $this->entity = $this->createEntity(); $url = $this->getEntityResourceUrl()->setOption('query', $url->getOption('query')); - // DX: 403 when unauthorized. $response = $this->request('DELETE', $url, $request_options); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('DELETE'), $response); - $this->grantPermissionsToTestedRole(['restful delete entity:' . static::$entityTypeId]); - // 204 for well-formed request. $response = $this->request('DELETE', $url, $request_options); $this->assertSame(204, $response->getStatusCode()); @@ -1254,17 +1150,14 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques $normalization[$bundle_field_name] = 'bad_bundle_name'; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 422 when incorrect entity type bundle is specified. $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(422, '"bad_bundle_name" is not a valid bundle type for denormalization.', $response); } - unset($normalization[$bundle_field_name]); $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 422 when no entity type bundle is specified. $response = $this->request($method, $url, $request_options); $this->assertResourceErrorResponse(422, sprintf('Could not determine entity type bundle: "%s" field is missing.', $bundle_field_name), $response); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/User/UserResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/User/UserResourceTestBase.php index caf290976282f8455fa75d7fa05d0f47e016e1be..d758cf660869a9647241cca2d026964585c01a55 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/User/UserResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/User/UserResourceTestBase.php @@ -144,7 +144,6 @@ public function testPatchDxForSecuritySensitiveBaseFields() { // @todo Remove the array_diff_key() call in https://www.drupal.org/node/2821077. $original_normalization = array_diff_key($this->serializer->normalize($user, static::$format), ['created' => TRUE, 'changed' => TRUE, 'name' => TRUE]); - // Since this test must be performed by the user that is being modified, // we cannot use $this->getUrl(). $url = $user->toUrl()->setOption('query', ['_format' => static::$format]); @@ -153,18 +152,15 @@ public function testPatchDxForSecuritySensitiveBaseFields() { ]; $request_options = array_merge_recursive($request_options, $this->getAuthenticationRequestOptions('PATCH')); - // Test case 1: changing email. $normalization = $original_normalization; $normalization['mail'] = [['value' => 'new-email@example.com']]; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 422 when changing email without providing the password. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\nmail: Your current password is missing or incorrect; it's required to change the Email.\n", $response); - $normalization['pass'] = [['existing' => 'wrong']]; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); @@ -172,41 +168,33 @@ public function testPatchDxForSecuritySensitiveBaseFields() { $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\nmail: Your current password is missing or incorrect; it's required to change the Email.\n", $response); - $normalization['pass'] = [['existing' => $this->account->passRaw]]; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - // Test case 2: changing password. $normalization = $original_normalization; $new_password = $this->randomString(); $normalization['pass'] = [['value' => $new_password]]; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 422 when changing password without providing the current password. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\npass: Your current password is missing or incorrect; it's required to change the Password.\n", $response); - $normalization['pass'][0]['existing'] = $this->account->pass_raw; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - // Verify that we can log in with the new password. $this->assertRpcLogin($user->getAccountName(), $new_password); - // Update password in $this->account, prepare for future requests. $this->account->passRaw = $new_password; $this->initAuthentication(); @@ -215,21 +203,17 @@ public function testPatchDxForSecuritySensitiveBaseFields() { ]; $request_options = array_merge_recursive($request_options, $this->getAuthenticationRequestOptions('PATCH')); - // Test case 3: changing name. $normalization = $original_normalization; $normalization['name'] = [['value' => 'Cooler Llama']]; $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // DX: 403 when modifying username without required permission. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(403, "Access denied on updating field 'name'.", $response); - $this->grantPermissionsToTestedRole(['change own username']); - // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index 94af5427e609af87dbcf58027c3f7197a2daaa17..6de1ec97ce12279ea4ba2f6cce1edf93e479110b 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -127,7 +127,6 @@ public function testSerializerResponses() { $this->assertIdentical($actual_json, json_encode($expected), 'The expected JSON output was found.'); - // Test that the rendered output and the preview output are the same. $view->destroy(); $view->setDisplay('rest_export_1'); diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index cc0b65e07b525d21a5d104e1a28acfb397941acf..fca2b23b76f30c4c10d3c3113667c24e32546203 100644 --- a/core/modules/search/src/SearchQuery.php +++ b/core/modules/search/src/SearchQuery.php @@ -571,7 +571,6 @@ public function execute() { } } - // Add arguments for the keyword relevance normalization number. $normalization = 1.0 / $this->normalize; for ($i = 0; $i < $this->relevance_count; $i++) { diff --git a/core/modules/search/src/Tests/SearchPageCacheTagsTest.php b/core/modules/search/src/Tests/SearchPageCacheTagsTest.php index 417d9918a2ca47c45750272f51b8b70ebd10e73e..55adf976e8f8e23acf6cb250df3ac4cb5082d88e 100644 --- a/core/modules/search/src/Tests/SearchPageCacheTagsTest.php +++ b/core/modules/search/src/Tests/SearchPageCacheTagsTest.php @@ -122,7 +122,6 @@ public function testSearchTagsBubbling() { $this->container->get('module_installer')->install(['field_ui', 'entity_reference']); $this->resetAll(); - // Creates a new content type that will have an entity reference. $type_name = 'entity_reference_test'; $type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]); diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php index de2a4a65423355eb68a5f280e5c6e8f27db9d67e..e9df564c5fd58f47bc04246916e8745429f9597a 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php @@ -251,7 +251,6 @@ public function testDenormalizeWithTypeWithIncorrectUuid() { ->willReturn('field_reference') ->shouldBeCalled(); - $this->assertDenormalize($data); } @@ -271,7 +270,6 @@ public function testDenormalizeWithEmtpyUuid() { ->willReturn('field_reference') ->shouldBeCalled(); - $this->assertDenormalize($data); } diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index 7bc20ecbf05414b8d42ce9518db72e0518e0f6d6..255adcc25634a1f52642d65620042bace434c54f 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -226,7 +226,6 @@ protected function setUp() { $this->kernel->shutdown(); $this->kernel->boot(); - // Save the original site directory path, so that extensions in the // site-specific directory can still be discovered in the test site // environment. diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index 7f5c5e340ffe33fad002285b8b146822d3cfb8fe..d215df5ccd42a3c2c6a71d7a84a6de6727441ec3 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -415,7 +415,6 @@ public function testReferencedEntity() { $cid = $this->createCacheId($cache_keys, $entity_cache_contexts); $this->verifyRenderCache($cid, $non_referencing_entity_cache_tags); - $this->pass("Test listing of referencing entities.", 'Debug'); // Prime the page cache for the listing of referencing entities. $this->verifyPageCache($listing_url, 'MISS'); @@ -434,7 +433,6 @@ public function testReferencedEntity() { $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); - $this->pass("Test listing containing referenced entity.", 'Debug'); // Prime the page cache for the listing containing the referenced entity. $this->verifyPageCache($nonempty_entity_listing_url, 'MISS', $nonempty_entity_listing_cache_tags); @@ -444,7 +442,6 @@ public function testReferencedEntity() { $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); - // Verify that after modifying the referenced entity, there is a cache miss // for every route except the one for the non-referencing entity. $this->pass("Test modification of referenced entity.", 'Debug'); @@ -461,7 +458,6 @@ public function testReferencedEntity() { $this->verifyPageCache($empty_entity_listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - // Verify that after modifying the referencing entity, there is a cache miss // for every route except the ones for the non-referencing entity and the // empty entity listing. @@ -478,7 +474,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - // Verify that after modifying the non-referencing entity, there is a cache // miss only for the non-referencing entity route. $this->pass("Test modification of non-referencing entity.", 'Debug'); @@ -492,7 +487,6 @@ public function testReferencedEntity() { // Verify cache hits. $this->verifyPageCache($non_referencing_entity_url, 'HIT'); - if ($this->entity->getEntityType()->hasHandlerClass('view_builder')) { // Verify that after modifying the entity's display, there is a cache miss // for both the referencing entity, and the listing of referencing @@ -512,7 +506,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); } - if ($bundle_entity_type_id = $this->entity->getEntityType()->getBundleEntityType()) { // Verify that after modifying the corresponding bundle entity, there is a // cache miss for both the referencing entity, and the listing of @@ -546,7 +539,6 @@ public function testReferencedEntity() { } } - if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. @@ -564,7 +556,6 @@ public function testReferencedEntity() { $this->verifyPageCache($referencing_entity_url, 'HIT'); $this->verifyPageCache($listing_url, 'HIT'); - // Verify that after modifying a configurable field on the entity, there // is a cache miss. $this->pass("Test modification of referenced entity's configurable field.", 'Debug'); @@ -582,7 +573,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); } - // Verify that after invalidating the entity's cache tag directly, there is // a cache miss for every route except the ones for the non-referencing // entity and the empty entity listing. @@ -614,7 +604,6 @@ public function testReferencedEntity() { $this->verifyPageCache($empty_entity_listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - if (!empty($view_cache_tag)) { // Verify that after invalidating the generic entity type's view cache tag // directly, there is a cache miss for both the referencing entity, and the diff --git a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php index 74c110380696edc8fd8870abd3219c851f793e6a..997a4d28f6f1fe083d08ac00cf197f5764367444 100644 --- a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php @@ -34,7 +34,6 @@ public function testEntityUri() { $view_cache_tag = \Drupal::entityManager()->getViewBuilder($entity_type)->getCacheTags(); $render_cache_tag = 'rendered'; - $this->pass("Test entity.", 'Debug'); $this->verifyPageCache($entity_url, 'MISS'); @@ -65,7 +64,6 @@ public function testEntityUri() { // Verify a cache hit. $this->verifyPageCache($entity_url, 'HIT'); - // Verify that after modifying the entity's display, there is a cache miss. $this->pass("Test modification of entity's '$view_mode' display.", 'Debug'); $entity_display = entity_get_display($entity_type, $this->entity->bundle(), $view_mode); @@ -75,7 +73,6 @@ public function testEntityUri() { // Verify a cache hit. $this->verifyPageCache($entity_url, 'HIT'); - if ($bundle_entity_type_id = $this->entity->getEntityType()->getBundleEntityType()) { // Verify that after modifying the corresponding bundle entity, there is a // cache miss. @@ -90,7 +87,6 @@ public function testEntityUri() { $this->verifyPageCache($entity_url, 'HIT'); } - if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. @@ -115,7 +111,6 @@ public function testEntityUri() { $this->verifyPageCache($entity_url, 'HIT'); } - // Verify that after invalidating the entity's cache tag directly, there is // a cache miss. $this->pass("Test invalidation of entity's cache tag.", 'Debug'); @@ -125,7 +120,6 @@ public function testEntityUri() { // Verify a cache hit. $this->verifyPageCache($entity_url, 'HIT'); - // Verify that after invalidating the generic entity type's view cache tag // directly, there is a cache miss. $this->pass("Test invalidation of entity's 'view' cache tag.", 'Debug'); @@ -135,7 +129,6 @@ public function testEntityUri() { // Verify a cache hit. $this->verifyPageCache($entity_url, 'HIT'); - // Verify that after deleting the entity, there is a cache miss. $this->pass('Test deletion of entity.', 'Debug'); $this->entity->delete(); diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index 38d7ecbe04c4d7da7438fecc6846ad1b8fc05ed5..83a9c55b39775589e2eeb1640f1b7eb36644df06 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -53,7 +53,6 @@ public function testFinishResponseSubscriber() { // a page inception style. This test verifies that is not happening. $this->assertNoPattern('#.*#s', 'There was no double-page effect from a misrendered subrequest.'); - // Confirm that route-level access check's cacheability is applied to the // X-Drupal-Cache-Contexts and X-Drupal-Cache-Tags headers. // 1. controller result: render array, globally cacheable route access. diff --git a/core/modules/system/src/Tests/System/UncaughtExceptionTest.php b/core/modules/system/src/Tests/System/UncaughtExceptionTest.php index 02c09562ee69b74b5e031d07b37248a5f5ac5907..c4218c6510b185a28f1f05526ef6d20ae59c6018 100644 --- a/core/modules/system/src/Tests/System/UncaughtExceptionTest.php +++ b/core/modules/system/src/Tests/System/UncaughtExceptionTest.php @@ -199,7 +199,6 @@ public function testExceptionContainer() { $this->drupalGet(''); $this->assertResponse(500); - $this->assertRaw('The website encountered an unexpected error'); $this->assertRaw($this->expectedExceptionMessage); $this->assertErrorLogged($this->expectedExceptionMessage); diff --git a/core/modules/system/src/Tests/Theme/EngineTwigTest.php b/core/modules/system/src/Tests/Theme/EngineTwigTest.php index ffff75fc49b9ceefa4565fa39e34ae47e2a9f7a9..2ca831cfd1f6496a0bec45107f666e3dc2eb7173 100644 --- a/core/modules/system/src/Tests/Theme/EngineTwigTest.php +++ b/core/modules/system/src/Tests/Theme/EngineTwigTest.php @@ -76,7 +76,6 @@ public function testTwigLinkGenerator() { /** @var \Drupal\Core\Utility\LinkGenerator $link_generator */ $link_generator = $this->container->get('link_generator'); - $generated_url = Url::fromRoute('user.register', [], ['absolute' => TRUE])->toString(TRUE)->getGeneratedUrl(); $expected = [ 'link via the linkgenerator: ' . $link_generator->generate('register', new Url('user.register', [], ['absolute' => TRUE])), diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 3b3d01d11fe58e5b7188884ed92c0e369a20b918..b66ff416a4e59bb1b26d5448f1c4f2eab47f104a 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1067,7 +1067,6 @@ function _system_rebuild_module_data() { _system_rebuild_module_data_ensure_required($module, $modules); } - if ($profile && isset($modules[$profile])) { // The installation profile is required, if it's a valid module. $modules[$profile]->info['required'] = TRUE; diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php index c7861e6adab121703c8700d9630b5c2f910b62eb..924a9fda61ceaf652944000423cd3c22e15d2e4e 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php @@ -54,7 +54,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#suffix' => '
    Append inside this div
    ', ]; - // Shows the 'before' command. $form['before_command_example'] = [ '#value' => $this->t("AJAX 'before': Click to put something before the div"), @@ -93,7 +92,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#suffix' => '
    box
    ', ]; - // Shows the Ajax 'data' command. But there is no use of this information, // as this would require a javascript client to use the data. $form['data_command_example'] = [ diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php index 6fc2857e3f2c5dec143ebfb2a25bd24b1b2504f6..3cb8105315e157170666c156d40a2e291f55a88b 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php @@ -111,7 +111,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Another AJAX checkbox in a nested group'), ]; - return $form; } diff --git a/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php b/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php index 3ca7715e364f25006fac30caa22205de15f2fa2e..2fd98281803188affd5a423bd633867bb4ecbed0 100644 --- a/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php +++ b/core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php @@ -70,7 +70,6 @@ public function renderResponse(array $main_content, Request $request, RouteMatch break; } - $response->addCommand(new OpenModalDialogCommand($title, $content, $options)); return $response; } diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php index 5d367795df267e48a8375c9e8a52b17d34afa11d..a756dc50b66fbf9991ea310f7e87c30607cbc2a8 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php @@ -148,7 +148,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#date_timezone' => 'Europe/Berlin', ]; - // Try to hijack the email field with a valid email. $form['disabled_container']['disabled_container_email'] = [ '#type' => 'email', diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php index 1476dfafec675a8e528067ef39463f98845536fd..aa9452a4bacc6bf77ba40f991bf97f4838db778a 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php @@ -412,7 +412,6 @@ public function testReferencedEntity() { $cid = $this->createCacheId($cache_keys, $entity_cache_contexts); $this->verifyRenderCache($cid, $non_referencing_entity_cache_tags); - $this->pass("Test listing of referencing entities.", 'Debug'); // Prime the page cache for the listing of referencing entities. $this->verifyPageCache($listing_url, 'MISS'); @@ -431,7 +430,6 @@ public function testReferencedEntity() { $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); - $this->pass("Test listing containing referenced entity.", 'Debug'); // Prime the page cache for the listing containing the referenced entity. $this->verifyPageCache($nonempty_entity_listing_url, 'MISS', $nonempty_entity_listing_cache_tags); @@ -441,7 +439,6 @@ public function testReferencedEntity() { $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); - // Verify that after modifying the referenced entity, there is a cache miss // for every route except the one for the non-referencing entity. $this->pass("Test modification of referenced entity.", 'Debug'); @@ -458,7 +455,6 @@ public function testReferencedEntity() { $this->verifyPageCache($empty_entity_listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - // Verify that after modifying the referencing entity, there is a cache miss // for every route except the ones for the non-referencing entity and the // empty entity listing. @@ -475,7 +471,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - // Verify that after modifying the non-referencing entity, there is a cache // miss only for the non-referencing entity route. $this->pass("Test modification of non-referencing entity.", 'Debug'); @@ -489,7 +484,6 @@ public function testReferencedEntity() { // Verify cache hits. $this->verifyPageCache($non_referencing_entity_url, 'HIT'); - if ($this->entity->getEntityType()->hasHandlerClass('view_builder')) { // Verify that after modifying the entity's display, there is a cache miss // for both the referencing entity, and the listing of referencing @@ -509,7 +503,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); } - if ($bundle_entity_type_id = $this->entity->getEntityType()->getBundleEntityType()) { // Verify that after modifying the corresponding bundle entity, there is a // cache miss for both the referencing entity, and the listing of @@ -543,7 +536,6 @@ public function testReferencedEntity() { } } - if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. @@ -561,7 +553,6 @@ public function testReferencedEntity() { $this->verifyPageCache($referencing_entity_url, 'HIT'); $this->verifyPageCache($listing_url, 'HIT'); - // Verify that after modifying a configurable field on the entity, there // is a cache miss. $this->pass("Test modification of referenced entity's configurable field.", 'Debug'); @@ -579,7 +570,6 @@ public function testReferencedEntity() { $this->verifyPageCache($listing_url, 'HIT'); } - // Verify that after invalidating the entity's cache tag directly, there is // a cache miss for every route except the ones for the non-referencing // entity and the empty entity listing. @@ -611,7 +601,6 @@ public function testReferencedEntity() { $this->verifyPageCache($empty_entity_listing_url, 'HIT'); $this->verifyPageCache($nonempty_entity_listing_url, 'HIT'); - if (!empty($view_cache_tag)) { // Verify that after invalidating the generic entity type's view cache tag // directly, there is a cache miss for both the referencing entity, and the diff --git a/core/modules/system/tests/src/Functional/Entity/Update/MoveRevisionMetadataFieldsUpdateTest.php b/core/modules/system/tests/src/Functional/Entity/Update/MoveRevisionMetadataFieldsUpdateTest.php index c843c835bf9ba77ca7acb3101915089d3bcf0e5f..8634b16d6e35a0426028238523bd1bc7f668cf4c 100644 --- a/core/modules/system/tests/src/Functional/Entity/Update/MoveRevisionMetadataFieldsUpdateTest.php +++ b/core/modules/system/tests/src/Functional/Entity/Update/MoveRevisionMetadataFieldsUpdateTest.php @@ -65,7 +65,6 @@ public function testSystemUpdate8400() { $this->assertEqual($entity_rev_second->getRevisionLogMessage(), 'second revision'); $this->assertEqual($entity_rev_second->getRevisionCreationTime(), '1476268518'); - // Test that the views using revision metadata fields are updated // properly. $view = View::load($entity_type_id . '_for_2248983'); diff --git a/core/modules/system/tests/src/Functional/Form/RedirectTest.php b/core/modules/system/tests/src/Functional/Form/RedirectTest.php index a4c9e15b3ce3668b498c53cbd45e03ca2a429bfc..62253a681bb5f78e9ca1f5f04dde21381845ace3 100644 --- a/core/modules/system/tests/src/Functional/Form/RedirectTest.php +++ b/core/modules/system/tests/src/Functional/Form/RedirectTest.php @@ -34,7 +34,6 @@ public function testRedirect() { $this->drupalPostForm($path, $edit, t('Submit')); $this->assertUrl($edit['destination'], [], 'Basic redirection works.'); - // Test without redirection. $edit = [ 'redirection' => FALSE, diff --git a/core/modules/system/tests/src/Functional/Update/EntityUpdateToRevisionableAndPublishableTest.php b/core/modules/system/tests/src/Functional/Update/EntityUpdateToRevisionableAndPublishableTest.php index eb4a01c99c0794edc26a4b71eaa424d214e996f3..e72f9f1b55f4cfc8ccb7534f40a15e2d18d70bc1 100644 --- a/core/modules/system/tests/src/Functional/Update/EntityUpdateToRevisionableAndPublishableTest.php +++ b/core/modules/system/tests/src/Functional/Update/EntityUpdateToRevisionableAndPublishableTest.php @@ -165,7 +165,6 @@ protected function updateEntityTypeDefinition() { ]; $entity_type->set('revision_metadata_keys', $revision_metadata_keys); - $entity_type->set('translatable', TRUE); $entity_type->set('data_table', 'entity_test_update_data'); $entity_type->set('revision_table', 'entity_test_update_revision'); diff --git a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php index b334e641225cbb616d0bc90bcd4fbc86d0d3d47a..9e878f5112663bb1ac39476d21717d0b413f62ec 100644 --- a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php +++ b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php @@ -96,7 +96,6 @@ public function testSystemSiteTokenReplacement() { ->set('mail', 'simpletest@example.com') ->save(); - // Generate and test tokens. $tests = []; $tests['[site:name]'] = Html::escape($config->get('name')); diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php index 2423668e18fba19311d2b27ad34b9a51af2b52dd..a3c5730b325176a47b19d55092d5a6ebff8b32bf 100644 --- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php @@ -182,7 +182,6 @@ public function providerTestBuildCacheability() { ], ]; - $data = []; // Empty tree. diff --git a/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php b/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php index a7ac9b866190c7114ff9176d980c8a1128145dc3..8260565e36c6ff399210ea99fe086779847ddce8 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/ArgumentValidatorTermTest.php @@ -65,7 +65,6 @@ public function testArgumentValidatorTerm() { $view = Views::getView('test_argument_validator_term'); $view->initHandlers(); - // Test the single validator for term IDs. $view->argument['tid']->validator->options['type'] = 'tid'; @@ -83,7 +82,6 @@ public function testArgumentValidatorTerm() { $view->argument['tid']->validated_title = NULL; $view->argument['tid']->argument_validated = NULL; - // Test the multiple validator for term IDs. $view->argument['tid']->validator->options['type'] = 'tids'; $view->argument['tid']->options['break_phrase'] = TRUE; diff --git a/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php b/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php index 159a699cf57a74843b69e6b724f54a4a82656b36..3ad8e7b327b23ec3a5e81753336bd0b15bfa6220 100644 --- a/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php +++ b/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php @@ -77,7 +77,6 @@ public function testUserSelectionByRole() { $user3->addRole($this->role2->id()); $user3->save(); - /** @var \Drupal\Core\Entity\EntityAutocompleteMatcher $autocomplete */ $autocomplete = \Drupal::service('entity.autocomplete_matcher'); diff --git a/core/modules/views/src/Element/View.php b/core/modules/views/src/Element/View.php index 43d1058c8761f7f4f4ce2e5f14a4ef6fb35c8410..6cc87e525c91233fa498a2a13a4d541ba04cf292 100644 --- a/core/modules/views/src/Element/View.php +++ b/core/modules/views/src/Element/View.php @@ -53,7 +53,6 @@ public static function preRenderViewElement($element) { // possible to manipulate the $element. $view->element['#pre_rendered'] = TRUE; - if (isset($element['#response'])) { $view->setResponse($element['#response']); } diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index a2e19a29d875f99dd330c1bc62eda198e9d61770..e1eab3e8585d424d9cf4f49428039d8920c19657 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -164,7 +164,6 @@ public function initDisplay(ViewExecutable $view, array &$display, array &$optio } } - $this->setOptionDefaults($this->options, $this->defineOptions()); $this->display = &$display; diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index c5ce66bdc37077ff5a8514daef27d30359d09a67..25f3c01cab92e851fdb5915225b2dcbb47b40e83 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -857,7 +857,6 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; - // Get a list of the available fields and arguments for token replacement. // Setup the tokens for fields. diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index fc1d7e170dae0c75e51b081eef2d3d8e48636dfc..873ecb9f6c5d7a3adad818970003894d117f38ac 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -104,7 +104,6 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o $this->options['expose']['multiple'] = TRUE; } - // If there are relationships in the view, allow empty should be true // so that we can do IS NULL checks on items. Not all filters respect // allow empty, but string and numeric do and that covers enough. diff --git a/core/modules/views/src/Plugin/views/pager/SqlBase.php b/core/modules/views/src/Plugin/views/pager/SqlBase.php index 55e07dfa1d4e9892ff390020f959e700307f5eda..d683202d1758a3f6de2e4d44a7d851b38c045565 100644 --- a/core/modules/views/src/Plugin/views/pager/SqlBase.php +++ b/core/modules/views/src/Plugin/views/pager/SqlBase.php @@ -132,7 +132,6 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ], ]; - $form['expose']['items_per_page_options_all'] = [ '#type' => 'checkbox', '#title' => $this->t('Allow user to display all items'), diff --git a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php index 7c01604604951dcebc1583b0fe92a0058c8afdee..568bcd2f31fda9649c582c0e01cf412152a7f035 100644 --- a/core/modules/views/src/Plugin/views/relationship/EntityReverse.php +++ b/core/modules/views/src/Plugin/views/relationship/EntityReverse.php @@ -71,7 +71,6 @@ public function query() { } $first_join = $this->joinManager->createInstance($id, $first); - $this->first_alias = $this->query->addTable($this->definition['field table'], $this->relationship, $first_join); // Second, relate the field table to the entity specified using diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php index 62389140186025478cf3e7231acc848fdb4c04d4..34e1b086ec4c8256b9dd12c5b5622b5bf85dd1a2 100644 --- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php @@ -115,7 +115,6 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->options['subquery_namespace'], ]; - // WIP: This stuff doesn't work yet: namespacing issues. // A list of suitable views to pick one as the subview. $views = ['' => '- None -']; diff --git a/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php b/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php index 5fe9fb7d0f6cc5e02888fd6d79fadd3c98c33ab7..206214e8ba0795094e78ec6ef6476480fc80f44b 100644 --- a/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php +++ b/core/modules/views/src/Tests/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php @@ -46,7 +46,6 @@ public function testUpdateMultiValueBaseFields() { // Check the table is still correct. $this->assertEqual('user__roles', $handler_config['table']); - // The plugin ID should be updated as well. $this->assertEqual($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']); } diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 82c1cb983280906dcc45a2d6472261b6967f6a17..0fda8c8bbc6713e38372cb8bb7c04ec331eea4c8 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -619,7 +619,6 @@ public function setOffset($offset) { $this->offset = $offset; - // If the pager is already initialized, pass it through to the pager. if (!empty($this->pager)) { $this->pager->setOffset($offset); diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleTest.php index fbb5bcfff1426895cea94ce0627bf92e2f46b87c..1686d53f13ed360118e29b51361b75aa1daafd2a 100644 --- a/core/modules/views/tests/src/Functional/Plugin/StyleTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/StyleTest.php @@ -173,7 +173,6 @@ public function _testGrouping($stripped = FALSE) { $expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_data_age = '28'; $expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_data_id = '3'; - // Alter the results to support the stripped case. if ($stripped) { @@ -194,7 +193,6 @@ public function _testGrouping($stripped = FALSE) { $view->style_plugin->options['grouping'][1] = ['field' => 'age', 'rendered' => TRUE, 'rendered_strip' => TRUE]; } - // The newer api passes the value of the grouping as well. $sets_new_rendered = $view->style_plugin->renderGrouping($view->result, $view->style_plugin->options['grouping'], TRUE); diff --git a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php index ace420484489c026edfa467537e5efa117a2892b..02e90cd502079dcad775281347e281025ba12be9 100644 --- a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php @@ -98,7 +98,6 @@ protected function assertCacheTagsForFieldBasedView($do_assert_views_caches) { $this->assertViewsCacheTags($view, $base_tags, $do_assert_views_caches, $base_tags); $this->assertViewsCacheTagsFromStaticRenderArray($view, $base_tags, $do_assert_views_caches); - // Non-empty result (1 entity). /** @var \Drupal\Core\Entity\EntityInterface[] $entities */ $entities[] = $entity = EntityTest::create(); @@ -109,7 +108,6 @@ protected function assertCacheTagsForFieldBasedView($do_assert_views_caches) { $this->assertViewsCacheTags($view, $tags_with_entity, $do_assert_views_caches, $tags_with_entity); $this->assertViewsCacheTagsFromStaticRenderArray($view, $tags_with_entity, $do_assert_views_caches); - // Paged result (more entities than the items-per-page limit). for ($i = 0; $i < 5; $i++) { $entities[] = $entity = EntityTest::create(); @@ -259,7 +257,6 @@ protected function assertCacheTagsForEntityBasedView($do_assert_views_caches) { $this->assertViewsCacheTags($view, $result_tags_with_entity, $do_assert_views_caches, $render_tags_with_entity); $this->assertViewsCacheTagsFromStaticRenderArray($view, $render_tags_with_entity, $do_assert_views_caches); - // Paged result (more entities than the items-per-page limit). for ($i = 0; $i < 5; $i++) { $entities[] = $entity = EntityTest::create(); diff --git a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php index 556aef91a9d022ffd2e992c9bd171d003ecc708a..64e2777b0d793420d16d06cf5269c3f62e72e9ab 100644 --- a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php @@ -92,7 +92,6 @@ protected function setUp() { ->method('getStyle') ->willReturn($this->stylePlugin); - $token = $this->getMockBuilder('Drupal\Core\Utility\Token') ->disableOriginalConstructor() ->getMock(); diff --git a/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php b/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php index 91d52829c5a1321e7c40181aaecc99bd577b141f..98a155466928310db57c5f4bcc1d453a3bf0bb73 100644 --- a/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/area/ViewTest.php @@ -58,7 +58,6 @@ public function testCalculateDependencies() { ]); $this->viewHandler->view->storage = $view_this; - $this->viewHandler->options['view_to_insert'] = 'other:default'; $this->assertArrayEquals(['config' => ['view.other']], $this->viewHandler->calculateDependencies()); diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php index 13a7bc952d89565bf79183b34bc5249fa31e054d..b398ddece9d315fbdb22bd77a1d62eda5e1a98df 100644 --- a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php @@ -71,7 +71,6 @@ protected function setUp() { ['test_op_3', NULL, FALSE, TRUE], ])); - $storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface'); // Setup values for IDs passed as strings or numbers. diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php index a145538a6f8c28605bde5270f42fac8f13eb7ca9..18d6b7a03db32a9c9f6023d6913e0c7d5014d060 100644 --- a/core/modules/views/tests/src/Unit/ViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php @@ -236,7 +236,6 @@ public function testFullAndTableGetCache() { ->method('alter') ->with('views_data', $expected_views_data); - // The cache should only be called once (before the clear() call) as get // will get all table data in the first get(). $this->cacheBackend->expects($this->at(0)) diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 526f350f7fbe710bb3cb4c408a01a881e01c11fe..633ce9b9da802408b922f3b16478b90f125438bf 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -171,7 +171,6 @@ function views_views_data() { } } - // Field modules can implement hook_field_views_data() to override the default // behavior for adding fields. $module_handler = \Drupal::moduleHandler(); diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index 84db541d3f06af2be787a4e97659049f6bb42745..9c1d58a52910f55aba02b11064e23e2ed71dcd81 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -165,7 +165,6 @@ public function form(array $form, FormStateInterface $form_state) { ], ]; - $form['displays']['top'] = $this->renderDisplayTop($view); // The rest requires a display to be selected. diff --git a/core/modules/views_ui/tests/src/Kernel/TagTest.php b/core/modules/views_ui/tests/src/Kernel/TagTest.php index e63bf228fbb7f3bc1eb32a2d42a5bafc7c964381..44d341776d7217897054cf079d2f336afcbf79c4 100644 --- a/core/modules/views_ui/tests/src/Kernel/TagTest.php +++ b/core/modules/views_ui/tests/src/Kernel/TagTest.php @@ -52,7 +52,6 @@ public function testViewsUiAutocompleteTag() { $this->assertTrue(in_array($match, $suggestions), 'Make sure the returned array has the proper format.'); } - // Make sure that matching by a certain prefix works. $request->query->set('q', 'autocomplete_tag_test_even'); $result = $controller->autocompleteTag($request); diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php index 23cc7a8e65d126cd7867ead78bd6599db26eff3f..b4a3df022d32dadb83e655bf1803a87abcd8b922 100644 --- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php +++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php @@ -75,7 +75,6 @@ public function testBuildRowEntityList() { ], ])); - $default_display = $this->getMock('Drupal\views\Plugin\views\display\DefaultDisplay', ['initDisplay'], [[], 'default', $display_manager->getDefinition('default')] diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 75f01b3ac0ee753b56af2f129a711d5f9e979abb..6e7e024efcf7bc17fc471e40fcfcd304acdaa81c 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -290,6 +290,7 @@ + diff --git a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php index 0f17e6425b69c529382270ed5a7e14b37cabf6cb..98f66bd7af69340c0d783224233256de3894ea3c 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php @@ -112,7 +112,6 @@ protected function setUp() { 'translatable' => FALSE, ])->save(); - entity_get_form_display($this->entityTypeId, $this->entityTypeId, 'default') ->setComponent($this->fieldNameSingle, ['type' => 'test_field_widget']) ->setComponent($this->fieldNameMultiple, ['type' => 'test_field_widget']) diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php index 66005de42883ae4c939954f76d92fc857603e8b3..e0eccbf58d139fb573a0e5ed73fb95e1be960653 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php @@ -49,7 +49,6 @@ public function testDrupalGetFilename() { // a fixed location and naming. $this->assertIdentical(drupal_get_filename('profile', 'testing'), 'core/profiles/testing/testing.info.yml'); - // Generate a non-existing module name. $non_existing_module = uniqid("", TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 6c0bc1a6f41a8a1527027add6b5fbe97438f762d..b2859a0bbfc156f0452134be01219ad61e47e9cd 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -211,7 +211,6 @@ public function testSchemaMapping() { $expected['mapping']['upscale']['label'] = 'Upscale'; $expected['type'] = 'image.effect.image_scale'; - $this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.effect.image_scale'); // Most complex case, get metadata for actual configuration element. diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php index c28e1aa4c2a297a653a7cbe74ee70f4aa0ff8b76..fb36fe7afe70f3a443e940efe37134dff7bb149e 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php @@ -467,7 +467,6 @@ public function testRegexCondition() { ], ]; - $database = $this->container->get('database'); foreach ($test_groups as $test_group) { $query = $database->select('test', 't'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 56050a7dc40d18307e95e5a42d205814ed87fa71..78c7a5d870efc3e41abdbcd44a2643bc0ebbed37 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -635,7 +635,6 @@ public function testLookupKeys() { $entity->enforceIsNew(); $entity->save(); - $expected[] = $entity->getConfigDependencyName(); $this->assertEqual($expected, $key_value->get('style:test')); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php index 0f77535a3f6b850e0a36023e5b7305d739ba3ece..7faa8b83f1525dff74ff6486406edee532d90817 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php @@ -131,7 +131,6 @@ public function testClonedEntityFields() { } $this->assertTrue($different_references, 'The entity object and the cloned entity object reference different field item list objects.'); - // Reload the entity, initialize one translation, clone it and check that // both entity objects reference different field instances. $entity = $this->reloadEntity($entity); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php index 11aeede830036e40671ef33fb649ef217f432ebb..179c63e9f16a61fc7e896e1f96ceb4cac722b60a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php @@ -63,7 +63,6 @@ public function testCopyFormValuesToEntity() { ]) ->shouldBeCalled(); - // An initially visible field, with a submitted region change. $entity->getComponent('field_start_visible_change_region') ->willReturn([ diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index ebb307284ccacad838f339c294c02c3931925544..9edee5cd21a7ce7fe5a40f00a42956da58b936cf 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -819,7 +819,6 @@ public function testCaseSensitivity() { )->execute(); $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); - // Check the case insensitive field, ENDS_WITH operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[1]['lowercase'], 'ENDS_WITH' @@ -842,7 +841,6 @@ public function testCaseSensitivity() { )->execute(); $this->assertIdentical(count($result), 0, 'Case sensitive, exact match.'); - // Check the case insensitive field, CONTAINS operator, use the inner 8 // characters of the uppercase and lowercase strings. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php index 875ca7a4fa81953ccc89f1c6279f26112fa36591..ea76f0a4f5ecf12d43bb1d3b69d4fb7fb0ff4200 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php @@ -54,7 +54,6 @@ public function testGarbageCollection() { ->execute(); } - // Perform a new set operation and then trigger garbage collection. $store->setWithExpire('autumn', 'winter', rand(500, 1000000)); system_cron(); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php index ed59f2f0ffecc2906725e5fa4627ca6836e6cf69..0f231f482a6bfd09649f07003a3187b1006dfd1b 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php @@ -532,7 +532,6 @@ public function testOutlinePathNoMatch() { $request = Request::create($path, 'GET'); - $routes = $provider->getRoutesByPattern($path); $this->assertFalse(count($routes), 'No path found with this pattern.'); diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php index c317bd84a40505de32124583da25c2aa419acd95..995f5fc8510ea6396b7e537579c2749e4546d171 100644 --- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php @@ -125,7 +125,6 @@ public function configurationDataProvider() { $class, ]; - // Test default configuration plus specific per collection setting. $data['default-plus-collection-setting'] = [ [ diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index 0b694c65006b4464fcd944db7dcac552472173e5..60a17a0fb68b7564a15a85f107a9173c5b275681 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -620,7 +620,6 @@ public function andOrCacheabilityPropagationProvider() { [$allowed_un, 'OR', $neutral_cf, FALSE, NULL], [$allowed_un, 'OR', $neutral_un, FALSE, NULL], - // Forbidden (ct) OR allowed (ct,cf,un). [$forbidden_ct, 'OR', $allowed_ct, TRUE, TRUE], [$forbidden_ct, 'OR', $allowed_cf, TRUE, TRUE], @@ -660,7 +659,6 @@ public function andOrCacheabilityPropagationProvider() { [$forbidden_un, 'OR', $forbidden_cf, FALSE, NULL], [$forbidden_un, 'OR', $forbidden_un, FALSE, NULL], - // Neutral (ct) OR allowed (ct,cf,un). [$neutral_ct, 'OR', $allowed_ct, TRUE, TRUE], [$neutral_ct, 'OR', $allowed_cf, TRUE, FALSE], @@ -700,7 +698,6 @@ public function andOrCacheabilityPropagationProvider() { [$neutral_un, 'OR', $forbidden_cf, FALSE, NULL], [$neutral_un, 'OR', $forbidden_un, FALSE, NULL], - // Allowed (ct) AND allowed (ct,cf,un). [$allowed_ct, 'AND', $allowed_ct, TRUE, TRUE], [$allowed_ct, 'AND', $allowed_cf, TRUE, FALSE], @@ -740,7 +737,6 @@ public function andOrCacheabilityPropagationProvider() { [$allowed_un, 'AND', $neutral_cf, FALSE, NULL], [$allowed_un, 'AND', $neutral_un, FALSE, NULL], - // Forbidden (ct) AND allowed (ct,cf,un). [$forbidden_ct, 'AND', $allowed_ct, TRUE, TRUE], [$forbidden_ct, 'AND', $allowed_cf, TRUE, TRUE], @@ -780,7 +776,6 @@ public function andOrCacheabilityPropagationProvider() { [$forbidden_un, 'AND', $forbidden_cf, FALSE, NULL], [$forbidden_un, 'AND', $forbidden_un, FALSE, NULL], - // Neutral (ct) AND allowed (ct,cf,un). [$neutral_ct, 'AND', $allowed_ct, TRUE, TRUE], [$neutral_ct, 'AND', $allowed_cf, TRUE, TRUE], diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index d525514e49c924fb4d6eb8ffd380743f56e94e73..a7f7eb41aa7e2f7e6cb3865735f9576d4e190ee9 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -439,7 +439,6 @@ public function testGetFieldStorageDefinitionsWithCaching() { }) ->shouldBeCalled(); - $this->assertSame($expected, $this->entityFieldManager->getFieldStorageDefinitions('test_entity_type')); $this->entityFieldManager->testClearEntityFieldInfo(); $this->assertSame($expected, $this->entityFieldManager->getFieldStorageDefinitions('test_entity_type')); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php index f7179c855bac214c55c7756fed2c4edced6804cd..49b9fbd28998bdf2e130fae14396f389c9220576 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php @@ -100,7 +100,6 @@ public function providerTestOnResponse() { RSS; - $data['invalid-feed'] = [$invalid_feed, $invalid_feed]; return $data; } diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 3d3d5015237e745d62c0a434953e41894189969a..624d5922144deea55e4a20419c275f111ed8567a 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -462,7 +462,6 @@ protected function setupFactoryAndLocalTaskPlugins(array $definitions, $active_p $mock->getCacheTags()->willReturn(isset($info['cache_tags']) ? $info['cache_tags'] : []); $mock->getCacheMaxAge()->willReturn(isset($info['cache_max_age']) ? $info['cache_max_age'] : Cache::PERMANENT); - $access_manager_map[] = [$info['route_name'], [], $this->account, TRUE, $info['access']]; $map[] = [$info['id'], [], $mock->reveal()]; diff --git a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php index 2bfb1c9ea9746abb06889d36ebfd7fac57483f62..5511f0abfcdef61656e2e6cd361dee52af57df07 100644 --- a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php @@ -133,7 +133,6 @@ public function testIsValidWithLinkToAnyPageAccount() { ->method('processInbound') ->willReturnArgument(0); - $this->assertTrue($this->pathValidator->isValid('test-path')); } diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 7188a51d132b78180b2c4ed1a619c7ff6b52e965..1fca8179a8327601bb650bd6a76e8583a4f59c58 100644 --- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -163,7 +163,6 @@ public function providerTestApplyTo() { ], ]; - $expected_when_empty_metadata = [ '#cache' => [ 'contexts' => [], @@ -228,7 +227,6 @@ public function providerTestCreateFromRenderArray() { ], ]; - $data[] = [$empty_render_array, $empty_metadata]; $data[] = [$nonempty_render_array, $nonempty_metadata]; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index 010ffc2add877207797a262195d709feb08127a9..52569eade9c50f4ceb5422547e235930c005b0d1 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -65,10 +65,8 @@ public function testRenderBasic($build, $expected, callable $setup_code = NULL) public function providerTestRenderBasic() { $data = []; - // Part 1: the most simplistic render arrays possible, none using #theme. - // Pass a NULL. $data[] = [NULL, '']; // Pass an empty string. @@ -216,7 +214,6 @@ public function providerTestRenderBasic() { // Part 2: render arrays using #theme and #theme_wrappers. - // Tests that #theme and #theme_wrappers can co-exist on an element. $build = [ '#theme' => 'common_test_foo', @@ -302,10 +299,8 @@ public function providerTestRenderBasic() { }; $data[] = [$build, '
    ' . "\n", $setup_code]; - // Part 3: render arrays using #markup as a fallback for #theme hooks. - // Theme suggestion is not implemented, #markup should be rendered. $build = [ '#theme' => ['suggestionnotimplemented'], @@ -357,10 +352,8 @@ public function providerTestRenderBasic() { ]; $data[] = [$build, $theme_function_output, $setup_code]; - // Part 4: handling of #children and child renderable elements. - // #theme is implemented so the values of both #children and 'child' will // be ignored - it is the responsibility of the theme hook to render these // if appropriate. diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 6c6d768a45632b363f897b4fc716e9a1055fe2ef..1fc6aeaf4279f3ef3a354ccb341eef9098b5382c 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -211,7 +211,6 @@ public function testAliasGeneration() { ->method('processOutbound') ->with($this->anything()); - // Check that the two generate methods return the same result. $this->assertGenerateFromRoute('test_1', [], [], $url, (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT)); @@ -232,7 +231,6 @@ public function testAliasGenerationUsingInterfaceConstants() { ->method('processOutbound') ->with($this->anything()); - // Check that the two generate methods return the same result. $this->assertGenerateFromRoute('test_1', [], [], $url, (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));