diff --git a/core/modules/migrate_drupal/tests/src/Unit/MigrationStateUnitTest.php b/core/modules/migrate_drupal/tests/src/Unit/MigrationStateUnitTest.php index 3c770c78471c457b6f9914c6036390fe722fc0d5..ea4b54356ea665bc835426235bb22d15233f3d4b 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/MigrationStateUnitTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/MigrationStateUnitTest.php @@ -396,7 +396,6 @@ public function providerGetUpgradeStates() { // Test menu migration with menu_ui uninstalled. $tests[3] = $tests[1]; unset($tests[3]['modules_to_enable']['menu_ui']); - unset($tests[3]['files']['menu_ui']); unset($tests[3]['migrations']['menu_ui']); $tests[3]['expected_7'] = [ MigrationState::NOT_FINISHED => [ diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index c9f24b6aa99313196d4355ea06c71313a9c045b0..1eed2d4c2be70a1b0564e5497701c85aae61cb71 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -449,7 +449,6 @@ public function defaultableSections($section = NULL) { // If the display cannot use a pager, then we cannot default it. if (!$this->usesPager()) { unset($sections['pager']); - unset($sections['items_per_page']); } foreach ($this->extenders as $extender) { diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index a6575c457496cb2dccdf038ef034336a3bf8cce0..e61ca1c182b5a741ee86c15e3e1cc57b48bc7f6a 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -885,11 +885,6 @@ parameters: count: 1 path: modules/migrate/tests/src/Kernel/MigrateTestBase.php - - - message: "#^Cannot unset offset 'menu_ui' on array\\{system\\: \"finished\\:\\\\n 6\\:\\\\n …\", menu_link_content\\: \"finished\\:\\\\n 6\\:\\\\n …\", menu\\: \"finished\\:\\\\n 6\\:\\\\n …\"\\}\\.$#" - count: 1 - path: modules/migrate_drupal/tests/src/Unit/MigrationStateUnitTest.php - - message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" count: 2 @@ -1405,11 +1400,6 @@ parameters: count: 1 path: modules/views/src/Plugin/views/cache/Time.php - - - message: "#^Cannot unset offset 'items_per_page' on array\\{access\\: array\\{'access'\\}, cache\\: array\\{'cache'\\}, title\\: array\\{'title'\\}, css_class\\: array\\{'css_class'\\}, use_ajax\\: array\\{'use_ajax'\\}, hide_attachment_summary\\: array\\{'hide_attachment…'\\}, show_admin_links\\: array\\{'show_admin_links'\\}, group_by\\: array\\{'group_by'\\}, \\.\\.\\.\\}\\.$#" - count: 1 - path: modules/views/src/Plugin/views/display/DisplayPluginBase.php - - message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" count: 2 @@ -1705,21 +1695,6 @@ parameters: count: 1 path: tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php - - - message: "#^Cannot unset offset int on array\\<string, mixed\\>\\.$#" - count: 1 - path: tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php - - - - message: "#^Cannot unset offset int on array\\<string, mixed\\>\\.$#" - count: 1 - path: tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php - - - - message: "#^Cannot unset offset int on array\\<string, mixed\\>\\.$#" - count: 1 - path: tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php - - message: "#^Result of static method Drupal\\\\Composer\\\\Composer\\:\\:ensureComposerVersion\\(\\) \\(void\\) is used\\.$#" count: 1 @@ -1745,11 +1720,6 @@ parameters: count: 1 path: tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php - - - message: "#^Cannot unset offset 'data\\-drupal\\-link…' on array\\{data\\-drupal\\-link\\-system\\-path\\: '\\<front\\>'\\}\\.$#" - count: 2 - path: tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php - - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" count: 3 @@ -1780,11 +1750,6 @@ parameters: count: 1 path: tests/Drupal/Tests/Core/Render/RendererCallbackTest.php - - - message: "#^Cannot unset offset '\\#cache' on array\\{\\#lazy_builder\\: array\\{'Drupal\\\\\\\\Tests\\\\\\\\Core…', array\\{mixed\\}\\}\\}\\.$#" - count: 1 - path: tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php - - message: "#^Call to an undefined method Drupal\\\\Tests\\\\Core\\\\Test\\\\TestClass\\:\\:assertArrayHasKey\\(\\)\\.$#" count: 3 diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php index c5df7508d6f56a3629938c202bfe6608ca1860c2..907f8c5688dfc2df7fa0bf60fef6ae9d52567f5a 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php @@ -57,11 +57,11 @@ public function testReadOnly() { // Find a global that doesn't exist. do { - $random = mt_rand(10000, 100000); + $random = 'test' . mt_rand(10000, 100000); } while (isset($GLOBALS[$random])); // Write out a PHP file and ensure it's successfully loaded. - $code = "<?php\n\$GLOBALS[$random] = TRUE;"; + $code = "<?php\n\$GLOBALS['$random'] = TRUE;"; $success = $php->save($name, $code); $this->assertTrue($success); $php_read = new FileReadOnlyStorage($this->readonlyStorage); diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php index 2ad99b4b226ce4819305e5c96083288ad6ca8b8f..de5fbb21c2591cde2be8b172144a2a24a9c34a21 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php @@ -70,11 +70,11 @@ public function testDeleteAll() { // Find a global that doesn't exist. do { - $random = mt_rand(10000, 100000); + $random = 'test' . mt_rand(10000, 100000); } while (isset($GLOBALS[$random])); // Write out a PHP file and ensure it's successfully loaded. - $code = "<?php\n\$GLOBALS[$random] = TRUE;"; + $code = "<?php\n\$GLOBALS['$random'] = TRUE;"; $this->assertTrue($php->save($name, $code), 'Saved php file'); $php->load($name); $this->assertTrue($GLOBALS[$random], 'File saved correctly with correct value'); diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php index 007a6fa0cbd798aaaa34cac39dc726a5f04108eb..c670bebadf4ee2f079397afc1129cd9d2f390105 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php @@ -39,11 +39,11 @@ public function assertCRUD($php) { // Find a global that doesn't exist. do { - $random = mt_rand(10000, 100000); + $random = 'test' . mt_rand(10000, 100000); } while (isset($GLOBALS[$random])); // Write out a PHP file and ensure it's successfully loaded. - $code = "<?php\n\$GLOBALS[$random] = TRUE;"; + $code = "<?php\n\$GLOBALS['$random'] = TRUE;"; $success = $php->save($name, $code); $this->assertTrue($success, 'Saved php file'); $php->load($name); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php index 5e5b06cfcc8f4c67780d8a92ae7446072efbb935..e639d8c346b1435211fb81d7660922740df39776 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php @@ -160,13 +160,11 @@ public function providerTestSetLinkActiveClass() { // Matching path, plus all matching variations. $attributes = [ 'data-drupal-link-system-path' => 'llama', - 'data-drupal-link-query' => Json::encode(['foo' => 'bar']), ]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'nl']]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; // Matching path, plus all non-matching variations. - $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en']]; - unset($attributes['data-drupal-link-query']); + $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => TRUE]]; // Special non-matching path, plus all variations. @@ -176,7 +174,6 @@ public function providerTestSetLinkActiveClass() { $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl']]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en']]; - unset($attributes['data-drupal-link-query']); $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => TRUE]]; @@ -191,13 +188,11 @@ public function providerTestSetLinkActiveClass() { // Matching path, plus all matching variations. $attributes = [ 'data-drupal-link-system-path' => 'llama', - 'data-drupal-link-query' => Json::encode(['foo' => 'bar']), ]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'nl']]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; // Matching path, plus all non-matching variations. - $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en']]; - unset($attributes['data-drupal-link-query']); + $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => TRUE]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => ""]]; @@ -209,7 +204,6 @@ public function providerTestSetLinkActiveClass() { $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl']]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en']]; - unset($attributes['data-drupal-link-query']); $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => TRUE]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => ""]]; @@ -226,13 +220,11 @@ public function providerTestSetLinkActiveClass() { // Matching path, plus all matching variations. $attributes = [ 'data-drupal-link-system-path' => 'my-front-page', - 'data-drupal-link-query' => Json::encode(['foo' => 'bar']), ]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'en']]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; // Matching path, plus all non-matching variations. - $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl']]; - unset($attributes['data-drupal-link-query']); + $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => TRUE]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => ""]]; @@ -240,13 +232,11 @@ public function providerTestSetLinkActiveClass() { // Special matching path, plus all variations. $attributes = [ 'data-drupal-link-system-path' => '<front>', - 'data-drupal-link-query' => Json::encode(['foo' => 'bar']), ]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes]; - $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'en']]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; + $situations[] = ['context' => $context, 'is active' => TRUE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; // Special matching path, plus all non-matching variations. - $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl']]; - unset($attributes['data-drupal-link-query']); + $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'nl', 'data-drupal-link-query' => Json::encode(['foo' => 'bar'])]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => ""]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['data-drupal-link-query' => TRUE]]; $situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => $attributes + ['hreflang' => 'en', 'data-drupal-link-query' => ""]]; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index 744f7879637017bf9e0b7600b0b5307c3f04fb48..c23cc1943e09b0a9b1cfd6cbed1ad5bc57f77a45 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -477,7 +477,7 @@ public function providerPlaceholders() { // - uncacheable $x = $base_element_b; $expected_placeholder_render_array = $x['#attached']['placeholders'][(string) $generate_placeholder_markup()]; - unset($x['#attached']['placeholders'][(string) $generate_placeholder_markup()]['#cache']); + $this->assertArrayNotHasKey('#cache', $expected_placeholder_render_array); $cases[] = [ $x, $args,