diff --git a/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php b/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php index ee6f39740366bd4f3e732796db6c09a1289cf785..239c5ab0d86468e189972ef9bbf94dfa41a34c99 100644 --- a/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php +++ b/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php @@ -57,8 +57,10 @@ public function testActions() { * The expected Action type. * @param array $configuration * The expected Action configuration. + * + * @internal */ - protected function assertEntity($id, $label, $type, $configuration) { + protected function assertEntity(string $id, string $label, string $type, array $configuration): void { $action = Action::load($id); $this->assertInstanceOf(Action::class, $action); diff --git a/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php b/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php index 85a6977d4232b2c6c08066cccc50fff8bf9cbd0a..920af405338a84b900ca7eb6ad4ef259c77515b6 100644 --- a/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php +++ b/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php @@ -57,8 +57,10 @@ public function testActions() { * The expected Action type. * @param array $configuration * The expected Action configuration. + * + * @internal */ - protected function assertEntity($id, $label, $type, $configuration) { + protected function assertEntity(string $id, string $label, string $type, array $configuration): void { $action = Action::load($id); $this->assertInstanceOf(Action::class, $action); diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php index 21a39eb5a45aab6cc733d230991db127fcc9b47f..dcb68b48430b3259ba3623ba2bcf1f9349541d40 100644 --- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php @@ -327,7 +327,10 @@ public function testBigPipeMultiOccurrencePlaceholders() { $this->assertSession()->responseNotContains('The count is 3.'); } - protected function assertBigPipeResponseHeadersPresent() { + /** + * @internal + */ + protected function assertBigPipeResponseHeadersPresent(): void { // Check that Cache-Control header set to "private". $this->assertSession()->responseHeaderContains('Cache-Control', 'private'); $this->assertSession()->responseHeaderEquals('Surrogate-Control', 'no-store, content="BigPipe/1.0"'); @@ -340,8 +343,10 @@ protected function assertBigPipeResponseHeadersPresent() { * @param array $expected_big_pipe_nojs_placeholders * Keys: BigPipe no-JS placeholder markup. Values: expected replacement * markup. + * + * @internal */ - protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_placeholders) { + protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_placeholders): void { $this->assertSetsEqual(array_keys($expected_big_pipe_nojs_placeholders), array_map('rawurldecode', explode(' ', $this->getSession()->getResponseHeader('BigPipe-Test-No-Js-Placeholders')))); foreach ($expected_big_pipe_nojs_placeholders as $big_pipe_nojs_placeholder => $expected_replacement) { // Checking whether the replacement for the BigPipe no-JS placeholder @@ -361,8 +366,10 @@ protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_p * @param array $expected_big_pipe_placeholder_stream_order * Keys: BigPipe placeholder IDs. Values: expected AJAX response. Keys are * defined in the order that they are expected to be rendered & streamed. + * + * @internal */ - protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholders, array $expected_big_pipe_placeholder_stream_order) { + protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholders, array $expected_big_pipe_placeholder_stream_order): void { $this->assertSetsEqual(array_keys($expected_big_pipe_placeholders), explode(' ', $this->getSession()->getResponseHeader('BigPipe-Test-Placeholders'))); $placeholder_positions = []; $placeholder_replacement_positions = []; @@ -437,36 +444,49 @@ protected function getTestCases($has_session = TRUE) { /** * Asserts whether arrays A and B are equal, when treated as sets. + * + * @todo This method is broken. Fix it in + * https://www.drupal.org/project/drupal/issues/3144926 + * + * @internal */ - protected function assertSetsEqual(array $a, array $b) { - return count($a) == count($b) && !array_diff_assoc($a, $b); + protected function assertSetsEqual(array $a, array $b): void { + $result = count($a) == count($b) && !array_diff_assoc($a, $b); } /** * Asserts whether a BigPipe no-JS cookie exists or not. + * + * @internal */ - protected function assertBigPipeNoJsCookieExists($expected) { + protected function assertBigPipeNoJsCookieExists(string $expected): void { $this->assertCookieExists('big_pipe_nojs', $expected, 'BigPipe no-JS'); } /** * Asserts whether a session cookie exists or not. + * + * @internal */ - protected function assertSessionCookieExists($expected) { + protected function assertSessionCookieExists(string $expected): void { $this->assertCookieExists($this->getSessionName(), $expected, 'Session'); } /** * Asserts whether a cookie exists on the client or not. + * + * @internal */ - protected function assertCookieExists($cookie_name, $expected, $cookie_label) { + protected function assertCookieExists(string $cookie_name, string $expected, string $cookie_label): void { $this->assertEquals($expected, !empty($this->getSession()->getCookie($cookie_name)), $expected ? "$cookie_label cookie exists." : "$cookie_label cookie does not exist."); } /** * Calls ::performMetaRefresh() and asserts the responses. + * + * @internal */ - protected function assertBigPipeNoJsMetaRefreshRedirect() { + protected function assertBigPipeNoJsMetaRefreshRedirect(): void { $original_url = $this->getSession()->getCurrentUrl(); // Disable automatic following of redirects by the HTTP client, so that this diff --git a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php index df7fba45a3a41ceaeb14691091b26dc943dd90cf..03b728da7f986594350e9a57ad179fd465cac513 100644 --- a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +++ b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php @@ -288,8 +288,10 @@ public function testBlockViewBuilderBuildAlter() { * The expected cache tags. * @param int $expected_max_age * The expected max-age. + * + * @internal */ - protected function assertBlockRenderedWithExpectedCacheability(array $expected_keys, array $expected_contexts, array $expected_tags, $expected_max_age) { + protected function assertBlockRenderedWithExpectedCacheability(array $expected_keys, array $expected_contexts, array $expected_tags, int $expected_max_age): void { $required_cache_contexts = ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions']; // Check that the expected cacheability metadata is present in: diff --git a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php index daa3f107b646f302987d74f8a7c6bca3e5660548..ecbea2ffb909492436ea9764ce21b5ab5b0d14a9 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php @@ -69,14 +69,16 @@ protected function setUp(): void { * The display region. * @param string $theme * The theme. - * @param string $weight + * @param int $weight * The block weight. * @param array $settings * (optional) The block settings. * @param bool $status * Whether the block is expected to be enabled or disabled. + * + * @internal */ - public function assertEntity($id, $visibility, $region, $theme, $weight, array $settings = NULL, $status = TRUE) { + public function assertEntity(string $id, array $visibility, string $region, string $theme, int $weight, array $settings = NULL, bool $status = TRUE): void { $block = Block::load($id); $this->assertInstanceOf(Block::class, $block); $this->assertSame($visibility, $block->getVisibility()); diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php index 991d02142c12c4a71fc1aff95e93e5d29f0a9cbc..a9f31b4ca3d88a09484298091e5b3f8f15b6619f 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php @@ -73,7 +73,7 @@ protected function setUp(): void { * The display region. * @param string $theme * The theme. - * @param string $weight + * @param int $weight * The block weight. * @param string $label * The block label. @@ -81,8 +81,10 @@ protected function setUp(): void { * The block label display setting. * @param bool $status * Whether the block is expected to be enabled or disabled. + * + * @internal */ - public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $theme, $weight, $label, $label_display, $status = TRUE) { + public function assertEntity(string $id, string $plugin_id, array $roles, string $pages, string $region, string $theme, int $weight, string $label, string $label_display, bool $status = TRUE): void { $block = Block::load($id); $this->assertInstanceOf(Block::class, $block); /** @var \Drupal\block\BlockInterface $block */ diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php index 280f0e81371b48bd97bfbb00dd9235cbc9d9f18d..60249e60e47f4fbb5b1493e42fe9d9eab4faaba4 100644 --- a/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php +++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php @@ -99,8 +99,10 @@ public function testFilters() { * that translation should be shown on the given page. * @param string $message * Message suffix to display. + * + * @internal */ - protected function assertPageCounts($path, $counts, $message) { + protected function assertPageCounts(string $path, array $counts, string $message): void { // Get the text of the page. $this->drupalGet($path); $text = $this->getTextContent(); diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php index e3053e4be3044d5e62652694756f3d1c2ee5c504..f47660906dada4e756b3e7605224da4c2ee108bf 100644 --- a/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php +++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php @@ -59,8 +59,10 @@ public function testBlockContentViewTypeArgument() { * * @param array $expected_ids * An array of block_content IDs. + * + * @internal */ - protected function assertIds(array $expected_ids = []) { + protected function assertIds(array $expected_ids = []): void { $result = $this->xpath('//span[@class="field-content"]'); $ids = []; foreach ($result as $element) { diff --git a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php index 509230d98f138ac1736159605c174a5fbc567a3c..32bb55a038ad14edce14395a5c3b01f6394f65aa 100644 --- a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php +++ b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php @@ -38,8 +38,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the display component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityViewDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('hidden', $component['label']); diff --git a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php index eb424395c8dba075dff706c4a6e43514b32f77e0..6d21b99d9d1525b5413b1941e5719a8cc9b13064 100644 --- a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php +++ b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php @@ -38,8 +38,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the form component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityFormDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('text_textarea_with_summary', $component['type']); diff --git a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php index cb4ac799b42681bda94f2f7b609b68f820085497..33f0c253f45e9b4ed6c226e55455b59f9553d403 100644 --- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php +++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php @@ -143,9 +143,11 @@ public function testBookOrdering() { * @throws \Behat\Mink\Exception\ExpectationException * When any of the given string is not found. * + * @internal + * * @todo Remove this once https://www.drupal.org/node/2817657 is committed. */ - protected function assertOrderInPage(array $items) { + protected function assertOrderInPage(array $items): void { $session = $this->getSession(); $text = $session->getPage()->getHtml(); $strings = []; diff --git a/core/modules/book/tests/src/Kernel/BookMultilingualTest.php b/core/modules/book/tests/src/Kernel/BookMultilingualTest.php index 38bcdcffc382d1319167a56ce05ba5d396e62c6f..033b9ae65bfb93434687d0768ca7213a62edf8c4 100644 --- a/core/modules/book/tests/src/Kernel/BookMultilingualTest.php +++ b/core/modules/book/tests/src/Kernel/BookMultilingualTest.php @@ -289,6 +289,8 @@ protected function setCurrentLanguage(string $langcode): void { * A book tree item. * @param string $langcode * The language code for the requested translation. + * + * @internal */ protected function assertBookItemIsCorrectlyTranslated(array $item, string $langcode): void { $this->assertNodeLinkIsCorrectlyTranslated($item['original_link']['nid'], $item['title'], $item['url'], $langcode); @@ -305,6 +307,8 @@ protected function assertBookItemIsCorrectlyTranslated(array $item, string $lang * The URL being tested. * @param string $langcode * The language code. + * + * @internal */ protected function assertNodeLinkIsCorrectlyTranslated(int $nid, string $title, Url $url, string $langcode): void { $node = Node::load($nid); @@ -324,8 +328,10 @@ protected function assertNodeLinkIsCorrectlyTranslated(int $nid, string $title, * The node ID. * @param string $indent * The indentation before the actual table of contents label. + * + * @internal */ - protected function assertToCEntryIsCorrectlyTranslated(array $toc, string $langcode, int $nid, string $indent) { + protected function assertToCEntryIsCorrectlyTranslated(array $toc, string $langcode, int $nid, string $indent): void { $node = Node::load($nid); $node_label = $node->getTranslation($langcode)->label(); $this->assertSame($indent . ' ' . $node_label, $toc[$nid]); diff --git a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php index f70fd87d0740506d850ff63c796c840db9c0629f..3f852ef8e31301b163c1b5192539f3f381157f3f 100644 --- a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php +++ b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php @@ -473,8 +473,10 @@ public function testExternalStylesheets() { * @param string $langcode * Language code to assert for. Defaults to French. That is the default * language set in this assertion. + * + * @internal */ - protected function assertCKEditorLanguage($langcode = 'fr') { + protected function assertCKEditorLanguage(string $langcode = 'fr'): void { // Set French as the site default language. ConfigurableLanguage::createFromLangcode('fr')->save(); $this->config('system.site')->set('default_langcode', 'fr')->save(); diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php index 0d3f6fe7542aefd825f0deb1642d6106c71f9842..8fb14f18d9da4e5533e9da4b297aacdcc11b6c95 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php @@ -664,11 +664,13 @@ public function testViewMode() { * * @param string $attribute * The attribute to check. - * @param mixed $value + * @param string|null $value * Either a string value or if NULL, asserts that <drupal-media> element * doesn't have the attribute. + * + * @internal */ - protected function assertSourceAttributeSame($attribute, $value) { + protected function assertSourceAttributeSame(string $attribute, ?string $value): void { $dom = $this->getEditorDataAsDom(); $drupal_media = (new \DOMXPath($dom))->query('//drupal-media'); $this->assertNotEmpty($drupal_media); diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index ef4fe3c018fea8257a7eabc8d1512f85d9dfd3db..aea7bb10d5db1dae202bd83595f67f81696cf309 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -210,8 +210,10 @@ public function testCommentOrderingThreading() { * An array of comments, must be of the type CommentInterface. * @param array $expected_order * An array of keys from $comments describing the expected order. + * + * @internal */ - public function assertCommentOrder(array $comments, array $expected_order) { + public function assertCommentOrder(array $comments, array $expected_order): void { $expected_cids = []; // First, rekey the expected order by cid. diff --git a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php index 00ccd29c2498f2684e96107ee24d2f8ef921e8ef..55ad7b4168b0bf86caaab0466db5248afc290aa2 100644 --- a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php +++ b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php @@ -131,8 +131,10 @@ public function testCommentThreading() { * The comment ID to check. * @param int $pid * The expected parent comment ID. + * + * @internal */ - protected function assertParentLink($cid, $pid) { + protected function assertParentLink(int $cid, int $pid): void { // This pattern matches a markup structure like: // @code // <a id="comment-2"></a> @@ -152,8 +154,10 @@ protected function assertParentLink($cid, $pid) { * * @param int $cid * The comment ID to check. + * + * @internal */ - protected function assertNoParentLink($cid) { + protected function assertNoParentLink(int $cid): void { // This pattern matches a markup structure like: // @code // <a id="comment-2"></a> diff --git a/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php b/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php index 9be47fc8e21530593fa4cbbe640a8166469746be..623d75c1c4f726e4094c28d12f12494bc7af5c32 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php @@ -108,8 +108,10 @@ public function testFilters() { * that translation should be shown on the given page. * @param string $message * Message suffix to display. + * + * @internal */ - protected function assertPageCounts($path, $counts, $message) { + protected function assertPageCounts(string $path, array $counts, string $message): void { // Get the text of the page. $this->drupalGet($path); $text = $this->getTextContent(); diff --git a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php index 39b842400daee10173fe0e5446d7a8d8f58c293e..2e6af3207013f3e2b772db98dbedfc80e59fb4b0 100644 --- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php +++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php @@ -189,8 +189,10 @@ public function testValidation() { * The field that violates the maximum length. * @param int $length * Number of characters that was exceeded. + * + * @internal */ - protected function assertLengthViolation(CommentInterface $comment, $field_name, $length) { + protected function assertLengthViolation(CommentInterface $comment, string $field_name, int $length): void { $violations = $comment->validate(); $this->assertCount(1, $violations, "Violation found when $field_name is too long."); $this->assertEquals("{$field_name}.0.value", $violations[0]->getPropertyPath()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php index b4a670562f1c7a011191b61417f5acf643422fa5..f2741270cec9242c4658ccefc3e5996bf363a65d 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php @@ -41,8 +41,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the display component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityViewDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('hidden', $component['label']); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplaySubjectTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplaySubjectTest.php index a57c2250fb420cf9b13c750a7837f95919e87104..57fb3d3849b288589b7e1cabafbe1f3f8396d394 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplaySubjectTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplaySubjectTest.php @@ -35,8 +35,10 @@ protected function setUp(): void { * * @param string $id * The entity form display ID. + * + * @internal */ - protected function assertSubjectVisible($id) { + protected function assertSubjectVisible(string $id): void { $component = EntityFormDisplay::load($id)->getComponent('subject'); $this->assertIsArray($component); $this->assertSame('string_textfield', $component['type']); @@ -48,8 +50,10 @@ protected function assertSubjectVisible($id) { * * @param string $id * The entity form display ID. + * + * @internal */ - protected function assertSubjectNotVisible($id) { + protected function assertSubjectNotVisible(string $id): void { $component = EntityFormDisplay::load($id)->getComponent('subject'); $this->assertNull($component); } diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplayTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplayTest.php index 5438c938c25b44d5b1d06e0d6d2f1013e3584c85..8c1bec00d645a9dd898795f2c63e717a39ee34f2 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplayTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityFormDisplayTest.php @@ -40,8 +40,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the form component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityFormDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('comment_default', $component['type']); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php index fab1c51204120c0f733d71dc002c226564b25e7f..2bea5867d017f8c93a7a8a86f26341590c5923f7 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php @@ -45,14 +45,16 @@ protected function setUp(): void { * The field's default_mode setting. * @param int $per_page * The field's per_page setting. - * @param bool $anonymous + * @param int $anonymous * The field's anonymous setting. - * @param int $form_location + * @param bool $form_location * The field's form_location setting. - * @param bool $preview + * @param int $preview * The field's preview setting. + * + * @internal */ - protected function assertEntity($bundle, $field_name, $default_value, $default_mode, $per_page, $anonymous, $form_location, $preview) { + protected function assertEntity(string $bundle, string $field_name, int $default_value, int $default_mode, int $per_page, int $anonymous, bool $form_location, int $preview): void { $entity = FieldConfig::load("node.$bundle.$field_name"); $this->assertInstanceOf(FieldConfig::class, $entity); $this->assertSame('node', $entity->getTargetEntityTypeId()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldTest.php index e2a865cd7c98f71e9ec30b9ddb2b51e4fbf3b0ad..f16e1da2e9543ce9763dc37b79422ccbe045e288 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldTest.php @@ -35,8 +35,10 @@ protected function setUp(): void { * * @param string $comment_type * The comment type. + * + * @internal */ - protected function assertEntity($comment_type) { + protected function assertEntity(string $comment_type): void { $entity = FieldStorageConfig::load('node.' . $comment_type); $this->assertInstanceOf(FieldStorageConfig::class, $entity); $this->assertSame('node', $entity->getTargetEntityTypeId()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php index 359116b882226f3b58d797284b307bf8fa6051c5..0fe36155d81861132cc416858ced97322e9f56c1 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php @@ -25,8 +25,10 @@ class MigrateCommentTypeTest extends MigrateDrupal6TestBase { * The entity ID. * @param string $label * The entity label. + * + * @internal */ - protected function assertEntity($id, $label) { + protected function assertEntity(string $id, string $label): void { $entity = CommentType::load($id); $this->assertInstanceOf(CommentType::class, $entity); $this->assertSame($label, $entity->label()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityDisplayTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityDisplayTest.php index 1ace7293f0f8067b4909e76729bdf0e9cbbc6c29..83709fdf0a34e367f289ba617ce58e4bf4464e1a 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityDisplayTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityDisplayTest.php @@ -39,8 +39,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the display component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityViewDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('hidden', $component['label']); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php index c0a1de628cd4ad70c57e0f7a3dcc60a60898f1f1..8031983498851226ac48048f81f3a2abc9037e72 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php @@ -32,8 +32,10 @@ protected function setUp(): void { * * @param string $id * The entity form display ID. + * + * @internal */ - protected function assertSubjectVisible($id) { + protected function assertSubjectVisible(string $id): void { $component = EntityFormDisplay::load($id)->getComponent('subject'); $this->assertIsArray($component); $this->assertSame('string_textfield', $component['type']); @@ -45,8 +47,10 @@ protected function assertSubjectVisible($id) { * * @param string $id * The entity form display ID. + * + * @internal */ - protected function assertSubjectNotVisible($id) { + protected function assertSubjectNotVisible(string $id): void { $component = EntityFormDisplay::load($id)->getComponent('subject'); $this->assertNull($component); } diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplayTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplayTest.php index 05d1651bc97387a5976534fe0bccf36169cbf895..51c7dbdf91716d214494c52f07abc9237c47e755 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplayTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplayTest.php @@ -39,8 +39,10 @@ protected function setUp(): void { * The entity ID. * @param string $component_id * The ID of the form component. + * + * @internal */ - protected function assertDisplay($id, $component_id) { + protected function assertDisplay(string $id, string $component_id): void { $component = EntityFormDisplay::load($id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame('comment_default', $component['type']); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php index e1fd26c66cbadbb604c48b7ee9c94b2872ddeb48..ccf447a33ea7b84b849d0aad21b3188d2dfc9a3c 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php @@ -44,14 +44,16 @@ protected function setUp(): void { * The field's default_mode setting. * @param int $per_page * The field's per_page setting. - * @param bool $anonymous + * @param int $anonymous * The field's anonymous setting. - * @param int $form_location + * @param bool $form_location * The field's form_location setting. - * @param bool $preview + * @param int $preview * The field's preview setting. + * + * @internal */ - protected function assertEntity($bundle, $field_name, $default_value, $default_mode, $per_page, $anonymous, $form_location, $preview) { + protected function assertEntity(string $bundle, string $field_name, int $default_value, int $default_mode, int $per_page, int $anonymous, bool $form_location, int $preview): void { $entity = FieldConfig::load("node.$bundle.$field_name"); $this->assertInstanceOf(FieldConfig::class, $entity); $this->assertSame('node', $entity->getTargetEntityTypeId()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php index 25e67d239f8f3cc207398a5c3d7c5ebfa0d13093..be068b9f41b52607a2248d71222ff7b62538a3e6 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php @@ -32,8 +32,10 @@ protected function setUp(): void { * * @param string $comment_type * The comment type. + * + * @internal */ - protected function assertEntity($comment_type) { + protected function assertEntity(string $comment_type): void { $entity = FieldStorageConfig::load('node.' . $comment_type); $this->assertInstanceOf(FieldStorageConfig::class, $entity); $this->assertSame('node', $entity->getTargetEntityTypeId()); diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php index 0da71b7b14bb2cf27f9a9fb4d2e2fb541faae759..93d899aaf2bb9e5f2622150f02e92a29aea75211 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php @@ -25,8 +25,10 @@ class MigrateCommentTypeTest extends MigrateDrupal7TestBase { * The entity ID. * @param string $label * The entity label. + * + * @internal */ - protected function assertEntity($id, $label) { + protected function assertEntity(string $id, string $label): void { $entity = CommentType::load($id); $this->assertInstanceOf(CommentType::class, $entity); $this->assertSame($label, $entity->label()); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index 50a74e205691f0fbd4e73de63f82f053565df9cc..1fd76ccaff37dfec35c666171698a87571fb5e4f 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -1186,10 +1186,9 @@ protected function renderContextualLinks($ids, $current_path) { * @param string $id * The HTML ID of the textarea. * - * @return bool - * TRUE if the assertion passed; FALSE otherwise. + * @internal */ - protected function assertDisabledTextarea($id) { + protected function assertDisabledTextarea(string $id): void { $textarea = $this->assertSession()->fieldDisabled($id); $this->assertSame('textarea', $textarea->getTagName()); $this->assertSame('This field has been disabled because you do not have sufficient permissions to edit it.', $textarea->getText()); diff --git a/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php b/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php index 6a8da2203b916a6fdc645cf1e0502e80247477d1..ea07bc57b5d1263914ca3ef544e0976bccce0a34 100644 --- a/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php +++ b/core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php @@ -98,8 +98,10 @@ public function testContactLink() { * All user objects used by the test. * @param array $names * Users which should have contact links. + * + * @internal */ - public function assertContactLinks(array $accounts, array $names) { + public function assertContactLinks(array $accounts, array $names): void { $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "views-field-contact")]//a', count($names)); foreach ($names as $name) { $account_url = $accounts[$name]->toUrl('contact-form')->toString(); diff --git a/core/modules/contact/tests/src/Kernel/Migrate/MigrateContactCategoryTest.php b/core/modules/contact/tests/src/Kernel/Migrate/MigrateContactCategoryTest.php index c6b3ea5ed3f7194509d91ce1ea5d6bc413d7f748..178cbc6643d24a9f0bd8918336435c2abef5f782 100644 --- a/core/modules/contact/tests/src/Kernel/Migrate/MigrateContactCategoryTest.php +++ b/core/modules/contact/tests/src/Kernel/Migrate/MigrateContactCategoryTest.php @@ -41,8 +41,10 @@ protected function setUp(): void { * The expected reply message. * @param int $expected_weight * The contact form's expected weight. + * + * @internal */ - protected function assertEntity($id, $expected_label, array $expected_recipients, $expected_reply, $expected_weight) { + protected function assertEntity(string $id, string $expected_label, array $expected_recipients, string $expected_reply, int $expected_weight): void { /** @var \Drupal\contact\ContactFormInterface $entity */ $entity = ContactForm::load($id); $this->assertInstanceOf(ContactFormInterface::class, $entity); diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php index a23011d2137f88ea88c5d8d40c58e624bc8f6d4b..caa404af6a5c814e01f1c1510250accde4ef4d0f 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php @@ -505,8 +505,10 @@ protected function loadTranslation(NodeInterface $node, $langcode) { * * @param \Drupal\node\NodeInterface $node * A node object. + * + * @internal */ - public function assertLatestVersionPage(NodeInterface $node) { + public function assertLatestVersionPage(NodeInterface $node): void { $this->assertEquals($node->toUrl('latest-version')->setAbsolute()->toString(), $this->getSession()->getCurrentUrl()); $this->assertModerationForm($node); } @@ -519,8 +521,10 @@ public function assertLatestVersionPage(NodeInterface $node) { * @param bool $moderation_form * (optional) Whether the page should contain the moderation form. Defaults * to FALSE. + * + * @internal */ - public function assertNotLatestVersionPage(NodeInterface $node, $moderation_form = FALSE) { + public function assertNotLatestVersionPage(NodeInterface $node, bool $moderation_form = FALSE): void { $this->assertNotEquals($node->toUrl('latest-version')->setAbsolute()->toString(), $this->getSession()->getCurrentUrl()); if ($moderation_form) { $this->assertModerationForm($node, FALSE); @@ -538,8 +542,10 @@ public function assertNotLatestVersionPage(NodeInterface $node, $moderation_form * @param bool $latest_tab * (optional) Whether the node form is expected to be displayed on the * latest version page or on the node view page. Defaults to the former. + * + * @internal */ - public function assertModerationForm(NodeInterface $node, $latest_tab = TRUE) { + public function assertModerationForm(NodeInterface $node, bool $latest_tab = TRUE): void { $this->drupalGet($node->toUrl()); $this->assertEquals(!$latest_tab, $this->hasModerationForm()); $this->drupalGet($node->toUrl('latest-version')); @@ -551,8 +557,10 @@ public function assertModerationForm(NodeInterface $node, $latest_tab = TRUE) { * * @param \Drupal\node\NodeInterface $node * A node object. + * + * @internal */ - public function assertNoModerationForm(NodeInterface $node) { + public function assertNoModerationForm(NodeInterface $node): void { $this->drupalGet($node->toUrl()); $this->assertFalse($this->hasModerationForm()); $this->drupalGet($node->toUrl('latest-version')); diff --git a/core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php b/core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php index b78e0938b08cf12c19eefed774d2e7207bba6d33..286bbcfedcc02a77423495a60445c9796bb17e2a 100644 --- a/core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php @@ -327,8 +327,10 @@ public function testFilterRenderCache() { * @param bool $check_size * (optional) Whether to check that size of the select element is not * greater than 8. Defaults to FALSE. + * + * @internal */ - protected function assertFilterStates($states, $check_size = FALSE) { + protected function assertFilterStates(array $states, bool $check_size = FALSE): void { $this->drupalGet('/filter-test-path'); $assert_session = $this->assertSession(); @@ -355,8 +357,10 @@ protected function assertFilterStates($states, $check_size = FALSE) { * An array of workflow IDs to check. * @param \Drupal\views\ViewEntityInterface $view * A view configuration object. + * + * @internal */ - protected function assertWorkflowDependencies(array $workflow_ids, ViewEntityInterface $view) { + protected function assertWorkflowDependencies(array $workflow_ids, ViewEntityInterface $view): void { $dependencies = $view->getDependencies(); $expected = []; diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php index 343bfe55b436ddc62ea9299aa9c7c1441abd6df8..c7b84fd6bae63769228f950b4c28dbfe5eee24f9 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateStorageSchemaTest.php @@ -124,8 +124,10 @@ public function testUniqueKeys() { * An array of entity values. * @param bool $has_exception * If an exception should be triggered when saving the entity. + * + * @internal */ - protected function assertStorageException(array $values, $has_exception) { + protected function assertStorageException(array $values, bool $has_exception): void { $defaults = [ 'moderation_state' => 'draft', 'workflow' => 'editorial', diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php index c238eb3d445ce324f57d1676058edafd3ca749af..6c260ef930a3eb2af65bf80f9a5d5178c0a275d6 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php @@ -777,8 +777,10 @@ protected function reloadEntity(EntityInterface $entity, $revision_id = FALSE) { * @param bool|null $published * (optional) Whether to check if the entity is published or not. Defaults * to TRUE. + * + * @internal */ - protected function assertDefaultRevision(EntityInterface $entity, $revision_id, $published = TRUE) { + protected function assertDefaultRevision(EntityInterface $entity, int $revision_id, $published = TRUE): void { // Get the default revision. $entity = $this->reloadEntity($entity); $this->assertEquals($revision_id, $entity->getRevisionId()); diff --git a/core/modules/content_moderation/tests/src/Kernel/DefaultRevisionStateTest.php b/core/modules/content_moderation/tests/src/Kernel/DefaultRevisionStateTest.php index 065973a242cd8773f7edc294ae34fd3431e62f7f..307dfc8b2fb503eee75ca414d068bbd920808958 100644 --- a/core/modules/content_moderation/tests/src/Kernel/DefaultRevisionStateTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/DefaultRevisionStateTest.php @@ -123,8 +123,10 @@ public function testMultilingual() { * The state the content moderation state revision should be in. * @param string $expected_workflow * The workflow the content moderation state revision should be using. + * + * @internal */ - protected function assertModerationState($revision_id, $langcode, $expected_state, $expected_workflow = 'editorial') { + protected function assertModerationState(int $revision_id, string $langcode, string $expected_state, string $expected_workflow = 'editorial'): void { $moderation_state_storage = $this->entityTypeManager->getStorage('content_moderation_state'); $query = $moderation_state_storage->getQuery()->accessCheck(FALSE); diff --git a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php index a59b485d698ff790f145e073f177b06fd3c01948..623534e72235c04136ea0f791e4c2b0dea7ae8b7 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php @@ -162,8 +162,10 @@ public function testAssignNullItemList() { /** * Assert the set of expectations when the moderation state field is emptied. + * + * @internal */ - protected function assertEmptiedModerationFieldItemList() { + protected function assertEmptiedModerationFieldItemList(): void { $this->assertTrue($this->testNode->moderation_state->isEmpty()); // Test the empty value causes a violation in the entity. $violations = $this->testNode->validate(); diff --git a/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php b/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php index 800073be049ffa7f59e9b189128921c7d1205bee..c42b798977cd06ac46a22158ab6b7e04c092392b 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php @@ -321,8 +321,10 @@ public function testStateFilterStatesList() { * * @param string[] $states * The states which should appear in the filter. + * + * @internal */ - protected function assertPluginStates($states) { + protected function assertPluginStates(array $states): void { $plugin = Views::pluginManager('filter')->createInstance('moderation_state_filter', []); $view = Views::getView('test_content_moderation_state_filter_base_table'); $plugin->init($view, $view->getDisplay()); @@ -338,8 +340,10 @@ protected function assertPluginStates($states) { * An array of filters to apply to the view. * @param string $view_id * The view to execute for the results. + * + * @internal */ - protected function assertNodesWithFilters(array $nodes, array $filters, $view_id = 'test_content_moderation_state_filter_base_table') { + protected function assertNodesWithFilters(array $nodes, array $filters, string $view_id = 'test_content_moderation_state_filter_base_table'): void { $view = Views::getView($view_id); $view->setExposedInput($filters); $view->execute(); diff --git a/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php b/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php index 6ddbec3eeddf107a879f646df73541c7b78c9bee..b27c4d62eecf96f6c753195f24802ca0c83ddbc3 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php @@ -165,8 +165,10 @@ public function testSortRevisionBaseTable() { * The sort order. * @param array $expected * The expected results array. + * + * @internal */ - protected function assertSortResults($view_id, $column, $order, array $expected) { + protected function assertSortResults(string $view_id, string $column, string $order, array $expected): void { // Test with exposed input. $view = Views::getView($view_id); $view->setExposedInput([ diff --git a/core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php index 79cf23286c454de3b2b0e254543fadce7ce05e1e..ce4730820114345932caf45d0f0d879c5ff5893a 100644 --- a/core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php @@ -253,7 +253,7 @@ protected function createContentType(array $values = []) { /** * {@inheritdoc} */ - protected function assertDefaultRevision(EntityInterface $entity, $revision_id, $published = TRUE) { + protected function assertDefaultRevision(EntityInterface $entity, int $revision_id, $published = TRUE): void { // In the context of a workspace, the default revision ID is always the // latest workspace-specific revision, so we need to adjust the expectation // of the parent assertion. diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php index 01e4e9766f5a91dae3d96af68e014aeca60c4f99..07dacff667bae691a4a62aa0b2a47eadd5fccde8 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php @@ -85,8 +85,10 @@ public function testFlagAsOutdatedHidden() { /** * Checks whether the flag widget is displayed. + * + * @internal */ - protected function assertFlagWidget() { + protected function assertFlagWidget(): void { $this->assertSession()->pageTextNotContains('Flag other translations as outdated'); $this->assertSession()->pageTextContains('Translations cannot be flagged as outdated when content is moderated.'); } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index 974e396e01e2482b71880539960e0fa584896e10..de65d5464f7ebeabac2caadb4939689710547ed7 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -253,14 +253,16 @@ public function testAccountLanguageSettingsUI() { * * @param string $entity_type * The entity type for which to check translatability. - * @param string $bundle + * @param string|null $bundle * The bundle for which to check translatability. * @param bool $enabled * TRUE if translatability should be enabled, FALSE otherwise. * @param array $edit * An array of values to submit to the content translation settings page. + * + * @internal */ - protected function assertSettings($entity_type, $bundle, $enabled, $edit) { + protected function assertSettings(string $entity_type, ?string $bundle, bool $enabled, array $edit): void { $this->drupalGet('admin/config/regional/content-language'); $this->submitForm($edit, 'Save configuration'); $args = ['@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled']; diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php index 9360122fb2bd9904d764249c6b48712a12610a00..6291989f41167000a9c7d440f6d4e3d8bf53225b 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php @@ -414,10 +414,12 @@ protected function doTestWorkflows(UserInterface $user, $expected_status) { /** * Assert that the current page does not contain shared form elements. + * + * @internal */ - protected function assertNoSharedElements() { + protected function assertNoSharedElements(): void { $language_none = LanguageInterface::LANGCODE_NOT_SPECIFIED; - return $this->assertSession()->fieldNotExists("field_test_text[$language_none][0][value]"); + $this->assertSession()->fieldNotExists("field_test_text[$language_none][0][value]"); } } diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php index 2c7f8a9a3736db625940199ea3b6f5b62497e258..a689935c413f7efbaf327eddb074b71c596a3427 100644 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php @@ -449,8 +449,10 @@ protected function createRevision(ContentEntityInterface $translation, $default * * @param \Drupal\Core\Entity\EntityConstraintViolationListInterface $violations * A list of violations. + * + * @internal */ - protected function assertViolations(EntityConstraintViolationListInterface $violations) { + protected function assertViolations(EntityConstraintViolationListInterface $violations): void { $entity_type_id = $this->storage->getEntityTypeId(); $settings = $this->contentTranslationManager->getBundleTranslationSettings($entity_type_id, $entity_type_id); $message = !empty($settings['untranslatable_fields_hide']) ? @@ -478,8 +480,10 @@ protected function assertViolations(EntityConstraintViolationListInterface $viol * - target ID (it) * - alt (en) * - alt (it) + * + * @internal */ - protected function assertLatestRevisionFieldValues($entity_id, array $expected_values) { + protected function assertLatestRevisionFieldValues(int $entity_id, array $expected_values): void { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = $this->storage->loadRevision($this->storage->getLatestRevisionId($entity_id)); @[$revision_id, $target_id_en, $target_id_it, $alt_en, $alt_it] = $expected_values; diff --git a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php index 3f70a6590b77da87b6d4d401ccbc373bd763f3d0..6f4449880245d5177c14babde4d311f74bf9036a 100644 --- a/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php +++ b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php @@ -72,8 +72,10 @@ protected function setUp(): void { * The value the migrated entity field should have. * @param int $expected_term_reference_tid * The term reference ID the migrated entity field should have. + * + * @internal */ - protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL) { + protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void { /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load($id); $this->assertInstanceOf(TermInterface::class, $entity); @@ -82,7 +84,7 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, $entity->getWeight()); + $this->assertSame($expected_weight, (int) $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } @@ -95,8 +97,10 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec * ID of the term to check. * @param array $parent_ids * The expected parent term IDs. + * + * @internal */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { + protected function assertHierarchy(string $vid, int $tid, array $parent_ids): void { if (!isset($this->treeData[$vid])) { $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); $this->treeData[$vid] = []; @@ -119,13 +123,13 @@ protected function assertHierarchy($vid, $tid, array $parent_ids) { * Tests the Drupal 6 i18n taxonomy term to Drupal 8 migration. */ public function testTranslatedTaxonomyTerms() { - $this->assertEntity(1, 'zu', 'zu - term 1 of vocabulary 1', 'vocabulary_1_i_0_', 'zu - description of term 1 of vocabulary 1', NULL, '0', []); - $this->assertEntity(2, 'fr', 'fr - term 2 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 2 of vocabulary 2', NULL, '3', []); - $this->assertEntity(3, 'fr', 'fr - term 3 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 3 of vocabulary 2', NULL, '4', ['2']); - $this->assertEntity(4, 'en', 'term 4 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 4 of vocabulary 3', NULL, '6', []); - $this->assertEntity(5, 'en', 'term 5 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 5 of vocabulary 3', NULL, '7', ['4']); - $this->assertEntity(6, 'en', 'term 6 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 6 of vocabulary 3', NULL, '8', ['4', '5']); - $this->assertEntity(7, 'fr', 'fr - term 2 of vocabulary 1', 'vocabulary_1_i_0_', 'fr - desc of term 2 vocab 1', NULL, '0', []); + $this->assertEntity(1, 'zu', 'zu - term 1 of vocabulary 1', 'vocabulary_1_i_0_', 'zu - description of term 1 of vocabulary 1', NULL, 0, []); + $this->assertEntity(2, 'fr', 'fr - term 2 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 2 of vocabulary 2', NULL, 3, []); + $this->assertEntity(3, 'fr', 'fr - term 3 of vocabulary 2', 'vocabulary_2_i_1_', 'fr - description of term 3 of vocabulary 2', NULL, 4, ['2']); + $this->assertEntity(4, 'en', 'term 4 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 4 of vocabulary 3', NULL, 6, []); + $this->assertEntity(5, 'en', 'term 5 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 5 of vocabulary 3', NULL, 7, ['4']); + $this->assertEntity(6, 'en', 'term 6 of vocabulary 3', 'vocabulary_3_i_2_', 'description of term 6 of vocabulary 3', NULL, 8, ['4', '5']); + $this->assertEntity(7, 'fr', 'fr - term 2 of vocabulary 1', 'vocabulary_1_i_0_', 'fr - desc of term 2 vocab 1', NULL, 0, []); } } diff --git a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php index 34e3e61b2f800869a58b709445084d260d39deb9..6e4755b623212fc71a02d7b2d8c271d5596fa396 100644 --- a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php +++ b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php @@ -222,8 +222,10 @@ public function testTokenProtection() { * * @param string $id * A contextual link id. + * + * @internal */ - protected function assertContextualLinkPlaceHolder($id) { + protected function assertContextualLinkPlaceHolder(string $id): void { $this->assertSession()->elementAttributeContains( 'css', 'div[data-contextual-id="' . $id . '"]', @@ -237,8 +239,10 @@ protected function assertContextualLinkPlaceHolder($id) { * * @param string $id * A contextual link id. + * + * @internal */ - protected function assertNoContextualLinkPlaceHolder($id) { + protected function assertNoContextualLinkPlaceHolder(string $id): void { $this->assertSession()->elementNotExists('css', 'div[data-contextual-id="' . $id . '"]'); } diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php index 219b30dc76b9c6532421e86a071f48d66c9f25eb..6cb1b68c3842cfcea1c13b003b518ac8fdcbd05c 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -100,8 +100,10 @@ protected function pressToolbarEditButton() { /** * Asserts that the correct message was announced when entering edit mode. + * + * @internal */ - protected function assertAnnounceEditMode() { + protected function assertAnnounceEditMode(): void { $web_assert = $this->assertSession(); // Wait for contextual trigger button. $web_assert->waitForElementVisible('css', '.contextual trigger'); @@ -111,8 +113,10 @@ protected function assertAnnounceEditMode() { /** * Assert that the correct message was announced when leaving edit mode. + * + * @internal */ - protected function assertAnnounceLeaveEditMode() { + protected function assertAnnounceLeaveEditMode(): void { $web_assert = $this->assertSession(); $page = $this->getSession()->getPage(); // Wait till all the contextual links are hidden. diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php index 9439f8cf4a23188577b9700861093c60f4bef40f..04e38fd0163e29805ea78ccb784374e787e58f24 100644 --- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php +++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php @@ -117,7 +117,7 @@ protected function getNormalizedPostEntity() { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) { + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void { parent::assertNormalizationEdgeCases($method, $url, $request_options); if ($this->entity->getEntityType()->hasKey('bundle')) { diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php index f9313f112265d0a46a17d9e47fc6ff0556040fb3..2030900cf42137cf6956e16ecd9fbab14aa34a01 100644 --- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php +++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php @@ -117,7 +117,7 @@ protected function getNormalizedPostEntity() { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) { + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void { parent::assertNormalizationEdgeCases($method, $url, $request_options); if ($this->entity->getEntityType()->hasKey('bundle')) { diff --git a/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php b/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php index 15bc8174459389461776d6c11d6a8780aea943ca..636221f95117a9703b94d89dafe44d09a1f86ddb 100644 --- a/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php +++ b/core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php @@ -118,7 +118,7 @@ protected function getNormalizedPostEntity() { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) { + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void { parent::assertNormalizationEdgeCases($method, $url, $request_options); if ($this->entity->getEntityType()->hasKey('bundle')) { diff --git a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php index 12cd954f96a330a0467020f818b9f1bc7f449bd3..4294949ef995dabc0490ac401d2e45e51d4e2d83 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php @@ -118,7 +118,7 @@ protected function setUpAuthorization($method) { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) {} + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void {} /** * {@inheritdoc} diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index 4b7ef3c2266fa8dc705daefa80e1061a05419186..f83931cf4de1fbe4241b3dad073b1d3d310a7378 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -819,8 +819,10 @@ protected function getSeverityConstant($class) { * The database log message to check. * @param string $message * The message to pass to simpletest. + * + * @internal */ - protected function assertLogMessage($log_message, $message) { + protected function assertLogMessage(string $log_message, string $message): void { $message_text = Unicode::truncate($log_message, 56, TRUE, TRUE); $this->assertSession()->linkExists($message_text, 0, $message); } diff --git a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php index 4196769ac85604728f1a553fd45e40fe9ede9d88..e983ea88fd48e44259217b75c34c1b56272b303a 100644 --- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -214,12 +214,14 @@ protected function uploadImage($uri) { /** * Asserts whether the saved maximum dimensions equal the ones provided. * - * @param string $width + * @param int|null $width * The expected width of the uploaded image. - * @param string $height + * @param int|null $height * The expected height of the uploaded image. + * + * @internal */ - protected function assertSavedMaxDimensions($width, $height) { + protected function assertSavedMaxDimensions(?int $width, ?int $height): void { $image_upload_settings = Editor::load('basic_html')->getImageUploadSettings(); $expected = [ 'width' => $image_upload_settings['max_dimensions']['width'], diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php index a9b551084e8a2f9fa077a85700085f9cdf585845..22c1d958a50bef8d51da7935c5085c3ac51a0ad5 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php @@ -398,8 +398,10 @@ protected function createEntityReferenceField($target_type, $bundles = []) { * The field name. * @param array $expected_options * An array of expected options. + * + * @internal */ - protected function assertFieldSelectOptions($name, array $expected_options) { + protected function assertFieldSelectOptions(string $name, array $expected_options): void { $options = $this->assertSession()->selectExists($name)->findAll('xpath', 'option'); array_walk($options, function (NodeElement &$option) { $option = $option->getValue(); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php index 58b51dc7e0b7c76542f96acd28fcda049609784a..e69abc86d91c42a114701d7abc6e9fd47da84e7c 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -175,8 +175,10 @@ public function testEntityReferenceDisplay() { /** * Assert entity reference display. + * + * @internal */ - protected function assertEntityReferenceDisplay() { + protected function assertEntityReferenceDisplay(): void { $url = $this->referrerEntity->toUrl(); $translation_url = $this->referrerEntity->toUrl('canonical', ['language' => ConfigurableLanguage::load($this->translateToLangcode)]); @@ -192,8 +194,10 @@ protected function assertEntityReferenceDisplay() { /** * Assert entity reference form display. + * + * @internal */ - protected function assertEntityReferenceFormDisplay() { + protected function assertEntityReferenceFormDisplay(): void { $this->drupalLogin($this->webUser); $url = $this->referrerEntity->toUrl('edit-form'); $translation_url = $this->referrerEntity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($this->translateToLangcode)]); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php index dd6f8d5900f9a326c6d57d51a779939ce12da59c..bf0ebc2b6d6d4541d4aea143973ce5adc8f58f64 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php @@ -196,8 +196,10 @@ public function testSupportedEntityTypesAndWidgets() { * The name of the test entity. * @param \Drupal\Core\Entity\EntityInterface[] $referenced_entities * An array of referenced entities. + * + * @internal */ - protected function assertFieldValues($entity_name, $referenced_entities) { + protected function assertFieldValues(string $entity_name, array $referenced_entities): void { $entity = current($this->container->get('entity_type.manager')->getStorage( $this->entityType)->loadByProperties(['name' => $entity_name])); diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index 595aba8e22c801a39d23f39b6c14a5438327a3bf..98253c179f9584340a5b7d5589d0cc3cfd99b19f 100644 --- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -4,6 +4,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\field\FieldConfigInterface; use Drupal\Tests\BrowserTestBase; /** @@ -426,8 +427,10 @@ public function testCreateNumberDecimalField() { /** * Helper function to set the minimum value of a field. + * + * @internal */ - public function assertSetMinimumValue($field, $minimum_value) { + public function assertSetMinimumValue(FieldConfigInterface $field, int $minimum_value): void { $field_configuration_url = 'entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field->getName(); // Set the minimum value. diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php index 3273c7a153218cd4317c9caa6835505f983fe237..f19f4ed37c41a0ff917d203a614d01d36c6e91fe 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php @@ -352,8 +352,10 @@ public function testFieldAdminHandler() { * The field name. * @param array $expected_options * An array of expected options. + * + * @internal */ - protected function assertFieldSelectOptions($name, array $expected_options) { + protected function assertFieldSelectOptions(string $name, array $expected_options): void { $field = $this->assertSession()->selectExists($name); $options = $field->findAll('xpath', 'option'); $optgroups = $field->findAll('xpath', 'optgroup'); diff --git a/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php b/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php index 58c1594ef65f6edc43be2e4f6b0ccdcc12a557e6..2e0b3a1023403b6f80f3fd367dfdcb5af1fcffd8 100644 --- a/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php +++ b/core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php @@ -150,8 +150,10 @@ public function testAnchorTagStripping() { * * @param array $result * Query results keyed by node type and nid. + * + * @internal */ - protected function assertResults(array $result) { + protected function assertResults(array $result): void { foreach ($result as $node_type => $values) { foreach ($values as $nid => $label) { $this->assertSame($node_type, $this->nodes[$nid]->bundle()); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php index b78961183c8080e17af74a70d686423beac5cf7b..83fac6e47f2333ba7f1f92aa84fd6476ae0a5664 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php @@ -34,8 +34,10 @@ protected function setUp(): void { * The display ID. * @param string $component_id * The component ID. + * + * @internal */ - protected function assertComponentNotExists($display_id, $component_id) { + protected function assertComponentNotExists(string $display_id, string $component_id): void { $component = EntityViewDisplay::load($display_id)->getComponent($component_id); $this->assertNull($component); } diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php index 162039c390df57eca500ecbdb9effad4ba764625..3df1b43de0b9273b3a80ba3af31f31ae1c4057e5 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php @@ -43,8 +43,10 @@ protected function setUp(): void { * * @param string $id * The view display ID. + * + * @internal */ - protected function assertEntity($id) { + protected function assertEntity(string $id): void { $display = EntityViewDisplay::load($id); $this->assertInstanceOf(EntityViewDisplayInterface::class, $display); } @@ -62,8 +64,10 @@ protected function assertEntity($id) { * The expected label of the component. * @param int $weight * The expected weight of the component. + * + * @internal */ - protected function assertComponent($display_id, $component_id, $type, $label, $weight) { + protected function assertComponent(string $display_id, string $component_id, string $type, string $label, int $weight): void { $component = EntityViewDisplay::load($display_id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame($type, $component['type']); @@ -78,8 +82,10 @@ protected function assertComponent($display_id, $component_id, $type, $label, $w * The display ID. * @param string $component_id * The component ID. + * + * @internal */ - protected function assertComponentNotExists($display_id, $component_id) { + protected function assertComponentNotExists(string $display_id, string $component_id): void { $component = EntityViewDisplay::load($display_id)->getComponent($component_id); $this->assertNull($component); } 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 31264bcde6bf05e963cf561607272daf26261152..8679f83f6dccb16f7724c8012604feffd0ec12b1 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php @@ -50,8 +50,10 @@ protected function setUp(): void { * Whether or not the field is required. * @param bool $expected_translatable * Whether or not the field is expected to be translatable. + * + * @internal */ - protected function assertEntity($id, $expected_label, $expected_field_type, $is_required, $expected_translatable) { + protected function assertEntity(string $id, string $expected_label, string $expected_field_type, bool $is_required, bool $expected_translatable): void { [$expected_entity_type, $expected_bundle, $expected_name] = explode('.', $id); /** @var \Drupal\field\FieldConfigInterface $field */ @@ -70,12 +72,14 @@ protected function assertEntity($id, $expected_label, $expected_field_type, $is_ /** * Asserts the settings of a link field config entity. * - * @param $id + * @param string $id * The entity ID in the form ENTITY_TYPE.BUNDLE.FIELD_NAME. - * @param $title_setting + * @param int $title_setting * The expected title setting. + * + * @internal */ - protected function assertLinkFields($id, $title_setting) { + protected function assertLinkFields(string $id, int $title_setting): void { $field = FieldConfig::load($id); $this->assertSame($title_setting, $field->getSetting('title')); } @@ -87,8 +91,10 @@ protected function assertLinkFields($id, $title_setting) { * The entity ID in the form ENTITY_TYPE.BUNDLE.FIELD_NAME. * @param string[] $target_bundles * An array of expected target bundles. + * + * @internal */ - protected function assertEntityReferenceFields($id, array $target_bundles) { + protected function assertEntityReferenceFields(string $id, array $target_bundles): void { $field = FieldConfig::load($id); $handler_settings = $field->getSetting('handler_settings'); $this->assertArrayHasKey('target_bundles', $handler_settings); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php index f04f1e5c02973fc3fbcafae488b894728aacdbb0..bf02267731340bad8c592d0924a2240a2f3c3fd7 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php @@ -49,8 +49,10 @@ protected function setUp(): void { * The expected entity type to which the display settings are attached. * @param string $expected_bundle * The expected bundle to which the display settings are attached. + * + * @internal */ - protected function assertEntity($id, $expected_entity_type, $expected_bundle) { + protected function assertEntity(string $id, string $expected_entity_type, string $expected_bundle): void { /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $entity */ $entity = EntityFormDisplay::load($id); $this->assertInstanceOf(EntityFormDisplayInterface::class, $entity); @@ -67,10 +69,12 @@ protected function assertEntity($id, $expected_entity_type, $expected_bundle) { * The component ID. * @param string $widget_type * The expected widget type. - * @param string $weight + * @param int $weight * The expected weight of the component. + * + * @internal */ - protected function assertComponent($display_id, $component_id, $widget_type, $weight) { + protected function assertComponent(string $display_id, string $component_id, string $widget_type, int $weight): void { $component = EntityFormDisplay::load($display_id)->getComponent($component_id); $this->assertIsArray($component); $this->assertSame($widget_type, $component['type']); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php index a08996a480ea5893c5ce0ce90ac52bf57f0915df..cdc96c455bc02d063704262d7a7a71f7072cf990 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php @@ -42,8 +42,10 @@ class MigrateFieldTest extends MigrateDrupal7TestBase { * Whether or not the field is expected to be translatable. * @param int $expected_cardinality * The expected cardinality of the field. + * + * @internal */ - protected function assertEntity($id, $expected_type, $expected_translatable, $expected_cardinality) { + protected function assertEntity(string $id, string $expected_type, bool $expected_translatable, int $expected_cardinality): void { [$expected_entity_type, $expected_name] = explode('.', $id); /** @var \Drupal\field\FieldStorageConfigInterface $field */ diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php index 4bdd5f5897c1159dd8dca8c0c1ec15d995653a09..1e7229481574287d15c35bceb221b86d7143a762 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php @@ -34,8 +34,10 @@ protected function setUp(): void { * The expected label of the view mode. * @param string $entity_type * The expected entity type ID which owns the view mode. + * + * @internal */ - protected function assertEntity($id, $label, $entity_type) { + protected function assertEntity(string $id, string $label, string $entity_type): void { /** @var \Drupal\Core\Entity\EntityViewModeInterface $view_mode */ $view_mode = EntityViewMode::load($id); $this->assertInstanceOf(EntityViewModeInterface::class, $view_mode); diff --git a/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php b/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php index f613d08cd18bb3bef7166c61c7341e708dd8cf2b..fc94687a725d6151d960dab866994fe44967bc43 100644 --- a/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php +++ b/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php @@ -164,8 +164,10 @@ protected function setUp(): void { * A list of allowed operations. * @param \Drupal\Core\Session\AccountInterface $user * The account to use for get access. + * + * @internal */ - public function assertAllowOperations(array $allow_operations, AccountInterface $user) { + public function assertAllowOperations(array $allow_operations, AccountInterface $user): void { foreach (['view', 'update', 'delete'] as $operation) { $expected = in_array($operation, $allow_operations); $actual = $this->accessControlHandler->access($this->entity, $operation, $user); diff --git a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php index 7ad41defd3c1a8e3d7576388383e9b2ffaf784e8..467114bc725420bbaaa975622374d9bf9b3644dc 100644 --- a/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php +++ b/core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php @@ -306,8 +306,10 @@ protected function getRegionTitles() { * The field selector, one of field id|name|label|value. * @param string $region_name * The machine name of the region. + * + * @internal */ - protected function assertFieldInRegion($field_selector, $region_name) { + protected function assertFieldInRegion(string $field_selector, string $region_name): void { $region_element = $this->getSession()->getPage()->find('css', ".layout__region--$region_name"); $this->assertNotNull($region_element); $this->assertSession()->fieldExists($field_selector, $region_element); diff --git a/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php b/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php index 0042c7b0585a9f72751a3365592ef267f8690376..3232d45ce8298147fb31e83170f62af2272145c0 100644 --- a/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php +++ b/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php @@ -175,14 +175,16 @@ public function testPreSave() { /** * Asserts than an entity has the correct values. * - * @param mixed $expected + * @param array $expected * The expected values. * @param array $values * The actual values. * @param string $message * (optional) An error message. + * + * @internal */ - public static function assertEntityValues($expected, array $values, $message = '') { + public static function assertEntityValues(array $expected, array $values, string $message = ''): void { static::assertArrayHasKey('uuid', $values); unset($values['uuid']); diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php index 5c073ae739006e857c3c35f61288a4c2442f5781..ea72a387a13b90b765e86e0be340e5b407d6ae87 100644 --- a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php +++ b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php @@ -108,8 +108,10 @@ public function testFieldUIRoutes() { /** * Asserts that local tasks exists. + * + * @internal */ - public function assertLocalTasks() { + public function assertLocalTasks(): void { $this->assertSession()->linkExists('Settings'); $this->assertSession()->linkExists('Manage fields'); $this->assertSession()->linkExists('Manage display'); diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index d0cbe7fba8625ac445ff3c441ebe3a93839b2f1f..864733e8b399220a9285f2e8b340a146db29b25d 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -220,18 +220,17 @@ public function testNoFieldsDisplayOverview() { * * @param \Drupal\Core\Entity\EntityInterface $node * The node. - * @param $view_mode + * @param string $view_mode * The view mode in which the node should be displayed. - * @param $text + * @param string $text * Plain text to look for. - * @param $message + * @param string $message * Message to display. * - * @return - * TRUE on pass, FALSE on fail. + * @internal */ - public function assertNodeViewText(EntityInterface $node, $view_mode, $text, $message) { - return $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, FALSE); + public function assertNodeViewText(EntityInterface $node, string $view_mode, string $text, string $message): void { + $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, FALSE); } /** @@ -239,18 +238,17 @@ public function assertNodeViewText(EntityInterface $node, $view_mode, $text, $me * * @param \Drupal\Core\Entity\EntityInterface $node * The node. - * @param $view_mode + * @param string $view_mode * The view mode in which the node should be displayed. - * @param $text + * @param string $text * Plain text to look for. - * @param $message + * @param string $message * Message to display. * - * @return - * TRUE on pass, FALSE on fail. + * @internal */ - public function assertNodeViewNoText(EntityInterface $node, $view_mode, $text, $message) { - return $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, TRUE); + public function assertNodeViewNoText(EntityInterface $node, string $view_mode, string $text, string $message): void { + $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, TRUE); } /** @@ -261,16 +259,18 @@ public function assertNodeViewNoText(EntityInterface $node, $view_mode, $text, $ * * @param \Drupal\Core\Entity\EntityInterface $node * The node. - * @param $view_mode + * @param string $view_mode * The view mode in which the node should be displayed. - * @param $text + * @param string $text * Plain text to look for. - * @param $message + * @param string $message * Message to display. - * @param $not_exists + * @param bool $not_exists * TRUE if this text should not exist, FALSE if it should. + * + * @internal */ - public function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $text, $message, $not_exists) { + public function assertNodeViewTextHelper(EntityInterface $node, string $view_mode, string $text, string $message, bool $not_exists): void { // Make sure caches on the tester side are refreshed after changes // submitted on the tested side. \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); @@ -297,8 +297,10 @@ public function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $tex * The field name. * @param array $expected_options * An array of expected options. + * + * @internal */ - protected function assertFieldSelectOptions($name, array $expected_options) { + protected function assertFieldSelectOptions(string $name, array $expected_options): void { $xpath = $this->assertSession()->buildXPathQuery('//select[@name=:name]', [':name' => $name]); $fields = $this->xpath($xpath); if ($fields) { diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index 1d54d284713527f56f9ea97731159e60a84284d7..1cc2b5adb84817d725180a36dcfe42cade9cb4c4 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -439,16 +439,18 @@ protected function addPersistentFieldStorage() { /** * Asserts field settings are as expected. * - * @param $bundle + * @param string $bundle * The bundle name for the field. - * @param $field_name + * @param string $field_name * The field name for the field. - * @param $string + * @param string $string * The settings text. - * @param $entity_type + * @param string $entity_type * The entity type for the field. + * + * @internal */ - public function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') { + public function assertFieldSettings(string $bundle, string $field_name, string $string = 'dummy test string', string $entity_type = 'node'): void { // Assert field storage settings. $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name); $this->assertSame($string, $field_storage->getSetting('test_field_storage_setting'), 'Field storage settings were found.'); diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php index c0ee1aff261eaad1cd86d07604f5a2afde055f9f..97489fb8fcbfc9a2f71094c693be0378b9693282 100644 --- a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\field_ui\FunctionalJavascript; +use Behat\Mink\Element\NodeElement; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; @@ -387,10 +388,12 @@ public function testWidgetUI() { * The select field to validate. * @param array $expected_options * An array of expected options. - * @param null $selected + * @param string|null $selected * The default value to validate. + * + * @internal */ - protected function assertFieldSelectOptions($field, array $expected_options, $selected = NULL) { + protected function assertFieldSelectOptions(NodeElement $field, array $expected_options, ?string $selected = NULL): void { /** @var \Behat\Mink\Element\NodeElement[] $select_options */ $select_options = $field->findAll('xpath', 'option'); diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php index 84ad60cd3c0b5feccf43b3735d6950520ea012e9..358c1f04e15bb9a2ae1a9f70d19c3fcff99717d0 100644 --- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php @@ -649,11 +649,10 @@ public function testComponentDependencies() { * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The entity display object to get dependencies from. * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. + * @internal */ - protected function assertDependency($type, $key, EntityDisplayInterface $display) { - return $this->assertDependencyHelper(TRUE, $type, $key, $display); + protected function assertDependency(string $type, string $key, EntityDisplayInterface $display): void { + $this->assertDependencyHelper(TRUE, $type, $key, $display); } /** @@ -666,11 +665,10 @@ protected function assertDependency($type, $key, EntityDisplayInterface $display * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The entity display object to get dependencies from. * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. + * @internal */ - protected function assertNoDependency($type, $key, EntityDisplayInterface $display) { - return $this->assertDependencyHelper(FALSE, $type, $key, $display); + protected function assertNoDependency(string $type, string $key, EntityDisplayInterface $display): void { + $this->assertDependencyHelper(FALSE, $type, $key, $display); } /** @@ -685,10 +683,9 @@ protected function assertNoDependency($type, $key, EntityDisplayInterface $displ * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The entity display object to get dependencies from. * - * @return bool - * TRUE if the assertion succeeded. + * @internal */ - protected function assertDependencyHelper($assertion, $type, $key, EntityDisplayInterface $display) { + protected function assertDependencyHelper(bool $assertion, string $type, string $key, EntityDisplayInterface $display): void { $all_dependencies = $display->getDependencies(); $dependencies = !empty($all_dependencies[$type]) ? $all_dependencies[$type] : []; $context = $display instanceof EntityViewDisplayInterface ? 'View' : 'Form'; @@ -696,7 +693,6 @@ protected function assertDependencyHelper($assertion, $type, $key, EntityDisplay $args = ['@context' => $context, '@id' => $display->id(), '@type' => $type, '@key' => $key]; $message = $assertion ? new FormattableMarkup("@context display '@id' depends on @type '@key'.", $args) : new FormattableMarkup("@context display '@id' do not depend on @type '@key'.", $args); $this->assertTrue($value, $message); - return TRUE; } } diff --git a/core/modules/file/tests/src/Functional/FileFieldPathTest.php b/core/modules/file/tests/src/Functional/FileFieldPathTest.php index f89e9982b8bd05f1a223e45a50eb2f82498c9aaf..4a139ab7da5164561a256fa0e199d77b2f5b37d1 100644 --- a/core/modules/file/tests/src/Functional/FileFieldPathTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldPathTest.php @@ -85,8 +85,10 @@ public function testUploadPath() { * Where the file was actually uploaded. * @param string $message * The message to display with this assertion. + * + * @internal */ - public function assertPathMatch($expected_path, $actual_path, $message) { + public function assertPathMatch(string $expected_path, string $actual_path, string $message): void { // Strip off the extension of the expected path to allow for _0, _1, etc. // suffixes when the file hits a duplicate name. $pos = strrpos($expected_path, '.'); diff --git a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php index 29f4914fa7660f6d79e071460537c38772245286..9141f031a7062651051a6035c952caf20725d9b1 100644 --- a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php +++ b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php @@ -49,26 +49,28 @@ protected function setUp(): void { * The expected MIME type. * @param int $uid * The expected file owner ID. + * + * @internal */ - protected function assertEntity($fid, $name, $size, $uri, $type, $uid) { + protected function assertEntity(int $fid, string $name, int $size, string $uri, string $type, int $uid): void { /** @var \Drupal\file\FileInterface $file */ $file = File::load($fid); $this->assertInstanceOf(FileInterface::class, $file); $this->assertSame($name, $file->getFilename()); - $this->assertSame($size, $file->getSize()); + $this->assertSame($size, (int) $file->getSize()); $this->assertSame($uri, $file->getFileUri()); $this->assertSame($type, $file->getMimeType()); - $this->assertSame($uid, $file->getOwnerId()); + $this->assertSame($uid, (int) $file->getOwnerId()); } /** * Tests the Drupal 6 files to Drupal 8 migration. */ public function testFiles() { - $this->assertEntity(1, 'Image1.png', '39325', 'public://image-1.png', 'image/png', '1'); - $this->assertEntity(2, 'Image2.jpg', '1831', 'public://image-2.jpg', 'image/jpeg', '1'); - $this->assertEntity(3, 'image-3.jpg', '1831', 'public://image-3.jpg', 'image/jpeg', '1'); - $this->assertEntity(4, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1'); + $this->assertEntity(1, 'Image1.png', 39325, 'public://image-1.png', 'image/png', 1); + $this->assertEntity(2, 'Image2.jpg', 1831, 'public://image-2.jpg', 'image/jpeg', 1); + $this->assertEntity(3, 'image-3.jpg', 1831, 'public://image-3.jpg', 'image/jpeg', 1); + $this->assertEntity(4, 'html-1.txt', 24, 'public://html-1.txt', 'text/plain', 1); // Ensure temporary file was not migrated. $this->assertNull(File::load(6)); diff --git a/core/modules/filter/tests/src/Functional/FilterFormTest.php b/core/modules/filter/tests/src/Functional/FilterFormTest.php index e7f9247e068059ee20dcb9788d1f34c8dbc6c868..bfe9f2bb631dd20bd5feee343c8ceed55b9df90f 100644 --- a/core/modules/filter/tests/src/Functional/FilterFormTest.php +++ b/core/modules/filter/tests/src/Functional/FilterFormTest.php @@ -175,8 +175,10 @@ protected function doFilterFormTestAsNonAdmin() { * * @param string $id * The HTML ID of the select element. + * + * @internal */ - protected function assertNoSelect($id) { + protected function assertNoSelect(string $id): void { $this->assertSession()->elementNotExists('xpath', "//select[@id=$id]"); } @@ -190,10 +192,9 @@ protected function assertNoSelect($id) { * @param string $selected * The value of the selected option. * - * @return bool - * TRUE if the assertion passed; FALSE otherwise. + * @internal */ - protected function assertOptions($id, array $expected_options, $selected) { + protected function assertOptions(string $id, array $expected_options, string $selected): void { $select = $this->assertSession()->selectExists($id); $found_options = $select->findAll('css', 'option'); $found_options = array_map(function ($item) { @@ -212,10 +213,9 @@ protected function assertOptions($id, array $expected_options, $selected) { * An array of option values that are contained in the select element * besides the "- Select -" option. * - * @return bool - * TRUE if the assertion passed; FALSE otherwise. + * @internal */ - protected function assertRequiredSelectAndOptions($id, array $options) { + protected function assertRequiredSelectAndOptions(string $id, array $options): void { $select = $this->assertSession()->selectExists($id); $this->assertSame('required', $select->getAttribute('required')); // A required select element has a "- Select -" option whose key is an empty @@ -230,10 +230,9 @@ protected function assertRequiredSelectAndOptions($id, array $options) { * @param string $id * The HTML ID of the textarea. * - * @return bool - * TRUE if the assertion passed; FALSE otherwise. + * @internal */ - protected function assertEnabledTextarea($id) { + protected function assertEnabledTextarea(string $id): void { $textarea = $this->assertSession()->fieldEnabled($id); $this->assertSame('textarea', $textarea->getTagName()); } @@ -244,10 +243,9 @@ protected function assertEnabledTextarea($id) { * @param string $id * The HTML ID of the textarea. * - * @return bool - * TRUE if the assertion passed; FALSE otherwise. + * @internal */ - protected function assertDisabledTextarea($id) { + protected function assertDisabledTextarea(string $id): void { $textarea = $this->assertSession()->fieldDisabled($id); $this->assertSame('textarea', $textarea->getTagName()); $this->assertSame('This field has been disabled because you do not have sufficient permissions to edit it.', $textarea->getText()); diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php index 76255f6f7ebd32c717321d3dd31c76a42e63e9d1..34a2ed13f406bb86316bc6773822af1156684046 100644 --- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php +++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php @@ -430,10 +430,12 @@ public function testFilterFormatPreSave() { * * @param \Symfony\Component\Validator\ConstraintViolationListInterface $violations * The violations to assert. - * @param mixed $invalid_value + * @param string $invalid_value * The expected invalid value. + * + * @internal */ - public function assertFilterFormatViolation(ConstraintViolationListInterface $violations, $invalid_value) { + public function assertFilterFormatViolation(ConstraintViolationListInterface $violations, string $invalid_value): void { $filter_format_violation_found = FALSE; foreach ($violations as $violation) { if ($violation->getRoot() instanceof FilterFormatDataType && $violation->getInvalidValue() === $invalid_value) { diff --git a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php index f51f86a6710d7eb9530ae0edbc57c46666719bea..c7f9b5fadfb8b340c2d59020a1af510f7602f78a 100644 --- a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php @@ -9,6 +9,7 @@ use Drupal\editor\EditorXssFilter\Standard; use Drupal\filter\Entity\FilterFormat; use Drupal\filter\FilterPluginCollection; +use Drupal\filter\Plugin\FilterInterface; use Drupal\KernelTests\KernelTestBase; /** @@ -860,7 +861,7 @@ public function testUrlFilter() { /** * Asserts multiple filter output expectations for multiple input strings. * - * @param FilterInterface $filter + * @param \Drupal\filter\Plugin\FilterInterface $filter * An input filter object. * @param array $tests * An associative array, whereas each key is an arbitrary input string and @@ -875,8 +876,10 @@ public function testUrlFilter() { * ), * ); * @endcode + * + * @internal */ - public function assertFilteredString($filter, $tests) { + public function assertFilteredString(FilterInterface $filter, array $tests): void { foreach ($tests as $source => $tasks) { $result = $filter->process($source, $filter)->getProcessedText(); foreach ($tasks as $value => $is_expected) { @@ -1141,8 +1144,10 @@ public function testHtmlCorrectorFilter() { * (optional) Message to display if failed. Defaults to an empty string. * @param string $group * (optional) The group this message belongs to. Defaults to 'Other'. + * + * @internal */ - public function assertNormalized($haystack, $needle, $message = '', $group = 'Other') { + public function assertNormalized(string $haystack, string $needle, string $message = '', string $group = 'Other'): void { $this->assertStringContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } @@ -1163,8 +1168,10 @@ public function assertNormalized($haystack, $needle, $message = '', $group = 'Ot * (optional) Message to display if failed. Defaults to an empty string. * @param string $group * (optional) The group this message belongs to. Defaults to 'Other'. + * + * @internal */ - public function assertNoNormalized($haystack, $needle, $message = '', $group = 'Other') { + public function assertNoNormalized(string $haystack, string $needle, string $message = '', string $group = 'Other'): void { $this->assertStringNotContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } diff --git a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php index c32885eae14bf27452029baf350fbe4328c8e1b6..72fd8dcd6213b55180991994393a98b80f59a346 100644 --- a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php +++ b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php @@ -67,8 +67,10 @@ public static function migrateDumpAlter(KernelTestBase $test) { * The weight of the filter. * @param bool $status * The status of the filter. + * + * @internal */ - protected function assertEntity($id, $label, array $enabled_filters, $weight, $status) { + protected function assertEntity(string $id, string $label, array $enabled_filters, int $weight, bool $status): void { /** @var \Drupal\filter\FilterFormatInterface $entity */ $entity = FilterFormat::load($id); $this->assertInstanceOf(FilterFormatInterface::class, $entity); diff --git a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php index 84e34b3af4fedf816b4bab0e0b213959b8173d1a..4aac99d5bd07ba2184d6c88ab2ace26981bc471c 100644 --- a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php @@ -290,8 +290,10 @@ public function testUninstallSearch() { * * @param int $count * The expected number of search results. + * + * @internal */ - protected function assertSearchResultsCount($count) { + protected function assertSearchResultsCount(int $count): void { $this->assertSession()->elementsCount('css', '.help_search-results > li', $count); } diff --git a/core/modules/image/tests/src/Kernel/ImageFormatterTest.php b/core/modules/image/tests/src/Kernel/ImageFormatterTest.php index da0e59845fe4faeec1800a54e2c160ae8f54704c..0def1eea416392db8f85a4f26c93e3889746f648 100644 --- a/core/modules/image/tests/src/Kernel/ImageFormatterTest.php +++ b/core/modules/image/tests/src/Kernel/ImageFormatterTest.php @@ -206,8 +206,10 @@ public function testImageFormatterUrlOptions() { * The renderable array. Must have a #cache[tags] element. * @param array $cache_tags * The expected cache tags. + * + * @internal */ - protected function assertCacheTags(array $renderable, array $cache_tags) { + protected function assertCacheTags(array $renderable, array $cache_tags): void { $diff = array_diff($cache_tags, $renderable['#cache']['tags']); $this->assertEmpty($diff); } diff --git a/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php b/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php index c4e3d5d46c4158ad4ea002eec86db9aa41841178..89009fd05886c70137ca005462922c0498766c53 100644 --- a/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php +++ b/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php @@ -4,6 +4,7 @@ use Drupal\Core\Database\Database; use Drupal\image\Entity\ImageStyle; +use Drupal\image\ImageEffectPluginCollection; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Exception\RequirementsException; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; @@ -141,27 +142,27 @@ public function testInvalidCropValues() { /** * Assert that a given image effect is migrated. * - * @param array $collection + * @param \Drupal\image\ImageEffectPluginCollection $collection * Collection of effects - * @param $id + * @param string $id * Id that should exist in the collection. - * @param $config + * @param array $config * Expected configuration for the collection. * - * @return bool + * @internal */ - protected function assertImageEffect($collection, $id, $config) { + protected function assertImageEffect(ImageEffectPluginCollection $collection, string $id, array $config): void { /** @var \Drupal\image\ConfigurableImageEffectBase $effect */ foreach ($collection as $effect) { $effect_config = $effect->getConfiguration(); if ($effect_config['id'] == $id && $effect_config['data'] == $config) { - // We found this effect so succeed and return. - return TRUE; + // We found this effect so the assertion is successful. + return; } } // The loop did not find the effect so we it was not imported correctly. - return $this->fail('Effect ' . $id . ' did not import correctly'); + $this->fail('Effect ' . $id . ' did not import correctly'); } } diff --git a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php index 11d2a88e14da8aabd039a0fc588ad8972fbe3342..df0f6c7d0433611503cecd5645894490e1dc6598 100644 --- a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php +++ b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php @@ -49,7 +49,7 @@ public function testImageStylesMigration() { * @param array $expected_effect_config * An array of expected configuration for each effect in the image style */ - protected function assertEntity($id, $label, array $expected_effect_plugins, array $expected_effect_config) { + protected function assertEntity(string $id, string $label, array $expected_effect_plugins, array $expected_effect_config): void { $style = ImageStyle::load($id); $this->assertInstanceOf(ImageStyleInterface::class, $style); /** @var \Drupal\image\ImageStyleInterface $style */ diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php index 5627ae8a4d1e72e6e8625e7c42a96dc6f8bae8d1..a44424b61c40b44c38bff2d679e84f35740c5a2d 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -910,8 +910,10 @@ protected function setUpAuthorization($method) { * The expected data. * @param \Psr\Http\Message\ResponseInterface $response * The file upload response. + * + * @internal */ - protected function assertResponseData(array $expected, ResponseInterface $response) { + protected function assertResponseData(array $expected, ResponseInterface $response): void { static::recursiveKSort($expected); $actual = Json::decode((string) $response->getBody()); static::recursiveKSort($actual); diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTest.php index 3f1418bf4c6205e83a7cca06518c7c25ad6f54e4..411e0738d6fdc3f54c1fc039d13316c04a466aa2 100644 --- a/core/modules/jsonapi/tests/src/Functional/NodeTest.php +++ b/core/modules/jsonapi/tests/src/Functional/NodeTest.php @@ -370,8 +370,10 @@ public function testGetIndividual() { * Asserts that normalizations are cached in an incremental way. * * @throws \Drupal\Core\Entity\EntityStorageException + * + * @internal */ - protected function assertCacheableNormalizations() { + protected function assertCacheableNormalizations(): void { // Save the entity to invalidate caches. $this->entity->save(); $uuid = $this->entity->uuid(); @@ -407,8 +409,10 @@ protected function assertCacheableNormalizations() { * * @param string[] $field_names * The field names. + * + * @internal */ - protected function assertNormalizedFieldsAreCached($field_names) { + protected function assertNormalizedFieldsAreCached(array $field_names): void { $cache = \Drupal::service('render_cache')->get([ '#cache' => [ 'keys' => ['node--camelids', $this->entity->uuid()], diff --git a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php index e0a79f3f5611108a3177803fb85b7070eb67945d..d58bc02b2f70b304397fd0d95021b16014b60e6e 100644 --- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php +++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php @@ -112,7 +112,7 @@ public function testApiJsonNotSupportedInRest() { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) {} + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void {} /** * {@inheritdoc} diff --git a/core/modules/jsonapi/tests/src/Functional/UserTest.php b/core/modules/jsonapi/tests/src/Functional/UserTest.php index 21a2d99d0b581317e6da9e7f40527f290f8a5dd5..365905b28e6e3444aea881210b52e10d100e27b8 100644 --- a/core/modules/jsonapi/tests/src/Functional/UserTest.php +++ b/core/modules/jsonapi/tests/src/Functional/UserTest.php @@ -315,8 +315,10 @@ public function testPatchDxForSecuritySensitiveBaseFields() { * The username to log in with. * @param string $password * The password to log in with. + * + * @internal */ - protected function assertRpcLogin($username, $password) { + protected function assertRpcLogin(string $username, string $password): void { $request_body = [ 'name' => $username, 'pass' => $password, diff --git a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentTaxonomyVocabularySettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentTaxonomyVocabularySettingsTest.php index b7df98402bb363172b5d47c67cba3c39f2ad8cc6..dc56e20b05436889fa93369d44e5c4ec007f96a5 100644 --- a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentTaxonomyVocabularySettingsTest.php +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentTaxonomyVocabularySettingsTest.php @@ -66,8 +66,10 @@ public function testLanguageContentTaxonomy() { * The expected state of language alterable. * @param array $third_party_settings * The content translation setting. + * + * @internal */ - public function assertLanguageContentSettings($target_entity, $bundle, $default_langcode, $language_alterable, array $third_party_settings) { + public function assertLanguageContentSettings(string $target_entity, string $bundle, string $default_langcode, bool $language_alterable, array $third_party_settings): void { $config = ContentLanguageSettings::load($target_entity . "." . $bundle); $this->assertInstanceOf(ContentLanguageSettings::class, $config); $this->assertSame($target_entity, $config->getTargetEntityTypeId()); diff --git a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php index 57e0728f5957b0f9e0909b551597c2ed7e00316f..957b1e986b13b8f2e3af54c300a89b74d59b0162 100644 --- a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php @@ -28,8 +28,10 @@ class MigrateLanguageTest extends MigrateDrupal6TestBase { * ConfigurableLanguageInterface). Defaults to LTR. * @param int $weight * (optional) The weight of the language. Defaults to 0. + * + * @internal */ - protected function assertLanguage($id, $label, $direction = ConfigurableLanguageInterface::DIRECTION_LTR, $weight = 0) { + protected function assertLanguage(string $id, string $label, string $direction = ConfigurableLanguageInterface::DIRECTION_LTR, int $weight = 0): void { /** @var \Drupal\language\ConfigurableLanguageInterface $language */ $language = ConfigurableLanguage::load($id); $this->assertInstanceOf(ConfigurableLanguageInterface::class, $language); diff --git a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentTaxonomyVocabularySettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentTaxonomyVocabularySettingsTest.php index 591cb5d9f0e0d3eb77e95bdeb750aabde00ee28c..2cacadd2394adf3e0ef9bad6211dcc347b0b9df0 100644 --- a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentTaxonomyVocabularySettingsTest.php +++ b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentTaxonomyVocabularySettingsTest.php @@ -67,8 +67,10 @@ public function testLanguageContentTaxonomy() { * The expected state of language alterable. * @param array $third_party_settings * The content translation setting. + * + * @internal */ - public function assertLanguageContentSettings($target_entity, $bundle, $default_langcode, $language_alterable, array $third_party_settings) { + public function assertLanguageContentSettings(string $target_entity, string $bundle, string $default_langcode, bool $language_alterable, array $third_party_settings): void { $config = ContentLanguageSettings::load($target_entity . '.' . $bundle); $this->assertInstanceOf(ContentLanguageSettings::class, $config); $this->assertSame($target_entity, $config->getTargetEntityTypeId()); diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php index 2f92dbee69f70ffec28e99117dc53d5b314c953f..dcf482eb8c3c20bfaeb5d9cb84af176e19a83bb9 100644 --- a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php @@ -279,7 +279,7 @@ public function providerTestAccessWithoutBundles() { * @param bool $expected_access * The expected access. */ - private function assertExpectedAccess($expected_access) { + private function assertExpectedAccess(bool $expected_access): void { $expected_status_code = $expected_access ? 200 : 403; $this->assertSession()->statusCodeEquals($expected_status_code); } diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php index 085942a9548963357dd1402d8f98a31dfb219fe1..d4314d7ecbb06890f2417bce229719a57697a3ef 100644 --- a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php @@ -1452,8 +1452,10 @@ public function testRemovingSectionWithoutLayoutLabel() { /** * Asserts that the correct layouts are available. + * + * @internal */ - protected function assertCorrectLayouts() { + protected function assertCorrectLayouts(): void { $assert_session = $this->assertSession(); // Ensure the layouts provided by layout_builder are available. $expected_layouts_hrefs = [ diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php index 75fd602839058e5df5e6848fa9a806f30834a513..c22938cb8b874f3d784c879b0ec8002ad9fd1eb8 100644 --- a/core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php +++ b/core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php @@ -293,8 +293,10 @@ public function testLayoutDeletingBundle() { * A string of cache tags to be found in the header. * @param string $expected_dynamic_cache * The expected dynamic cache header. Either 'HIT', 'MISS' or 'UNCACHEABLE'. + * + * @internal */ - protected function assertLayoutSection($expected_selector, $expected_content, $expected_cache_contexts = '', $expected_cache_tags = '', $expected_dynamic_cache = 'MISS') { + protected function assertLayoutSection($expected_selector, $expected_content, string $expected_cache_contexts = '', string $expected_cache_tags = '', string $expected_dynamic_cache = 'MISS'): void { $assert_session = $this->assertSession(); // Find the given selector. foreach ((array) $expected_selector as $selector) { diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php index d50e1fa400be413f62d723729ce1eff62e380c0a..d4402a796583363ff704f6182d372d4dc36dd70c 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php @@ -149,8 +149,10 @@ protected function filterVisibleElements(array $elements) { * * @param string $expected_message * The text expected to be present in #drupal-live-announce. + * + * @internal */ - protected function assertAnnounceContains($expected_message) { + protected function assertAnnounceContains(string $expected_message): void { $assert_session = $this->assertSession(); $this->assertNotEmpty($assert_session->waitForElement('css', "#drupal-live-announce:contains('$expected_message')")); } diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFormMessagesTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFormMessagesTest.php index 4fccd1c8427e7adffbb0e9c8a4239d79ebc84aab..c5e7c0cb4543af02e3c2dda79a19688418f9e7ad 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFormMessagesTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFormMessagesTest.php @@ -91,8 +91,10 @@ public function testValidationMessage() { /** * Asserts that the validation messages are shown correctly. + * + * @internal */ - protected function assertMessagesDisplayed() { + protected function assertMessagesDisplayed(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); $messages_locator = '#drupal-off-canvas .messages--error'; diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php index 01b76696c534b6092e80ebfe691d82da27ff72d6..0d472adc821960f961ad9cfe97fbb922ca975569 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php @@ -123,8 +123,10 @@ public function testContentPreviewToggle() { /** * Checks if contextual links are working properly. + * + * @internal */ - protected function assertContextualLinks() { + protected function assertContextualLinks(): void { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); @@ -141,8 +143,10 @@ protected function assertContextualLinks() { * * @param string[] $items * An ordered list of strings that should appear in the blocks. + * + * @internal */ - protected function assertOrderInPage(array $items) { + protected function assertOrderInPage(array $items): void { $session = $this->getSession(); $page = $session->getPage(); $blocks = $page->findAll('css', '[data-layout-content-preview-placeholder-label]'); diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php index fc73d5f23febc3f0c387b82cba289bf3a89ae5d8..9487233233746241759ddc0c0836d517b57329e2 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php @@ -123,8 +123,10 @@ protected function addBlock($block_name) { /** * Asserts the contextual links are correct in Layout Builder UI. + * + * @internal */ - protected function assertCorrectContextualLinksInUi() { + protected function assertCorrectContextualLinksInUi(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.block-views-blocktest-block-view-block-2')); @@ -139,8 +141,10 @@ protected function assertCorrectContextualLinksInUi() { /** * Asserts the contextual links are correct on the canonical entity route. + * + * @internal */ - protected function assertCorrectContextualLinksInNode() { + protected function assertCorrectContextualLinksInNode(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php index 90bd6a5e77881f7ec3dfbfd6cfb4965341e6d96b..5727e9b8a40373717508d31594b50f6430191ffa 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php @@ -97,7 +97,7 @@ public function testPrivateFiles() { $this->assertSaveLayout(); $this->drupalGet('node/1'); - $private_href1 = $this->assertFileAccessibleOnNode($file); + $private_href1 = $this->getFileHrefAccessibleOnNode($file); // Remove the inline block with the private file. $this->drupalGet('node/1/layout'); @@ -121,7 +121,7 @@ public function testPrivateFiles() { $this->assertSaveLayout(); $this->drupalGet('node/1'); - $private_href2 = $this->assertFileAccessibleOnNode($file2); + $private_href2 = $this->getFileHrefAccessibleOnNode($file2); $this->createNewNodeRevision(1); @@ -131,7 +131,7 @@ public function testPrivateFiles() { $this->assertSaveLayout(); $this->drupalGet('node/1'); - $private_href3 = $this->assertFileAccessibleOnNode($file3); + $private_href3 = $this->getFileHrefAccessibleOnNode($file3); // $file2 is on a previous revision of the block which is on a previous // revision of the node. The user does not have access to view the previous @@ -154,7 +154,7 @@ public function testPrivateFiles() { $this->assertSaveLayout(); $this->drupalGet('node/2'); - $private_href4 = $this->assertFileAccessibleOnNode($file4); + $private_href4 = $this->getFileHrefAccessibleOnNode($file4); $this->createNewNodeRevision(2); @@ -236,7 +236,7 @@ protected function createPrivateFile($file_name) { } /** - * Asserts a file is accessible on the page. + * Returns the href of a file, asserting it is accessible on the page. * * @param \Drupal\file\FileInterface $file * The file entity. @@ -244,17 +244,16 @@ protected function createPrivateFile($file_name) { * @return string * The file href. */ - protected function assertFileAccessibleOnNode(FileInterface $file) { - $assert_session = $this->assertSession(); + protected function getFileHrefAccessibleOnNode(FileInterface $file): string { $page = $this->getSession()->getPage(); - $assert_session->linkExists($file->label()); + $this->assertSession()->linkExists($file->label()); $private_href = $page->findLink($file->label())->getAttribute('href'); $page->clickLink($file->label()); - $assert_session->pageTextContains($this->getFileSecret($file)); + $this->assertSession()->pageTextContains($this->getFileSecret($file)); // Access file directly. $this->drupalGet($private_href); - $assert_session->pageTextContains($this->getFileSecret($file)); + $this->assertSession()->pageTextContains($this->getFileSecret($file)); return $private_href; } diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php index bbcd3cf5127ae37a881b2cc323b37987f14e19a0..773ad3a396a1276be81c654cb41b276e5b0c9fda 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php @@ -316,8 +316,10 @@ public function testInlineBlocksRevisioningIntegrity() { * The revision ID to assert. * @param array $content * The content items to assert on the page. + * + * @internal */ - protected function assertNodeRevisionContent($revision_id, array $content) { + protected function assertNodeRevisionContent(int $revision_id, array $content): void { $this->drupalGet("node/1/revisions/$revision_id/view"); foreach ($content as $content_item) { $this->assertSession()->pageTextContains($content_item); @@ -331,8 +333,10 @@ protected function assertNodeRevisionContent($revision_id, array $content) { * The block title. * @param int $expected_revision_count * The revision count. + * + * @internal */ - protected function assertBlockRevisionCountByTitle($block_title, $expected_revision_count) { + protected function assertBlockRevisionCountByTitle(string $block_title, int $expected_revision_count): void { $actual_revision_count = $this->blockStorage->getQuery() ->accessCheck(FALSE) ->condition('info', $block_title) diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php index 773715c932e363249d100ce88c88fab1d2cd56f3..083b9682a3dc5111279b88b5c6eb60157ca5f7b4 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php @@ -173,8 +173,10 @@ protected function addBlock($block_link_text, $rendered_locator) { * * @param \Behat\Mink\Element\NodeElement $element * Element being checked for. + * + * @internal */ - protected function assertElementUnclickable(NodeElement $element) { + protected function assertElementUnclickable(NodeElement $element): void { try { $element->click(); $tag_name = $element->getTagName(); @@ -188,8 +190,10 @@ protected function assertElementUnclickable(NodeElement $element) { /** * Asserts that forms, links, and iframes in preview are non-interactive. + * + * @internal */ - protected function assertLinksFormIframeNotInteractive() { + protected function assertLinksFormIframeNotInteractive(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); @@ -204,8 +208,10 @@ protected function assertLinksFormIframeNotInteractive() { /** * Confirms that Layout Builder contextual links remain active. + * + * @internal */ - protected function assertContextualLinksClickable() { + protected function assertContextualLinksClickable(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); $this->drupalGet($this->getUrl()); @@ -233,8 +239,10 @@ protected function assertContextualLinksClickable() { * This is confirmed by clicking a contextual link then moving the mouse * pointer. If mouseup is working properly, the draggable element will not * be moved by the pointer moving. + * + * @internal */ - protected function assertContextualLinkRetainsMouseup() { + protected function assertContextualLinkRetainsMouseup(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); $body_field_selector = '.block-field-blocknodebundle-with-section-fieldbody'; diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php index 1562216da5934eecac6d72d2b3bd8fae2ad9a777..35c8b8090c69d2c1b83510d2027d87d91af555c7 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php @@ -477,7 +477,7 @@ private function openAddBlockForm($block_title) { * @param string $expected_form_id * The expected form ID. */ - private function assertOffCanvasFormAfterWait($expected_form_id) { + private function assertOffCanvasFormAfterWait(string $expected_form_id): void { $this->assertSession()->assertWaitOnAjaxRequest(); $off_canvas = $this->assertSession()->waitForElementVisible('css', '#drupal-off-canvas'); $this->assertNotNull($off_canvas); @@ -503,7 +503,7 @@ private function markCurrentPage() { * * @todo Remove in https://www.drupal.org/project/drupal/issues/2909782. */ - private function assertPageNotReloaded() { + private function assertPageNotReloaded(): void { $this->assertSession()->pageTextContains($this->pageReloadMarker); } diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php index 6523bd636797428fd44fa8282c81905d4ac12c8f..77af692cc51a533c6e2e3fcde8e670f54d1bdafc 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php @@ -105,8 +105,10 @@ public function testUnsavedChangesMessage() { * * @param string $path * The path to a Layout Builder UI page. + * + * @internal */ - protected function assertModifiedLayout($path) { + protected function assertModifiedLayout(string $path): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); @@ -267,7 +269,7 @@ public function testNewExtraField() { * @param string $selector * The highlighted element must also match this selector. */ - private function assertHighlightedElement($selector) { + private function assertHighlightedElement(string $selector): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); @@ -281,7 +283,7 @@ private function assertHighlightedElement($selector) { /** * Waits for the dialog to close and confirms no highlights are present. */ - private function assertHighlightNotExists() { + private function assertHighlightNotExists(): void { $assert_session = $this->assertSession(); $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas'); diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php index 3b857b10e5badc91f15d34e8910262a03cb1cfae..f7b302e7355b8ddab19293c60b2ae1758b2b0f5c 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/MoveBlockFormTest.php @@ -142,8 +142,10 @@ public function testMoveBlock() { * * @param string[] $expected_block_labels * The expected block labels. + * + * @internal */ - protected function assertBlockTable(array $expected_block_labels) { + protected function assertBlockTable(array $expected_block_labels): void { $page = $this->getSession()->getPage(); $this->assertSession()->assertWaitOnAjaxRequest(); $block_tds = $page->findAll('css', '.layout-builder-components-table__block-label'); @@ -202,8 +204,10 @@ protected function findRowHandle($block_label) { * The region. * @param array $expected_block_selectors * The block selectors. + * + * @internal */ - protected function assertRegionBlocksOrder($section_delta, $region, array $expected_block_selectors) { + protected function assertRegionBlocksOrder(int $section_delta, string $region, array $expected_block_selectors): void { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php index 2fd7cd7a783950a7e9074fb4c45e694f0e9d1522..9ec01e7cb0d3a9be38257bbcef46b65d93303b68 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php @@ -112,8 +112,10 @@ public function testWidthChange() { * * @param string $width_class * The width class. + * + * @internal */ - protected function assertWidthClassApplied($width_class) { + protected function assertWidthClassApplied(string $width_class): void { $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', ".{$width_class}[data-layout-delta=\"0\"]")); } diff --git a/core/modules/layout_builder/tests/src/Unit/SectionTest.php b/core/modules/layout_builder/tests/src/Unit/SectionTest.php index 2e21947de9ddc977afe22a16cc5979783586858e..7e3c5b130280915e5300dcdef765cf3f782417c5 100644 --- a/core/modules/layout_builder/tests/src/Unit/SectionTest.php +++ b/core/modules/layout_builder/tests/src/Unit/SectionTest.php @@ -188,8 +188,10 @@ public function testInsertComponentInvalidDelta() { * The expected sections. * @param \Drupal\layout_builder\Section $section * The section storage to check. + * + * @internal */ - protected function assertComponents(array $expected, Section $section) { + protected function assertComponents(array $expected, Section $section): void { $result = $section->getComponents(); $this->assertEquals($expected, $result); $this->assertSame(array_keys($expected), array_keys($result)); diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 2e4044abfa934da65e1f00c9a442638b3d70fcc6..80b03928006a2c37a651a5d990de4c1ddab7c439 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -211,8 +211,10 @@ public function testURLValidation() { * The field name. * @param array $valid_entries * An array of valid URL entries. + * + * @internal */ - protected function assertValidEntries($field_name, array $valid_entries) { + protected function assertValidEntries(string $field_name, array $valid_entries): void { foreach ($valid_entries as $uri => $string) { $edit = [ "{$field_name}[0][uri]" => $uri, @@ -233,8 +235,10 @@ protected function assertValidEntries($field_name, array $valid_entries) { * The field name. * @param array $invalid_entries * An array of invalid URL entries. + * + * @internal */ - protected function assertInvalidEntries($field_name, array $invalid_entries) { + protected function assertInvalidEntries(string $field_name, array $invalid_entries): void { foreach ($invalid_entries as $invalid_value => $error_message) { $edit = [ "{$field_name}[0][uri]" => $invalid_value, diff --git a/core/modules/link/tests/src/Functional/LinkFieldUITest.php b/core/modules/link/tests/src/Functional/LinkFieldUITest.php index 7045a04fa3d70a77902c78f7c0dee6ae423ee1c9..177fa62a8ac17576464ef4f07fb288f486d071d6 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php @@ -218,8 +218,10 @@ public function runFieldUIItem($cardinality, $link_type, $title, $label, $field_ * The name of the field to check. * @param string $text * The text to check. + * + * @internal */ - protected function assertFieldContainsRawText($field_name, $text) { + protected function assertFieldContainsRawText(string $field_name, string $text): void { $this->assertTrue((bool) preg_match('/' . preg_quote($text, '/') . '/ui', $this->getFieldHtml($field_name))); } @@ -230,8 +232,10 @@ protected function assertFieldContainsRawText($field_name, $text) { * The name of the field to check. * @param string $text * The text to check. + * + * @internal */ - protected function assertNoFieldContainsRawText($field_name, $text) { + protected function assertNoFieldContainsRawText(string $field_name, string $text): void { $this->assertFalse((bool) preg_match('/' . preg_quote($text, '/') . '/ui', $this->getFieldHtml($field_name))); } diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php index b9f6f3bababb0ebeb0efde98c148511115cb250f..886710312b58319ff7604f5bdd046c13ff0fe20b 100644 --- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php @@ -247,8 +247,10 @@ public function testOptionalConfiguration() { * @param bool $optional * Whether to assume a sample of the optional default configuration is * present. + * + * @internal */ - protected function assertNodeConfig($required, $optional) { + protected function assertNodeConfig(bool $required, bool $optional): void { // Check the required default configuration in node module. $string = $this->storage->findString(['source' => 'Make content sticky', 'context' => '', 'type' => 'configuration']); if ($required) { diff --git a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php index 9084e1d529795dd56ae83522e710a56e8ed413ed..f059508eed3aa2a1e7f3d6c141f5771dc08499e0 100644 --- a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php +++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php @@ -386,8 +386,10 @@ protected function deleteLocaleTranslationData($config_name, $key, $source_value * The configuration name. * @param string $langcode * The language code. + * + * @internal */ - protected function assertNoConfigOverride($config_name, $langcode) { + protected function assertNoConfigOverride(string $config_name, string $langcode): void { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); $this->assertNotEquals($langcode, $config_langcode); @@ -401,12 +403,14 @@ protected function assertNoConfigOverride($config_name, $langcode) { * The configuration name. * @param string $key * The configuration key. - * @param string $value + * @param string|array $value * The configuration value. * @param string $langcode * The language code. + * + * @internal */ - protected function assertConfigOverride($config_name, $key, $value, $langcode) { + protected function assertConfigOverride(string $config_name, string $key, $value, string $langcode): void { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); $this->assertNotEquals($langcode, $config_langcode); @@ -424,8 +428,10 @@ protected function assertConfigOverride($config_name, $key, $value, $langcode) { * The configuration value. * @param string $langcode * The language code. + * + * @internal */ - protected function assertActiveConfig($config_name, $key, $value, $langcode) { + protected function assertActiveConfig(string $config_name, string $key, string $value, string $langcode): void { $config = $this->configFactory->getEditable($config_name); $this->assertEquals($langcode, $config->get('langcode')); $this->assertSame($value, $config->get($key)); @@ -438,8 +444,10 @@ protected function assertActiveConfig($config_name, $key, $value, $langcode) { * The configuration name. * @param string $langcode * The language code. + * + * @internal */ - protected function assertNoTranslation($config_name, $langcode) { + protected function assertNoTranslation(string $config_name, string $langcode): void { $strings = $this->stringStorage->getTranslations([ 'type' => 'configuration', 'name' => $config_name, @@ -461,8 +469,10 @@ protected function assertNoTranslation($config_name, $langcode) { * @param bool $customized * Whether or not the string should be asserted to be customized or not * customized. + * + * @internal */ - protected function assertTranslation($config_name, $translation, $langcode, $customized = TRUE) { + protected function assertTranslation(string $config_name, $translation, string $langcode, bool $customized = TRUE): void { // Make sure a string exists. $strings = $this->stringStorage->getTranslations([ 'type' => 'configuration', diff --git a/core/modules/media/tests/src/Functional/MediaRevisionTest.php b/core/modules/media/tests/src/Functional/MediaRevisionTest.php index f3361c76b49fd31f3f5196aed28a09ce307232f1..d3c89fc72a3db300371657880ca9d13e1bd9e754 100644 --- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php @@ -190,8 +190,10 @@ protected function createMediaRevision(MediaInterface $media) { * The entity in question. * @param int $expected_revisions * The expected number of revisions. + * + * @internal */ - protected function assertRevisionCount(EntityInterface $entity, $expected_revisions) { + protected function assertRevisionCount(EntityInterface $entity, int $expected_revisions): void { $entity_type = $entity->getEntityType(); $count = $this->container diff --git a/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php b/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php index 828f2e0317b100da69591680ac26d95049655215..5446c3a3ca7ed586749f2c245f670824e20d229e 100644 --- a/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php +++ b/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php @@ -475,8 +475,10 @@ public function testMediaCreateRedirect() { * A list of the help texts to check. * @param string $selector * (optional) The selector to search. + * + * @internal */ - public function assertHelpTexts(array $texts, $selector = '') { + public function assertHelpTexts(array $texts, string $selector = ''): void { $assert_session = $this->assertSession(); foreach ($texts as $text) { // We only want to escape single quotes, so use str_replace() rather than @@ -496,8 +498,10 @@ public function assertHelpTexts(array $texts, $selector = '') { * * @param string[] $texts * A list of the help texts to check. + * + * @internal */ - public function assertNoHelpTexts(array $texts) { + public function assertNoHelpTexts(array $texts): void { $assert_session = $this->assertSession(); foreach ($texts as $text) { $assert_session->pageTextNotContains($text); @@ -514,8 +518,10 @@ public function assertNoHelpTexts(array $texts) { * @param string[] $attributes * An associative array of any expected attributes, keyed by the * attribute name. + * + * @internal */ - protected function assertHelpLink(NodeElement $element, $text, array $attributes = []) { + protected function assertHelpLink(NodeElement $element, string $text, array $attributes = []): void { // Find all the links inside the element. $link = $element->findLink($text); @@ -532,8 +538,10 @@ protected function assertHelpLink(NodeElement $element, $text, array $attributes * The element to search. * @param string $text * The link text. + * + * @internal */ - protected function assertNoHelpLink(NodeElement $element, $text) { + protected function assertNoHelpLink(NodeElement $element, string $text): void { $assert_session = $this->assertSession(); // Assert that the link and its text are not present anywhere on the page. $assert_session->elementNotExists('named', ['link', $text], $element); diff --git a/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php index d192edcde704a9b3484d8c532773d12f43b172cb..5785a13a680d4a2f6ea27272610300efa644a254 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -1415,11 +1415,13 @@ protected function leaveSourceMode() { * * @param string $attribute * The attribute to check. - * @param mixed $value + * @param string|null $value * Either a string value or if NULL, asserts that <drupal-media> element * doesn't have the attribute. + * + * @internal */ - protected function assertSourceAttributeSame($attribute, $value) { + protected function assertSourceAttributeSame(string $attribute, ?string $value): void { $this->assertNotEmpty($drupal_media = $this->getDrupalMediaFromSource()); if ($value === NULL) { $this->assertFalse($drupal_media->hasAttribute($attribute)); @@ -1524,8 +1526,10 @@ protected function openContextMenu($instance_id = 'edit-body-0-value') { * * @param string $label * The `aria-label` attribute value of the context menu item. + * + * @internal */ - protected function assertContextMenuItemExists($label) { + protected function assertContextMenuItemExists(string $label): void { $this->assertSession()->elementExists('xpath', '//a[@aria-label="' . $label . '"]'); } @@ -1534,8 +1538,10 @@ protected function assertContextMenuItemExists($label) { * * @param string $label * The `aria-label` attribute value of the context menu item. + * + * @internal */ - protected function assertContextMenuItemNotExists($label) { + protected function assertContextMenuItemNotExists(string $label): void { $this->assertSession()->elementNotExists('xpath', '//a[@aria-label="' . $label . '"]'); } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php index e4a0f942c4e0f7d122d7a3a80ddda49bd5b6c50f..9f17c9245e2dc9f13fd251685b939ea3a6bfdb68 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @@ -159,8 +159,10 @@ public function testMediaImageSource() { * * @param string $media_type_id * The media type ID. + * + * @internal */ - protected function assertViewDisplayConfigured($media_type_id) { + protected function assertViewDisplayConfigured(string $media_type_id): void { $assert_session = $this->assertSession(); $type = MediaType::load($media_type_id); $display = EntityViewDisplay::load('media.' . $media_type_id . '.' . EntityDisplayRepositoryInterface::DEFAULT_DISPLAY_MODE); diff --git a/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php b/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php index 59fa8af6ace92c01d43dc4b1c6cac6dc7500800d..f6d00a3da6d86f7cf9a305cbecbd0c22ab7abfc2 100644 --- a/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php +++ b/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php @@ -92,8 +92,10 @@ public function testCreateAccess(array $permissions, AccessResultInterface $expe * Expected cache tags. * @param \Drupal\Core\Access\AccessResultInterface $actual * The actual access result. + * + * @internal */ - protected function assertAccess(AccessResultInterface $expected_access_result, array $expected_cache_contexts, array $expected_cache_tags, AccessResultInterface $actual) { + protected function assertAccess(AccessResultInterface $expected_access_result, array $expected_cache_contexts, array $expected_cache_tags, AccessResultInterface $actual): void { $this->assertSame($expected_access_result->isAllowed(), $actual->isAllowed()); $this->assertSame($expected_access_result->isForbidden(), $actual->isForbidden()); $this->assertSame($expected_access_result->isNeutral(), $actual->isNeutral()); diff --git a/core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php b/core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php index b24dcc6903b860a7d444e4d7de9620d74492c5a1..e83c5e31831b58ffb9ee5075698555529bfba937 100644 --- a/core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php +++ b/core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php @@ -222,8 +222,10 @@ public function testDisplayModes() { * @param bool $has_source_field * Whether the media library form display should contain the source field or * not. + * + * @internal */ - protected function assertFormDisplay($type_id, $has_name, $has_source_field) { + protected function assertFormDisplay(string $type_id, bool $has_name, bool $has_source_field): void { // These components are added by default and invisible. $components = [ 'revision_log_message', @@ -254,8 +256,10 @@ protected function assertFormDisplay($type_id, $has_name, $has_source_field) { * The media type ID. * @param string $image_style * The ID of the image style that should be configured for the thumbnail. + * + * @internal */ - protected function assertViewDisplay($type_id, $image_style) { + protected function assertViewDisplay(string $type_id, string $image_style): void { $view_display = EntityViewDisplay::load('media.' . $type_id . '.media_library'); $this->assertInstanceOf(EntityViewDisplay::class, $view_display); // Assert the media library view display contains only the thumbnail. diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/ContentModerationTest.php b/core/modules/media_library/tests/src/FunctionalJavascript/ContentModerationTest.php index 07b8f514f19ccc3f843f504ac5b833eb5836e058..dd21529b76ebe726633f99167fc73dae6d862c43 100644 --- a/core/modules/media_library/tests/src/FunctionalJavascript/ContentModerationTest.php +++ b/core/modules/media_library/tests/src/FunctionalJavascript/ContentModerationTest.php @@ -312,8 +312,10 @@ public function testWidget() { /** * Asserts all media items are visible. + * + * @internal */ - protected function assertAllMedia() { + protected function assertAllMedia(): void { $assert_session = $this->assertSession(); $assert_session->pageTextContains('Hoglet'); $assert_session->pageTextContains('Panda'); @@ -322,8 +324,10 @@ protected function assertAllMedia() { /** * Asserts only published media items are visible. + * + * @internal */ - protected function assertOnlyPublishedMedia() { + protected function assertOnlyPublishedMedia(): void { $assert_session = $this->assertSession(); $assert_session->pageTextNotContains('Hoglet'); $assert_session->pageTextContains('Panda'); diff --git a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php index b8fa3d268c2cf3ca97baf45e6e5059b01c3332a9..7ed7e1975c10703d7c49326d77deca781cbadccf 100644 --- a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php +++ b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php @@ -412,7 +412,7 @@ public function testAddFormAccess(): void { * @param string[] $expected_cache_contexts * (optional) The expected cache contexts attached to the access result. */ - private function assertAccess(AccessResult $access_result, $is_allowed, $expected_reason = NULL, array $expected_cache_tags = [], array $expected_cache_contexts = []) { + private function assertAccess(AccessResult $access_result, bool $is_allowed, string $expected_reason = NULL, array $expected_cache_tags = [], array $expected_cache_contexts = []): void { $this->assertSame($is_allowed, $access_result->isAllowed()); if ($access_result instanceof AccessResultReasonInterface && isset($expected_reason)) { $this->assertSame($expected_reason, $access_result->getReason()); diff --git a/core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php b/core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php index e5fc54ff9e20dd7ce838f38c54df75e96a819398..57e3ef47f652c793cb96338ddb92ff992581d517 100644 --- a/core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php +++ b/core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php @@ -4,10 +4,12 @@ use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Form\FormState; +use Drupal\Core\Session\AccountInterface; use Drupal\entity_test\Entity\EntityTest; use Drupal\entity_test\Entity\EntityTestRev; use Drupal\KernelTests\KernelTestBase; use Drupal\media\Entity\MediaType; +use Drupal\media_library\MediaLibraryState; use Drupal\Tests\user\Traits\UserCreationTrait; /** @@ -128,8 +130,10 @@ public function testRevisionableWidgetAccess() { * The media library state. * * @throws \Exception + * + * @internal */ - protected function assertMediaLibraryStateAccess($access, $user, $state) { + protected function assertMediaLibraryStateAccess(bool $access, AccountInterface $user, MediaLibraryState $state): void { $ui_builder = $this->container->get('media_library.ui_builder'); $access_result = $ui_builder->checkAccess($user, $state); $this->assertEquals($access, $access_result->isAllowed()); diff --git a/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php index 61279cb7a76cb5efebc012b224a0f9a4cb336683..894bb59993d120fc18a456d8279b5dd0bf5dada7 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php @@ -120,8 +120,10 @@ public function createLinkHierarchy($module = 'menu_test') { /** * Assert that at set of links is properly parented. + * + * @internal */ - public function assertMenuLinkParents($links, $expected_hierarchy) { + public function assertMenuLinkParents(array $links, array $expected_hierarchy): void { foreach ($expected_hierarchy as $id => $parent) { /** @var \Drupal\Core\Menu\MenuLinkInterface $menu_link_plugin */ $menu_link_plugin = $this->menuLinkManager->createInstance($links[$id]); diff --git a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php index bc72be37598d64787d88c89fa73c83af101504dc..c21a085fd5b03c3db74960e16d1efcac8385540a 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Migrate/d6/MigrateMenuLinkTest.php @@ -53,7 +53,7 @@ protected function setUp(): void { * The expected title of the link. * @param string $menu * The expected ID of the menu to which the link will belong. - * @param string $description + * @param string|null $description * The link's expected description. * @param bool $enabled * Whether the link is enabled. @@ -66,10 +66,9 @@ protected function setUp(): void { * @param int $weight * The expected weight of the link. * - * @return \Drupal\menu_link_content\MenuLinkContentInterface - * The menu link content. + * @internal */ - protected function assertEntity($id, $title, $menu, $description, $enabled, $expanded, array $attributes, $uri, $weight) { + protected function assertEntity(string $id, string $title, string $menu, ?string $description, bool $enabled, bool $expanded, array $attributes, string $uri, int $weight): void { /** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link */ $menu_link = MenuLinkContent::load($id); $this->assertInstanceOf(MenuLinkContentInterface::class, $menu_link); @@ -81,7 +80,6 @@ protected function assertEntity($id, $title, $menu, $description, $enabled, $exp $this->assertSame($attributes, $menu_link->link->options); $this->assertSame($uri, $menu_link->link->uri); $this->assertSame($weight, $menu_link->getWeight()); - return $menu_link; } /** diff --git a/core/modules/migrate/tests/src/Kernel/HighWaterTest.php b/core/modules/migrate/tests/src/Kernel/HighWaterTest.php index f45a662758f1b7e37d4016d541345ccef98c1b01..0793ea3652e230e5c635fde512b8c929e30f23aa 100644 --- a/core/modules/migrate/tests/src/Kernel/HighWaterTest.php +++ b/core/modules/migrate/tests/src/Kernel/HighWaterTest.php @@ -267,8 +267,10 @@ public function testHighWaterUpdate() { * * @param string $title * Title of the node. + * + * @internal */ - protected function assertNodeExists($title) { + protected function assertNodeExists(string $title): void { self::assertTrue($this->nodeExists($title)); } @@ -277,8 +279,10 @@ protected function assertNodeExists($title) { * * @param string $title * Title of the node. + * + * @internal */ - protected function assertNodeDoesNotExist($title) { + protected function assertNodeDoesNotExist(string $title): void { self::assertFalse($this->nodeExists($title)); } diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php index 1123737bcfa5d58dbc9b4367dc9d9c525c17dbca..b5fb3ec2502467158b1db2ac7e89fbac11324936 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php @@ -67,8 +67,10 @@ protected function setUp(): void { * The expected default translation language code. * @param string[] $others * The expected other translation language codes. + * + * @internal */ - protected function assertTranslations($id, $default, $others = []) { + protected function assertTranslations(int $id, string $default, array $others = []): void { $entity = $this->storage->load($id); $this->assertNotEmpty($entity, "Entity exists"); $this->assertEquals($default, $entity->language()->getId(), "Entity default translation"); diff --git a/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php b/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php index 04d45b8c04d6d81ace140faa148703fa5cead50c..1f8f80c1afbd102d96479dee92375f8cab6a4abb 100644 --- a/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php +++ b/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php @@ -153,8 +153,10 @@ public function testTrackChanges() { * Property to evaluate. * @param string $value * Value to evaluate. + * + * @internal */ - protected function assertTermExists($property, $value) { + protected function assertTermExists(string $property, string $value): void { self::assertTrue($this->termExists($property, $value)); } @@ -165,8 +167,10 @@ protected function assertTermExists($property, $value) { * Property to evaluate. * @param string $value * Value to evaluate. + * + * @internal */ - protected function assertTermDoesNotExist($property, $value) { + protected function assertTermDoesNotExist(string $property, string $value): void { self::assertFalse($this->termExists($property, $value)); } diff --git a/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php b/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php index dc7cce130bfa023676d3669ff946c2f1704dd0b7..72d55143b45de44c947c5badbf83032d2efdd9ef 100644 --- a/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php +++ b/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php @@ -48,10 +48,12 @@ public function providerFileProcessBaseConstructor() { * * @param array $configuration * The plugin configuration. - * @param $expected + * @param int $expected * The expected value of the plugin configuration. + * + * @internal */ - protected function assertPlugin($configuration, $expected) { + protected function assertPlugin(array $configuration, int $expected): void { $stream_wrapper_manager = $this->prophesize(StreamWrapperManagerInterface::class)->reveal(); $file_system = $this->prophesize(FileSystemInterface::class)->reveal(); $download_plugin = $this->prophesize(MigrateProcessInterface::class)->reveal(); diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php index eb07400d312a1b0dee6087b6ad8d8f734ecc85ab..900a374d491099b0ea3442c610e10e0835c4a755 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php @@ -67,8 +67,10 @@ public function testD7Categories() { * * @param \Drupal\migrate\Plugin\MigrationInterface[] $migrations * The migrations. + * + * @internal */ - protected function assertCategories($migrations) { + protected function assertCategories(array $migrations): void { foreach ($migrations as $id => $migration) { $object_classes = class_parents($migration->getDestinationPlugin()); $object_classes[] = get_class($migration->getDestinationPlugin()); diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php index 34a486053512e3284bafd522a4d3d5aa439d96b1..73cad339dc48f2a4a1e3a805c56f44e9e363c830 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php @@ -186,8 +186,10 @@ protected function setUp(): void { * The source plugin. * @param array $configuration * The source plugin configuration (Nope, no getter available). + * + * @internal */ - protected function assertIds(MigrateSourceInterface $source, array $configuration) { + protected function assertIds(MigrateSourceInterface $source, array $configuration): void { $ids = $source->getIds(); [, $entity_type_id] = explode(PluginBase::DERIVATIVE_SEPARATOR, $source->getPluginId()); $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php index 1d86b61ef8b3b2dcce885e3c3741cf1b9ef9cbd4..f25d28e11d8f712e921147f9417c9dc31c234861 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php @@ -127,8 +127,10 @@ public function testMigrateUpgradeReviewPage() { * The WebAssert object. * @param string $expected * The expected response text. + * + * @internal */ - protected function assertFirstForm(WebAssert $session, $expected) { + protected function assertFirstForm(WebAssert $session, string $expected): void { $paths = [ '', '/incremental', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php index 31feae3cccf5706c52684bba151510cf87462390..4ee6cda5a7f6224d1ca91c09378110b4b8bff28e 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php @@ -210,8 +210,10 @@ public function testUpgradeAndIncremental() { /** * Tests that follow-up migrations have been run successfully. + * + * @internal */ - protected function assertFollowUpMigrationResults() { + protected function assertFollowUpMigrationResults(): void { $node = Node::load(10); $this->assertSame('12', $node->get('field_reference')->target_id); $this->assertSame('12', $node->get('field_reference_2')->target_id); diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php index 7f1a26fd93faaee6882e85b841dad787c560a3cb..864c5dd8e4779e0cc3db1d787dd7c52a381ea330 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php @@ -234,8 +234,10 @@ public function testUpgradeAndIncremental() { /** * Tests that follow-up migrations have been run successfully. + * + * @internal */ - protected function assertFollowUpMigrationResults() { + protected function assertFollowUpMigrationResults(): void { $node = Node::load(2); $this->assertSame('4', $node->get('field_reference')->target_id); $this->assertSame('6', $node->get('field_reference_2')->target_id); diff --git a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php index a20379f1682213a4448009b3e542427f0d26e96b..ac042c114582b944c8722e7573897fea1ad495a9 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php @@ -207,12 +207,14 @@ public function testNodeAccessBasic() { /** * Checks taxonomy/term listings to ensure only accessible nodes are listed. * - * @param $is_admin + * @param bool $is_admin * A boolean indicating whether the current user is an administrator. If * TRUE, all nodes should be listed. If FALSE, only public nodes and the * user's own private nodes should be listed. + * + * @internal */ - protected function assertTaxonomyPage($is_admin) { + protected function assertTaxonomyPage(bool $is_admin): void { foreach ([$this->publicTid, $this->privateTid] as $tid_is_private => $tid) { $this->drupalGet("taxonomy/term/$tid"); $this->nidsVisible = []; diff --git a/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php b/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php index e647190921fc621673fdab4f455c00a304fac44b..746a750fe39ba260a6d3fb1d2180e41bd891233e 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php @@ -76,8 +76,10 @@ protected function setUp(): void { * * @param array $expected * Expected values, keyed by user ID, expected cache contexts as values. + * + * @internal */ - protected function assertUserCacheContext(array $expected) { + protected function assertUserCacheContext(array $expected): void { foreach ($expected as $uid => $context) { if ($uid > 0) { $this->drupalLogin($this->userMapping[$uid]); diff --git a/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php b/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php index dc788da0a76fb21d3374ddfcadb9201d51012631..c85042d625c3807e98c780c811873156ce750587 100644 --- a/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php +++ b/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php @@ -114,8 +114,10 @@ public function testDisplayConfigurable(string $theme, string $metadata_region, * The region of the node html content where meta data is expected. * @param bool $field_classes * If TRUE, check for field--name-XXX classes. + * + * @internal */ - protected function assertNodeHtml(NodeInterface $node, UserInterface $user, bool $is_inline, string $metadata_region, bool $field_classes) { + protected function assertNodeHtml(NodeInterface $node, UserInterface $user, bool $is_inline, string $metadata_region, bool $field_classes): void { $assert = $this->assertSession(); $html_element = $is_inline ? 'span' : 'div'; diff --git a/core/modules/node/tests/src/Functional/NodeTestBase.php b/core/modules/node/tests/src/Functional/NodeTestBase.php index 6705134a22fb4adec627887ce92b67cc853aa117..44dc2faec0ebf710f7ca8108edf74b9d00d1a97d 100644 --- a/core/modules/node/tests/src/Functional/NodeTestBase.php +++ b/core/modules/node/tests/src/Functional/NodeTestBase.php @@ -56,6 +56,8 @@ protected function setUp() { * The node object to check. * @param \Drupal\Core\Session\AccountInterface $account * The user account for which to check access. + * + * @internal */ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterface $account) { foreach ($ops as $op => $result) { @@ -75,8 +77,10 @@ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterfa * @param string|null $langcode * (optional) The language code indicating which translation of the node * to check. If NULL, the untranslated (fallback) access is checked. + * + * @internal */ - public function assertNodeCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) { + public function assertNodeCreateAccess(string $bundle, bool $result, AccountInterface $account, ?string $langcode = NULL) { $this->assertEquals($this->accessHandler->createAccess($bundle, $account, ['langcode' => $langcode]), $result, $this->nodeAccessAssertMessage('create', $result, $langcode)); } diff --git a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php index bf1cc6ac20d7881364ae54a04d03c5bdcb1cb7b3..1ee1b6606dce673c4e6a1d4458cce91386bee878 100644 --- a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php +++ b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php @@ -166,8 +166,10 @@ public function testFrontPage() { * An array of nids which should not be part of the resultset. * @param string $message * (optional) A custom message to display with the assertion. + * + * @internal */ - protected function assertNotInResultSet(ViewExecutable $view, array $not_expected_nids, $message = '') { + protected function assertNotInResultSet(ViewExecutable $view, array $not_expected_nids, string $message = ''): void { $found_nids = array_filter($view->result, function ($row) use ($not_expected_nids) { return in_array($row->nid, $not_expected_nids); }); diff --git a/core/modules/node/tests/src/Functional/Views/NodeFieldFilterTest.php b/core/modules/node/tests/src/Functional/Views/NodeFieldFilterTest.php index 33105bebc3b8d9ffd9fd9eec13243e1c65e0c52f..e94a11ecb3acf7d3623e59126ad5800d40defdf1 100644 --- a/core/modules/node/tests/src/Functional/Views/NodeFieldFilterTest.php +++ b/core/modules/node/tests/src/Functional/Views/NodeFieldFilterTest.php @@ -97,8 +97,10 @@ public function testFilters() { * that translation should be shown on the given page. * @param string $message * Message suffix to display. + * + * @internal */ - protected function assertPageCounts($path, $counts, $message) { + protected function assertPageCounts(string $path, array $counts, string $message): void { // Disable read more links. \Drupal::service('entity_display.repository') ->getViewDisplay('node', 'page', 'teaser') diff --git a/core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php b/core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php index dec8d923967f0ee672b8cd876f87dee429125819..ea0cfe411acc62c9547c3ad05dfb8e56ff8bff8e 100644 --- a/core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php +++ b/core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php @@ -59,8 +59,10 @@ public function testNodeViewTypeArgument() { * * @param array $expected_nids * An array of node IDs. + * + * @internal */ - protected function assertNids(array $expected_nids = []) { + protected function assertNids(array $expected_nids = []): void { $result = $this->xpath('//span[@class="field-content"]'); $nids = []; foreach ($result as $element) { diff --git a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php index 986f59cbc09f810cb1efc614d0f12cfea1d9aff2..c5bd79ccb953fbd4fbb0147afcce160840a8ecf0 100644 --- a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php +++ b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php @@ -281,8 +281,10 @@ public function testNativeLanguageField() { * * @param bool $native * (optional) Whether to assert the language name in its native form. + * + * @internal */ - protected function assertLanguageNames($native = FALSE) { + protected function assertLanguageNames(bool $native = FALSE): void { $this->drupalGet('test-language'); if ($native) { $this->assertSession()->pageTextContains('Français'); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php index 298df46b55f9d0204cfe99fb3302ca3ed1f4dd61..324feb7cd70724f0fd40e29f33b39dc5e98968c7 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php @@ -96,8 +96,10 @@ public function testNodeCompleteMigration() { * An array of revision data matching a node_field_revision table row. * @param array $data * An array of revision data. + * + * @internal */ - protected function assertRevision(array $revision, array $data) { + protected function assertRevision(array $revision, array $data): void { /** @var \Drupal\node\NodeInterface $actual */ $actual = $this->nodeStorage->loadRevision($revision['vid']) ->getTranslation($revision['langcode']); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php index d975e9e4b8fad3fc64ce1a99272230d56391fa57..ed3bc55add437c4a04fc79e7d707ab7d46423c57 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php @@ -42,19 +42,21 @@ protected function setUp(): void { * The revision language. * @param string $title * The expected title. - * @param string $log + * @param string|null $log * The revision log message. * @param int $timestamp * The revision's time stamp. + * + * @internal */ - protected function assertRevision($id, $langcode, $title, $log, $timestamp) { + protected function assertRevision(int $id, string $langcode, string $title, ?string $log, int $timestamp): void { /** @var \Drupal\node\NodeInterface $revision */ $revision = $this->nodeStorage->loadRevision($id) ->getTranslation($langcode); $this->assertInstanceOf(NodeInterface::class, $revision); $this->assertSame($title, $revision->getTitle()); $this->assertSame($log, $revision->revision_log->value); - $this->assertSame($timestamp, $revision->getRevisionCreationTime()); + $this->assertSame($timestamp, (int) $revision->getRevisionCreationTime()); } /** @@ -73,27 +75,27 @@ public function testNodeRevision() { $this->assertSame('modified rev 3', $node->revision_log->value); $this->assertSame('1420861423', $node->getRevisionCreationTime()); - $this->assertRevision(1, 'und', 'Test title', NULL, '1390095702'); - $this->assertRevision(3, 'und', 'Test title rev 3', NULL, '1420718386'); - $this->assertRevision(4, 'und', 'Test page title rev 4', NULL, '1390095701'); - $this->assertRevision(5, 'und', 'Test title rev 2', 'modified rev 2', '1390095703'); - $this->assertRevision(6, 'und', 'Node 4', NULL, '1390095701'); - $this->assertRevision(7, 'und', 'Node 5', NULL, '1390095701'); - $this->assertRevision(8, 'und', 'Node 6', NULL, '1390095701'); - $this->assertRevision(9, 'und', 'Node 7', NULL, '1390095701'); - $this->assertRevision(10, 'und', 'Node 8', NULL, '1390095701'); - $this->assertRevision(11, 'und', 'Node 9', NULL, '1390095701'); - $this->assertRevision(12, 'und', 'Once upon a time', NULL, '1444671588'); - $this->assertRevision(13, 'en', 'The Real McCoy', NULL, '1444238808'); - $this->assertRevision(15, 'zu', 'Abantu zulu', NULL, '1444238808'); - $this->assertRevision(17, 'und', 'United Federation of Planets', NULL, '1493066668'); - $this->assertRevision(18, 'und', 'Klingon Empire', NULL, '1493066677'); - $this->assertRevision(19, 'und', 'Romulan Empire', NULL, '1493066684'); - $this->assertRevision(20, 'und', 'Ferengi Commerce Authority', NULL, '1493066693'); - $this->assertRevision(21, 'und', 'Ambassador Sarek', NULL, '1494966544'); - $this->assertRevision(22, 'und', 'New Forum Topic', NULL, '1501955771'); - $this->assertRevision(2001, 'und', 'Test title rev 3', 'modified rev 3', '1420861423'); - $this->assertRevision(2002, 'en', 'John Smith - EN', NULL, '1534014650'); + $this->assertRevision(1, 'und', 'Test title', NULL, 1390095702); + $this->assertRevision(3, 'und', 'Test title rev 3', NULL, 1420718386); + $this->assertRevision(4, 'und', 'Test page title rev 4', NULL, 1390095701); + $this->assertRevision(5, 'und', 'Test title rev 2', 'modified rev 2', 1390095703); + $this->assertRevision(6, 'und', 'Node 4', NULL, 1390095701); + $this->assertRevision(7, 'und', 'Node 5', NULL, 1390095701); + $this->assertRevision(8, 'und', 'Node 6', NULL, 1390095701); + $this->assertRevision(9, 'und', 'Node 7', NULL, 1390095701); + $this->assertRevision(10, 'und', 'Node 8', NULL, 1390095701); + $this->assertRevision(11, 'und', 'Node 9', NULL, 1390095701); + $this->assertRevision(12, 'und', 'Once upon a time', NULL, 1444671588); + $this->assertRevision(13, 'en', 'The Real McCoy', NULL, 1444238808); + $this->assertRevision(15, 'zu', 'Abantu zulu', NULL, 1444238808); + $this->assertRevision(17, 'und', 'United Federation of Planets', NULL, 1493066668); + $this->assertRevision(18, 'und', 'Klingon Empire', NULL, 1493066677); + $this->assertRevision(19, 'und', 'Romulan Empire', NULL, 1493066684); + $this->assertRevision(20, 'und', 'Ferengi Commerce Authority', NULL, 1493066693); + $this->assertRevision(21, 'und', 'Ambassador Sarek', NULL, 1494966544); + $this->assertRevision(22, 'und', 'New Forum Topic', NULL, 1501955771); + $this->assertRevision(2001, 'und', 'Test title rev 3', 'modified rev 3', 1420861423); + $this->assertRevision(2002, 'en', 'John Smith - EN', NULL, 1534014650); // Test that the revision translations are not migrated and there should not // be a revision with id of 2003. diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php index 1d38c97104458e31bdad5e64a9994a1749758e5b..3f5039c9a9c37d50ac9760facfd1cb8dc177cc95 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php @@ -194,8 +194,10 @@ public function testRollbackNodeComplete() { * An array of revision data matching a node_field_revision table row. * @param array $data * An array of revision data. + * + * @internal */ - protected function assertRevision(array $revision, array $data) { + protected function assertRevision(array $revision, array $data): void { /** @var \Drupal\node\NodeInterface $actual */ $actual = $this->nodeStorage->loadRevision($revision['vid']) ->getTranslation($revision['langcode']); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php index 50cabf5f185ffe9867ed093a4e7653f6e64674ab..04656656c2ac67bf6c0670629306c5a14b873f3e 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php @@ -92,30 +92,32 @@ protected function getFileMigrationInfo() { * The revision language. * @param string $title * The expected title. - * @param string $log + * @param string|null $log * The revision log message. * @param int $timestamp * The revision's time stamp. + * + * @internal */ - protected function assertRevision($id, $langcode, $title, $log, $timestamp) { + protected function assertRevision(int $id, string $langcode, string $title, ?string $log, int $timestamp): void { $revision = $this->nodeStorage->loadRevision($id); $this->assertInstanceOf(NodeInterface::class, $revision); $this->assertSame($title, $revision->getTitle()); $this->assertSame($langcode, $revision->language()->getId()); $this->assertSame($log, $revision->revision_log->value); - $this->assertSame($timestamp, $revision->getRevisionCreationTime()); + $this->assertSame($timestamp, (int) $revision->getRevisionCreationTime()); } /** * Tests the migration of node revisions with translated nodes. */ public function testNodeRevisions() { - $this->assertRevision(1, 'en', 'An English Node', NULL, '1441032132'); - $this->assertRevision(2, 'en', 'The thing about Deep Space 9 (1st rev)', 'DS9 1st rev', '1564543588'); - $this->assertRevision(4, 'is', 'is - The thing about Firefly (1st rev)', 'is - Firefly 1st rev', '1478755274'); - $this->assertRevision(6, 'en', 'Comments are closed :-(', NULL, '1504715414'); - $this->assertRevision(7, 'en', 'Comments are open :-)', NULL, '1504715432'); - $this->assertRevision(8, 'en', 'The number 47', NULL, '1552126363'); + $this->assertRevision(1, 'en', 'An English Node', NULL, 1441032132); + $this->assertRevision(2, 'en', 'The thing about Deep Space 9 (1st rev)', 'DS9 1st rev', 1564543588); + $this->assertRevision(4, 'is', 'is - The thing about Firefly (1st rev)', 'is - Firefly 1st rev', 1478755274); + $this->assertRevision(6, 'en', 'Comments are closed :-(', NULL, 1504715414); + $this->assertRevision(7, 'en', 'Comments are open :-)', NULL, 1504715432); + $this->assertRevision(8, 'en', 'The number 47', NULL, 1552126363); // Test that the revision translation are not migrated and there should not // be a revision with id of 9. diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php index 0c62e6251dec089e9ab66ec88f13fd643a619672..f91b9f720796c413ebfb6df21f091fe10d272f44 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -103,8 +103,10 @@ protected function getFileMigrationInfo() { * Whether the node is expected to be promoted to the front page. * @param bool $sticky * Whether the node is expected to be sticky. + * + * @internal */ - protected function assertEntity($id, $type, $langcode, $title, $uid, $status, $created, $changed, $promoted, $sticky) { + protected function assertEntity(string $id, string $type, string $langcode, string $title, int $uid, bool $status, int $created, int $changed, bool $promoted, bool $sticky): void { /** @var \Drupal\node\NodeInterface $node */ $node = Node::load($id); $this->assertInstanceOf(NodeInterface::class, $node); @@ -130,12 +132,14 @@ protected function assertEntity($id, $type, $langcode, $title, $uid, $status, $c * The expected title. * @param int $uid * The revision author ID. - * @param string $log + * @param string|null $log * The revision log message. * @param int $timestamp * The revision's time stamp. + * + * @internal */ - protected function assertRevision($id, $title, $uid, $log, $timestamp) { + protected function assertRevision(int $id, string $title, int $uid, ?string $log, int $timestamp): void { $revision = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($id); $this->assertInstanceOf(NodeInterface::class, $revision); $this->assertEquals($title, $revision->getTitle()); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php index e0c6773c4cefbbd7f943d73f3ba1cdc101c8986f..9b79ea1092a949165417fb018279e0358f55b73f 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php @@ -30,8 +30,10 @@ protected function setUp(): void { * The override ID. * @param string $label * The label's expected (overridden) value. + * + * @internal */ - protected function assertEntity($id, $label) { + protected function assertEntity(string $id, string $label): void { $override = BaseFieldOverride::load($id); $this->assertInstanceOf(BaseFieldOverride::class, $override); /** @var \Drupal\Core\Field\Entity\BaseFieldOverride $override */ diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php index 94a579c8703bbb0b18a0b4d6e6948eff5acec3a6..70f2a26e1b52af31cd1930b9b8d3c60baf3cfd78 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php @@ -45,14 +45,16 @@ protected function setUp(): void { * If submission information is displayed. * @param bool $new_revision * If this is a new revision. - * @param array $expected_available_menus + * @param array|null $expected_available_menus * The expected menus. - * @param string $expected_parent + * @param string|null $expected_parent * The expected menu parents. * @param string|null $body_label * (optional) The label for the body field. + * + * @internal */ - protected function assertEntity($id, $label, $description, $help, $display_submitted, $new_revision, $expected_available_menus, $expected_parent, $body_label = NULL) { + protected function assertEntity(string $id, string $label, string $description, string $help, bool $display_submitted, bool $new_revision, ?array $expected_available_menus, ?string $expected_parent, ?string $body_label = NULL): void { /** @var \Drupal\node\NodeTypeInterface $entity */ $entity = NodeType::load($id); $this->assertInstanceOf(NodeTypeInterface::class, $entity); diff --git a/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php b/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php index 3ee8ba16f323a408551292b5288da5a2f5682902..32eca5d6ba2bd6eeb35250e08452c143413595d8 100644 --- a/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php +++ b/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php @@ -91,6 +91,8 @@ protected function setUp() { * The node object to check. * @param \Drupal\Core\Session\AccountInterface $account * The user account for which to check access. + * + * @internal */ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterface $account) { foreach ($ops as $op => $result) { @@ -111,8 +113,10 @@ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterfa * @param string|null $langcode * (optional) The language code indicating which translation of the node * to check. If NULL, the untranslated (fallback) access is checked. + * + * @internal */ - public function assertNodeCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) { + public function assertNodeCreateAccess(string $bundle, bool $result, AccountInterface $account, ?string $langcode = NULL) { $this->assertEquals($result, $this->accessHandler->createAccess($bundle, $account, [ 'langcode' => $langcode, ]), $this->nodeAccessAssertMessage('create', $result, $langcode)); diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php index e3d732464eee3144359c73ee3507717afb992a10..23e965bd41745fc362bc92669118f41acc9fcfcb 100644 --- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php +++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php @@ -306,16 +306,18 @@ protected function createOptionsField($type) { /** * Tests a string input for the 'allowed values' form element. * - * @param $input_string + * @param string $input_string * The input string, in the pipe-linefeed format expected by the form * element. - * @param $result + * @param array|string $result * Either an expected resulting array in * $field->getSetting('allowed_values'), or an expected error message. - * @param $message + * @param string $message * Message to display. + * + * @internal */ - public function assertAllowedValuesInput($input_string, $result, $message) { + public function assertAllowedValuesInput(string $input_string, $result, string $message): void { $edit = ['settings[allowed_values]' => $input_string]; $this->drupalGet($this->adminPath); $this->submitForm($edit, 'Save field settings'); diff --git a/core/modules/path/tests/src/Functional/PathContentModerationTest.php b/core/modules/path/tests/src/Functional/PathContentModerationTest.php index dbc9b0f788cd20fa96286c34eee88bbd41298327..46e9a92d2e0118481f193efb36b6dd848b614c48 100644 --- a/core/modules/path/tests/src/Functional/PathContentModerationTest.php +++ b/core/modules/path/tests/src/Functional/PathContentModerationTest.php @@ -234,8 +234,10 @@ public function testTranslatedModeratedNodeAlias() { * * @param string[] $paths * An array of paths to check for. + * + * @internal */ - public function assertPathsAreAccessible(array $paths) { + public function assertPathsAreAccessible(array $paths): void { foreach ($paths as $path) { $this->drupalGet($path); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php index 43bc7e72d312f6b3d972abca3af4f7b2655cf260..065d229f1fba3a872d16e2e7e894915211cb4e55 100644 --- a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php +++ b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php @@ -58,8 +58,10 @@ protected function setUp(): void { * The path conditions. * @param \Drupal\path_alias\PathAliasInterface $path_alias * The path alias. + * + * @internal */ - private function assertPath($pid, $conditions, PathAliasInterface $path_alias) { + private function assertPath(int $pid, array $conditions, PathAliasInterface $path_alias): void { $this->assertSame($pid, (int) $path_alias->id()); $this->assertSame($conditions['alias'], $path_alias->getAlias()); $this->assertSame($conditions['langcode'], $path_alias->get('langcode')->value); diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php index cfac219e1da9f7bd03ce9e13723268f49f6a5a5e..9accbe0435fb0ec1865299b3185fb4068d2cba9e 100644 --- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php @@ -93,12 +93,14 @@ public function testUrlAlter() { /** * Assert that an outbound path is altered to an expected value. * - * @param $original + * @param string $original * A string with the original path that is run through generateFrommPath(). - * @param $final + * @param string $final * A string with the expected result after generateFrommPath(). + * + * @internal */ - protected function assertUrlOutboundAlter($original, $final) { + protected function assertUrlOutboundAlter(string $original, string $final): void { // Test outbound altering. $result = $this->container->get('path_processor_manager')->processOutbound($original); $this->assertSame($final, $result, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); @@ -107,12 +109,14 @@ protected function assertUrlOutboundAlter($original, $final) { /** * Assert that an inbound path is altered to an expected value. * - * @param $original + * @param string $original * The original path before it has been altered by inbound URL processing. - * @param $final + * @param string $final * A string with the expected result. + * + * @internal */ - protected function assertUrlInboundAlter($original, $final) { + protected function assertUrlInboundAlter(string $original, string $final): void { // Test inbound altering. $result = $this->container->get('path_alias.manager')->getPathByAlias($original); $this->assertSame($final, $result, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php index 1cb90adf40db13966eda6296620ee770f5b71b60..dbff08aa289f1e3622c0cb0745d035505de90072 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php @@ -76,8 +76,10 @@ public function testEndPointAccess() { * The URL to check. * @param array $body * The payload to send with the request. + * + * @internal */ - protected function assertAccessIsBlocked($url, array $body) { + protected function assertAccessIsBlocked(string $url, array $body): void { $client = $this->getHttpClient(); $message = ['message' => "The 'access in-place editing' permission is required."]; diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php index daa5a192c4d9a36793da9e072b73542b1f6e1b05..05744d77eafcb7a05d2037672906109c9b579a02 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php @@ -214,14 +214,14 @@ protected function enableLayouts($path) { /** * {@inheritdoc} */ - protected function assertEntityInstanceFieldStates($entity_type_id, $entity_id, $entity_instance_id, array $expected_field_states) { + protected function assertEntityInstanceFieldStates($entity_type_id, $entity_id, $entity_instance_id, array $expected_field_states): void { parent::assertEntityInstanceFieldStates($entity_type_id, $entity_id, $entity_instance_id, $this->replaceLayoutBuilderFieldIdKeys($expected_field_states)); } /** * {@inheritdoc} */ - protected function assertEntityInstanceFieldMarkup($expected_field_attributes) { + protected function assertEntityInstanceFieldMarkup($expected_field_attributes): void { if (func_num_args() === 4) { $expected_field_attributes = func_get_arg(3); @trigger_error('Calling ' . __METHOD__ . '() with 4 arguments is deprecated in drupal:9.1.0 and will throw an error in drupal:10.0.0. See https://www.drupal.org/project/drupal/issues/3037436', E_USER_DEPRECATED); @@ -327,7 +327,7 @@ protected function disableLayoutBuilder($path) { * @param string[] $fields * The fields test. */ - private function assertQuickEditInit(array $fields) { + private function assertQuickEditInit(array $fields): void { $this->assertNotEmpty($fields); $node = $this->article; $this->drupalGet('node/' . $node->id()); diff --git a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php index 7b9d268f2ad11269d51644e458e513e9ae3b9728..7148aa38d2c256fe926482c39af4cbe285a9acde 100644 --- a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php +++ b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php @@ -338,8 +338,10 @@ protected function doTermRdfaTests() { * The word to use in the test assertion message. * * @throws \Drupal\Core\Entity\EntityMalformedException + * + * @internal */ - protected function assertRdfaCommonNodeProperties(NodeInterface $node, $message_prefix) { + protected function assertRdfaCommonNodeProperties(NodeInterface $node, string $message_prefix): void { $this->drupalGet($node->toUrl()); $uri = $node->toUrl('canonical', ['absolute' => TRUE])->toString(); @@ -390,8 +392,10 @@ protected function assertRdfaCommonNodeProperties(NodeInterface $node, $message_ * * @param string $message_prefix * The word to use in the test assertion message. + * + * @internal */ - protected function assertRdfaArticleProperties($message_prefix) { + protected function assertRdfaArticleProperties(string $message_prefix): void { // Tags. $expected_value = [ 'type' => 'uri', @@ -415,8 +419,10 @@ protected function assertRdfaArticleProperties($message_prefix) { /** * Tests output for comment properties on nodes in full page view mode. + * + * @internal */ - protected function assertRdfaNodeCommentProperties() { + protected function assertRdfaNodeCommentProperties(): void { $this->drupalGet($this->article->toUrl()); // Relationship between node and comment. diff --git a/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php b/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php index 59c2157e86c9d48cf06c46a95f935ddc793947d3..bad3a45e41668b326f7fd52af6fde7b84d1dfb92 100644 --- a/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php +++ b/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php @@ -49,8 +49,10 @@ protected function setUp(): void { * The expected RDF types. * @param array[] $field_mappings * The expected RDF field mappings. + * + * @internal */ - protected function assertRdfMapping($entity_type, $bundle, $types, $field_mappings) { + protected function assertRdfMapping(string $entity_type, string $bundle, array $types, array $field_mappings): void { $rdf_mapping = rdf_get_mapping($entity_type, $bundle); $this->assertInstanceOf(RdfMappingInterface::class, $rdf_mapping); $this->assertSame($types, $rdf_mapping->getBundleMapping()); diff --git a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php index b56b027fece99ed107ace7b333c77ef9359aef32..ba2708ceda6ef5f3e82e568a3da9a74e2f837ec7 100644 --- a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php @@ -469,7 +469,7 @@ public function testResponsiveImageFieldFormattersOneSource() { * @param string $link_type * The link type to test. Either 'file' or 'content'. */ - private function assertResponsiveImageFieldFormattersLink($link_type) { + private function assertResponsiveImageFieldFormattersLink(string $link_type): void { $field_name = mb_strtolower($this->randomMachineName()); $field_settings = ['alt_field_required' => 0]; $this->createImageField($field_name, 'article', ['uri_scheme' => 'public'], $field_settings); diff --git a/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php b/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php index 10f35c8ccd8661cf9b8bc1d46f12fc88ca31bfa7..5f6c12ea7e8c84a811218046d71cb7e1b016f85c 100644 --- a/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php +++ b/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php @@ -93,8 +93,10 @@ public function testSearchUsingAdminTheme() { * * @param bool $is_admin * TRUE to test for administrative theme, FALSE otherwise. + * + * @internal */ - protected function assertAdminTheme($is_admin) { + protected function assertAdminTheme(bool $is_admin): void { if ($is_admin) { $this->assertSession()->responseContains('core/themes/' . $this->adminTheme); } diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php index d0148ca933e7c98a449330cf3f7632b3c9f24aef..b07904e922e369e51ac058fb77ba0341187e7895 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -307,8 +307,10 @@ public function setRolePermissions($rid, $access_comments = FALSE, $search_conte /** * Update search index and search for comment. + * + * @internal */ - public function assertCommentAccess($assume_access, $message) { + public function assertCommentAccess(bool $assume_access, string $message): void { // Invoke search index update. \Drupal::service('search.index')->markForReindex('node_search', $this->node->id()); $this->cronRun(); diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php index 35d0fd16cd0152cebe2407ea9947ffdfe03f804c..a5d4a7f71c68d768846d07439252889db31ae6db 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -408,17 +408,17 @@ protected function verifySearchPageOperations($id, $edit, $delete, $disable, $en /** * Checks that the default search page matches expectations. * - * @param string $expected + * @param string|false $expected * The expected search page. * @param string $message * (optional) A message to display with the assertion. - * @param string $group - * (optional) The group this message is in. + * + * @internal */ - protected function assertDefaultSearch($expected, $message = '', $group = 'Other') { + protected function assertDefaultSearch($expected, string $message = ''): void { /** @var \Drupal\search\SearchPageRepositoryInterface $search_page_repository */ $search_page_repository = \Drupal::service('search.search_page_repository'); - $this->assertSame($expected, $search_page_repository->getDefaultSearchPage(), $message, $group); + $this->assertSame($expected, $search_page_repository->getDefaultSearchPage(), $message); } /** diff --git a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php index 7fcefbe50f5db75819bcb7077b99c60454db6183..a8dbc5d130ba7916fc709c647c28f38eb1bbe2e2 100644 --- a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php +++ b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php @@ -284,8 +284,10 @@ public function testMultilingualSearch() { * Count of total items to verify. * @param string $message * Message to use, something like "after updating the search index". + * + * @internal */ - protected function assertIndexCounts($remaining, $total, $message) { + protected function assertIndexCounts(int $remaining, int $total, string $message): void { // Check status via plugin method call. $status = $this->plugin->indexStatus(); $this->assertEquals($remaining, $status['remaining'], 'Remaining items ' . $message . ' is ' . $remaining); @@ -320,8 +322,10 @@ protected function assertIndexCounts($remaining, $total, $message) { * Count of "foo" items to assert. * @param string $message * Message suffix to use. + * + * @internal */ - protected function assertDatabaseCounts($count_node, $count_foo, $message) { + protected function assertDatabaseCounts(int $count_node, int $count_foo, string $message): void { // Count number of distinct nodes by ID. $connection = Database::getConnection(); $results = $connection->select('search_dataset', 'i') diff --git a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php index 16106e75302faaaebfde4a98421b1f81ce3ce031..d3e8ee38ea987cb5107807bc934b5c8cc61a3feb 100644 --- a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php +++ b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php @@ -31,8 +31,10 @@ class MigrateSearchPageTest extends MigrateDrupal7TestBase { * The expected status of the search page. * @param array $expected_config * An array of expected configuration for the search page. + * + * @internal */ - protected function assertEntity($id, $path, $status = FALSE, array $expected_config = NULL) { + protected function assertEntity(string $id, string $path, bool $status = FALSE, array $expected_config = NULL): void { /** @var \Drupal\search\Entity\SearchPage $search_page */ $search_page = SearchPage::load($id); $this->assertSame($id, $search_page->id()); diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php index 617dce5271d7667ff94c52b6d93fc5374c61b4e4..459ad5da43a6b8c2a833b0545454f6e25a4c8902 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php @@ -427,8 +427,10 @@ public function testDenormalizeWithId() { * * @param array $data * The data to denormalize. + * + * @internal */ - protected function assertDenormalize(array $data) { + protected function assertDenormalize(array $data): void { $this->fieldItem->getParent() ->willReturn($this->prophesize(FieldItemListInterface::class)->reveal()); $this->fieldItem->getFieldDefinition()->willReturn($this->fieldDefinition->reveal()); diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php index cfe5c1566bb2cdb0e7d5cf3a5d960a4537a6c351..8d17f3a6527098e1fe12ae67c4f338eb4df43722 100644 --- a/core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php +++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php @@ -156,8 +156,10 @@ public function testOverriddenBlock() { * The overridden block. * @param string $override_text * The override text that should appear in the block. + * + * @internal */ - protected function assertOverriddenBlockDisabled(Block $overridden_block, $override_text) { + protected function assertOverriddenBlockDisabled(Block $overridden_block, string $override_text): void { $web_assert = $this->assertSession(); $page = $this->getSession()->getPage(); $block_selector = $this->getBlockSelector($overridden_block); diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php index a3029053f4e2e9d1ec1160aca8aaf132fb9c7a7d..4dc879b389fda12c00890e7365e7df556df1b096 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php @@ -462,20 +462,13 @@ public function testShortcutBlockAccess() { * (optional) A message to display with the assertion. Do not translate * messages: use new FormattableMarkup() to embed variables in the message text, not * t(). If left blank, a default message will be displayed. - * @param string $group - * (optional) The group this message is in, which is displayed in a column - * in test output. Use 'Debug' to indicate this is debugging output. Do not - * translate this string. Defaults to 'Other'; most tests do not override - * this default. * - * @return bool - * TRUE if the assertion succeeded. + * @internal */ - protected function assertShortcutQuickLink($label, $index = 0, $message = '', $group = 'Other') { + protected function assertShortcutQuickLink(string $label, int $index = 0, string $message = ''): void { $links = $this->xpath('//a[normalize-space()=:label]', [':label' => $label]); $message = ($message ? $message : new FormattableMarkup('Shortcut quick link with label %label found.', ['%label' => $label])); $this->assertArrayHasKey($index, $links, $message); - return TRUE; } } diff --git a/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php b/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php index 61b438abbc5e87be8b4b39c993b8eeb74afc0b94..c932114e6e961aed644e9c62e8463b7df9faf215 100644 --- a/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php +++ b/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php @@ -54,8 +54,10 @@ public function testShortcutSetMigration() { * The expected shortcut set label. * @param int $expected_size * The number of shortcuts expected to be in the set. + * + * @internal */ - protected function assertEntity($id, $label, $expected_size) { + protected function assertEntity(string $id, string $label, int $expected_size): void { $shortcut_set = ShortcutSet::load($id); $this->assertInstanceOf(ShortcutSetInterface::class, $shortcut_set); /** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */ diff --git a/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php b/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php index 6e1b4fefe03e523ca53bf10c6aa586883c26dae0..bf9d9bbf1b3bee8b9512a0c77afa0e6cb79726b6 100644 --- a/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php +++ b/core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php @@ -48,13 +48,15 @@ protected function setUp(): void { * The expected weight of the shortcut. * @param string $url * The expected URL of the shortcut. + * + * @internal */ - protected function assertEntity($id, $title, $weight, $url) { + protected function assertEntity(int $id, string $title, int $weight, string $url): void { $shortcut = Shortcut::load($id); $this->assertInstanceOf(ShortcutInterface::class, $shortcut); /** @var \Drupal\shortcut\ShortcutInterface $shortcut */ $this->assertSame($title, $shortcut->getTitle()); - $this->assertSame($weight, $shortcut->getWeight()); + $this->assertSame($weight, (int) $shortcut->getWeight()); $this->assertSame($url, $shortcut->getUrl()->toString()); } @@ -63,10 +65,10 @@ protected function assertEntity($id, $title, $weight, $url) { */ public function testShortcutMigration() { // Check if the 4 shortcuts were migrated correctly. - $this->assertEntity(1, 'Add content', '-20', '/node/add'); - $this->assertEntity(2, 'Find content', '-19', '/admin/content'); - $this->assertEntity(3, 'Help', '-49', '/admin/help'); - $this->assertEntity(4, 'People', '-50', '/admin/people'); + $this->assertEntity(1, 'Add content', -20, '/node/add'); + $this->assertEntity(2, 'Find content', -19, '/admin/content'); + $this->assertEntity(3, 'Help', -49, '/admin/help'); + $this->assertEntity(4, 'People', -50, '/admin/people'); } } diff --git a/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php index 7e31b6a308f9a837b534d98100741a41e335b693..f42079f74a7353f2063cf8bbe66db3d2f9aece7f 100644 --- a/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php @@ -77,8 +77,10 @@ public function testStatisticsSettings() { * The expected day count. * @param int $timestamp * The expected timestamp. + * + * @internal */ - protected function assertNodeCounter($nid, $total_count, $day_count, $timestamp) { + protected function assertNodeCounter(int $nid, int $total_count, int $day_count, int $timestamp): void { /** @var \Drupal\statistics\StatisticsViewsResult $statistics */ $statistics = $this->container->get('statistics.storage.node')->fetchView($nid); $this->assertSame($total_count, $statistics->getTotalCount()); diff --git a/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php index f2041654f285b48033d8555c85ce9ba2b2733947..7f8c319831e56f67e4071270dc9b84c65f7dc77e 100644 --- a/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php @@ -68,8 +68,10 @@ public function testStatisticsSettings() { * The expected day count. * @param int $timestamp * The expected timestamp. + * + * @internal */ - protected function assertNodeCounter($nid, $total_count, $day_count, $timestamp) { + protected function assertNodeCounter(int $nid, int $total_count, int $day_count, int $timestamp): void { /** @var \Drupal\statistics\StatisticsViewsResult $statistics */ $statistics = $this->container->get('statistics.storage.node')->fetchView($nid); $this->assertSame($total_count, $statistics->getTotalCount()); diff --git a/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php b/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php index 402ac866622ef16856fdc7d33bacb07669940ed8..de95fb5761684f511f8a9be6d5bf5940db277eb9 100644 --- a/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php +++ b/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php @@ -107,12 +107,14 @@ public function testAJAXRenderError() { * the actual command contains additional settings that aren't part of * $needle. * - * @param $haystack + * @param array $haystack * An array of rendered Ajax commands returned by the server. - * @param $needle + * @param array $needle * Array of info we're expecting in one of those commands. + * + * @internal */ - protected function assertCommand($haystack, $needle) { + protected function assertCommand(array $haystack, array $needle): void { $found = FALSE; foreach ($haystack as $command) { // If the command has additional settings that we're not testing for, do diff --git a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php index e624e4c1decf759e5c1ece94519af9130dbc7cf8..430883e7cbd10a2f1aa824830cd9137724a19f19 100644 --- a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php +++ b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php @@ -221,16 +221,13 @@ public function testBatchLargePercentage() { * Triggers a pass if the texts were found in order in the raw content. * * @param $texts - * Array of raw strings to look for . - * @param $message - * Message to display. + * Array of raw strings to look for. * - * @return - * TRUE on pass, FALSE on fail. + * @internal */ - public function assertBatchMessages($texts, $message) { + public function assertBatchMessages(array $texts): void { $pattern = '|' . implode('.*', $texts) . '|s'; - return $this->assertSession()->responseMatches($pattern); + $this->assertSession()->responseMatches($pattern); } /** diff --git a/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php b/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php index e7561716cbb4926a248eddaa8ce124b44c9fd36f..dca3999efc5941b601fb2845616e1e5afd79c68d 100644 --- a/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php +++ b/core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php @@ -62,8 +62,10 @@ public function testCacheContext() { /** * Asserts whether a session cookie is present on the client or not. + * + * @internal */ - public function assertSessionCookieOnClient($expected_present) { + public function assertSessionCookieOnClient(bool $expected_present): void { $this->assertEquals($expected_present, (bool) $this->getSession()->getCookie($this->getSessionName()), 'Session cookie exists.'); } diff --git a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php index 148d025e8dfeece48316170271d5cd4bfa21a293..4e064969f8fd58200c273319ff214313591c064f 100644 --- a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php +++ b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php @@ -47,8 +47,10 @@ public function testNoJavaScript() { /** * Passes if no JavaScript is found on the page. + * + * @internal */ - protected function assertNoJavaScript() { + protected function assertNoJavaScript(): void { // Ensure drupalSettings is not set. $settings = $this->getDrupalSettings(); $this->assertTrue(empty($settings), 'drupalSettings is not set.'); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php b/core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php index 1ab19c710c1b30f26ff4254167d7e655bc5b7d1c..8f6a4fcaa34c56d582e41925beefe3f12a74201e 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php @@ -91,8 +91,10 @@ protected function setUp(): void { * An array of tests to run. * @param string $handler_name * The name of the entity type selection handler being tested. + * + * @internal */ - protected function assertReferenceable(array $selection_options, $tests, $handler_name) { + protected function assertReferenceable(array $selection_options, array $tests, string $handler_name): void { $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getInstance($selection_options); foreach ($tests as $test) { diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php index 5be7c331889da395641a17ce68611434633634b1..1cd9a8eb7482cb0a0efc71dffcff184c03b56ed1 100644 --- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php @@ -79,13 +79,13 @@ public function testConfirmFormWithExternalDestination() { * The url to check for. * @param string $message * The assert message. - * @param string $group - * The assertion group. + * + * @internal */ - public function assertCancelLinkUrl(Url $url, $message = '', $group = 'Other') { + public function assertCancelLinkUrl(Url $url, string $message = ''): void { $links = $this->xpath('//a[@href=:url]', [':url' => $url->toString()]); $message = ($message ? $message : new FormattableMarkup('Cancel link with URL %url found.', ['%url' => $url->toString()])); - $this->assertTrue(isset($links[0]), $message, $group); + $this->assertTrue(isset($links[0]), $message); } } diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 860ff8dd007782384a64875528f93d53cee03670..7c4eddd2fd38f7f331b52c35c9f3bdd553600b40 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -790,8 +790,10 @@ public function testDisabledElements() { /** * Assert that the values submitted to a form matches the default values of the elements. + * + * @internal */ - public function assertFormValuesDefault($values, $form) { + public function assertFormValuesDefault(array $values, array $form): void { foreach (Element::children($form) as $key) { if (isset($form[$key]['#default_value'])) { if (isset($form[$key]['#expected_value'])) { diff --git a/core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php b/core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php index ca1af095f3ba309467014ca66f4a6f7cf6a76871..ecb9e260547048b81d133ac977da817c6a071aad 100644 --- a/core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php +++ b/core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php @@ -41,18 +41,20 @@ protected function stringToHtml($text) { /** * Helper function to test \Drupal\Core\Mail\MailFormatHelper::htmlToText(). * - * @param $html + * @param string $html * The source HTML string to be converted. - * @param $text + * @param string $text * The expected result of converting $html to text. - * @param $message + * @param string $message * A text message to display in the assertion message. - * @param $allowed_tags + * @param array|null $allowed_tags * (optional) An array of allowed tags, or NULL to default to the full * set of tags supported by * \Drupal\Core\Mail\MailFormatHelper::htmlToText(). + * + * @internal */ - protected function assertHtmlToText($html, $text, $message, $allowed_tags = NULL) { + protected function assertHtmlToText(string $html, string $text, string $message, ?array $allowed_tags = NULL): void { preg_match_all('/<([a-z0-6]+)/', mb_strtolower($html), $matches); $tested_tags = implode(', ', array_unique($matches[1])); $message .= ' (' . $tested_tags . ')'; diff --git a/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php b/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php index fcea5966ad9252536deeda082e5c12c4e389e887..f4ca2ab86ef8457fd09025f0298409fb378a9a2e 100644 --- a/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php +++ b/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php @@ -70,8 +70,10 @@ public function testLocalAction() { * * @param array $actions * A list of expected action link titles, keyed by the hrefs. + * + * @internal */ - protected function assertLocalAction(array $actions) { + protected function assertLocalAction(array $actions): void { $elements = $this->xpath('//a[contains(@class, :class)]', [ ':class' => 'button-action', ]); diff --git a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php index 7c74f5aaedf8c7bb51ba7c60daff406f65420d24..c9ddfb282402cff0043f78f6c3730dc4801f7a54 100644 --- a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php +++ b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php @@ -51,8 +51,10 @@ protected function setUp(): void { * @param int $level * (optional) The local tasks level to assert; 0 for primary, 1 for * secondary. Defaults to 0. + * + * @internal */ - protected function assertLocalTasks(array $routes, $level = 0) { + protected function assertLocalTasks(array $routes, int $level = 0): void { $elements = $this->xpath('//*[contains(@class, :class)]//a', [ ':class' => $level == 0 ? 'tabs primary' : 'tabs secondary', ]); @@ -71,15 +73,14 @@ protected function assertLocalTasks(array $routes, $level = 0) { * @param string $title * The expected title. * - * @return bool - * TRUE if the local task exists on the page. + * @internal */ - protected function assertLocalTaskAppears($title) { + protected function assertLocalTaskAppears(string $title): void { // SimpleXML gives us the unescaped text, not the actual escaped markup, // so use a pattern instead to check the raw content. // This behavior is a bug in libxml, see // https://bugs.php.net/bug.php?id=49437. - return $this->assertSession()->responseMatches('@<a [^>]*>' . preg_quote($title, '@') . '</a>@'); + $this->assertSession()->responseMatches('@<a [^>]*>' . preg_quote($title, '@') . '</a>@'); } /** @@ -88,8 +89,10 @@ protected function assertLocalTaskAppears($title) { * @param int $level * (optional) The local tasks level to assert; 0 for primary, 1 for * secondary. Defaults to 0. + * + * @internal */ - protected function assertNoLocalTasks($level = 0) { + protected function assertNoLocalTasks(int $level = 0): void { $elements = $this->xpath('//*[contains(@class, :class)]//a', [ ':class' => $level == 0 ? 'tabs primary' : 'tabs secondary', ]); diff --git a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php index 9b6a3cb856f36c6213e861b256951b6be2efd293..11030908cc23a4094babbda0d19f16b927c3fdf3 100644 --- a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php @@ -231,8 +231,10 @@ public function testInstallUninstall() { * * @param string $name * Name of the module to check. + * + * @internal */ - protected function assertModuleNotInstalled($name) { + protected function assertModuleNotInstalled(string $name): void { $this->assertModules([$name], FALSE); $this->assertModuleTablesDoNotExist($name); } @@ -242,8 +244,10 @@ protected function assertModuleNotInstalled($name) { * * @param string $name * Name of the module to check. + * + * @internal */ - protected function assertModuleSuccessfullyInstalled($name) { + protected function assertModuleSuccessfullyInstalled(string $name): void { $this->assertModules([$name], TRUE); $this->assertModuleTablesExist($name); $this->assertModuleConfig($name); @@ -257,8 +261,10 @@ protected function assertModuleSuccessfullyInstalled($name) { * @param string $package * (optional) The package of the module to uninstall. Defaults * to 'Core'. + * + * @internal */ - protected function assertSuccessfulUninstall($module, $package = 'Core') { + protected function assertSuccessfulUninstall(string $module, string $package = 'Core'): void { $edit = []; $edit['uninstall[' . $module . ']'] = TRUE; $this->drupalGet('admin/modules/uninstall'); @@ -286,8 +292,10 @@ protected function assertSuccessfulUninstall($module, $package = 'Core') { * * @param string $module * The module that got installed. + * + * @internal */ - protected function assertInstallModuleUpdates($module) { + protected function assertInstallModuleUpdates(string $module): void { /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $all_update_functions = $post_update_registry->getPendingUpdateFunctions(); @@ -323,8 +331,10 @@ protected function assertInstallModuleUpdates($module) { * * @param string $module * The module that got installed. + * + * @internal */ - protected function assertUninstallModuleUpdates($module) { + protected function assertUninstallModuleUpdates(string $module): void { /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */ $post_update_registry = \Drupal::service('update.post_update_registry'); $all_update_functions = $post_update_registry->getPendingUpdateFunctions(); @@ -350,8 +360,10 @@ protected function assertUninstallModuleUpdates($module) { * Machine name of the module to verify. * @param string $name * Human-readable name of the module to verify. + * + * @internal */ - protected function assertHelp($module, $name) { + protected function assertHelp(string $module, string $name): void { $this->drupalGet('admin/help/' . $module); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains($name . ' module'); diff --git a/core/modules/system/tests/src/Functional/Pager/PagerTest.php b/core/modules/system/tests/src/Functional/Pager/PagerTest.php index cc570726c37b16431f7b8655a5905278d84175da..d6f09f2174bbf2cc85322af3039ab01e81b254e4 100644 --- a/core/modules/system/tests/src/Functional/Pager/PagerTest.php +++ b/core/modules/system/tests/src/Functional/Pager/PagerTest.php @@ -216,8 +216,10 @@ public function testPagerEllipsis() { * * @param int $current_page * The current pager page the internal browser is on. + * + * @internal */ - protected function assertPagerItems($current_page) { + protected function assertPagerItems(int $current_page): void { $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']); $this->assertNotEmpty($elements, 'Pager found.'); @@ -319,8 +321,10 @@ protected function assertPagerItems($current_page) { * The class to assert. * @param string $message * (optional) A verbose message to output. + * + * @internal */ - protected function assertClass(NodeElement $element, $class, $message = NULL) { + protected function assertClass(NodeElement $element, string $class, string $message = NULL): void { if (!isset($message)) { $message = "Class .$class found."; } @@ -336,8 +340,10 @@ protected function assertClass(NodeElement $element, $class, $message = NULL) { * The class to assert. * @param string $message * (optional) A verbose message to output. + * + * @internal */ - protected function assertNoClass(NodeElement $element, $class, $message = NULL) { + protected function assertNoClass(NodeElement $element, string $class, string $message = NULL): void { if (!isset($message)) { $message = "Class .$class not found."; } diff --git a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php index 9921fe04a9001f34fc563a55c56a0fad39514630..a66e3d023260959d119411f3181449d7519e99de 100644 --- a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php +++ b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php @@ -101,8 +101,10 @@ public function testRenderCachedBlock() { /** * Helper function to make assertions about added HTTP headers. + * + * @internal */ - protected function assertTeapotHeaders() { + protected function assertTeapotHeaders(): void { $this->assertSession()->responseHeaderEquals('X-Test-Teapot', 'Teapot Mode Active'); $this->assertSession()->responseHeaderEquals('X-Test-Teapot-Replace', 'Teapot replaced'); $this->assertSession()->responseHeaderEquals('X-Test-Teapot-No-Replace', 'This value is not replaced'); @@ -110,8 +112,10 @@ protected function assertTeapotHeaders() { /** * Helper function to make assertions about the presence of an RSS feed. + * + * @internal */ - protected function assertFeed() { + protected function assertFeed(): void { // Discover the DOM element for the feed link. $test_meta = $this->xpath('//head/link[@href="test://url"]'); $this->assertCount(1, $test_meta, 'Link has URL.'); @@ -135,8 +139,10 @@ protected function assertFeed() { /** * Helper function to make assertions about HTML head elements. + * + * @internal */ - protected function assertHead() { + protected function assertHead(): void { // Discover the DOM element for the meta link. $test_meta = $this->xpath('//head/meta[@test-attribute="testvalue"]'); $this->assertCount(1, $test_meta, 'There\'s only one test attribute.'); diff --git a/core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php b/core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php index 4d6cb3928cc65da369f1fc7ecbefd0f780ae7ffa..c96f119d5f4108f13fef5d389001f69fa3ffb4a7 100644 --- a/core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php +++ b/core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php @@ -217,6 +217,8 @@ public function testPsa(): void { * The expected links' text. * @param int $error_or_warning * Whether the links are a warning or an error. Should be one of the REQUIREMENT_* constants. + * + * @internal */ private function assertAdminPageLinks(array $expected_link_texts, int $error_or_warning): void { $assert = $this->assertSession(); @@ -241,6 +243,8 @@ private function assertAdminPageLinks(array $expected_link_texts, int $error_or_ * The expected links' text. * @param int $error_or_warning * Whether the links are a warning or an error. Should be one of the REQUIREMENT_* constants. + * + * @internal */ private function assertStatusReportLinks(array $expected_link_texts, int $error_or_warning): void { $this->drupalGet(Url::fromRoute('system.status')); @@ -260,6 +264,8 @@ private function assertStatusReportLinks(array $expected_link_texts, int $error_ * The advisory links. * @param array $routes * The routes to test. + * + * @internal */ private function assertAdvisoriesNotDisplayed(array $links, array $routes = ['system.status', 'system.admin']): void { foreach ($routes as $route) { @@ -281,6 +287,8 @@ private function assertAdvisoriesNotDisplayed(array $links, array $routes = ['sy * The expected error messages. * * @see \Drupal\advisory_feed_test\TestSystemLoggerChannel::log() + * + * @internal */ protected function assertServiceAdvisoryLoggedErrors(array $expected_messages): void { $state = $this->container->get('state'); diff --git a/core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php b/core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php index 55219cd376f5a4b06645345331b5c3e9ba7abf75..5b7c31c92f87abbdbf5d328cdd7ac4bf8225cb61 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php @@ -103,8 +103,10 @@ public function testBasicAuthSession() { * A response object containing the session values and the user ID. * @param string $expected * The expected session value. + * + * @internal */ - protected function assertSessionData($response, $expected) { + protected function assertSessionData(string $response, string $expected): void { $response = json_decode($response, TRUE); $this->assertEquals(['test_value' => $expected], $response['session'], 'The session data matches the expected value.'); diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php index 0b679ad373e5e0a568c8fdfcaf151c600a6e5bd1..8b123f0882a729d4e833ef4cc5573c666113c574 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php @@ -254,12 +254,14 @@ protected function getPathFromLocationHeader(ResponseInterface $response, $https /** * Tests that there exists a session with two specific session IDs. * - * @param $sid + * @param string $sid * The insecure session ID to search for. - * @param $assertion_text + * @param string $assertion_text * The text to display when we perform the assertion. + * + * @internal */ - protected function assertSessionIds($sid, $assertion_text) { + protected function assertSessionIds(string $sid, string $assertion_text): void { $this->assertNotEmpty(\Drupal::database()->select('sessions', 's')->fields('s', ['timestamp'])->condition('sid', Crypt::hashBase64($sid))->execute()->fetchField(), $assertion_text); } diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php index b07b8cb55b97df78524db2008434778f8d498512..10c8f55b4704148a8f289c0b32af1da98dccfe08 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -372,8 +372,10 @@ public function sessionReset() { /** * Assert whether the SimpleTest browser sent a session cookie. + * + * @internal */ - public function assertSessionCookie($sent) { + public function assertSessionCookie(bool $sent): void { if ($sent) { $this->assertNotEmpty($this->getSessionCookies()->count(), 'Session cookie was sent.'); } @@ -384,8 +386,10 @@ public function assertSessionCookie($sent) { /** * Assert whether $_SESSION is empty at the beginning of the request. + * + * @internal */ - public function assertSessionEmpty($empty) { + public function assertSessionEmpty(bool $empty): void { if ($empty) { $this->assertSession()->responseHeaderEquals('X-Session-Empty', '1'); } diff --git a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php index 5d97125dd57cc8534a2a151380df1ec00cc2ea5a..26daf6ec1c9d408239faf662423d1fe875a69096 100644 --- a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php +++ b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php @@ -150,16 +150,20 @@ public function testExceptionHandler() { /** * Helper function: assert that the error message is found. + * + * @internal */ - public function assertErrorMessage(array $error) { + public function assertErrorMessage(array $error): void { $message = new FormattableMarkup('%type: @message in %function (line ', $error); $this->assertSession()->responseContains($message); } /** * Helper function: assert that the error message is not found. + * + * @internal */ - public function assertNoErrorMessage(array $error) { + public function assertNoErrorMessage(array $error): void { $message = new FormattableMarkup('%type: @message in %function (line ', $error); $this->assertSession()->responseNotContains($message); } @@ -169,8 +173,10 @@ public function assertNoErrorMessage(array $error) { * * Ensures that no messages div exists, which proves that no messages were * generated by the error handler, not even an empty one. + * + * @internal */ - protected function assertNoMessages() { + protected function assertNoMessages(): void { $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "messages")]'); } diff --git a/core/modules/system/tests/src/Functional/System/HtaccessTest.php b/core/modules/system/tests/src/Functional/System/HtaccessTest.php index 092f57ac7020d4907d3da7ba8cf6b27e71063d60..e932fa3b348cd9009935c9af9bbacb4207d65a2f 100644 --- a/core/modules/system/tests/src/Functional/System/HtaccessTest.php +++ b/core/modules/system/tests/src/Functional/System/HtaccessTest.php @@ -139,8 +139,10 @@ public function testFileAccess() { * Path to file. Without leading slash. * @param int $response_code * The expected response code. For example: 200, 403 or 404. + * + * @internal */ - protected function assertFileAccess($path, $response_code) { + protected function assertFileAccess(string $path, int $response_code): void { $this->assertFileExists(\Drupal::root() . '/' . $path); $this->drupalGet($path); $this->assertEquals($response_code, $this->getSession()->getStatusCode(), "Response code to $path should be $response_code"); diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php index ca1c94eaf14ad00c496b912cf02173fefc59eedf..6859bf697ecd2bad9a386667ef06e2361a55f1e1 100644 --- a/core/modules/system/tests/src/Functional/System/ThemeTest.php +++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php @@ -509,7 +509,7 @@ public function testThemeSettingsNoLogoNoFavicon() { * @param string $expected_text * The expected incompatibility text. */ - private function assertThemeIncompatibleText($theme_name, $expected_text) { + private function assertThemeIncompatibleText(string $theme_name, string $expected_text): void { $this->assertSession()->elementExists('css', ".theme-info:contains(\"$theme_name\") .incompatible:contains(\"$expected_text\")"); } diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php index 39fce07d4c255fe7ee094b4563eee462cb906ad9..98388dbd1462c87d8380d610366a3b5ea54b95ed 100644 --- a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php @@ -285,8 +285,10 @@ public function providerTestThemeInstallWithModuleDependencies() { * The modules listed as being required to install the theme. * @param string $theme_name * The name of the theme. + * + * @internal */ - protected function assertUninstallableTheme(array $expected_requires_list_items, $theme_name) { + protected function assertUninstallableTheme(array $expected_requires_list_items, string $theme_name): void { $theme_container = $this->getSession()->getPage()->find('css', "h3:contains(\"$theme_name\")")->getParent(); $requires_list_items = $theme_container->findAll('css', '.theme-info__requires li'); $this->assertSameSize($expected_requires_list_items, $requires_list_items); diff --git a/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php b/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php index e123f7e051532645d61c8501f81cc02a8d725949..d2eab6684343da18e7d2478336f19f47af3c12a6 100644 --- a/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php +++ b/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php @@ -37,8 +37,10 @@ protected function setUp(): void { /** * Checks to see if a value is a Twig template. + * + * @internal */ - public function assertTwigTemplate($value, $message = '') { + public function assertTwigTemplate($value, string $message = ''): void { $this->assertInstanceOf(TemplateWrapper::class, $value, $message); } diff --git a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php index cb292abf31d76471cef865d0e907db5a90854d15..35078dc727168b60961761f6643cf1800222e72f 100644 --- a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php +++ b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php @@ -123,8 +123,10 @@ public function testEmptyTwigTransTags() { /** * Asserts Twig trans tags. + * + * @internal */ - protected function assertTwigTransTags() { + protected function assertTwigTransTags(): void { // Assert that {% trans "Hello sun." %} is translated correctly. $this->assertSession()->pageTextContains('OH HAI SUNZ'); diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php index c6b31078c2479059de315621f732a174bb33b40e..63286e8fb77211e5198678fd164acb8c313c14cb 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php @@ -803,8 +803,10 @@ public function getSystemSchema() { * The extension type, either 'module' or 'theme'. * @param string $extension_machine_name * The extension machine name. + * + * @internal */ - protected function assertInstalledExtensionConfig($extension_type, $extension_machine_name) { + protected function assertInstalledExtensionConfig(string $extension_type, string $extension_machine_name): void { $extension_config = $this->container->get('config.factory')->getEditable('core.extension'); $this->assertSame(0, $extension_config->get("$extension_type.$extension_machine_name")); } @@ -820,8 +822,10 @@ protected function assertInstalledExtensionConfig($extension_type, $extension_ma * The extension machine name. * * @throws \Behat\Mink\Exception\ResponseTextException + * + * @internal */ - protected function assertUpdateWithNoError($unexpected_error_text, $extension_type, $extension_machine_name) { + protected function assertUpdateWithNoError(string $unexpected_error_text, string $extension_type, string $extension_machine_name): void { $assert_session = $this->assertSession(); $this->drupalGet($this->statusReportUrl); $this->assertSession()->pageTextNotContains($unexpected_error_text); @@ -845,8 +849,10 @@ protected function assertUpdateWithNoError($unexpected_error_text, $extension_ty * * @throws \Behat\Mink\Exception\ExpectationException * @throws \Behat\Mink\Exception\ResponseTextException + * + * @internal */ - protected function assertErrorOnUpdate($expected_error_text, $extension_type, $extension_machine_name) { + protected function assertErrorOnUpdate(string $expected_error_text, string $extension_type, string $extension_machine_name): void { $assert_session = $this->assertSession(); $this->drupalGet($this->statusReportUrl); $this->assertSession()->pageTextContains($expected_error_text); diff --git a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php index 348c11addef1688de18a429af43cd59b2948f740..c4f6a047aaacfb2ce6cdb53e2e53f8fdf9520ce8 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php @@ -150,8 +150,10 @@ public function testNarrowWidth() { * The index of the link to test. * @param string $position * The position of the dialog to test. + * + * @internal */ - protected function assertOffCanvasDialog($link_index, $position) { + protected function assertOffCanvasDialog(int $link_index, string $position): void { $page = $this->getSession()->getPage(); $web_assert = $this->assertSession(); $link_text = "Open $position panel $link_index"; diff --git a/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php b/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php index 9c8330455629b37742b649982c8cf66c381e3667..f5f79c1d2a24cd87e6fe9fa02a1b304e3c6beec2 100644 --- a/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php +++ b/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php @@ -139,8 +139,10 @@ public function testDrupalRenderFormElements() { /** * Tests that elements are rendered properly. + * + * @internal */ - protected function assertRenderedElement(array $element, $xpath, array $xpath_args = []) { + protected function assertRenderedElement(array $element, string $xpath, array $xpath_args = []): void { $this->render($element); $xpath = $this->buildXPathQuery($xpath, $xpath_args); diff --git a/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php b/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php index 6c4e263ccf005748f8d4bd8ad232d9d73c6c0531..a7842b480a8704d17358e29c3aa12679ad7b09da 100644 --- a/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php +++ b/core/modules/system/tests/src/Kernel/Common/PageRenderTest.php @@ -36,8 +36,10 @@ public function testHookPageAlter() { * The module whose invalid logic in its hooks to enable. * @param string $hook * The page render hook to assert expected exceptions for. + * + * @internal */ - public function assertPageRenderHookExceptions($module, $hook) { + public function assertPageRenderHookExceptions(string $module, string $hook): void { $html_renderer = \Drupal::getContainer()->get('main_content_renderer.html'); // Assert a valid hook implementation doesn't trigger an exception. diff --git a/core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php b/core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php index 81356bb922641c10f65b8f993a8dce1a8a717320..a970c30257c17f206065bae46c3bac1b1ad65edc 100644 --- a/core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php +++ b/core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php @@ -254,8 +254,10 @@ protected function checkSinglePluginConfigSync(EntityWithPluginCollectionInterfa * The original data stored in the config object. * @param array $custom_data * The new data to store in the config object. + * + * @internal */ - public function assertConfigUpdateImport($name, $original_data, $custom_data) { + public function assertConfigUpdateImport(string $name, array $original_data, array $custom_data): void { $this->container->get('config.storage.sync')->write($name, $custom_data); // Verify the active configuration still returns the default values. diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php index ff33361d4f4532b77a05a5baba7cdb5f8641473c..8ca75e1065829d2ab4a1bd16195bbd072c12d4da 100644 --- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php @@ -58,10 +58,12 @@ public function testModuleList() { * * @param array $expected_values * The expected values, sorted by weight and module name. - * @param $condition + * @param string $condition * The condition being tested, such as 'After adding a module'. + * + * @internal */ - protected function assertModuleList(array $expected_values, $condition) { + protected function assertModuleList(array $expected_values, string $condition): void { $expected_values = array_values(array_unique($expected_values)); $enabled_modules = array_keys($this->container->get('module_handler')->getModuleList()); $this->assertEquals($expected_values, $enabled_modules, new FormattableMarkup('@condition: extension handler returns correct results', ['@condition' => $condition])); diff --git a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php index b0cd4ff2a906c47417a28f20d544ddea85568633..d4aac6d578abb289edcc85edf4c66e688dd21d69 100644 --- a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php +++ b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateMenuTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { /** * Asserts various aspects of a menu. * - * @param $id + * @param string $id * The menu ID. * @param string $language * The menu language. @@ -32,8 +32,10 @@ protected function setUp(): void { * The menu label. * @param $description * The menu description. + * + * @internal */ - protected function assertEntity($id, $language, $label, $description) { + protected function assertEntity(string $id, string $language, string $label, string $description): void { $navigation_menu = Menu::load($id); $this->assertSame($id, $navigation_menu->id()); $this->assertSame($language, $navigation_menu->language()->getId()); diff --git a/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php b/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php index 294b90dbb2810c1f8b0c74c00fd08f43c9da067b..70a11c4d63b3f555c220a585a3afaa0ceb4be05b 100644 --- a/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php +++ b/core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php @@ -730,6 +730,8 @@ protected function setTestFeedResponses(array $responses): void { * * @param string[] $expected_messages * The expected error messages. + * + * @internal */ protected function assertServiceAdvisoryLoggedErrors(array $expected_messages): void { $this->assertSame($expected_messages, $this->logErrorMessages); diff --git a/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php b/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php index 40c476f0b5a3e2f4ae9fa54e580c2e8ded201936..f758ddd287c9c7573aea54cc180f54c3f2d32cf0 100644 --- a/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php +++ b/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php @@ -37,8 +37,10 @@ protected function setUp(): void { /** * Checks to see if a value is a twig template. + * + * @internal */ - public function assertTwigTemplate($value, $message = '') { + public function assertTwigTemplate($value, string $message = ''): void { $this->assertInstanceOf(TemplateWrapper::class, $value, $message); } diff --git a/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php b/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php index 39a4c5d3c87799f4dcd593214346ef60c8f318c3..a07f0bd69c600581167dbd8f79b7df2ff8a189d8 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php @@ -110,14 +110,16 @@ public function testTermAccess() { * * @param \Drupal\taxonomy\TermInterface $term * A taxonomy term entity. - * @param $access_operation + * @param string $access_operation * The entity operation, e.g. 'view', 'edit', 'delete', etc. * @param bool $access_allowed * Whether the current use has access to the given operation or not. * @param string $access_reason * (optional) The reason of the access result. + * + * @internal */ - protected function assertTermAccess(TermInterface $term, $access_operation, $access_allowed, $access_reason = '') { + protected function assertTermAccess(TermInterface $term, string $access_operation, bool $access_allowed, string $access_reason = ''): void { $access_result = $term->access($access_operation, NULL, TRUE); $this->assertSame($access_allowed, $access_result->isAllowed()); diff --git a/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php b/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php index 88d3033cf942c9b103ebea7fce3936595e3cfded..ef0d06ff245e6b957db7805ea416d1ecf2c1d2b8 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php @@ -282,8 +282,10 @@ protected function createTerm($name, array $parent_ids = []) { * @param bool $selected * (optional) Whether or not the option should be selected. Defaults to * FALSE. + * + * @internal */ - protected function assertParentOption($option, $selected = FALSE) { + protected function assertParentOption(string $option, bool $selected = FALSE): void { $option = $this->assertSession()->optionExists('Parent terms', $option); if ($selected) { $this->assertTrue($option->hasAttribute('selected')); @@ -298,8 +300,10 @@ protected function assertParentOption($option, $selected = FALSE) { * * @param \Drupal\taxonomy\TermInterface $term * The term to check. + * + * @internal */ - protected function assertParentsUnchanged(TermInterface $term) { + protected function assertParentsUnchanged(TermInterface $term): void { $saved_term = $this->termStorage->load($term->id()); $expected = $term->get('parent')->getValue(); diff --git a/core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php b/core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php index 61f90cb5013efc73f9edae4503d190da3558aec9..e79e77fc77057fc00b5d8a3cdcc2f271eab886f9 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php @@ -94,8 +94,10 @@ public function testTag() { * The View to check for the term access tag. * @param bool $hasTag * The expected existence of taxonomy_term_access tag. + * + * @internal */ - protected function assertQueriesTermAccessTag(ViewExecutable $view, $hasTag) { + protected function assertQueriesTermAccessTag(ViewExecutable $view, bool $hasTag): void { $main_query = $view->build_info['query']; $count_query = $view->build_info['count_query']; diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php index dafa38e2241cdd340255ab20130ba680b3e9dfd9..2f47bae8fb7245b7073bec5ae91a1a4fc726dbef 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldFilterTest.php @@ -146,8 +146,10 @@ public function testFilters() { * that translation should be shown on the given page. * @param string $message * Message suffix to display. + * + * @internal */ - protected function assertPageCounts($path, $counts, $message) { + protected function assertPageCounts(string $path, array $counts, string $message): void { // Get the text of the page. $this->drupalGet($path); $text = $this->getTextContent(); diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php index 79f9829555e8dde28bebfa515e21e739fe285258..481a4c69d33617de37e00bef930dd5ae492b2951 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermFilterDepthTest.php @@ -137,8 +137,10 @@ public function testTermWithDepthFilter() { * The depth to search. * @param array $expected * The expected views result. + * + * @internal */ - protected function assertTermWithDepthResult($tid, $depth, array $expected) { + protected function assertTermWithDepthResult(int $tid, int $depth, array $expected): void { $this->view->destroy(); $this->view->initDisplay(); $filters = $this->view->displayHandlers->get('default') diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php index 3b66a94fb445c4f200cb6f92aa56b27d7b87d7ed..c2afbe1f336c2069a71e4a4c007b24fbe41a6b53 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php @@ -60,9 +60,9 @@ protected function setUp(): void { * The label the migrated entity should have. * @param string $expected_vid * The parent vocabulary the migrated entity should have. - * @param string $expected_description + * @param string|null $expected_description * The description the migrated entity should have. - * @param string $expected_format + * @param string|null $expected_format * The format the migrated entity should have. * @param int $expected_weight * The weight the migrated entity should have. @@ -72,8 +72,10 @@ protected function setUp(): void { * The value the migrated entity field should have. * @param int $expected_term_reference_tid * The term reference ID the migrated entity field should have. + * + * @internal */ - protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, array $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL) { + protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void { /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load($id); $this->assertInstanceOf(TermInterface::class, $entity); @@ -82,7 +84,7 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, $entity->getWeight()); + $this->assertSame($expected_weight, (int) $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } @@ -95,8 +97,10 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec * ID of the term to check. * @param array $parent_ids * The expected parent term IDs. + * + * @internal */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { + protected function assertHierarchy(string $vid, int $tid, array $parent_ids): void { if (!isset($this->treeData[$vid])) { $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); $this->treeData[$vid] = []; @@ -114,8 +118,8 @@ protected function assertHierarchy($vid, $tid, array $parent_ids) { * Tests the Drupal 6 i18n localized taxonomy term to Drupal 8 migration. */ public function testTranslatedLocalizedTaxonomyTerms() { - $this->assertEntity(14, 'en', 'Talos IV', 'vocabulary_name_much_longer_th', 'The home of Captain Christopher Pike.', NULL, '0', []); - $this->assertEntity(15, 'en', 'Vulcan', 'vocabulary_name_much_longer_th', NULL, NULL, '0', []); + $this->assertEntity(14, 'en', 'Talos IV', 'vocabulary_name_much_longer_th', 'The home of Captain Christopher Pike.', NULL, 0, []); + $this->assertEntity(15, 'en', 'Vulcan', 'vocabulary_name_much_longer_th', NULL, NULL, 0, []); /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load(14); diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php index e9f7f89f8fd5c4b89d1e588289bcfe2fac48a540..39c91d517bba918bd606d41dc3519d96aa697a1d 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php @@ -56,7 +56,7 @@ protected function setUp(): void { /** * Validate a migrated term contains the expected values. * - * @param $id + * @param int $id * Entity ID to load and check. * @param string $expected_language * The language code for this term. @@ -64,9 +64,9 @@ protected function setUp(): void { * The label the migrated entity should have. * @param $expected_vid * The parent vocabulary the migrated entity should have. - * @param string $expected_description + * @param string|null $expected_description * The description the migrated entity should have. - * @param string $expected_format + * @param string|null $expected_format * The format the migrated entity should have. * @param int $expected_weight * The weight the migrated entity should have. @@ -78,8 +78,10 @@ protected function setUp(): void { * The term reference id the migrated entity field should have. * @param bool $expected_container_flag * The term should be a container entity. + * + * @internal */ - protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, array $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL, $expected_container_flag = 0) { + protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL, bool $expected_container_flag = FALSE): void { /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load($id); $this->assertInstanceOf(TermInterface::class, $entity); @@ -88,7 +90,7 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec $this->assertEquals($expected_vid, $entity->bundle()); $this->assertEquals($expected_description, $entity->getDescription()); $this->assertEquals($expected_format, $entity->getFormat()); - $this->assertEquals($expected_weight, $entity->getWeight()); + $this->assertEquals($expected_weight, (int) $entity->getWeight()); $this->assertEquals($expected_parents, $this->getParentIDs($id)); $this->assertHierarchy($expected_vid, $id, $expected_parents); if (!is_null($expected_field_integer_value)) { @@ -228,7 +230,7 @@ protected function getParentIDs($tid) { * @param array $parent_ids * The expected parent term IDs. */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { + protected function assertHierarchy(string $vid, int $tid, array $parent_ids): void { if (!isset($this->treeData[$vid])) { $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); $this->treeData[$vid] = []; diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php index c85a52f6d1db53e8ec95b8736bcfcff38e416e96..bd37bf6e319d35b4f984613a92d17ba41bbbed74 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php @@ -71,9 +71,9 @@ protected function setUp(): void { * The label the migrated entity should have. * @param string $expected_vid * The parent vocabulary the migrated entity should have. - * @param string $expected_description + * @param string|null $expected_description * The description the migrated entity should have. - * @param string $expected_format + * @param string|null $expected_format * The format the migrated entity should have. * @param int $expected_weight * The weight the migrated entity should have. @@ -83,8 +83,10 @@ protected function setUp(): void { * The value the migrated entity field should have. * @param int $expected_term_reference_tid * The term reference ID the migrated entity field should have. + * + * @internal */ - protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, array $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL) { + protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void { /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load($id); $this->assertInstanceOf(TermInterface::class, $entity); @@ -93,7 +95,7 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, $entity->getWeight()); + $this->assertSame($expected_weight, (int) $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } @@ -106,8 +108,10 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec * ID of the term to check. * @param array $parent_ids * The expected parent term IDs. + * + * @internal */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { + protected function assertHierarchy(string $vid, int $tid, array $parent_ids): void { if (!isset($this->treeData[$vid])) { $tree = \Drupal::entityTypeManager() ->getStorage('taxonomy_term') diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php index ef8d3eda6df3b9fd66c9a4f2bb94d34530724f18..979d5b5ac1fb4192cc0f48196c3f99eb96fd5b46 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php @@ -29,7 +29,7 @@ protected function setUp(): void { /** * Validate a migrated vocabulary contains the expected values. * - * @param $id + * @param string $id * Entity ID to load and check. * @param $expected_label * The label the migrated entity should have. @@ -37,14 +37,16 @@ protected function setUp(): void { * The description the migrated entity should have. * @param $expected_weight * The weight the migrated entity should have. + * + * @internal */ - protected function assertEntity($id, $expected_label, $expected_description, $expected_weight) { + protected function assertEntity(string $id, string $expected_label, string $expected_description, int $expected_weight): void { /** @var \Drupal\taxonomy\VocabularyInterface $entity */ $entity = Vocabulary::load($id); $this->assertInstanceOf(VocabularyInterface::class, $entity); $this->assertSame($expected_label, $entity->label()); $this->assertSame($expected_description, $entity->getDescription()); - $this->assertSame($expected_weight, $entity->get('weight')); + $this->assertSame($expected_weight, (int) $entity->get('weight')); } /** diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php index 5c011bf93680478354295b682dd3a34377c7ce27..fb0d80b1b5ac266dc2e7ade65c1341ff83facc5d 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php @@ -68,8 +68,10 @@ protected function setUp(): void { * The value the migrated entity field should have. * @param int $expected_term_reference_tid * The term reference ID the migrated entity field should have. + * + * @internal */ - protected function assertEntity($id, $expected_language, $expected_label, $expected_vid, $expected_description = '', $expected_format = NULL, $expected_weight = 0, array $expected_parents = [], $expected_field_integer_value = NULL, $expected_term_reference_tid = NULL) { + protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, string $expected_description = '', string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL): void { /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load($id); $this->assertInstanceOf(TermInterface::class, $entity); @@ -78,7 +80,7 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec $this->assertSame($expected_vid, $entity->bundle()); $this->assertSame($expected_description, $entity->getDescription()); $this->assertSame($expected_format, $entity->getFormat()); - $this->assertSame($expected_weight, $entity->getWeight()); + $this->assertSame($expected_weight, (int) $entity->getWeight()); $this->assertHierarchy($expected_vid, $id, $expected_parents); } @@ -91,8 +93,10 @@ protected function assertEntity($id, $expected_language, $expected_label, $expec * ID of the term to check. * @param array $parent_ids * The expected parent term IDs. + * + * @internal */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { + protected function assertHierarchy(string $vid, int $tid, array $parent_ids): void { if (!isset($this->treeData[$vid])) { $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); $this->treeData[$vid] = []; @@ -110,9 +114,9 @@ protected function assertHierarchy($vid, $tid, array $parent_ids) { * Tests the Drupal 6 i18n localized taxonomy term to Drupal 8 migration. */ public function testTranslatedLocalizedTaxonomyTerms() { - $this->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', '0', []); - $this->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', '0', []); - $this->assertEntity(25, 'en', 'Emissary', 'vocablocalized2', 'Pilot episode', 'filtered_html', '0', []); + $this->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', 0, []); + $this->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', 0, []); + $this->assertEntity(25, 'en', 'Emissary', 'vocablocalized2', 'Pilot episode', 'filtered_html', 0, []); /** @var \Drupal\taxonomy\TermInterface $entity */ $entity = Term::load(19); diff --git a/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php b/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php index 444bb85a86bad9155b6bc491ab9c632b3d0f3a29..02683a629122ccc1d2745768efe74cdfcc490ae6 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php @@ -134,8 +134,10 @@ protected function setupQueryTagTestHooks() { * @param int $expected_specific_invocations * The number of times the tag-specific query_alter hooks are expected to * have been invoked. + * + * @internal */ - protected function assertQueryTagTestResult($expected_generic_invocations, $expected_specific_invocations) { + protected function assertQueryTagTestResult(int $expected_generic_invocations, int $expected_specific_invocations): void { $state = $this->container->get('state'); $this->assertEquals($expected_generic_invocations, $state->get('taxonomy_test_query_alter')); $this->assertEquals($expected_specific_invocations, $state->get('taxonomy_test_query_term_access_alter')); diff --git a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php index 1a04055ef5794f00674a7dea4bd38f61ca79ac64..bd03bb13bc264beceb66e5d84e20263ab3964621 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php @@ -178,6 +178,8 @@ public function testTermWithDepthFilter(): void { * The depth to search. * @param bool $break_phrase * Whether to break the argument up into multiple terms. + * + * @internal */ protected function assertTermWithDepthResult(array $expected, $tid, int $depth, bool $break_phrase = FALSE): void { $this->view->destroy(); diff --git a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermFilterDepthTest.php b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermFilterDepthTest.php index f679633af8bedc8ef82f2437916dbb836c652e72..51c7c53009843c3d0a39a9ad8cd1d3f396fd9254 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermFilterDepthTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermFilterDepthTest.php @@ -155,6 +155,8 @@ public function testTermWithDepthFilter(): void { * The term ID or IDs to filter on. * @param int $depth * The depth to search. + * + * @internal */ protected function assertTermWithDepthResult(array $expected, $tid, int $depth): void { $this->view->destroy(); diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php index 2c51a91ea4981b9798a46fcfbb75a10cdf1a0271..12f8b9dc2135cb8e86e14669c9d0c7cfce64dcf7 100644 --- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php @@ -40,8 +40,10 @@ protected function setUp(): void { /** * Helper to test toggling the summary area. + * + * @internal */ - protected function assertSummaryToggle() { + protected function assertSummaryToggle(): void { $this->drupalGet('node/add/page'); $widget = $this->getSession()->getPage()->findById('edit-body-wrapper'); $summary_field = $widget->findField('edit-body-0-summary'); diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php index c1e79d241578c99f7cb86182b040aaaab6b89324..5537e74acc0cd7d2ae0376c50c5c9ac8e480963c 100644 --- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php +++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php @@ -238,8 +238,10 @@ public function testInvalidFilterFormat() { /** * Calls text_summary() and asserts that the expected teaser is returned. + * + * @internal */ - public function assertTextSummary($text, $expected, $format = NULL, $size = NULL) { + public function assertTextSummary(string $text, string $expected, ?string $format = NULL, int $size = NULL): void { $summary = text_summary($text, $format, $size); $this->assertSame($expected, $summary, new FormattableMarkup('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', ['@actual' => $summary, '@expected' => $expected])); } diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php index 65975d1e25ba4d454ce32fdb0542379246d3e049..2b2ef5a3c99c917037ece28f8edeb2f8c60e6747 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php @@ -453,8 +453,10 @@ private function getSubtreesHash() { /** * Asserts the subtrees hash on a fresh page GET is different from the hash * from the previous page GET. + * + * @internal */ - private function assertDifferentHash() { + private function assertDifferentHash(): void { // Request a new page to refresh the drupalSettings object. $this->drupalGet('test-page'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php index 5de4c2d8b62d0980f5d54b11997d093e67261bf9..c7ff8b304f489b45ce6f7945b92d4f41e3a355a2 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php @@ -107,8 +107,10 @@ public function testToolbarCacheContextsCaller() { * Expected cache contexts for both users. * @param string $message * (optional) A verbose message to output. + * + * @internal */ - protected function assertToolbarCacheContexts(array $cache_contexts, $message = NULL) { + protected function assertToolbarCacheContexts(array $cache_contexts, string $message = NULL): void { // Default cache contexts that should exist on all test cases. $default_cache_contexts = [ 'languages:language_interface', diff --git a/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php b/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php index f33a80f5f7d3569de3162f6819edd417ea188b55..eefdc4d52c9de16d211e1f027e1abcf28163f0e7 100644 --- a/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php +++ b/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php @@ -92,8 +92,10 @@ public function testTourTipMarkup(string $path, string $theme = NULL) { * The expected position of the nub arrow. * @param string $joyride_content_container_name * For identifying classnames specific to a tip type. + * + * @internal */ - private function assertToolTipMarkup($index, $nub_position, $joyride_content_container_name = 'body') { + private function assertToolTipMarkup(int $index, string $nub_position, string $joyride_content_container_name = 'body'): void { $assert_session = $this->assertSession(); $tip = $assert_session->waitForElementVisible('css', ".joyride-tip-guide[data-index=\"$index\"]"); $this->assertNotNull($tip, 'The tour tip element is present.'); diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php index 4c01a0d06dc14ebe3efd23972e4d3812380cfcf5..b3515564535a67cc2648e84f4f1872edc46dba86 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -474,8 +474,10 @@ public function testTrackerAdminUnpublish() { * data-history-node-last-comment-timestamp attribute. * @param bool $library_is_present * Whether the drupal.tracker-history library should be present or not. + * + * @internal */ - public function assertHistoryMetadata($node_id, $node_timestamp, $node_last_comment_timestamp, $library_is_present = TRUE) { + public function assertHistoryMetadata(int $node_id, int $node_timestamp, int $node_last_comment_timestamp, bool $library_is_present = TRUE): void { $settings = $this->getDrupalSettings(); $this->assertSame($library_is_present, isset($settings['ajaxPageState']) && in_array('tracker/history', explode(',', $settings['ajaxPageState']['libraries'])), 'drupal.tracker-history library is present.'); $this->assertCount(1, $this->xpath('//table/tbody/tr/td[@data-history-node-id="' . $node_id . '" and @data-history-node-timestamp="' . $node_timestamp . '"]'), 'Tracker table cell contains the data-history-node-id and data-history-node-timestamp attributes for the node.'); diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index 3b07f69161d20c9b266598de52abd01d14e776e8..30898f0c2d9d6851cbb68d9ba56c058a5a65b909 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -871,8 +871,10 @@ public function testNonStandardVersionStrings() { * The expected release title. * @param bool $is_compatible * If the update is compatible with the installed version of Drupal. + * + * @internal */ - protected function assertCoreCompatibilityMessage($version, $expected_range, $expected_release_title, $is_compatible = TRUE) { + protected function assertCoreCompatibilityMessage(string $version, string $expected_range, string $expected_release_title, bool $is_compatible = TRUE): void { $update_element = $this->findUpdateElementByLabel($expected_release_title); $this->assertTrue($update_element->hasLink($version)); $compatibility_details = $update_element->find('css', '.project-update__compatibility-details details'); diff --git a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php index 7bcdf26583cc721d6b50be86bde31601d372427b..302944f924ed12822ff47c60f067dc0257c47a5f 100644 --- a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php +++ b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php @@ -256,7 +256,7 @@ protected function setUpAuthorization($method) { /** * {@inheritdoc} */ - protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) {} + protected function assertNormalizationEdgeCases($method, Url $url, array $request_options): void {} /** * {@inheritdoc} diff --git a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php index 87c68c2c718d8471a4e08b7349d18a9ba9dad8c9..7751707a13987c42df15d1837d31000a6826f6f3 100644 --- a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php @@ -325,12 +325,14 @@ public function testGlobalLoginFloodControl() { * The response object. * @param int $expected_code * The expected status code. - * @param mixed $expected_body + * @param string $expected_body * The expected response body. + * + * @internal */ - protected function assertHttpResponse(ResponseInterface $response, $expected_code, $expected_body) { + protected function assertHttpResponse(ResponseInterface $response, int $expected_code, string $expected_body): void { $this->assertEquals($expected_code, $response->getStatusCode()); - $this->assertEquals($expected_body, (string) $response->getBody()); + $this->assertEquals($expected_body, $response->getBody()); } /** @@ -344,8 +346,10 @@ protected function assertHttpResponse(ResponseInterface $response, $expected_cod * The expected message encoded in response. * @param string $format * The format that the response is encoded in. + * + * @internal */ - protected function assertHttpResponseWithMessage(ResponseInterface $response, $expected_code, $expected_message, $format = 'json') { + protected function assertHttpResponseWithMessage(ResponseInterface $response, int $expected_code, string $expected_message, string $format = 'json'): void { $this->assertEquals($expected_code, $response->getStatusCode()); $this->assertEquals($expected_message, $this->getResultValue($response, 'message', $format)); } diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php index 778f1744853caa01dff757efa2d266e3c5a59341..cbc3b29cbeb45fa5681775706a4f6440f511dfef 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -188,15 +188,16 @@ public function testCookiesNotAccepted() { * * @param \Drupal\user\Entity\User $account * A user object with name and passRaw attributes for the login attempt. - * @param mixed $flood_trigger + * @param string $flood_trigger * (optional) Whether or not to expect that the flood control mechanism * will be triggered. Defaults to NULL. * - Set to 'user' to expect a 'too many failed logins error. - * - Set to any value to expect an error for too many failed logins per IP - * . + * - Set to any value to expect an error for too many failed logins per IP. * - Set to NULL to expect a failed login. + * + * @internal */ - public function assertFailedLogin($account, $flood_trigger = NULL) { + public function assertFailedLogin(User $account, string $flood_trigger = NULL): void { $database = \Drupal::database(); $edit = [ 'name' => $account->getAccountName(), diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index 775f2806c1d331fef917ffb44b5d2e13c1f180e6..e984c466edd0b3852373531bd157144027c83b03 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -486,8 +486,10 @@ public function testUserResetPasswordUserFloodControlIsCleared() { /** * Helper function to make assertions about a valid password reset. + * + * @internal */ - public function assertValidPasswordReset($name) { + public function assertValidPasswordReset(string $name): void { $this->assertSession()->pageTextContains("If $name is a valid account, an email will be sent with instructions to reset your password."); $this->assertMail('to', $this->account->getEmail(), 'Password e-mail sent to user.'); $subject = 'Replacement login information for ' . $this->account->getAccountName() . ' at Drupal'; @@ -499,8 +501,10 @@ public function assertValidPasswordReset($name) { * * @param string $name * The user name. + * + * @internal */ - public function assertNoValidPasswordReset($name) { + public function assertNoValidPasswordReset(string $name): void { // This message is the same as the valid reset for privacy reasons. $this->assertSession()->pageTextContains("If $name is a valid account, an email will be sent with instructions to reset your password."); // The difference is that no email is sent. @@ -509,15 +513,19 @@ public function assertNoValidPasswordReset($name) { /** * Makes assertions about a password reset triggering IP flood control. + * + * @internal */ - public function assertPasswordIpFlood() { + public function assertPasswordIpFlood(): void { $this->assertSession()->pageTextContains('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'); } /** * Makes assertions about a password reset not triggering IP flood control. + * + * @internal */ - public function assertNoPasswordIpFlood() { + public function assertNoPasswordIpFlood(): void { $this->assertSession()->pageTextNotContains('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'); } diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index 4575ee9ba8e81db4c00aeb4b4d774d99522d0629..bd4d375b8963a61057a706e74d48594ba5afb522 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -397,8 +397,10 @@ public function testRegistrationWithUserFields() { /** * Asserts the presence of cache tags on registration form with user fields. + * + * @internal */ - protected function assertRegistrationFormCacheTagsWithUserFields() { + protected function assertRegistrationFormCacheTagsWithUserFields(): void { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:core.entity_form_display.user.user.register'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:field.field.user.user.test_user_field'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:field.storage.user.test_user_field'); diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php index ffeb2442ba7aff79564d3a113f49c2a4dbe77055..d31525e02088a7840acf63e4e0c8e0c66539fc26 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php @@ -51,12 +51,12 @@ public function testUserPictures() { // Tests the D6 user pictures migration in combination with D6 file. $this->setUpMigratedFiles(); - $this->assertEntity(1, 'image-test.jpg', '1901', 'public://image-test.jpg', 'image/jpeg', '2'); - $this->assertEntity(2, 'image-test.png', '125', 'public://image-test.png', 'image/png', '8'); - $this->assertEntity(3, 'Image1.png', '39325', 'public://image-1.png', 'image/png', '1'); - $this->assertEntity(4, 'Image2.jpg', '1831', 'public://image-2.jpg', 'image/jpeg', '1'); - $this->assertEntity(5, 'Image-test.gif', '183', 'public://image-test.gif', 'image/jpeg', '1'); - $this->assertEntity(6, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1'); + $this->assertEntity(1, 'image-test.jpg', 1901, 'public://image-test.jpg', 'image/jpeg', 2); + $this->assertEntity(2, 'image-test.png', 125, 'public://image-test.png', 'image/png', 8); + $this->assertEntity(3, 'Image1.png', 39325, 'public://image-1.png', 'image/png', 1); + $this->assertEntity(4, 'Image2.jpg', 1831, 'public://image-2.jpg', 'image/jpeg', 1); + $this->assertEntity(5, 'Image-test.gif', 183, 'public://image-test.gif', 'image/jpeg', 1); + $this->assertEntity(6, 'html-1.txt', 24, 'public://html-1.txt', 'text/plain', 1); } /** @@ -74,16 +74,18 @@ public function testUserPictures() { * The expected MIME type. * @param int $uid * The expected file owner ID. + * + * @internal */ - protected function assertEntity($fid, $name, $size, $uri, $type, $uid) { + protected function assertEntity(int $fid, string $name, int $size, string $uri, string $type, int $uid): void { /** @var \Drupal\file\FileInterface $file */ $file = File::load($fid); $this->assertInstanceOf(FileInterface::class, $file); $this->assertSame($name, $file->getFilename()); - $this->assertSame($size, $file->getSize()); + $this->assertSame($size, (int) $file->getSize()); $this->assertSame($uri, $file->getFileUri()); $this->assertSame($type, $file->getMimeType()); - $this->assertSame($uid, $file->getOwnerId()); + $this->assertSame($uid, (int) $file->getOwnerId()); } } diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php index cab4de4a5e5f8477bd7bd187a6d3b126586756df..ea6f946358aec23e029bd4b0816c9cf2f4687643 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php @@ -33,8 +33,10 @@ protected function setUp(): void { * The original numeric ID of the role in the source database. * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $id_map * The map table plugin. + * + * @internal */ - protected function assertRole($id, array $permissions, $lookupId, MigrateIdMapInterface $id_map) { + protected function assertRole(string $id, array $permissions, int $lookupId, MigrateIdMapInterface $id_map): void { /** @var \Drupal\user\RoleInterface $role */ $role = Role::load($id); $this->assertInstanceOf(RoleInterface::class, $role); @@ -49,8 +51,10 @@ protected function assertRole($id, array $permissions, $lookupId, MigrateIdMapIn * * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $id_map * The map table plugin. + * + * @internal */ - protected function assertRoles(MigrateIdMapInterface $id_map) { + protected function assertRoles(MigrateIdMapInterface $id_map): void { // The permissions for each role are found in the two tables in the Drupal 6 // source database. One is the permission table and the other is the diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php index 9b3495028efed4540d319651760394eb9bfb21c5..4d7fcd66b73729fd0e1fee20b5e8379972db7330 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php @@ -29,10 +29,12 @@ protected function setUp(): void { * The role ID. * @param string $label * The role's expected label. - * @param int|null $original_rid + * @param int $original_rid * The original (integer) ID of the role, to check permissions. + * + * @internal */ - protected function assertEntity($id, $label, $original_rid) { + protected function assertEntity(string $id, string $label, int $original_rid): void { /** @var \Drupal\user\RoleInterface $entity */ $entity = Role::load($id); $this->assertInstanceOf(RoleInterface::class, $entity); diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php index 655b460f47aec27409af4b8d74b203184b51acbe..f8c533bc6efd03951bfcb374d98076871d1ebfe4 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php @@ -79,24 +79,26 @@ protected function setUp(): void { * The user's initial email address. * @param string[] $roles * Role IDs the user account is expected to have. - * @param int $field_integer + * @param array|null $field_integer * The value of the integer field. * @param int|false $field_file_target_id * (optional) The target ID of the file field. * @param bool $has_picture * (optional) Whether the user is expected to have a picture attached. + * + * @internal */ - protected function assertEntity($id, $label, $mail, $password, $created, $access, $login, $blocked, $entity_langcode, $prefered_langcode, $timezone, $init, $roles, $field_integer, $field_file_target_id = FALSE, $has_picture = FALSE) { + protected function assertEntity(string $id, string $label, string $mail, string $password, int $created, int $access, int $login, bool $blocked, string $entity_langcode, string $prefered_langcode, string $timezone, string $init, array $roles, ?array $field_integer, $field_file_target_id = FALSE, bool $has_picture = FALSE): void { /** @var \Drupal\user\UserInterface $user */ $user = User::load($id); $this->assertInstanceOf(UserInterface::class, $user); $this->assertSame($label, $user->label()); $this->assertSame($mail, $user->getEmail()); $this->assertSame($password, $user->getPassword()); - $this->assertSame($created, $user->getCreatedTime()); - $this->assertSame($access, $user->getLastAccessedTime()); - $this->assertSame($login, $user->getLastLoginTime()); - $this->assertNotSame($blocked, $user->isBlocked()); + $this->assertSame($created, (int) $user->getCreatedTime()); + $this->assertSame($access, (int) $user->getLastAccessedTime()); + $this->assertSame($login, (int) $user->getLastLoginTime()); + $this->assertNotSame($blocked, (bool) $user->isBlocked()); // Ensure the user's langcode, preferred_langcode and // preferred_admin_langcode are valid. diff --git a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php index 00c75cd60457ec686951c4c06b89099ea7ff595b..1aabea79a8a533ca6210b670afac9636e2a64081 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -89,8 +89,10 @@ public function testUserEditForm() { * * @param array $elements * A form array section that contains the user account form elements. + * + * @internal */ - protected function assertFieldOrder(array $elements) { + protected function assertFieldOrder(array $elements): void { $name_index = 0; $name_weight = 0; $pass_index = 0; diff --git a/core/modules/user/tests/src/Kernel/UserValidationTest.php b/core/modules/user/tests/src/Kernel/UserValidationTest.php index 73886da53eae0927eee56de60e1bce433928fdcd..579b8b4be0de6a6c60fd6cb8fe1e6624ef777b4b 100644 --- a/core/modules/user/tests/src/Kernel/UserValidationTest.php +++ b/core/modules/user/tests/src/Kernel/UserValidationTest.php @@ -198,8 +198,10 @@ public function testValidation() { * (optional) The number of expected violations. Defaults to 1. * @param int $expected_index * (optional) The index at which to expect the violation. Defaults to 0. + * + * @internal */ - protected function assertLengthViolation(EntityInterface $entity, $field_name, $length, $count = 1, $expected_index = 0) { + protected function assertLengthViolation(EntityInterface $entity, string $field_name, int $length, int $count = 1, int $expected_index = 0): void { $violations = $entity->validate(); $this->assertCount($count, $violations, "Violation found when $field_name is too long."); $this->assertEquals("{$field_name}.0.value", $violations[$expected_index]->getPropertyPath()); @@ -214,8 +216,10 @@ protected function assertLengthViolation(EntityInterface $entity, $field_name, $ * The entity object to validate. * @param string $field_name * The name of the field to verify. + * + * @internal */ - protected function assertAllowedValuesViolation(EntityInterface $entity, $field_name) { + protected function assertAllowedValuesViolation(EntityInterface $entity, string $field_name): void { $violations = $entity->validate(); $this->assertCount(1, $violations, "Allowed values violation for $field_name found."); $this->assertEquals($field_name === 'langcode' ? "{$field_name}.0" : "{$field_name}.0.value", $violations[0]->getPropertyPath()); diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php index 36d9254229dcacd0477d8529da56bc67fa4d0ae1..369b4f299a244722d6b14ae9c1f636eab12d2fb2 100644 --- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php +++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php @@ -332,8 +332,10 @@ public function testPermissionsYamlStaticAndCallback() { * * @param array $actual_permissions * The actual permissions + * + * @internal */ - protected function assertPermissions(array $actual_permissions) { + protected function assertPermissions(array $actual_permissions): void { $this->assertCount(4, $actual_permissions); $this->assertEquals('single_description', $actual_permissions['access_module_a']['title']); $this->assertEquals('module_a', $actual_permissions['access_module_a']['provider']); diff --git a/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php b/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php index 2e29bb43e16ab0ea20a18f0e95e9f000b29ceebd..0767c5ca6a508eaaaf64ddcd9b47d5abc330301f 100644 --- a/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php +++ b/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php @@ -135,8 +135,10 @@ protected function setUp(): void { /** * Asserts correct field access grants for a field. + * + * @internal */ - public function assertFieldAccess($field, $viewer, $target, $view, $edit) { + public function assertFieldAccess(string $field, string $viewer, string $target, bool $view, bool $edit): void { $field_definition = $this->createMock('Drupal\Core\Field\FieldDefinitionInterface'); $field_definition->expects($this->any()) ->method('getName') diff --git a/core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php b/core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php index 5a3ed15f306eb23fb80ed6f51a03772f75c401fc..c6ef369371258c24801726bf83d1435f9baa52bb 100644 --- a/core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php +++ b/core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php @@ -168,8 +168,10 @@ public function testTranslationRows() { * * @param array $expected * The expected rows of the result. + * + * @internal */ - protected function assertRows($expected = []) { + protected function assertRows(array $expected = []): void { $actual = []; $rows = $this->cssSelect('div.views-row'); foreach ($rows as $row) { diff --git a/core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php b/core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php index f61145fe9cc7ae141c0e07917e4f314f30e4ab4e..f6e063f450da31826c4bb90ab54fea6e67702aa0 100644 --- a/core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php +++ b/core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php @@ -287,8 +287,10 @@ public function testTranslationRows() { * * @param array $expected * The expected rows of the result. + * + * @internal */ - protected function assertRows(array $expected = []) { + protected function assertRows(array $expected = []): void { $actual = []; $rows = $this->cssSelect('div.views-row'); foreach ($rows as $row) { diff --git a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php index 520db9cadcf97e54cbadf85023e73a6a75932ee7..3baa6f3943f00101b2ba91e0d5627cf48a2e8f2d 100644 --- a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php @@ -141,10 +141,10 @@ protected function clickSortLoadIdsFromOutput() { * The value to search for. * @param string $message * The message to display along with the assertion. - * @param string $group - * The type of assertion - examples are "Browser", "PHP". + * + * @internal */ - protected function assertSubString($haystack, $needle, $message = '', $group = 'Other') { + protected function assertSubString(string $haystack, string $needle, string $message = ''): void { $this->assertStringContainsString($needle, $haystack, $message); } @@ -157,10 +157,10 @@ protected function assertSubString($haystack, $needle, $message = '', $group = ' * The value to search for. * @param string $message * The message to display along with the assertion. - * @param string $group - * The type of assertion - examples are "Browser", "PHP". + * + * @internal */ - protected function assertNotSubString($haystack, $needle, $message = '', $group = 'Other') { + protected function assertNotSubString(string $haystack, string $needle, string $message = ''): void { $this->assertStringNotContainsString($needle, $haystack, $message); } diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php index 38f371799b459b9c34e8e78604164b347d07b3bd..6fc75547dee1856efa6f22304d238bb5f25c01a3 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php @@ -152,8 +152,10 @@ public function testPagePaths() { * * @param string $path * Path that will be set as the view page display path. + * + * @internal */ - public function assertPagePath($path) { + public function assertPagePath(string $path): void { $view = Views::getView('test_page_display_path'); $view->initDisplay('page_1'); $view->displayHandlers->get('page_1')->overrideOption('path', $path); diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php index 92381e1da74c603a83278d1450dcc58fd6064b7c..ea733a5b4a30e9a11300a20e311c8393798c63ae 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php @@ -414,8 +414,10 @@ public function testExposedSortAndItemsPerPage() { * * @param int[] $ids * The ids to check. + * + * @internal */ - protected function assertIds(array $ids) { + protected function assertIds(array $ids): void { $elements = $this->cssSelect('div.view-test-exposed-form-sort-items-per-page div.views-row span.field-content'); $actual_ids = []; foreach ($elements as $element) { @@ -492,8 +494,10 @@ public function testExposedFilterPagination() { * * @param array $bundles * Bundles of nodes. + * + * @internal */ - protected function assertNodesExist(array $bundles) { + protected function assertNodesExist(array $bundles): void { foreach ($this->nodes as $node) { if (in_array($node->bundle(), $bundles)) { $this->assertSession()->pageTextContains($node->label()); diff --git a/core/modules/views/tests/src/Functional/SearchIntegrationTest.php b/core/modules/views/tests/src/Functional/SearchIntegrationTest.php index 70dc2b6bb8805e9c8a41bdb52a080cb6b690f3d4..569c9ef11b233312fba34c4f79c36dd7966b1f9d 100644 --- a/core/modules/views/tests/src/Functional/SearchIntegrationTest.php +++ b/core/modules/views/tests/src/Functional/SearchIntegrationTest.php @@ -144,15 +144,13 @@ public function testSearchIntegration() { * @param string $label * Link label to assert. * - * @return bool - * TRUE if the assertion succeeded. + * @internal */ - protected function assertOneLink($label) { + protected function assertOneLink(string $label): void { $xpath = $this->assertSession()->buildXPathQuery('//a[normalize-space(text())=:label]', [ ':label' => $label, ]); $this->assertSession()->elementsCount('xpath', $xpath, 1); - return TRUE; } } diff --git a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php index ff7f60357ac0b7e54cbc720492d2b9c8fb64fddb..f96b468e3ca1efcd79020910153a5c140927d89d 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php @@ -136,8 +136,10 @@ public function testBasicPagination() { /** * Assert that assets are not loaded twice on a page. + * + * @internal */ - protected function assertNoDuplicateAssetsOnPage() { + protected function assertNoDuplicateAssetsOnPage(): void { /** @var \Behat\Mink\Element\NodeElement[] $scripts */ $scripts = $this->getSession()->getPage()->findAll('xpath', '//script'); $script_src = []; diff --git a/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php b/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php index 338223709ab065eec155ff7074fc3fe76481f212..fa47eca31b884577657d7687fb1c632aed3a8a88 100644 --- a/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php +++ b/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php @@ -95,8 +95,10 @@ public function testCacheableMetadataCalculation() { * @param bool $expected_result * TRUE if it is expected that the cacheability metadata has been * calculated. FALSE otherwise. + * + * @internal */ - protected function assertCacheableMetadataHasBeenCalculated($expected_result) { + protected function assertCacheableMetadataHasBeenCalculated(bool $expected_result): void { $this->state->resetCache(); $this->assertEquals($expected_result, $this->state->get('views_test_cacheable_metadata_has_been_accessed')); } diff --git a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php index 6bab4cfdbdec1756c16a56aa2bf30df6f42f098a..372a4c4add80e1d4e608999eb4afd9e8fbfeb53a 100644 --- a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php @@ -637,18 +637,22 @@ public function testRevisionTableFields() { * The views data to check. * @param string $field_name * The entity field name. + * + * @internal */ - protected function assertViewsDataField($data, $field_name) { + protected function assertViewsDataField(array $data, string $field_name): void { $this->assertEquals($field_name, $data['entity field']); } /** * Tests views data for a string field. * - * @param $data + * @param array $data * The views data to check. + * + * @internal */ - protected function assertStringField($data) { + protected function assertStringField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('string', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); @@ -658,10 +662,12 @@ protected function assertStringField($data) { /** * Tests views data for a URI field. * - * @param $data + * @param array $data * The views data to check. + * + * @internal */ - protected function assertUriField($data) { + protected function assertUriField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('string', $data['field']['default_formatter']); $this->assertEquals('string', $data['filter']['id']); @@ -672,12 +678,14 @@ protected function assertUriField($data) { /** * Tests views data for a long text field. * - * @param $data + * @param array $data * The views data for the table this field is in. - * @param $field_name + * @param string $field_name * The name of the field being checked. + * + * @internal */ - protected function assertLongTextField($data, $field_name) { + protected function assertLongTextField(array $data, string $field_name): void { $value_field = $data[$field_name . '__value']; $this->assertEquals('field', $value_field['field']['id']); $this->assertEquals($field_name . '__format', $value_field['field']['format']); @@ -693,8 +701,10 @@ protected function assertLongTextField($data, $field_name) { * * @param array $data * The views data to check. + * + * @internal */ - protected function assertUuidField($data) { + protected function assertUuidField(array $data): void { // @todo Can we provide additional support for UUIDs in views? $this->assertEquals('field', $data['field']['id']); $this->assertFalse($data['field']['click sortable']); @@ -708,8 +718,10 @@ protected function assertUuidField($data) { * * @param array $data * The views data to check. + * + * @internal */ - protected function assertNumericField($data) { + protected function assertNumericField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('numeric', $data['filter']['id']); $this->assertEquals('numeric', $data['argument']['id']); @@ -721,8 +733,10 @@ protected function assertNumericField($data) { * * @param array $data * The views data to check. + * + * @internal */ - protected function assertLanguageField($data) { + protected function assertLanguageField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('language', $data['filter']['id']); $this->assertEquals('language', $data['argument']['id']); @@ -731,8 +745,10 @@ protected function assertLanguageField($data) { /** * Tests views data for an entity reference field. + * + * @internal */ - protected function assertEntityReferenceField($data) { + protected function assertEntityReferenceField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('numeric', $data['filter']['id']); $this->assertEquals('numeric', $data['argument']['id']); @@ -741,8 +757,10 @@ protected function assertEntityReferenceField($data) { /** * Tests views data for a bundle field. + * + * @internal */ - protected function assertBundleField($data) { + protected function assertBundleField(array $data): void { $this->assertEquals('field', $data['field']['id']); $this->assertEquals('bundle', $data['filter']['id']); $this->assertEquals('string', $data['argument']['id']); diff --git a/core/modules/views/tests/src/Kernel/Entity/LatestRevisionFilterTest.php b/core/modules/views/tests/src/Kernel/Entity/LatestRevisionFilterTest.php index 1b47f80b4e4790891615ee0660517f79b2a8c54b..41606428b747792966d1584ac3c723f1c23a7d5a 100644 --- a/core/modules/views/tests/src/Kernel/Entity/LatestRevisionFilterTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/LatestRevisionFilterTest.php @@ -126,8 +126,10 @@ public function testLatestRevisionFilter() { * An executed View. * @param array $not_expected_revision_ids * An array of revision IDs which should not be part of the result set. + * + * @internal */ - protected function assertNotInResultSet(ViewExecutable $view, array $not_expected_revision_ids) { + protected function assertNotInResultSet(ViewExecutable $view, array $not_expected_revision_ids): void { $found_revision_ids = array_filter($view->result, function ($row) use ($not_expected_revision_ids) { return in_array($row->vid, $not_expected_revision_ids); }); diff --git a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php index d373072d09ed46ae2e15592c9157f1d69e55153d..42eaa3b12d770e1dd603c7ca6744ae317510104e 100644 --- a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php @@ -241,10 +241,10 @@ protected function checkLanguageRenderers($display, $values) { * An array of expected title translation values, one for each result row. * @param string $message * (optional) A message to display with the assertion. - * @param string $group - * (optional) The group this message is in. + * + * @internal */ - protected function assertTranslations($display, $renderer_id, array $expected, $message = '', $group = 'Other') { + protected function assertTranslations(string $display, string $renderer_id, array $expected, string $message = ''): void { $view = Views::getView('test_entity_row_renderers'); $view->storage->invalidateCaches(); $view->setDisplay($display); @@ -267,7 +267,7 @@ protected function assertTranslations($display, $renderer_id, array $expected, $ } } - $this->assertTrue($result, $message, $group); + $this->assertTrue($result, $message); } } diff --git a/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php b/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php index 9c25d3aead6dd3934f85542286893d1fcf90352d..b22c6b1c3b3eb355e2a314591bbbf63a4778ef7c 100644 --- a/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php @@ -548,8 +548,10 @@ protected function getUpdatedViewAndDisplay($revision = FALSE) { * * @param string[] $updated_view_ids * An array of view IDs. + * + * @internal */ - protected function assertUpdatedViews($updated_view_ids) { + protected function assertUpdatedViews(array $updated_view_ids): void { $all_view_ids = array_keys($this->entityTypeManager->getStorage('view')->loadMultiple()); $view_save_count = \Drupal::state()->get('views_test_data.view_save_count', []); diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php index 82caa80f19bf1c0883965e3484e91b2eb3c179b1..659e1490efb722b194ced9d9f641a68336ee2da2 100644 --- a/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php @@ -302,8 +302,10 @@ public function testAreaDisplayLink() { * The view to check. * @param string $display_link_id * The display link ID to check the options for. + * + * @internal */ - protected function assertFormOptions(ViewExecutable $view, $display_link_id) { + protected function assertFormOptions(ViewExecutable $view, string $display_link_id): void { $form = []; $form_state = new FormState(); $view->display_handler->getHandler('header', $display_link_id)->buildOptionsForm($form, $form_state); @@ -319,8 +321,10 @@ protected function assertFormOptions(ViewExecutable $view, $display_link_id) { * The view to check. * @param string $display_id * The display ID to check the links for. + * + * @internal */ - protected function assertRenderedDisplayLinks(ViewExecutable $view, $display_id) { + protected function assertRenderedDisplayLinks(ViewExecutable $view, string $display_id): void { $page_1_active = $display_id === 'page_1' ? ' is-active' : ''; $page_2_active = $display_id === 'page_2' ? ' is-active' : ''; @@ -368,8 +372,10 @@ protected function renderDisplayLink(ViewExecutable $view, $display_link_id) { * * @param \Drupal\views\ViewExecutable $view * The view to check. + * + * @internal */ - protected function assertNoWarningMessages(ViewExecutable $view) { + protected function assertNoWarningMessages(ViewExecutable $view): void { $messenger = $this->container->get('messenger'); $view->validate(); @@ -385,8 +391,10 @@ protected function assertNoWarningMessages(ViewExecutable $view) { * An array of options that should be unequal. * * @throws \Exception + * + * @internal */ - protected function assertWarningMessages(ViewExecutable $view, array $unequal_options) { + protected function assertWarningMessages(ViewExecutable $view, array $unequal_options): void { $messenger = $this->container->get('messenger'); // Create a list of options to check. diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php index 5ce5e83c83256d56fdc43f7dc46869c1012391b3..cd584e685983eeb07e37afddc62055d30b3c2c50 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Kernel\Handler; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; +use Drupal\views\ViewExecutable; use Drupal\views\Views; /** @@ -142,14 +143,16 @@ public function testFieldDate() { /** * Asserts properly formatted display against 'created' field in view. * - * @param mixed $view + * @param \Drupal\views\ViewExecutable $view * View to be tested. * @param array $map * Data map. - * @param null $timezone + * @param string|null $timezone * Optional timezone. + * + * @internal */ - protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) { + protected function assertRenderedDatesEqual(ViewExecutable $view, array $map, ?string $timezone = NULL): void { foreach ($map as $date_format => $expected_result) { $view->field['created']->options['date_format'] = $date_format; if (isset($timezone)) { @@ -167,12 +170,14 @@ protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) { /** * Asserts properly formatted display against 'destroyed' field in view. * - * @param mixed $view + * @param \Drupal\views\ViewExecutable $view * View to be tested. * @param array $map * Data map. + * + * @internal */ - protected function assertRenderedFutureDatesEqual($view, $map) { + protected function assertRenderedFutureDatesEqual(ViewExecutable $view, array $map): void { foreach ($map as $format => $result) { $view->field['destroyed']->options['date_format'] = $format; $view_result = $view->field['destroyed']->advancedRender($view->result[0]); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php index 4f910234e9aef934480f66c1f387b808afa700dc..fa37204e0a006935b7d6e69ca06b8f4b26ee09f4 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php @@ -104,13 +104,10 @@ public function testQuery() { * messages: use \Drupal\Component\Render\FormattableMarkup to embed * variables in the message text, not t(). If left blank, a default message * will be displayed. - * @param string $group - * (optional) The group this message is in, which is displayed in a column - * in test output. Use 'Debug' to indicate this is debugging output. Do not - * translate this string. Defaults to 'Other'; most tests do not override - * this default. + * + * @internal */ - protected function assertSubString($haystack, $needle, $message = '', $group = 'Other') { + protected function assertSubString(string $haystack, string $needle, string $message = ''): void { $this->assertStringContainsString($needle, $haystack, $message); } @@ -126,13 +123,10 @@ protected function assertSubString($haystack, $needle, $message = '', $group = ' * messages: use \Drupal\Component\Render\FormattableMarkup to embed * variables in the message text, not t(). If left blank, a default message * will be displayed. - * @param string $group - * (optional) The group this message is in, which is displayed in a column - * in test output. Use 'Debug' to indicate this is debugging output. Do not - * translate this string. Defaults to 'Other'; most tests do not override - * this default. + * + * @internal */ - protected function assertNotSubString($haystack, $needle, $message = '', $group = 'Other') { + protected function assertNotSubString(string $haystack, string $needle, string $message = ''): void { $this->assertStringNotContainsString($needle, $haystack, $message); } diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php index 241c65cec516c18c2117f66a3e4ea842103b22a6..1c598edcb29ea5812e4493aac8c8f3700ad36aac 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php @@ -142,8 +142,10 @@ public function testRenderedEntityWithoutField() { * * @param array $build * The render array + * + * @internal */ - protected function assertCacheabilityMetadata($build) { + protected function assertCacheabilityMetadata(array $build): void { $this->assertEqualsCanonicalizing([ 'config:core.entity_view_display.entity_test.entity_test.foobar', 'config:views.view.test_field_entity_test_rendered', @@ -168,8 +170,10 @@ protected function assertCacheabilityMetadata($build) { * * @param \Drupal\views\Entity\View $storage * The view storage. + * + * @internal */ - protected function assertConfigDependencies(View $storage) { + protected function assertConfigDependencies(View $storage): void { $storage->calculateDependencies(); $this->assertEquals([ 'config' => ['core.entity_view_mode.entity_test.foobar'], diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index f59370d62d0f72adc85eddd8c7ec523584158ea8..8113f573d061d65e264f86eab8022b4f22ca4e18 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -8,6 +8,7 @@ use Drupal\views\Plugin\views\field\Broken as BrokenField; use Drupal\views\Plugin\views\filter\Broken as BrokenFilter; use Drupal\views\Plugin\views\filter\Standard; +use Drupal\views\Plugin\views\ViewsHandlerInterface; use Drupal\views\Views; /** @@ -334,8 +335,10 @@ protected function formatViewOptions(array $views = []) { /** * Ensure that a certain handler is an instance of a certain table/field. + * + * @internal */ - public function assertInstanceHandler($handler, $table, $field, $id) { + public function assertInstanceHandler(ViewsHandlerInterface $handler, string $table, string $field, string $id): void { $table_data = $this->container->get('views.views_data')->get($table); $field_data = $table_data[$field][$id]; diff --git a/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php b/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php index 521ab74ed43e28d06cf1939a51e907755577b161..69f940ed05ed24bcd56d6e419874a76dc95e054d 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php @@ -50,8 +50,10 @@ public function testGrid() { * The alignment of the grid to test. * @param int $columns * The number of columns in the grid to test. + * + * @internal */ - protected function assertGrid(ViewExecutable $view, $alignment, $columns) { + protected function assertGrid(ViewExecutable $view, string $alignment, int $columns): void { $view->setDisplay('default'); $view->initStyle(); $view->initHandlers(); diff --git a/core/modules/views/tests/src/Kernel/PluginInstanceTest.php b/core/modules/views/tests/src/Kernel/PluginInstanceTest.php index 5858ae115f25633a30ac76303df1270fa1b5cc4d..315fae720372ba56fa4c1cb3e02ec7f93948224b 100644 --- a/core/modules/views/tests/src/Kernel/PluginInstanceTest.php +++ b/core/modules/views/tests/src/Kernel/PluginInstanceTest.php @@ -93,8 +93,10 @@ public function testPluginInstances() { * * @param bool $test_deprecated * Indicates if deprecated plugins should be tested or skipped. + * + * @internal */ - protected function assertPluginInstances($test_deprecated) { + protected function assertPluginInstances(bool $test_deprecated): void { foreach ($this->definitions as $type => $plugins) { // Get a plugin manager for this type. $manager = $this->container->get("plugin.manager.views.$type"); diff --git a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php index ed1fa20e285b66fee0f19c8334b46ed66a87f0b7..2ed8125a3b3f44b0596f89b7fd73037343f6bb2e 100644 --- a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php @@ -87,8 +87,10 @@ public function testFieldBasedViewCacheTagsWithCachePluginTime() { * * @param bool $do_assert_views_caches * Whether to check Views' result & output caches. + * + * @internal */ - protected function assertCacheTagsForFieldBasedView($do_assert_views_caches) { + protected function assertCacheTagsForFieldBasedView(bool $do_assert_views_caches): void { $view = Views::getview('entity_test_fields'); // Empty result (no entities yet). @@ -229,8 +231,10 @@ public function testEntityBasedViewCacheTagsWithCachePluginTime() { /** * Tests cache tags on output & result cache items for an entity-based view. + * + * @internal */ - protected function assertCacheTagsForEntityBasedView($do_assert_views_caches) { + protected function assertCacheTagsForEntityBasedView(bool $do_assert_views_caches): void { $view = Views::getview('entity_test_row'); // Empty result (no entities yet). diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index 92e4b51d2590b9622b2d16ad57d5e4605989b59f..5fa97a3928cfb23779143f4b3f295ca937a5bcfe 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -362,8 +362,10 @@ public function testDestroy() { * * @param \Drupal\views\ViewExecutable $view * The view executable. + * + * @internal */ - protected function assertViewDestroy(ViewExecutable $view) { + protected function assertViewDestroy(ViewExecutable $view): void { $reflection = new \ReflectionClass($view); $defaults = $reflection->getDefaultProperties(); // The storage and user should remain. diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index f0e3ba9ce91e648a642efa30ef555e1bec6ceaa9..c0dff398575f5ff27dc48ccd9034b71ce897853c 100644 --- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -437,8 +437,10 @@ protected function getCommands(ViewAjaxResponse $response) { * The response object. * @param int $position * The position where the view content command is expected. + * + * @internal */ - protected function assertViewResultCommand(ViewAjaxResponse $response, $position = 0) { + protected function assertViewResultCommand(ViewAjaxResponse $response, int $position = 0): void { $commands = $this->getCommands($response); $this->assertEquals('insert', $commands[$position]['command']); $this->assertEquals('View result', $commands[$position]['data']); diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php index 5cd30b04aed9907d2212932dc9aff4b1afb673fb..219951d155447dca66e0d7f96c550a655e216e1e 100644 --- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php +++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php @@ -294,19 +294,15 @@ public function testGroupedFilterAdminUiErrors() { * * @param string $message * The assert message. - * @param string $group - * The assertion group. * - * @return bool - * Result of the assertion. + * @internal */ - protected function assertNoGroupedFilterErrors($message = '', $group = 'Other') { + protected function assertNoGroupedFilterErrors(string $message = ''): void { foreach ($this->groupFormUiErrors as $error) { if (empty($message)) { - return $this->assertSession()->responseNotContains($error); + $this->assertSession()->responseNotContains($error); } } - return TRUE; } /** diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index e20089a77c43d008bae213ef7b0ccc51df675d67..e5235989fca6b0f4477b4fcefbe4e0aedeea3b74 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -294,8 +294,10 @@ public function testErrorMissingHelp() { * The field name. * @param string $entity_type * The entity type to which the field belongs. + * + * @internal */ - public function assertNoDuplicateField($field_name, $entity_type) { + public function assertNoDuplicateField(string $field_name, string $entity_type): void { $elements = $this->xpath('//td[.=:entity_type]/preceding-sibling::td[@class="title" and .=:title]', [':title' => $field_name, ':entity_type' => $entity_type]); $this->assertCount(1, $elements, $field_name . ' appears just once in ' . $entity_type . '.'); } diff --git a/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php b/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php index bd57872746ca2a9387fe0deb89a300c783829077..4aea55c68196a716c58f91dd2edd3ce3418567ed 100644 --- a/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php +++ b/core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php @@ -40,12 +40,14 @@ protected function getViewFields($view_name = 'test_view', $display_id = 'defaul /** * Check if the fields are in the correct order. * - * @param $view_name + * @param string $view_name * The name of the view. - * @param $fields + * @param array $fields * Array of field names. + * + * @internal */ - protected function assertFieldOrder($view_name, $fields) { + protected function assertFieldOrder(string $view_name, array $fields): void { $this->drupalGet('admin/structure/views/nojs/rearrange/' . $view_name . '/default/field'); foreach ($fields as $idx => $field) { diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php index 43eab572b48baf4c9d02bab10fb60c0eaff16d8e..9ca8b80a65e2094a482a8deb4fbc6fe77bf6e838 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php @@ -282,8 +282,10 @@ protected function clickPreviewLinkAJAX(NodeElement $element, $row_count) { * * @param int $row_count * The expected number of rows in the preview. + * + * @internal */ - protected function assertPreviewAJAX($row_count) { + protected function assertPreviewAJAX(int $row_count): void { $elements = $this->getSession()->getPage()->findAll('css', '.view-content .views-row'); $this->assertCount($row_count, $elements, 'Expected items found on page.'); } @@ -297,8 +299,10 @@ protected function assertPreviewAJAX($row_count) { * The class to assert. * @param string $message * (optional) A verbose message to output. + * + * @internal */ - protected function assertClass(NodeElement $element, $class, $message = NULL) { + protected function assertClass(NodeElement $element, string $class, string $message = ''): void { if (!isset($message)) { $message = "Class .$class found."; } diff --git a/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php b/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php index e97c77820541b03f839abeb1b1c20105fd5c57e8..8cd3a71638540b1d00b80fc03657698a30c6202c 100644 --- a/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php +++ b/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php @@ -305,8 +305,10 @@ public function testPathAliasesWithTranslation() { * * @param string[] $paths * An array of paths to check for. + * + * @internal */ - protected function assertAccessiblePaths(array $paths) { + protected function assertAccessiblePaths(array $paths): void { foreach ($paths as $path) { $this->drupalGet($path); $this->assertSession()->statusCodeEquals(200); @@ -318,8 +320,10 @@ protected function assertAccessiblePaths(array $paths) { * * @param string[] $paths * An array of paths to check for. + * + * @internal */ - protected function assertNotAccessiblePaths(array $paths) { + protected function assertNotAccessiblePaths(array $paths): void { foreach ($paths as $path) { $this->drupalGet($path); $this->assertSession()->statusCodeEquals(404); diff --git a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php index dd32a2682b48f4e2f2d38710cae8a5e4915139bf..3c86921cf60387e8089b07db2e5845b76ad7b7c1 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php @@ -753,8 +753,10 @@ public function testExecuteInWorkspaceContext() { * An array of expected values, as defined in ::testWorkspaces(). * @param string $entity_type_id * The ID of the entity type that is being tested. + * + * @internal */ - protected function assertWorkspaceStatus(array $expected, $entity_type_id) { + protected function assertWorkspaceStatus(array $expected, string $entity_type_id): void { $expected = $this->flattenExpectedValues($expected, $entity_type_id); $entity_keys = $this->entityTypeManager->getDefinition($entity_type_id)->getKeys(); @@ -823,8 +825,10 @@ protected function assertWorkspaceStatus(array $expected, $entity_type_id) { * An array of expected values, as defined in ::testWorkspaces(). * @param string $entity_type_id * The ID of the entity type to check. + * + * @internal */ - protected function assertEntityLoad(array $expected_values, $entity_type_id) { + protected function assertEntityLoad(array $expected_values, string $entity_type_id): void { // Filter the expected values so we can check only the default revisions. $expected_default_revisions = array_filter($expected_values, function ($expected_value) { return $expected_value['default_revision'] === TRUE; @@ -875,8 +879,10 @@ protected function assertEntityLoad(array $expected_values, $entity_type_id) { * An array of expected values, as defined in ::testWorkspaces(). * @param string $entity_type_id * The ID of the entity type to check. + * + * @internal */ - protected function assertEntityRevisionLoad(array $expected_values, $entity_type_id) { + protected function assertEntityRevisionLoad(array $expected_values, string $entity_type_id): void { $entity_keys = $this->entityTypeManager->getDefinition($entity_type_id)->getKeys(); $id_key = $entity_keys['id']; $revision_key = $entity_keys['revision']; @@ -901,8 +907,10 @@ protected function assertEntityRevisionLoad(array $expected_values, $entity_type * An array of expected values, as defined in ::testWorkspaces(). * @param string $entity_type_id * The ID of the entity type to check. + * + * @internal */ - protected function assertEntityQuery(array $expected_values, $entity_type_id) { + protected function assertEntityQuery(array $expected_values, string $entity_type_id): void { $storage = $this->entityTypeManager->getStorage($entity_type_id); $entity_keys = $this->entityTypeManager->getDefinition($entity_type_id)->getKeys(); $id_key = $entity_keys['id']; diff --git a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php index 205575be3a9c7e468ad2a294e5e33aa9b98ba1d3..b7235cf770668da9d39881a7f93e4b1891af736c 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php @@ -85,7 +85,7 @@ public function testReinstall() { * @param \Drupal\Core\Entity\EntityStorageInterface $node_storage * Node storage. */ - protected function assertRecipesImported(EntityStorageInterface $node_storage) { + protected function assertRecipesImported(EntityStorageInterface $node_storage): void { $count = $node_storage->getQuery() ->accessCheck(FALSE) ->condition('type', 'recipe') @@ -104,7 +104,7 @@ protected function assertRecipesImported(EntityStorageInterface $node_storage) { * @param \Drupal\Core\Entity\EntityStorageInterface $node_storage * Node storage. */ - protected function assertArticlesImported(EntityStorageInterface $node_storage) { + protected function assertArticlesImported(EntityStorageInterface $node_storage): void { $count = $node_storage->getQuery() ->accessCheck(FALSE) ->condition('type', 'article') @@ -123,7 +123,7 @@ protected function assertArticlesImported(EntityStorageInterface $node_storage) * @param \Drupal\Core\Entity\EntityStorageInterface $block_storage * Block storage. */ - protected function assertImportedCustomBlock(EntityStorageInterface $block_storage) { + protected function assertImportedCustomBlock(EntityStorageInterface $block_storage): void { $assert = $this->assertSession(); foreach ($this->expectedBlocks() as $block_info) { $this->drupalGet($block_info['path']); diff --git a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php index be483fd9c03a2de58a2a59a4cd58590b6e3e7e2b..89f6a6a20ead70fdf1adc485cde4935a625205e4 100644 --- a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php +++ b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php @@ -67,7 +67,7 @@ public function testConfig() { * @param \Drupal\Core\Config\StorageInterface $active_config_storage * The active configuration storage. */ - protected function assertDefaultConfig(StorageInterface $default_config_storage, StorageInterface $active_config_storage) { + protected function assertDefaultConfig(StorageInterface $default_config_storage, StorageInterface $active_config_storage): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = $this->container->get('config.manager'); diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php index 7a9370a90dccc529ceb771da0aad4665b2a4e984..cec79deacf5088e8cfc963917942e392bafabb7c 100644 --- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php +++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php @@ -50,7 +50,7 @@ public function testBigPipe() { * @param int $expected_count * The expected number of BigPipe placeholders. */ - protected function assertBigPipePlaceholderReplacementCount($expected_count) { + protected function assertBigPipePlaceholderReplacementCount($expected_count): void { $web_assert = $this->assertSession(); $web_assert->waitForElement('css', 'script[data-big-pipe-event="stop"]'); $page = $this->getSession()->getPage(); diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php index 04c5ff9bc0079a5f2c979d0e8d16f276ed54b0e7..a80a9482bb8d19412422459398e8f4a28b47f97b 100644 --- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php @@ -259,8 +259,10 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir) * The expected version. * @param string $dir * The path to the site root. + * + * @internal */ - protected function assertDrupalVersion($expectedVersion, $dir) { + protected function assertDrupalVersion(string $expectedVersion, string $dir): void { $drupal_php_path = $dir . '/core/lib/Drupal.php'; $this->assertFileExists($drupal_php_path); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php index efeb6167690572d38a26ff1927b9e36d730550d1..87ec2d21087402f813eb6965139aff5659afb6fe 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php @@ -162,8 +162,10 @@ public function testInsertAjaxResponse() { * Expected result. * @param string $script * Script for additional theming. + * + * @internal */ - public function assertInsert($render_type, $expected, $script = '') { + public function assertInsert(string $render_type, string $expected, string $script = ''): void { // Check insert to block element. $this->drupalGet('ajax-test/insert-block-wrapper'); $this->getSession()->executeScript($script); @@ -192,8 +194,10 @@ public function assertInsert($render_type, $expected, $script = '') { * * @param string $expected * A needle text. + * + * @internal */ - protected function assertWaitPageContains($expected) { + protected function assertWaitPageContains(string $expected): void { $page = $this->getSession()->getPage(); $this->assertTrue($page->waitFor(10, function () use ($page, $expected) { // Clear content from empty styles and "processed" classes after effect. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php index 11e31855175530b29aa6065da7502837a45c3987..5f4b48bf8bd731ab9fd77b43cd841f82d5fa5666 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php @@ -145,8 +145,10 @@ public function testAjaxCommands() { * * @param string $text * A needle text. + * + * @internal */ - protected function assertWaitPageContains($text) { + protected function assertWaitPageContains(string $text): void { $page = $this->getSession()->getPage(); $page->waitFor(10, function () use ($page, $text) { return stripos($page->getContent(), $text) !== FALSE; diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php index a0c1d57cbb8bb8424d88185cda6b20c2f592815c..03c6b3af15b67c4583c2eb92f3b38bd1f4972e14 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php @@ -109,8 +109,10 @@ protected function waitForMessageRemoved($message, $selector = '[data-drupal-mes * * @param string $expected_message * The text expected to be present in #drupal-live-announce. + * + * @internal */ - protected function assertAnnounceContains($expected_message) { + protected function assertAnnounceContains(string $expected_message): void { $assert_session = $this->assertSession(); $this->assertNotEmpty($assert_session->waitForElement('css', "#drupal-live-announce:contains('$expected_message')")); } @@ -120,8 +122,10 @@ protected function assertAnnounceContains($expected_message) { * * @param string $expected_message * The text expected to be absent from #drupal-live-announce. + * + * @internal */ - protected function assertAnnounceNotContains($expected_message) { + protected function assertAnnounceNotContains(string $expected_message): void { $assert_session = $this->assertSession(); $this->assertEmpty($assert_session->waitForElement('css', "#drupal-live-announce:contains('$expected_message')", 1000)); } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php index e52149b74f9a5e5095eb9e93dbaf37dc65d2bfbb..951330cbd48f8c72a9563ee80cb41a7bee9e0ccb 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php @@ -108,8 +108,10 @@ public function testAddRemoveMessages() { * Expected messages. * @param string $messagesSelector * The css selector for the containing messages element. + * + * @internal */ - protected function assertCurrentMessages(array $expected_messages, $messagesSelector) { + protected function assertCurrentMessages(array $expected_messages, string $messagesSelector): void { $expected_messages = array_values($expected_messages); $current_messages = []; if ($message_divs = $this->getSession()->getPage()->findAll('css', "$messagesSelector .messages")) { diff --git a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php index cf36dc19299f6b70e71d1008ed4387c7eb9dce02..4003ecf9e69eaf6e2a8e2461c687407d6a84a8ec 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php @@ -156,8 +156,10 @@ public function testKeyboardAccessibility() { * @param array|null $structure * The expected table structure. If this isn't specified or equals NULL, * then the expected structure will be set by this method. Defaults to NULL. + * + * @internal */ - protected function assertKeyboardAccessibility($drupal_path = 'tabledrag_test', $structure = NULL) { + protected function assertKeyboardAccessibility(string $drupal_path = 'tabledrag_test', ?array $structure = NULL): void { $expected_table = $structure ?: [ ['id' => 1, 'weight' => 0, 'parent' => '', 'indentation' => 0, 'changed' => FALSE], ['id' => 2, 'weight' => 0, 'parent' => '', 'indentation' => 0, 'changed' => FALSE], @@ -321,8 +323,10 @@ public function testTableDragChangedWarning() { * When any of the given string is not found. * * @todo Remove this and use the WebAssert method when #2817657 is done. + * + * @internal */ - protected function assertOrder(array $items) { + protected function assertOrder(array $items): void { $session = $this->getSession(); $text = $session->getPage()->getHtml(); $strings = []; @@ -484,8 +488,10 @@ public function testNestedDraggableTables() { * @param bool $skip_missing * Whether assertions done on missing elements value may be skipped or not. * Defaults to FALSE. + * + * @internal */ - protected function assertDraggableTable(array $structure, $table_id = 'tabledrag-test-table', $skip_missing = FALSE) { + protected function assertDraggableTable(array $structure, string $table_id = 'tabledrag-test-table', bool $skip_missing = FALSE): void { $rows = $this->getSession()->getPage()->findAll('xpath', "//table[@id='$table_id']/tbody/tr"); $this->assertSession()->elementsCount('xpath', "//table[@id='$table_id']/tbody/tr", count($structure)); @@ -513,8 +519,10 @@ protected function assertDraggableTable(array $structure, $table_id = 'tabledrag * @param bool $skip_missing * Whether assertions done on missing elements value may be skipped or not. * Defaults to FALSE. + * + * @internal */ - protected function assertTableRow(NodeElement $row, $id, $weight, $parent = '', $indentation = 0, $changed = FALSE, $skip_missing = FALSE) { + protected function assertTableRow(NodeElement $row, string $id, int $weight, string $parent = '', int $indentation = 0, ?bool $changed = FALSE, bool $skip_missing = FALSE): void { // Assert that the row position is correct by checking that the id // corresponds. $id_name = "table[$id][id]"; diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index 21b02065b22b2b8be50ab4fbfacdec1616efc065..06dde6ce8d09c29c31b6f5ddb23b22be8252ab08 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -282,8 +282,10 @@ public function testLoggerException() { * * @see \Drupal\simpletest\TestBase::prepareEnvironment() * @see \Drupal\Core\DrupalKernel::bootConfiguration() + * + * @internal */ - protected function assertErrorLogged($error_message) { + protected function assertErrorLogged(string $error_message): void { $error_log_filename = DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'; $this->assertFileExists($error_log_filename); @@ -310,8 +312,10 @@ protected function assertErrorLogged($error_message) { * * @see \Drupal\simpletest\TestBase::prepareEnvironment() * @see \Drupal\Core\DrupalKernel::bootConfiguration() + * + * @internal */ - protected function assertNoErrorsLogged() { + protected function assertNoErrorsLogged(): void { // Since PHP only creates the error.log file when an actual error is // triggered, it is sufficient to check whether the file exists. $this->assertFileDoesNotExist(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'); diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php index d79ea5b0e0bed852516f3b37a90b980d761c1b2e..0de9040330c0d65d9aa5707567440b1540c50f8f 100644 --- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php +++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php @@ -71,8 +71,10 @@ public function testThemeConfig($theme) { * Extension name. * @param string $type * Extension type, either 'module' or 'theme'. + * + * @internal */ - protected function assertExtensionConfig(string $name, string $type) { + protected function assertExtensionConfig(string $name, string $type): void { // System and user are required in order to be able to install some of the // other modules. Therefore they are put into static::$modules, which though // doesn't install config files, so import those config files explicitly. Do diff --git a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php index faf8cadb6fc449c760978416dec1994c2b6203d5..487f3c6cd47b231a176185e4e8bab1ffbfc6ce92 100644 --- a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php @@ -88,14 +88,16 @@ public function testEmptyInsertCommand() { * the actual command contains additional settings that aren't part of * $needle. * - * @param $haystack + * @param array $haystack * An array of rendered Ajax commands returned by the server. - * @param $needle + * @param array $needle * Array of info we're expecting in one of those commands. - * @param $message + * @param string $message * An assertion message. + * + * @internal */ - protected function assertCommand($haystack, $needle, $message) { + protected function assertCommand(array $haystack, array $needle, string $message): void { $found = FALSE; foreach ($haystack as $command) { // If the command has additional settings that we're not testing for, do diff --git a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php index fd58a786a415227dac4cb892b38bd7ebb3c35634..82d9d3c670ba643681a1b35bdf38cfcf4ec5d95c 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php @@ -262,25 +262,24 @@ protected function activateTheme($theme_name) { * The extension in which the $library is defined. * @param string $library_name * Name of the library. - * @param mixed $sub_key + * @param string $sub_key * The library sub key where the given asset is defined. * @param string $message * (optional) A message to display with the assertion. * - * @return bool - * TRUE if the specified asset is found in the library. + * @internal */ - protected function assertAssetInLibrary($asset, $extension, $library_name, $sub_key, $message = NULL) { + protected function assertAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, string $message = NULL): void { if (!isset($message)) { $message = sprintf('Asset %s found in library "%s/%s"', $asset, $extension, $library_name); } $library = $this->libraryDiscovery->getLibraryByName($extension, $library_name); foreach ($library[$sub_key] as $definition) { if ($asset == $definition['data']) { - return TRUE; + return; } } - return $this->fail($message); + $this->fail($message); } /** @@ -292,25 +291,23 @@ protected function assertAssetInLibrary($asset, $extension, $library_name, $sub_ * The extension in which the $library_name is defined. * @param string $library_name * Name of the library. - * @param mixed $sub_key + * @param string $sub_key * The library sub key where the given asset is defined. * @param string $message * (optional) A message to display with the assertion. * - * @return bool - * TRUE if the specified asset is not found in the library. + * @internal */ - protected function assertNoAssetInLibrary($asset, $extension, $library_name, $sub_key, $message = NULL) { + protected function assertNoAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, string $message = NULL): void { if (!isset($message)) { $message = sprintf('Asset %s not found in library "%s/%s"', $asset, $extension, $library_name); } $library = $this->libraryDiscovery->getLibraryByName($extension, $library_name); foreach ($library[$sub_key] as $definition) { if ($asset == $definition['data']) { - return $this->fail($message); + $this->fail($message); } } - return TRUE; } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index 06fda37ec7a9ae8a2025c3a330a314b13f79984f..120cf77de8a644749c71c0a309defeda65e30c3a 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -151,8 +151,10 @@ public function testCollectionDiff() { * @param mixed $closing * (optional) The closing value of the edit. If not supplied, assertion * is skipped. + * + * @internal */ - protected function assertYamlEdit(array $edits, $field, $type, $orig = NULL, $closing = NULL) { + protected function assertYamlEdit(array $edits, string $field, string $type, $orig = NULL, $closing = NULL): void { $match = FALSE; foreach ($edits as $edit) { // Choose which section to search for the field. diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php index 67a81adbfbea11386c235a65eac80af674e13e61..9b88592c73a118448ac46f65a8ce4306ccfd4c2f 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php @@ -95,8 +95,10 @@ protected function getConnectionId() { * * @param int $id * The connection ID to verify. + * + * @internal */ - protected function assertConnection($id) { + protected function assertConnection(int $id): void { $list = $this->monitor->query($this->getQuery()['processlist'])->fetchAllKeyed(0, 0); $this->assertTrue(isset($list[$id]), new FormattableMarkup('Connection ID @id found.', ['@id' => $id])); } @@ -106,8 +108,10 @@ protected function assertConnection($id) { * * @param int $id * The connection ID to verify. + * + * @internal */ - protected function assertNoConnection($id) { + protected function assertNoConnection(int $id): void { $list = $this->monitor->query($this->getQuery()['processlist'])->fetchAllKeyed(0, 0); $this->assertFalse(isset($list[$id]), new FormattableMarkup('Connection ID @id not found.', ['@id' => $id])); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php index 039e916a33abc9592a13381ea1059dc21b574826..bf73ba4609c8da877bd9f43b2a05dfdbea419ba5 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php @@ -672,10 +672,12 @@ public function testSchemaAddFieldDefaultInitial() { * The addition test covers both defining a field of a given specification * when initially creating at table and extending an existing table. * - * @param $field_spec + * @param array $field_spec * The schema specification of the field. + * + * @internal */ - protected function assertFieldAdditionRemoval($field_spec) { + protected function assertFieldAdditionRemoval(array $field_spec): void { // Try creating the field on a new table. $table_name = 'test_table_' . ($this->counter++); $table_spec = [ @@ -737,8 +739,10 @@ protected function assertFieldAdditionRemoval($field_spec) { /** * Asserts that a newly added field has the correct characteristics. + * + * @internal */ - protected function assertFieldCharacteristics($table_name, $field_name, $field_spec) { + protected function assertFieldCharacteristics(string $table_name, string $field_name, array $field_spec): void { // Check that the initial value has been registered. if (isset($field_spec['initial'])) { // There should be no row with a value different then $field_spec['initial']. @@ -1007,14 +1011,16 @@ public function testSchemaChangeFieldDefaultInitial() { /** * Asserts that a field can be changed from one spec to another. * - * @param $old_spec + * @param array $old_spec * The beginning field specification. - * @param $new_spec + * @param array $new_spec * The ending field specification. - * @param $test_data + * @param mixed $test_data * (optional) A test value to insert and test, if specified. + * + * @internal */ - protected function assertFieldChange($old_spec, $new_spec, $test_data = NULL) { + protected function assertFieldChange(array $old_spec, array $new_spec, $test_data = NULL): void { $table_name = 'test_table_' . ($this->counter++); $table_spec = [ 'fields' => [ diff --git a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php index d55fe82cbdb1cc307c36c97551e126a3b8ebfe3b..e76618152a627892623c8a7960f0c05e51272f5a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -316,12 +316,14 @@ protected function cleanUp() { /** * Asserts that a given row is present in the test table. * - * @param $name + * @param string $name * The name of the row. - * @param $message + * @param string $message * The message to log for the assertion. + * + * @internal */ - public function assertRowPresent($name, $message = NULL) { + public function assertRowPresent(string $name, string $message = NULL): void { if (!isset($message)) { $message = new FormattableMarkup('Row %name is present.', ['%name' => $name]); } @@ -332,12 +334,14 @@ public function assertRowPresent($name, $message = NULL) { /** * Asserts that a given row is absent from the test table. * - * @param $name + * @param string $name * The name of the row. - * @param $message + * @param string $message * The message to log for the assertion. + * + * @internal */ - public function assertRowAbsent($name, $message = NULL) { + public function assertRowAbsent(string $name, string $message = NULL): void { if (!isset($message)) { $message = new FormattableMarkup('Row %name is absent.', ['%name' => $name]); } diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php index 0e790af4c8664c6fc60e509e7012f92506abe122..161f3b3edef344faafa133a6d9bb2a346d770907 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php @@ -252,8 +252,10 @@ public function testDatelistTimezonePropertyProcessed() { * The names of the default input elements used by this element type. * * @throws \Exception + * + * @internal */ - protected function assertTimesUnderstoodCorrectly($elementType, array $inputs) { + protected function assertTimesUnderstoodCorrectly(string $elementType, array $inputs): void { $this->elementType = $elementType; // Simulate the form being saved, with the user adding the date for any @@ -326,8 +328,10 @@ protected function assertTimesUnderstoodCorrectly($elementType, array $inputs) { * The element type to test. * * @throws \Exception + * + * @internal */ - public function assertDateTimezonePropertyProcessed($elementType) { + public function assertDateTimezonePropertyProcessed(string $elementType): void { $this->elementType = $elementType; // Simulate form being loaded and default values displayed to user. $form_state = new FormState(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php index 3d755a55c1600e546f0bd15670b6088a64d1ebe8..bee4cd224e07ce819c367182a756c8dfcaea293b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php @@ -42,8 +42,10 @@ public function testValidation() { * * @param string|array $bundle * Bundle/bundles to use as constraint option. + * + * @internal */ - protected function assertValidation($bundle) { + protected function assertValidation($bundle): void { // Create a typed data definition with a Bundle constraint. $definition = DataDefinition::create('entity_reference') ->addConstraint('Bundle', $bundle); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 667bae835334355095a54e23aee12c83d975e122..c40a4bebdeb91adc5a7551b041d2c666f8fc836f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -726,8 +726,10 @@ public function testLookupKeys() { * * @param array $expected * Array of expected entity IDs. + * + * @internal */ - protected function assertResults($expected) { + protected function assertResults(array $expected): void { $expected_count = count($expected); $this->assertCount($expected_count, $this->queryResults); foreach ($expected as $value) { diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index 269dc77eb56d12d12f952829443411beb9b9ce52..daa74a9aacca373857e97a2d14b1e4b8b9a4ab59 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -38,8 +38,10 @@ public function setUp(): void { /** * Asserts entity access correctly grants or denies access. + * + * @internal */ - public function assertEntityAccess($ops, AccessibleInterface $object, AccountInterface $account = NULL) { + public function assertEntityAccess(array $ops, AccessibleInterface $object, AccountInterface $account = NULL): void { foreach ($ops as $op => $result) { $message = new FormattableMarkup("Entity access returns @result with operation '@op'.", [ '@result' => !isset($result) ? 'null' : ($result ? 'true' : 'false'), diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php index 268cedd7057598d7c2bf7bd923877275763d15a5..ccc1f537affe801aa95b294bf63934f4d3bac35b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php @@ -46,8 +46,10 @@ public function testCRUD() { * The entity type to run the tests with. * @param \Drupal\user\UserInterface $user1 * The user to run the tests with. + * + * @internal */ - protected function assertCRUD($entity_type, UserInterface $user1) { + protected function assertCRUD(string $entity_type, UserInterface $user1): void { // Create some test entities. $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type) diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php index 6f0ac63ac6b4c18d915bf76ac6a10408656efdf8..a77b0eb5fd920f989321791b06435008fd3968fa 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php @@ -68,10 +68,12 @@ protected function setUp(): void { * Module entity_crud_hook_test implements all core entity CRUD hooks and * stores a message for each in $GLOBALS['entity_crud_hook_test']. * - * @param $messages + * @param array $messages * An array of plain-text messages in the order they should appear. + * + * @internal */ - protected function assertHookMessageOrder($messages) { + protected function assertHookMessageOrder(array $messages): void { $positions = []; foreach ($messages as $message) { // Verify that each message is found and record its position. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php index c5e27218c2abb10cf23abd9e039f5a3406503319..93d07c4d23ab80c9c7e739399e9ed7262ed19f0f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php @@ -40,8 +40,10 @@ public function testDefaultValues() { * * @param string $entity_type_id * The entity type to run the tests with. + * + * @internal */ - protected function assertDefaultValues($entity_type_id) { + protected function assertDefaultValues(string $entity_type_id): void { $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type_id) ->create(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php index 9a50a78fe6aa012cca9253d9378ed8fbff7aa225..275d9274a6a7856d965fd5c63cb2d643fb0edab5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php @@ -626,8 +626,10 @@ public function testRepeatedExecution() { * @param bool $sorted * (optiOnal) Whether the array keys of the expected are sorted, defaults to * FALSE. + * + * @internal */ - protected function assertResults($expected, $sorted = FALSE) { + protected function assertResults(array $expected, bool $sorted = FALSE): void { $found = TRUE; $expected_keys = array_keys($expected); foreach ($this->queryResult as $key => $row) { @@ -649,9 +651,11 @@ protected function assertResults($expected, $sorted = FALSE) { * * @param array $expected * An array of the expected results. + * + * @internal */ - protected function assertSortedResults($expected) { - return $this->assertResults($expected, TRUE); + protected function assertSortedResults(array $expected): void { + $this->assertResults($expected, TRUE); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php index 54c4484c6ca0f87d30d781f7ccbb130fe5753430..b0983c7577647cec6e98e9a29bb97409f14d2a2f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php @@ -224,8 +224,10 @@ public function testInvalidSpecifier() { * * @param array $expected * A list of indexes in the $this->entities array. + * + * @internal */ - protected function assertResults($expected) { + protected function assertResults(array $expected): void { $expected_count = count($expected); $this->assertCount($expected_count, $this->queryResults); foreach ($expected as $key) { diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index 176413cf6988b3345a904529ebae3a87ac0f37e5..bf35a517f3cb1990990745af06362d61fdf51707 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -720,7 +720,10 @@ public function testDelta() { } - protected function assertResult() { + /** + * @internal + */ + protected function assertResult(): void { $assert = []; $expected = func_get_args(); if ($expected && is_array($expected[0])) { @@ -732,16 +735,21 @@ protected function assertResult() { $this->assertSame($assert, $this->queryResults); } - protected function assertRevisionResult($keys, $expected) { + /** + * @internal + */ + protected function assertRevisionResult(array $keys, array $expected): void { $assert = []; foreach ($expected as $key => $binary) { $assert[$keys[$key]] = strval($binary); } $this->assertSame($assert, $this->queryResults); - return $assert; } - protected function assertBundleOrder($order) { + /** + * @internal + */ + protected function assertBundleOrder(string $order): void { // This loop is for bundle1 entities. for ($i = 1; $i <= 15; $i += 2) { $ok = TRUE; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php index 9258c4acf70ec12402b87b2b933fa897bc56aa5d..c3005afd879dc98936fc94c68199a406d8a03d35 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -331,10 +331,12 @@ public function testAutocreateApi() { * * @param \Drupal\Core\Entity\EntityInterface $entity * The referencing entity. - * @param $setter_callback + * @param callable $setter_callback * A callback setting the target entity on the referencing entity. + * + * @internal */ - protected function assertUserAutocreate(EntityInterface $entity, $setter_callback) { + protected function assertUserAutocreate(EntityInterface $entity, callable $setter_callback): void { $storage = $this->entityTypeManager->getStorage('user'); $user_id = $this->generateRandomEntityId(); $user = $storage->create(['uid' => $user_id, 'name' => $this->randomString()]); @@ -350,10 +352,12 @@ protected function assertUserAutocreate(EntityInterface $entity, $setter_callbac * * @param \Drupal\Core\Entity\EntityInterface $entity * The referencing entity. - * @param $setter_callback + * @param callable $setter_callback * A callback setting the target entity on the referencing entity. + * + * @internal */ - protected function assertUserRoleAutocreate(EntityInterface $entity, $setter_callback) { + protected function assertUserRoleAutocreate(EntityInterface $entity, callable $setter_callback): void { $storage = $this->entityTypeManager->getStorage('user_role'); $role_id = $this->generateRandomEntityId(TRUE); $role = $storage->create(['id' => $role_id, 'label' => $this->randomString()]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php index 5bebe5d370c0d0584074c22cc4a84d9049073a13..bd36cad7b0c3fa0783a1182eec05158d21c7fea8 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php @@ -300,8 +300,10 @@ protected function doTestLanguageFallback($method_name) { * An entity object or NULL. * @param string $expected_entity_type_id * The expected entity type ID. + * + * @internal */ - protected function assertEntityType($entity, $expected_entity_type_id) { + protected function assertEntityType(?object $entity, string $expected_entity_type_id): void { $this->assertInstanceOf(EntityTest::class, $entity); $this->assertEquals($expected_entity_type_id, $entity->getEntityTypeId()); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index f9b7b328aa37956998de8f3f8716b830f489e7d0..86f116702b39b3429ae1f46a2c1ec33e792ed126 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -35,8 +35,10 @@ public function testCRUD() { * * @param string $entity_type * The entity type to run the tests with. + * + * @internal */ - protected function assertCRUD($entity_type) { + protected function assertCRUD(string $entity_type): void { // Verify that no UUID is auto-generated when passing one for creation. $uuid_service = $this->container->get('uuid'); $uuid = $uuid_service->generate(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php index 3559c03a894194049117f9e773a1dd25c94e1dd0..0cfff0994fac92437dcbdacdc7099b0829d962d0 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php @@ -70,8 +70,10 @@ public function testFieldSqlStorage() { * The entity fields are attached to. * @param string $message * (optional) A message to display with the assertion. + * + * @internal */ - protected function assertFieldStorageLangcode(FieldableEntityInterface $entity, $message = '') { + protected function assertFieldStorageLangcode(FieldableEntityInterface $entity, string $message = ''): void { $status = TRUE; $entity_type = $entity->getEntityTypeId(); $id = $entity->id(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php index 7cb95a4afd83f18ff6bd9c8e60973c6cf4e77901..ffeea531665341bb264e1a27db2295669d86b4c5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php @@ -381,8 +381,10 @@ protected function insertData($revisionable, $translatable) { * Whether the entity type was revisionable prior to the update. * @param bool $translatable * Whether the entity type was translatable prior to the update. + * + * @internal */ - protected function assertEntityData($revisionable, $translatable) { + protected function assertEntityData(bool $revisionable, bool $translatable): void { $entities = $this->entityTypeManager->getStorage($this->entityTypeId)->loadMultiple(); $this->assertCount(3, $entities); foreach ($entities as $entity_id => $entity) { @@ -456,8 +458,10 @@ protected function assertEntityData($revisionable, $translatable) { * @param bool $new_base_field * (optional) Whether a new base field was added as part of the update. * Defaults to FALSE. + * + * @internal */ - protected function assertEntityTypeSchema($revisionable, $translatable, $new_base_field = FALSE) { + protected function assertEntityTypeSchema(bool $revisionable, bool $translatable, bool $new_base_field = FALSE): void { // Check whether the 'new_base_field' field has been installed correctly. $field_storage_definition = $this->entityDefinitionUpdateManager->getFieldStorageDefinition('new_base_field', $this->entityTypeId); if ($new_base_field) { @@ -485,8 +489,10 @@ protected function assertEntityTypeSchema($revisionable, $translatable, $new_bas /** * Asserts the revisionable characteristics of an entity type. + * + * @internal */ - protected function assertRevisionable() { + protected function assertRevisionable(): void { /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */ $entity_type = $this->entityDefinitionUpdateManager->getEntityType($this->entityTypeId); $this->assertTrue($entity_type->isRevisionable()); @@ -524,8 +530,10 @@ protected function assertRevisionable() { /** * Asserts the translatable characteristics of an entity type. + * + * @internal */ - protected function assertTranslatable() { + protected function assertTranslatable(): void { /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */ $entity_type = $this->entityDefinitionUpdateManager->getEntityType($this->entityTypeId); $this->assertTrue($entity_type->isTranslatable()); @@ -553,8 +561,10 @@ protected function assertTranslatable() { /** * Asserts the revisionable / translatable characteristics of an entity type. + * + * @internal */ - protected function assertRevisionableAndTranslatable() { + protected function assertRevisionableAndTranslatable(): void { $this->assertRevisionable(); $this->assertTranslatable(); @@ -599,8 +609,10 @@ protected function assertRevisionableAndTranslatable() { /** * Asserts that an entity type is neither revisionable nor translatable. + * + * @internal */ - protected function assertNonRevisionableAndNonTranslatable() { + protected function assertNonRevisionableAndNonTranslatable(): void { /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */ $entity_type = $this->entityDefinitionUpdateManager->getEntityType($this->entityTypeId); $this->assertFalse($entity_type->isRevisionable()); @@ -618,8 +630,10 @@ protected function assertNonRevisionableAndNonTranslatable() { * * @param bool $revisionable * Whether the entity type is revisionable or not. + * + * @internal */ - protected function assertBundleFieldSchema($revisionable) { + protected function assertBundleFieldSchema(bool $revisionable): void { $entity_type_id = 'entity_test_update'; $field_storage_definition = $this->entityFieldManager->getFieldStorageDefinitions($entity_type_id)['new_bundle_field']; $database_schema = $this->database->schema(); @@ -635,8 +649,10 @@ protected function assertBundleFieldSchema($revisionable) { /** * Asserts that the backup tables have been kept after a successful update. + * + * @internal */ - protected function assertBackupTables() { + protected function assertBackupTables(): void { $backups = \Drupal::keyValue('entity.update_backup')->getAll(); $backup = reset($backups); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php index bc38a47d66eb617d59be6910552cf1118b822e73..15d56e68d604b009873ded5795d9f5e9ac3051b8 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php @@ -166,8 +166,10 @@ public function testWasDefaultRevision() { * The number of items expected to be in revisions related tables. * @param \Drupal\Core\Entity\EntityTypeInterface $definition * The definition and metadata of the entity being tested. + * + * @internal */ - protected function assertItemsTableCount($count, EntityTypeInterface $definition) { + protected function assertItemsTableCount(int $count, EntityTypeInterface $definition): void { $connection = Database::getConnection(); $this->assertEquals(1, (int) $connection->select($definition->getBaseTable())->countQuery()->execute()->fetchField()); $this->assertEquals(1, (int) $connection->select($definition->getDataTable())->countQuery()->execute()->fetchField()); diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php index 15ab322db081234aadec781be8390e7636bc6f26..36f1f9cc83977440c549a0bc2dda78d5b27175b6 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php @@ -83,10 +83,12 @@ public function testSaveWorkflow() { * * @param \Drupal\entity_test\Entity\EntityTest $entity * The test entity. - * @param $expected_value + * @param string $expected_value * The expected field item value. + * + * @internal */ - protected function assertSavedFieldItemValue(EntityTest $entity, $expected_value) { + protected function assertSavedFieldItemValue(EntityTest $entity, string $expected_value): void { $entity->setNewRevision(TRUE); $entity->save(); $base_field_expected_value = str_replace($this->fieldName, 'field_test_item', $expected_value); diff --git a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php index b9f59efbd8bc812d1617cc3355f12166b105f125..e49ff3b4c39ce3328e524a89367f9647d589d7fa 100644 --- a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php @@ -97,8 +97,10 @@ public function testHtaccessSave() { * The URI of the file to check. * @param int $expected * The expected file permissions; e.g., 0444. + * + * @internal */ - protected function assertFilePermissions($uri, $expected) { + protected function assertFilePermissions(string $uri, int $expected): void { $actual = fileperms($uri) & 0777; $this->assertSame($actual, $expected, new FormattableMarkup('@uri file permissions @actual are identical to @expected.', [ '@uri' => $uri, diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php index ea400d607a61a1061a58f8f3ebc1e7cd0ab46b30..0704cec75d24119000ea672e846d0168e19b3be5 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php @@ -412,8 +412,10 @@ protected function moveMenuLink($id, $new_parent) { * An ordered array of the IDs of the menu links that are the parents. * @param array $children * Array of child IDs that are visible (enabled == 1). + * + * @internal */ - protected function assertMenuLink($id, array $expected_properties, array $parents = [], array $children = []) { + protected function assertMenuLink(string $id, array $expected_properties, array $parents = [], array $children = []): void { $query = $this->connection->select('menu_tree'); $query->fields('menu_tree'); $query->condition('id', $id); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php index b589d0e5f6995450651e08b0fdb728b85d3d2f14..73c8c010e7c5b52a71588ec1a989be2359551a17 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php @@ -34,8 +34,10 @@ protected function setUp(): void { * The expected markup. * @param string $message * Assertion message. + * + * @internal */ - protected function assertElements(array $elements, $expected_html, $message) { + protected function assertElements(array $elements, string $expected_html, string $message): void { $actual_html = (string) \Drupal::service('renderer')->renderRoot($elements); $this->assertSame($expected_html, $actual_html, Html::escape($message)); } diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php index a2c80f893497b3384d3b8f949b5a5d1beafb4eb0..95120187bf7dc50dbeb3983907caf6ed5630211d 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @@ -193,8 +193,10 @@ public function testDateTimestamp($input, array $initial, array $transform) { * @see testTimestamp() * @param array $transform * @see testTimestamp() + * + * @internal */ - public function assertDateTimestamp($date, $input, $initial, $transform) { + public function assertDateTimestamp(DateTimePlus $date, string $input, array $initial, array $transform): void { // Check format. $value = $date->format($initial['format']); $this->assertEquals($initial['expected_date'], $value, sprintf("Test new DateTimePlus(%s, %s): should be %s, found %s.", $input, $initial['timezone'], $initial['expected_date'], $value)); diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php index 9876f7985d394c860ac0cd407cb93d31f452b768..74cd216fe55ccb5e9ce4992b55114b95b3bc1990 100644 --- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php +++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php @@ -41,7 +41,7 @@ public function testNoCoreInComponentTests() { * * @dataProvider \Drupal\Tests\Component\DrupalComponentTest::getComponents */ - public function testComponentLicence($component_path) { + public function testComponentLicense($component_path) { $this->assertFileExists($component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt'); $this->assertSame('e84dac1d9fbb5a4a69e38654ce644cea769aa76b', hash_file('sha1', $component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt')); } @@ -90,8 +90,10 @@ protected function findPhpClasses($dir) { * * @param string $class_path * The full path to the class that should be checked. + * + * @internal */ - protected function assertNoCoreUsage($class_path) { + protected function assertNoCoreUsage(string $class_path): void { $contents = file_get_contents($class_path); preg_match_all('/^.*Drupal\\\Core.*$/m', $contents, $matches); $matches = array_filter($matches[0], function ($line) { diff --git a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php index aacd9b59203a787773efcf5ed0c9da11891a4dae..2773d46ba30916a7121831e97003429315ef5f8b 100644 --- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php +++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php @@ -103,12 +103,14 @@ protected function normalizeGraph($graph) { /** * Verify expected paths in a graph. * - * @param $graph + * @param array $graph * A graph array processed by \Drupal\Component\Graph\Graph::searchAndSort() - * @param $expected_paths + * @param array $expected_paths * An associative array containing vertices with their expected paths. + * + * @internal */ - protected function assertPaths($graph, $expected_paths) { + protected function assertPaths(array $graph, array $expected_paths): void { foreach ($expected_paths as $vertex => $paths) { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); @@ -120,13 +122,15 @@ protected function assertPaths($graph, $expected_paths) { /** * Verify expected reverse paths in a graph. * - * @param $graph + * @param array $graph * A graph array processed by \Drupal\Component\Graph\Graph::searchAndSort() - * @param $expected_reverse_paths + * @param array $expected_reverse_paths * An associative array containing vertices with their expected reverse * paths. + * + * @internal */ - protected function assertReversePaths($graph, $expected_reverse_paths) { + protected function assertReversePaths(array $graph, array $expected_reverse_paths): void { foreach ($expected_reverse_paths as $vertex => $paths) { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); @@ -138,12 +142,14 @@ protected function assertReversePaths($graph, $expected_reverse_paths) { /** * Verify expected components in a graph. * - * @param $graph + * @param array $graph * A graph array processed by \Drupal\Component\Graph\Graph::searchAndSort(). - * @param $expected_components + * @param array $expected_components * An array containing of components defined as a list of their vertices. + * + * @internal */ - protected function assertComponents($graph, $expected_components) { + protected function assertComponents(array $graph, array $expected_components): void { $unassigned_vertices = array_fill_keys(array_keys($graph), TRUE); foreach ($expected_components as $component) { $result_components = []; @@ -159,12 +165,14 @@ protected function assertComponents($graph, $expected_components) { /** * Verify expected order in a graph. * - * @param $graph + * @param array $graph * A graph array processed by \Drupal\Component\Graph\Graph::searchAndSort() - * @param $expected_orders + * @param array $expected_orders * An array containing lists of vertices in their expected order. + * + * @internal */ - protected function assertWeights($graph, $expected_orders) { + protected function assertWeights(array $graph, array $expected_orders): void { foreach ($expected_orders as $order) { $previous_vertex = array_shift($order); foreach ($order as $vertex) { diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php index ce8588a6e728fe3303f80c39cc986bc656c40bff..413991ff5e01527892d316421a01ce7276e24a60 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php @@ -314,8 +314,10 @@ public function providerSortByTitleProperty() { * Expected comparison function return value. * @param int $result * Actual comparison function return value. + * + * @internal */ - protected function assertBothNegativePositiveOrZero($expected, $result) { + protected function assertBothNegativePositiveOrZero(int $expected, int $result): void { $this->assertIsNumeric($expected); $this->assertIsNumeric($result); $message = "Numbers should be both negative, both positive or both zero. Expected: $expected, actual: $result"; diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php index b0c434da5d7aa4f93882a24af6bb2963badac6b0..9ecffc195eca01025e214d50828d0e76699f506b 100644 --- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php @@ -594,10 +594,10 @@ public function providerTestFilterXssAdminNotNormalized() { * Lowercase, plain text to look for. * @param string $message * (optional) Message to display if failed. Defaults to an empty string. - * @param string $group - * (optional) The group this message belongs to. Defaults to 'Other'. + * + * @internal */ - protected function assertNormalized($haystack, $needle, $message = '', $group = 'Other') { + protected function assertNormalized(string $haystack, string $needle, string $message = ''): void { $this->assertStringContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } @@ -616,10 +616,10 @@ protected function assertNormalized($haystack, $needle, $message = '', $group = * Lowercase, plain text to look for. * @param string $message * (optional) Message to display if failed. Defaults to an empty string. - * @param string $group - * (optional) The group this message belongs to. Defaults to 'Other'. + * + * @internal */ - protected function assertNotNormalized($haystack, $needle, $message = '', $group = 'Other') { + protected function assertNotNormalized(string $haystack, string $needle, string $message = ''): void { $this->assertStringNotContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message); } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php index 0fd2cfed5b3606577ee2db27d407ab4f120c9526..12868c0facea790b867c01f78b452c71db842215 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php @@ -356,8 +356,10 @@ public function testDrupalDrupalFileWasAppended($fixture_name, $is_link, $scaffo * The path to the System-under-Test's docroot. * @param bool $is_link * Whether or not symlinking is used. + * + * @internal */ - protected function assertDefaultSettingsFromScaffoldOverride($docroot, $is_link) { + protected function assertDefaultSettingsFromScaffoldOverride(string $docroot, bool $is_link): void { $this->assertScaffoldedFile($docroot . '/sites/default/default.settings.php', $is_link, 'scaffolded from the scaffold-override-fixture'); } @@ -366,8 +368,10 @@ protected function assertDefaultSettingsFromScaffoldOverride($docroot, $is_link) * * @param string $docroot * The path to the System-under-Test's docroot. + * + * @internal */ - protected function assertHtaccessExcluded($docroot) { + protected function assertHtaccessExcluded(string $docroot): void { // Ensure that the .htaccess.txt file was not written, as our // top-level composer.json excludes it from the files to scaffold. $this->assertFileDoesNotExist($docroot . '/.htaccess'); @@ -384,8 +388,10 @@ protected function assertHtaccessExcluded($docroot) { * The path to the System-under-Test's docroot. * @param bool $is_link * Whether or not symlinking is used. + * + * @internal */ - protected function assertCommonDrupalAssetsWereScaffolded($docroot, $is_link) { + protected function assertCommonDrupalAssetsWereScaffolded(string $docroot, bool $is_link): void { // Assert scaffold files are written in the correct locations. $this->assertScaffoldedFile($docroot . '/.csslintrc', $is_link, 'Test version of .csslintrc from drupal/core.'); $this->assertScaffoldedFile($docroot . '/.editorconfig', $is_link, 'Test version of .editorconfig from drupal/core.'); @@ -408,8 +414,10 @@ protected function assertCommonDrupalAssetsWereScaffolded($docroot, $is_link) { * Location of the doc root, where autoload.php should be written. * @param bool $relocated_docroot * Whether the document root is relocated or now. + * + * @internal */ - protected function assertAutoloadFileCorrect($docroot, $relocated_docroot = FALSE) { + protected function assertAutoloadFileCorrect(string $docroot, bool $relocated_docroot = FALSE): void { $autoload_path = $docroot . '/autoload.php'; // Ensure that the autoload.php file was written. diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index 8eef0c87f3057f092023768b599a4846d88ebd6f..dbe8008b00e901823babed3cb4a0094230624b66 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -45,7 +45,10 @@ protected function setUp(): void { \Drupal::setContainer($container); } - protected function assertDefaultCacheability(AccessResult $access) { + /** + * @internal + */ + protected function assertDefaultCacheability(AccessResult $access): void { $this->assertSame([], $access->getCacheContexts()); $this->assertSame([], $access->getCacheTags()); $this->assertSame(Cache::PERMANENT, $access->getCacheMaxAge()); diff --git a/core/tests/Drupal/Tests/Core/Common/TagsTest.php b/core/tests/Drupal/Tests/Core/Common/TagsTest.php index 3c3058f9655b41b5666bfca70a0d90f5e6caa853..ad2fba9322f30325d41e93c296b5b08e442fea1b 100644 --- a/core/tests/Drupal/Tests/Core/Common/TagsTest.php +++ b/core/tests/Drupal/Tests/Core/Common/TagsTest.php @@ -43,8 +43,10 @@ public function testImplodeTags() { /** * Helper function: asserts that the ending array of tags is what we wanted. + * + * @internal */ - protected function assertTags($tags) { + protected function assertTags(array $tags): void { $original = $this->validTags; foreach ($tags as $tag) { $key = array_search($tag, $original); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php index 0fba72d8fc1bf02bac86e16fa735c49aba022c15..d7b6ee5f0e800c24182ef2537b2d4b0e28832b2d 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php @@ -581,8 +581,10 @@ public function nestedDataProvider() { * * @param array $data * Config data to be checked. + * + * @internal */ - public function assertConfigDataEquals($data) { + public function assertConfigDataEquals(array $data): void { foreach ($data as $key => $value) { $this->assertEquals($value, $this->config->get($key)); } @@ -595,8 +597,10 @@ public function assertConfigDataEquals($data) { * Config data to be checked. * @param bool $apply_overrides * Apply any overrides to the original data. + * + * @internal */ - public function assertOriginalConfigDataEquals($data, $apply_overrides) { + public function assertOriginalConfigDataEquals(array $data, bool $apply_overrides): void { foreach ($data as $key => $value) { $config_value = $this->config->getOriginal($key, $apply_overrides); $this->assertEquals($value, $config_value); @@ -632,8 +636,10 @@ public function testSafeStringHandling() { * The original data. * @param array $overridden_data * The overridden data. + * + * @internal */ - protected function assertOverriddenKeys(array $data, array $overridden_data) { + protected function assertOverriddenKeys(array $data, array $overridden_data): void { if (empty($overridden_data)) { $this->assertFalse($this->config->hasOverrides()); } diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php index b9b63e0b18fe58df92934b201a542555484b4d0b..bbd4f5ce4aeeaae16748bbd4de8af8e0d7823634 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -180,10 +180,12 @@ public function testGetControllerFromDefinitionNotCallable() { * @param string|null $class * Either the name of the class the controller represents, or NULL if it is * not an object. - * @param mixed $output + * @param string|null $output * The output expected for this controller. + * + * @internal */ - protected function assertCallableController($controller, $class, $output) { + protected function assertCallableController(callable $controller, ?string $class, ?string $output): void { if ($class) { $this->assertIsObject($controller[0]); $this->assertInstanceOf($class, $controller[0]); diff --git a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php index b262aa89872063ab780a4f41d78761843166c457..154a1b0c618e4d830bba08a54bf986aaadb218a6 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php @@ -202,8 +202,10 @@ protected function setUp(): void { * A list of allowed operations. * @param \Drupal\Core\Session\AccountInterface $user * The account to use for get access. + * + * @internal */ - public function assertAllowOperations(array $allow_operations, AccountInterface $user) { + public function assertAllowOperations(array $allow_operations, AccountInterface $user): void { foreach (['view', 'update', 'delete'] as $operation) { $expected = in_array($operation, $allow_operations); $actual = $this->accessControlHandler->access($this->entity, $operation, $user); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index a05fe7cac13aaa3e30eac5bc3838e18887fbcc8c..3ffe645995ccba521092fe7d76d0bbb009bf8470 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -484,8 +484,10 @@ public function testConstraintMethods() { * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type. + * + * @internal */ - protected function assertNoPublicProperties(EntityTypeInterface $entity_type) { + protected function assertNoPublicProperties(EntityTypeInterface $entity_type): void { $reflection = new \ReflectionObject($entity_type); $this->assertEmpty($reflection->getProperties(\ReflectionProperty::IS_PUBLIC)); } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index 0084e4ecba1ae1292e960385789488ddda39b364..865779dc090c9d066a2b06db167f9cdfc7813e11 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -460,8 +460,10 @@ protected function getEntity($class, array $values, array $methods = []) { * Whether or not the URL is expected to have a language option. * @param \Drupal\Core\Url $url * The URL option to make the assertions on. + * + * @internal */ - protected function assertUrl($expected_route_name, array $expected_route_parameters, $entity, $has_language, Url $url) { + protected function assertUrl(string $expected_route_name, array $expected_route_parameters, $entity, bool $has_language, Url $url): void { $this->assertEquals($expected_route_name, $url->getRouteName()); $this->assertEquals($expected_route_parameters, $url->getRouteParameters()); $this->assertEquals($this->entityTypeId, $url->getOption('entity_type')); diff --git a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php index 465c60adb4f7c8925e50616577e74c8491485cf5..aa4ec558a8a1bcb1a3e8d2827a05d9e0adb87431 100644 --- a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php @@ -138,8 +138,10 @@ public function providerTestBasename() { * The URI to test. * @param string $message * An optional error message. + * + * @internal */ - protected function assertFilePermissions($expected_mode, $uri, $message = '') { + protected function assertFilePermissions(int $expected_mode, string $uri, string $message = ''): void { // Mask out all but the last three octets. $actual_mode = fileperms($uri) & 0777; diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index ee723020f64a9ca8ca91a129532d54d1f99b3ca2..1f51ed6f40a52318ece2c0ccb1f61c13c22510cb 100644 --- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -51,6 +51,13 @@ class FormAjaxSubscriberTest extends UnitTestCase { */ protected $messenger; + /** + * The event used to derive the response. + * + * @var \Symfony\Component\HttpKernel\Event\ExceptionEvent + */ + protected $event = NULL; + /** * {@inheritdoc} */ @@ -84,9 +91,9 @@ public function testOnException() { ->with($request, $expected_form, $form_state, $commands) ->willReturn($response); - $event = $this->assertResponseFromException($request, $exception, $response); - $this->assertTrue($event->isAllowingCustomResponseCode()); - $this->assertSame(200, $event->getResponse()->getStatusCode()); + $this->assertResponseFromException($request, $exception, $response); + $this->assertTrue($this->event->isAllowingCustomResponseCode()); + $this->assertSame(200, $this->event->getResponse()->getStatusCode()); } /** @@ -109,9 +116,9 @@ public function testOnExceptionNewBuildId() { ->with($request, $expected_form, $form_state, $commands) ->willReturn($response); - $event = $this->assertResponseFromException($request, $exception, $response); - $this->assertTrue($event->isAllowingCustomResponseCode()); - $this->assertSame(200, $event->getResponse()->getStatusCode()); + $this->assertResponseFromException($request, $exception, $response); + $this->assertTrue($this->event->isAllowingCustomResponseCode()); + $this->assertSame(200, $this->event->getResponse()->getStatusCode()); } /** @@ -146,8 +153,8 @@ public function testOnExceptionResponseBuilderException() { ->with($request, $expected_form, $form_state, $commands) ->willThrowException($expected_exception); - $event = $this->assertResponseFromException($request, $exception, NULL); - $this->assertSame($expected_exception, $event->getThrowable()); + $this->assertResponseFromException($request, $exception, NULL); + $this->assertSame($expected_exception, $this->event->getThrowable()); } /** @@ -256,15 +263,13 @@ public function testOnExceptionNestedWrongException() { * @param \Symfony\Component\HttpFoundation\Response|null $expected_response * The response expected to be set on the event. * - * @return \Symfony\Component\HttpKernel\Event\ExceptionEvent - * The event used to derive the response. + * @internal */ - protected function assertResponseFromException(Request $request, \Exception $exception, $expected_response) { - $event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); - $this->subscriber->onException($event); + protected function assertResponseFromException(Request $request, \Exception $exception, ?Response $expected_response): void { + $this->event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $this->subscriber->onException($this->event); - $this->assertSame($expected_response, $event->getResponse()); - return $event; + $this->assertSame($expected_response, $this->event->getResponse()); } } diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php index 39d4f5b5f870a3df82e9f450d077f9433a230d4c..7f9a23df2221611cf22f21d5c5a6e8f62397ad8a 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php @@ -89,8 +89,10 @@ protected function setUp(): void { * The context definition to check. * @param mixed $value * (optional) The value to set on the context, defaults to NULL. + * + * @internal */ - protected function assertRequirementIsSatisfied($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL) { + protected function assertRequirementIsSatisfied(bool $expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL): void { $context = new EntityContext($definition, $value); $this->assertSame($expected, $requirement->isSatisfiedBy($context)); } diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index a6626959fa5edfd99590814492c6d72169594e67..f9006bb3db5e481360223086cf922f6dc973e855 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -554,8 +554,10 @@ protected function generatePlaceholderElement() { * rendered. * @param array $expected_data * A render array with the expected values. + * + * @internal */ - protected function assertPlaceholderRenderCache($cid_parts, array $bubbled_cache_contexts, array $expected_data) { + protected function assertPlaceholderRenderCache($cid_parts, array $bubbled_cache_contexts, array $expected_data): void { if ($cid_parts !== FALSE) { if ($bubbled_cache_contexts) { // Verify render cached placeholder. diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index 8938dd44e6416584f2012201005c2f280766c388..ac69590e8bac6e068d9eecc16f6ee90f926eb465 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -731,10 +731,12 @@ public function providerAccessValues() { * * @param array $build * A render array with either #access or #access_callback. - * @param bool $access + * @param \Drupal\Core\Access\AccessResultInterface|bool $access * Whether the render array is accessible or not. + * + * @internal */ - protected function assertAccess($build, $access) { + protected function assertAccess(array $build, $access): void { $sensitive_content = $this->randomContextValue(); $build['#markup'] = $sensitive_content; if (($access instanceof AccessResultInterface && $access->isAllowed()) || $access === TRUE) { diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 108eb7f71649a773f49fcbb7f8024917ad1dc4fc..bd3268d86d96762ac4f309941c762a317dffb1ea 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -529,18 +529,20 @@ public function testGenerateWithPathProcessorChangingQueryParameter() { /** * Asserts \Drupal\Core\Routing\UrlGenerator::generateFromRoute()'s output. * - * @param $route_name + * @param string $route_name * The route name to test. * @param array $route_parameters * The route parameters to test. * @param array $options * The options to test. - * @param $expected_url + * @param string $expected_url * The expected generated URL string. * @param \Drupal\Core\Render\BubbleableMetadata $expected_bubbleable_metadata * The expected generated bubbleable metadata. + * + * @internal */ - protected function assertGenerateFromRoute($route_name, array $route_parameters, array $options, $expected_url, BubbleableMetadata $expected_bubbleable_metadata) { + protected function assertGenerateFromRoute(string $route_name, array $route_parameters, array $options, string $expected_url, BubbleableMetadata $expected_bubbleable_metadata): void { // First, test with $collect_cacheability_metadata set to the default value. $url = $this->generator->generateFromRoute($route_name, $route_parameters, $options); $this->assertSame($expected_url, $url); diff --git a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php index 03450142e002bd335a8c68deb6c86cfeea2dd61a..7cfc554cd3ecea12046356348d7f10874e5694d1 100644 --- a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php +++ b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php @@ -357,8 +357,10 @@ public function errorHandler($errno, $errstr) { * The error message. * @param int $errno * The severity level of the error. + * + * @internal */ - protected function assertError($errstr, $errno) { + protected function assertError(string $errstr, int $errno): void { foreach ($this->errors as $error) { if ($error['errstr'] === $errstr && $error['errno'] === $errno) { return; diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php index b48b59668594ce6995a9083e541cfa462e8ed8d3..c05a4bfbe3ce93f31380a23835da0e9a579750eb 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php @@ -382,8 +382,10 @@ public function providerTestAttributeValues() { * The CSS class to check. * @param string $html * The HTML snippet to check. + * + * @internal */ - protected function assertClass($class, $html) { + protected function assertClass(string $class, string $html): void { $xpath = "//*[@class='$class']"; self::assertTrue((bool) $this->getXPathResultCount($xpath, $html)); } @@ -395,8 +397,10 @@ protected function assertClass($class, $html) { * The CSS class to check. * @param string $html * The HTML snippet to check. + * + * @internal */ - protected function assertNoClass($class, $html) { + protected function assertNoClass(string $class, string $html): void { $xpath = "//*[@class='$class']"; self::assertFalse((bool) $this->getXPathResultCount($xpath, $html)); } @@ -408,8 +412,10 @@ protected function assertNoClass($class, $html) { * The CSS ID to check. * @param string $html * The HTML snippet to check. + * + * @internal */ - protected function assertID($id, $html) { + protected function assertID(string $id, string $html): void { $xpath = "//*[@id='$id']"; self::assertTrue((bool) $this->getXPathResultCount($xpath, $html)); } @@ -421,8 +427,10 @@ protected function assertID($id, $html) { * The CSS ID to check. * @param string $html * The HTML snippet to check. + * + * @internal */ - protected function assertNoID($id, $html) { + protected function assertNoID(string $id, string $html): void { $xpath = "//*[@id='$id']"; self::assertFalse((bool) $this->getXPathResultCount($xpath, $html)); } diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php index cc466edd644ad06e757aa92c1d693cc74dec5d17..540442693af8cae3681b4de830e44b3343ec703f 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -650,8 +650,10 @@ public function testGenerateTwice() { * The HTML to check. * @param int $count * How many times the link should be present in the HTML. Defaults to 1. + * + * @internal */ - public static function assertLink(array $properties, MarkupInterface $html, $count = 1) { + public static function assertLink(array $properties, MarkupInterface $html, int $count = 1): void { // Provide default values. $properties += ['attributes' => []]; @@ -686,10 +688,9 @@ public static function assertLink(array $properties, MarkupInterface $html, $cou * @param string $html * The HTML snippet to check. * - * @return int - * The number of results that are found. + * @internal */ - protected function assertNoXPathResults($query, $html) { + protected function assertNoXPathResults(string $query, string $html): void { $document = new \DOMDocument(); $document->loadHTML($html); $xpath = new \DOMXPath($document);