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 ee6f3974036..239c5ab0d86 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 @@ class MigrateActionsTest extends MigrateDrupal6TestBase { * 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 85a6977d423..920af405338 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 @@ class MigrateActionsTest extends MigrateDrupal7TestBase { * 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 21a39eb5a45..dcb68b48430 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 @@ class BigPipeTest extends BrowserTestBase { $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 @@ class BigPipeTest extends BrowserTestBase { * @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 @@ class BigPipeTest extends BrowserTestBase { * @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 @@ class BigPipeTest extends BrowserTestBase { /** * 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 df7fba45a3a..03b728da7f9 100644 --- a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +++ b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php @@ -288,8 +288,10 @@ class BlockViewBuilderTest extends KernelTestBase { * 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 daa3f107b64..ecbea2ffb90 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 @@ class MigrateBlockTest extends MigrateDrupal6TestBase { * 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 991d02142c1..a9f31b4ca3d 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 @@ class MigrateBlockTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateBlockTest extends MigrateDrupal7TestBase { * 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 280f0e81371..60249e60e47 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 @@ class BlockContentFieldFilterTest extends BlockContentTestBase { * 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 e3053e4be30..f47660906da 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 @@ class BlockContentIntegrationTest extends BlockContentTestBase { * * @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 509230d98f1..32bb55a038a 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 @@ class MigrateBlockContentEntityDisplayTest extends MigrateDrupal7TestBase { * 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 eb424395c8d..6d21b99d9d1 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 @@ class MigrateBlockContentEntityFormDisplayTest extends MigrateDrupal7TestBase { * 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 cb4ac799b42..33f0c253f45 100644 --- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php +++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php @@ -143,9 +143,11 @@ class BookJavascriptTest extends WebDriverTestBase { * @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 38bcdcffc38..033b9ae65bf 100644 --- a/core/modules/book/tests/src/Kernel/BookMultilingualTest.php +++ b/core/modules/book/tests/src/Kernel/BookMultilingualTest.php @@ -289,6 +289,8 @@ class BookMultilingualTest extends KernelTestBase { * 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 @@ class BookMultilingualTest extends KernelTestBase { * 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 @@ class BookMultilingualTest extends KernelTestBase { * 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 f70fd87d074..3f852ef8e31 100644 --- a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php +++ b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php @@ -473,8 +473,10 @@ class CKEditorTest extends KernelTestBase { * @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 0d3f6fe7542..8fb14f18d9d 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php @@ -664,11 +664,13 @@ class MediaTest extends WebDriverTestBase { * * @param string $attribute * The attribute to check. - * @param mixed $value + * @param string|null $value * Either a string value or if NULL, asserts that 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 ef4fe3c018f..aea7bb10d5d 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -210,8 +210,10 @@ class CommentPagerTest extends CommentTestBase { * 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 00ccd29c249..55ad7b4168b 100644 --- a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php +++ b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php @@ -131,8 +131,10 @@ class CommentThreadingTest extends CommentTestBase { * 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 // @@ -152,8 +154,10 @@ class CommentThreadingTest extends CommentTestBase { * * @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 // diff --git a/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php b/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php index 9be47fc8e21..623d75c1c4f 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 @@ class CommentFieldFilterTest extends CommentTestBase { * 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 39b842400da..2e6af320701 100644 --- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php +++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php @@ -189,8 +189,10 @@ class CommentValidationTest extends EntityKernelTestBase { * 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 b4a670562f1..f2741270cec 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 @@ class MigrateCommentEntityDisplayTest extends MigrateDrupal6TestBase { * 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 a57c2250fb4..57fb3d3849b 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 @@ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal6TestBase * * @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 @@ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal6TestBase * * @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 5438c938c25..8c1bec00d64 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 @@ class MigrateCommentEntityFormDisplayTest extends MigrateDrupal6TestBase { * 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 fab1c512041..2bea5867d01 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 @@ class MigrateCommentFieldInstanceTest extends MigrateDrupal6TestBase { * 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 e2a865cd7c9..f16e1da2e95 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 @@ class MigrateCommentFieldTest extends MigrateDrupal6TestBase { * * @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 359116b8822..0fe36155d81 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 1ace7293f0f..83709fdf0a3 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 @@ class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase { * 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 c0a1de628cd..80319834988 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 @@ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase * * @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 @@ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase * * @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 05d1651bc97..51c7dbdf917 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 @@ class MigrateCommentEntityFormDisplayTest extends MigrateDrupal7TestBase { * 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 e1fd26c66cb..ccf447a33ea 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 @@ class MigrateCommentFieldInstanceTest extends MigrateDrupal7TestBase { * 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 25e67d239f8..be068b9f41b 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 @@ class MigrateCommentFieldTest extends MigrateDrupal7TestBase { * * @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 0da71b7b14b..93d899aaf2b 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 50a74e20569..1fd76ccaff3 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 @@ class ConfigTranslationUiTest extends BrowserTestBase { * @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 6a8da2203b9..ea07bc57b5d 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 @@ class ContactLinkTest extends ViewTestBase { * 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 c6b3ea5ed3f..178cbc6643d 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 @@ class MigrateContactCategoryTest extends MigrateDrupal6TestBase { * 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 a23011d2137..caa404af6a5 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 @@ class ModerationLocaleTest extends ModerationStateTestBase { * * @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 @@ class ModerationLocaleTest extends ModerationStateTestBase { * @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 @@ class ModerationLocaleTest extends ModerationStateTestBase { * @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 @@ class ModerationLocaleTest extends ModerationStateTestBase { * * @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 b78e0938b08..286bbcfedcc 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 @@ class ViewsModerationStateFilterTest extends ViewTestBase { * @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 @@ class ViewsModerationStateFilterTest extends ViewTestBase { * 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 343bfe55b43..c7b84fd6bae 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 @@ class ContentModerationStateStorageSchemaTest extends KernelTestBase { * 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 c238eb3d445..6c260ef930a 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 @@ class ContentModerationStateTest extends KernelTestBase { * @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 065973a242c..307dfc8b2fb 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 @@ class DefaultRevisionStateTest extends KernelTestBase { * 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 a59b485d698..623534e7223 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 @@ class ModerationStateFieldItemListTest extends KernelTestBase { /** * 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 800073be049..c42b798977c 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 @@ class ViewsModerationStateFilterTest extends ViewsKernelTestBase { * * @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 @@ class ViewsModerationStateFilterTest extends ViewsKernelTestBase { * 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 6ddbec3eedd..b27c4d62eec 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 @@ class ViewsModerationStateSortTest extends ViewsKernelTestBase { * 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 79cf23286c4..ce473082011 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 @@ class WorkspacesContentModerationStateTest extends ContentModerationStateTest { /** * {@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 01e4e9766f5..07dacff667b 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 @@ class ContentTranslationOutdatedRevisionTranslationTest extends ContentTranslati /** * 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 974e396e01e..de65d5464f7 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 @@ class ContentTranslationSettingsTest extends BrowserTestBase { * * @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 9360122fb2b..6291989f411 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 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase { /** * 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 2c7f8a9a373..a689935c413 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 @@ class ContentTranslationFieldSyncRevisionTest extends EntityKernelTestBase { * * @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 @@ class ContentTranslationFieldSyncRevisionTest extends EntityKernelTestBase { * - 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 3f70a6590b7..6f444988024 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase { $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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase { * 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 34e3e61b2f8..6e4755b6232 100644 --- a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php +++ b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php @@ -222,8 +222,10 @@ class ContextualDynamicContextTest extends BrowserTestBase { * * @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 @@ class ContextualDynamicContextTest extends BrowserTestBase { * * @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 219b30dc76b..6cb1b68c384 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -100,8 +100,10 @@ class EditModeTest extends WebDriverTestBase { /** * 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 @@ class EditModeTest extends WebDriverTestBase { /** * 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 9439f8cf4a2..04e38fd0163 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 @@ class EntityTestDateonlyTest extends EntityTestResourceTestBase { /** * {@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 f9313f11226..2030900cf42 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 @@ class EntityTestDatetimeTest extends EntityTestResourceTestBase { /** * {@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 15bc8174459..636221f9511 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 @@ class EntityTestDateRangeTest extends EntityTestResourceTestBase { /** * {@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 12cd954f96a..4294949ef99 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php @@ -118,7 +118,7 @@ class DbLogResourceTest extends ResourceTestBase { /** * {@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 4b7ef3c2266..f83931cf4de 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -819,8 +819,10 @@ class DbLogTest extends BrowserTestBase { * 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 4196769ac85..e983ea88fd4 100644 --- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -214,12 +214,14 @@ class EditorUploadImageScaleTest extends BrowserTestBase { /** * 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 a9b551084e8..22c1d958a50 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 @@ class EntityReferenceAdminTest extends BrowserTestBase { * 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 58b51dc7e0b..e69abc86d91 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 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends BrowserTestBase { /** * 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 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends BrowserTestBase { /** * 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 dd6f8d5900f..bf0ebc2b6d6 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 @@ class EntityReferenceIntegrationTest extends BrowserTestBase { * 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 595aba8e22c..98253c179f9 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 @@ namespace Drupal\Tests\field\Functional\Number; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\field\FieldConfigInterface; use Drupal\Tests\BrowserTestBase; /** @@ -426,8 +427,10 @@ class NumberFieldTest extends BrowserTestBase { /** * 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 3273c7a1532..f19f4ed37c4 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 @@ class EntityReferenceAdminTest extends WebDriverTestBase { * 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 58c1594ef65..2e0b3a10234 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 @@ class SelectionTest extends KernelTestBase { * * @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 b78961183c8..83fac6e47f2 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 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal6TestBase { * 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 162039c390d..3df1b43de0b 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 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase { * * @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 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase { * 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 31264bcde6b..8679f83f6dc 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 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase { /** * 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 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase { * 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 f04f1e5c029..bf022677313 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 @@ class MigrateFieldInstanceWidgetSettingsTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateFieldInstanceWidgetSettingsTest extends MigrateDrupal7TestBase { * 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 a08996a480e..cdc96c455bc 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 4bdd5f5897c..1e722948157 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 @@ class MigrateViewModesTest extends MigrateDrupal7TestBase { * 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 f613d08cd18..fc94687a725 100644 --- a/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php +++ b/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php @@ -164,8 +164,10 @@ class FieldStorageConfigAccessControlHandlerTest extends UnitTestCase { * 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 7ad41defd3c..467114bc725 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 @@ class FieldLayoutTest extends WebDriverTestBase { * 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 0042c7b0585..3232d45ce82 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 @@ class FieldLayoutEntityDisplayTest extends KernelTestBase { /** * 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 5c073ae7390..ea72a387a13 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 @@ class FieldUIRouteTest extends BrowserTestBase { /** * 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 d0cbe7fba86..864733e8b39 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 @@ class ManageDisplayTest extends BrowserTestBase { * * @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 @@ class ManageDisplayTest extends BrowserTestBase { * * @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 @@ class ManageDisplayTest extends BrowserTestBase { * * @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 @@ class ManageDisplayTest extends BrowserTestBase { * 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 1d54d284713..1cc2b5adb84 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 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { /** * 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 c0ee1aff261..97489fb8fcb 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 @@ class ManageDisplayTest extends WebDriverTestBase { * 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 84ad60cd3c0..358c1f04e15 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 @@ class EntityDisplayTest extends KernelTestBase { * @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 @@ class EntityDisplayTest extends KernelTestBase { * @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 @@ class EntityDisplayTest extends KernelTestBase { * @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 @@ class EntityDisplayTest extends KernelTestBase { $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 f89e9982b8b..4a139ab7da5 100644 --- a/core/modules/file/tests/src/Functional/FileFieldPathTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldPathTest.php @@ -85,8 +85,10 @@ class FileFieldPathTest extends FileFieldTestBase { * 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 29f4914fa76..9141f031a70 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 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter * 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 e7f9247e068..bfe9f2bb631 100644 --- a/core/modules/filter/tests/src/Functional/FilterFormTest.php +++ b/core/modules/filter/tests/src/Functional/FilterFormTest.php @@ -175,8 +175,10 @@ class FilterFormTest extends BrowserTestBase { * * @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 @@ class FilterFormTest extends BrowserTestBase { * @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 @@ class FilterFormTest extends BrowserTestBase { * 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 @@ class FilterFormTest extends BrowserTestBase { * @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 @@ class FilterFormTest extends BrowserTestBase { * @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 76255f6f7eb..34a2ed13f40 100644 --- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php +++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php @@ -430,10 +430,12 @@ class FilterAPITest extends EntityKernelTestBase { * * @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 f51f86a6710..c7f9b5fadfb 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\Core\Render\RenderContext; 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 @@ www.example.com with a newline in comments --> /** * 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 @@ www.example.com with a newline in comments --> * ), * ); * @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 @@ body {color:red} * (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 @@ body {color:red} * (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 c32885eae14..72fd8dcd621 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 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase implements MigrateD * 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 84e34b3af4f..4aac99d5bd0 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 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase { * * @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 da0e59845fe..0def1eea416 100644 --- a/core/modules/image/tests/src/Kernel/ImageFormatterTest.php +++ b/core/modules/image/tests/src/Kernel/ImageFormatterTest.php @@ -206,8 +206,10 @@ class ImageFormatterTest extends FieldKernelTestBase { * 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 c4e3d5d46c4..89009fd0588 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 @@ namespace Drupal\Tests\image\Kernel\Migrate\d6; 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 @@ class MigrateImageCacheTest extends MigrateDrupal6TestBase { /** * 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 11d2a88e14d..df0f6c7d043 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 @@ class MigrateImageStylesTest extends MigrateDrupal7TestBase { * @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 5627ae8a4d1..a44424b61c4 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -910,8 +910,10 @@ class FileUploadTest extends ResourceTestBase { * 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 3f1418bf4c6..411e0738d6f 100644 --- a/core/modules/jsonapi/tests/src/Functional/NodeTest.php +++ b/core/modules/jsonapi/tests/src/Functional/NodeTest.php @@ -370,8 +370,10 @@ class NodeTest extends ResourceTestBase { * 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 @@ class NodeTest extends ResourceTestBase { * * @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 e0a79f3f561..d58bc02b2f7 100644 --- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php +++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php @@ -112,7 +112,7 @@ class RestJsonApiUnsupported extends ResourceTestBase { /** * {@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 21a2d99d0b5..365905b28e6 100644 --- a/core/modules/jsonapi/tests/src/Functional/UserTest.php +++ b/core/modules/jsonapi/tests/src/Functional/UserTest.php @@ -315,8 +315,10 @@ class UserTest extends ResourceTestBase { * 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 b7df98402bb..dc56e20b054 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 @@ class MigrateLanguageContentTaxonomyVocabularySettingsTest extends MigrateDrupal * 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 57e0728f595..957b1e986b1 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 591cb5d9f0e..2cacadd2394 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 @@ class MigrateLanguageContentTaxonomyVocabularySettingsTest extends MigrateDrupal * 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 2f92dbee69f..dcf482eb8c3 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 @@ class LayoutBuilderAccessTest extends BrowserTestBase { * @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 085942a9548..d4314d7ecbb 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 @@ class LayoutBuilderTest extends BrowserTestBase { /** * 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 75fd6028390..c22938cb8b8 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 @@ class LayoutSectionTest extends BrowserTestBase { * 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 d50e1fa400b..d4402a79658 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 @@ class BlockFilterTest extends WebDriverTestBase { * * @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 4fccd1c8427..c5e7c0cb454 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 @@ class BlockFormMessagesTest extends WebDriverTestBase { /** * 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 01b76696c53..0d472adc821 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 @@ class ContentPreviewToggleTest extends WebDriverTestBase { /** * 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 @@ class ContentPreviewToggleTest extends WebDriverTestBase { * * @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 fc73d5f23fe..94872332337 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 @@ class ContextualLinksTest extends WebDriverTestBase { /** * 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 @@ class ContextualLinksTest extends WebDriverTestBase { /** * 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 90bd6a5e778..5727e9b8a40 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 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { $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 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { $this->assertSaveLayout(); $this->drupalGet('node/1'); - $private_href2 = $this->assertFileAccessibleOnNode($file2); + $private_href2 = $this->getFileHrefAccessibleOnNode($file2); $this->createNewNodeRevision(1); @@ -131,7 +131,7 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { $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 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { $this->assertSaveLayout(); $this->drupalGet('node/2'); - $private_href4 = $this->assertFileAccessibleOnNode($file4); + $private_href4 = $this->getFileHrefAccessibleOnNode($file4); $this->createNewNodeRevision(2); @@ -236,7 +236,7 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { } /** - * 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 @@ class InlineBlockPrivateFilesTest extends InlineBlockTestBase { * @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 bbcd3cf5127..773ad3a396a 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 @@ class InlineBlockTest extends InlineBlockTestBase { * 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 @@ class InlineBlockTest extends InlineBlockTestBase { * 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 773715c932e..083b9682a3d 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 @@ class LayoutBuilderDisableInteractionsTest extends WebDriverTestBase { * * @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 @@ class LayoutBuilderDisableInteractionsTest extends WebDriverTestBase { /** * 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 @@ class LayoutBuilderDisableInteractionsTest extends WebDriverTestBase { /** * 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 @@ class LayoutBuilderDisableInteractionsTest extends WebDriverTestBase { * 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 1562216da59..35c8b8090c6 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 @@ class LayoutBuilderTest extends WebDriverTestBase { * @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 @@ class LayoutBuilderTest extends WebDriverTestBase { * * @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 6523bd63679..77af692cc51 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 @@ class LayoutBuilderUiTest extends WebDriverTestBase { * * @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 @@ class LayoutBuilderUiTest extends WebDriverTestBase { * @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 @@ class LayoutBuilderUiTest extends WebDriverTestBase { /** * 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 3b857b10e5b..f7b302e7355 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 @@ class MoveBlockFormTest extends WebDriverTestBase { * * @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 @@ class MoveBlockFormTest extends WebDriverTestBase { * 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 2fd7cd7a783..9ec01e7cb0d 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 @@ class TestMultiWidthLayoutsTest extends WebDriverTestBase { * * @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 2e21947de9d..7e3c5b13028 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 @@ class SectionTest extends UnitTestCase { * 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 2e4044abfa9..80b03928006 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -211,8 +211,10 @@ class LinkFieldTest extends BrowserTestBase { * 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 @@ class LinkFieldTest extends BrowserTestBase { * 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 7045a04fa3d..177fa62a8ac 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php @@ -218,8 +218,10 @@ class LinkFieldUITest extends BrowserTestBase { * 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 @@ class LinkFieldUITest extends BrowserTestBase { * 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 b9f6f3babab..886710312b5 100644 --- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php @@ -247,8 +247,10 @@ class LocaleConfigTranslationTest extends BrowserTestBase { * @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 9084e1d5297..f059508eed3 100644 --- a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php +++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php @@ -386,8 +386,10 @@ class LocaleConfigSubscriberTest extends KernelTestBase { * 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase { * 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase { * 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase { * 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase { * @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 f3361c76b49..d3c89fc72a3 100644 --- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php @@ -190,8 +190,10 @@ class MediaRevisionTest extends MediaFunctionalTestBase { * 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 828f2e0317b..5446c3a3ca7 100644 --- a/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php +++ b/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php @@ -475,8 +475,10 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { * 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 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { * * @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 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { * @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 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { * 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 d192edcde70..5785a13a680 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -1415,11 +1415,13 @@ class CKEditorIntegrationTest extends WebDriverTestBase { * * @param string $attribute * The attribute to check. - * @param mixed $value + * @param string|null $value * Either a string value or if NULL, asserts that 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 @@ JS; * * @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 @@ JS; * * @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 e4a0f942c4e..9f17c9245e2 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @@ -159,8 +159,10 @@ class MediaSourceImageTest extends MediaSourceTestBase { * * @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 59fa8af6ace..f6d00a3da6d 100644 --- a/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php +++ b/core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php @@ -92,8 +92,10 @@ class MediaAccessControlHandlerTest extends MediaKernelTestBase { * 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 b24dcc6903b..e83c5e31831 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 @@ class MediaLibraryDisplayModeTest extends BrowserTestBase { * @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 @@ class MediaLibraryDisplayModeTest extends BrowserTestBase { * 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 07b8f514f19..dd21529b76e 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 @@ class ContentModerationTest extends WebDriverTestBase { /** * 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 @@ class ContentModerationTest extends WebDriverTestBase { /** * 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 b8fa3d268c2..7ed7e1975c1 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 @@ class MediaLibraryAccessTest extends KernelTestBase { * @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 e5fc54ff9e2..57e3ef47f65 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 @@ namespace Drupal\Tests\media_library\Kernel; 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 @@ class MediaLibraryWidgetTest extends KernelTestBase { * 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 61279cb7a76..894bb59993d 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 @@ class MenuLinksTest extends KernelTestBase { /** * 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 bc72be37598..c21a085fd5b 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 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { * 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 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { * @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 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { $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 f45a662758f..0793ea3652e 100644 --- a/core/modules/migrate/tests/src/Kernel/HighWaterTest.php +++ b/core/modules/migrate/tests/src/Kernel/HighWaterTest.php @@ -267,8 +267,10 @@ class HighWaterTest extends MigrateTestBase { * * @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 @@ class HighWaterTest extends MigrateTestBase { * * @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 1123737bcfa..b5fb3ec2502 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php @@ -67,8 +67,10 @@ class MigrateEntityContentBaseTest extends KernelTestBase { * 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 04d45b8c04d..1f8f80c1afb 100644 --- a/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php +++ b/core/modules/migrate/tests/src/Kernel/TrackChangesTest.php @@ -153,8 +153,10 @@ class TrackChangesTest extends MigrateTestBase { * 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 @@ class TrackChangesTest extends MigrateTestBase { * 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 dc7cce130bf..72d55143b45 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 @@ class FileCopyTest extends MigrateProcessTestCase { * * @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 eb07400d312..900a374d491 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 @@ class DestinationCategoryTest extends MigrateDrupalTestBase { * * @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 34a48605351..73cad339dc4 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 @@ class ContentEntityTest extends KernelTestBase { * 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 1d86b61ef8b..f25d28e11d8 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 @@ class MigrateUpgradeFormStepsTest extends BrowserTestBase { * 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 31feae3cccf..4ee6cda5a7f 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 @@ class Upgrade6Test extends MigrateUpgradeExecuteTestBase { /** * 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 7f1a26fd93f..864c5dd8e47 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 @@ class Upgrade7Test extends MigrateUpgradeExecuteTestBase { /** * 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 a20379f1682..ac042c11458 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php @@ -207,12 +207,14 @@ class NodeAccessBaseTableTest extends NodeTestBase { /** * 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 e647190921f..746a750fe39 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php @@ -76,8 +76,10 @@ class NodeAccessGrantsCacheContextTest extends NodeTestBase { * * @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 dc788da0a76..c85042d625c 100644 --- a/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php +++ b/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php @@ -114,8 +114,10 @@ class NodeDisplayConfigurableTest extends NodeTestBase { * 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 6705134a22f..44dc2faec0e 100644 --- a/core/modules/node/tests/src/Functional/NodeTestBase.php +++ b/core/modules/node/tests/src/Functional/NodeTestBase.php @@ -56,6 +56,8 @@ abstract class NodeTestBase extends BrowserTestBase { * 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 @@ abstract class NodeTestBase extends BrowserTestBase { * @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 bf1cc6ac20d..1ee1b6606dc 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 @@ class FrontPageTest extends ViewTestBase { * 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 33105bebc3b..e94a11ecb3a 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 @@ class NodeFieldFilterTest extends NodeTestBase { * 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 dec8d923967..ea0cfe411ac 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 @@ class NodeIntegrationTest extends NodeTestBase { * * @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 986f59cbc09..c5bd79ccb95 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 @@ class NodeLanguageTest extends NodeTestBase { * * @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 298df46b55f..324feb7cd70 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 @@ class MigrateNodeCompleteTest extends MigrateNodeTestBase { * 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 d975e9e4b8f..ed3bc55add4 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 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { * 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 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { $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 1d38c971044..3f5039c9a9c 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 @@ class MigrateNodeCompleteTest extends MigrateDrupal7TestBase { * 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 50cabf5f185..04656656c2a 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 @@ class MigrateNodeRevisionTest extends MigrateDrupal7TestBase { * 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 0c62e6251de..f91b9f72079 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 @@ class MigrateNodeTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateNodeTest extends MigrateDrupal7TestBase { * 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 e0c6773c4ce..9b79ea1092a 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 @@ class MigrateNodeTitleLabelTest extends MigrateDrupal7TestBase { * 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 94a579c8703..70f2a26e1b5 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 @@ class MigrateNodeTypeTest extends MigrateDrupal7TestBase { * 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 3ee8ba16f32..32eca5d6ba2 100644 --- a/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php +++ b/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php @@ -91,6 +91,8 @@ abstract class NodeAccessTestBase extends KernelTestBase { * 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 @@ abstract class NodeAccessTestBase extends KernelTestBase { * @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 e3d732464ee..23e965bd417 100644 --- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php +++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php @@ -306,16 +306,18 @@ class OptionsFieldUITest extends FieldTestBase { /** * 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 dbc9b0f788c..46e9a92d2e0 100644 --- a/core/modules/path/tests/src/Functional/PathContentModerationTest.php +++ b/core/modules/path/tests/src/Functional/PathContentModerationTest.php @@ -234,8 +234,10 @@ class PathContentModerationTest extends BrowserTestBase { * * @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 43bc7e72d31..065d229f1fb 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 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase { * 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 cfac219e1da..9accbe0435f 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 @@ class UrlAlterFunctionalTest extends BrowserTestBase { /** * 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 @@ class UrlAlterFunctionalTest extends BrowserTestBase { /** * 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 1cb90adf40d..dbff08aa289 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php @@ -76,8 +76,10 @@ class QuickEditEndPointAccessTest extends BrowserTestBase { * 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 daa5a192c4d..05744d77eaf 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php @@ -214,14 +214,14 @@ class LayoutBuilderQuickEditTest extends QuickEditJavascriptTestBase { /** * {@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 @@ class LayoutBuilderQuickEditTest extends QuickEditJavascriptTestBase { * @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 7b9d268f2ad..7148aa38d2c 100644 --- a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php +++ b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php @@ -338,8 +338,10 @@ class StandardProfileTest extends BrowserTestBase { * 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 @@ class StandardProfileTest extends BrowserTestBase { * * @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 @@ class StandardProfileTest extends BrowserTestBase { /** * 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 59c2157e86c..bad3a45e416 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 @@ class MigrateRdfMappingTest extends MigrateDrupal7TestBase { * 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 b56b027fece..ba2708ceda6 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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { * @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 10f35c8ccd8..5f6c12ea7e8 100644 --- a/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php +++ b/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php @@ -93,8 +93,10 @@ class SearchAdminThemeTest extends BrowserTestBase { * * @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 d0148ca933e..b07904e922e 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -307,8 +307,10 @@ class SearchCommentTest extends BrowserTestBase { /** * 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 35d0fd16cd0..a5d4a7f71c6 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -408,17 +408,17 @@ class SearchConfigSettingsFormTest extends BrowserTestBase { /** * 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 7fcefbe50f5..a8dbc5d130b 100644 --- a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php +++ b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php @@ -284,8 +284,10 @@ class SearchMultilingualEntityTest extends BrowserTestBase { * 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 @@ class SearchMultilingualEntityTest extends BrowserTestBase { * 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 16106e75302..d3e8ee38ea9 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 617dce5271d..459ad5da43a 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 @@ class EntityReferenceFieldItemNormalizerTest extends UnitTestCase { * * @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 cfe5c1566bb..8d17f3a6527 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 @@ class OverriddenConfigurationTest extends SettingsTrayTestBase { * 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 a3029053f4e..4dc879b389f 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php @@ -462,20 +462,13 @@ class ShortcutLinksTest extends ShortcutTestBase { * (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 61b438abbc5..c932114e6e9 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 @@ class MigrateShortcutSetTest extends MigrateDrupal7TestBase { * 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 6e1b4fefe03..bf9d9bbf1b3 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 @@ class MigrateShortcutTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateShortcutTest extends MigrateDrupal7TestBase { */ 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 7e31b6a308f..f42079f74a7 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 @@ class MigrateNodeCounterTest extends MigrateDrupal6TestBase { * 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 f2041654f28..7f8c319831e 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 @@ class MigrateNodeCounterTest extends MigrateDrupal7TestBase { * 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 402ac866622..de95fb57616 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 @@ class FrameworkTest extends BrowserTestBase { * 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 e624e4c1dec..430883e7cbd 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 @@ class ProcessingTest extends BrowserTestBase { * 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 e7561716cbb..dca3999efc5 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 @@ class SessionExistsCacheContextTest extends BrowserTestBase { /** * 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 148d025e8df..4e064969f8f 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 @@ class NoJavaScriptAnonymousTest extends BrowserTestBase { /** * 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 1ab19c710c1..8f6a4fcaa34 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 @@ class EntityReferenceSelectionAccessTest extends KernelTestBase { * 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 5be7c331889..1cd9a8eb748 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 @@ class ConfirmFormTest extends BrowserTestBase { * 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 860ff8dd007..7c4eddd2fd3 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 @@ class FormTest extends BrowserTestBase { /** * 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 ca1af095f3b..ecb9e260547 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 @@ class HtmlToTextTest extends BrowserTestBase { /** * 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 fcea5966ad9..f4ca2ab86ef 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 @@ class LocalActionTest extends BrowserTestBase { * * @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 7c74f5aaedf..c9ddfb28240 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 @@ class LocalTasksTest extends BrowserTestBase { * @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 @@ class LocalTasksTest extends BrowserTestBase { * @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('@]*>' . preg_quote($title, '@') . '@'); + $this->assertSession()->responseMatches('@]*>' . preg_quote($title, '@') . '@'); } /** @@ -88,8 +89,10 @@ class LocalTasksTest extends BrowserTestBase { * @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 9b6a3cb856f..11030908cc2 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 @@ class InstallUninstallTest extends ModuleTestBase { * * @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 @@ class InstallUninstallTest extends ModuleTestBase { * * @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 @@ class InstallUninstallTest extends ModuleTestBase { * @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 @@ class InstallUninstallTest extends ModuleTestBase { * * @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 @@ class InstallUninstallTest extends ModuleTestBase { * * @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 @@ class InstallUninstallTest extends ModuleTestBase { * 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 cc570726c37..d6f09f2174b 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 @@ class PagerTest extends BrowserTestBase { * * @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 @@ class PagerTest extends BrowserTestBase { * 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 @@ class PagerTest extends BrowserTestBase { * 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 9921fe04a90..a66e3d02326 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 @@ class HtmlResponseAttachmentsTest extends BrowserTestBase { /** * 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 @@ class HtmlResponseAttachmentsTest extends BrowserTestBase { /** * 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 @@ class HtmlResponseAttachmentsTest extends BrowserTestBase { /** * 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 4d6cb3928cc..c96f119d5f4 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 @@ class SecurityAdvisoryTest extends BrowserTestBase { * 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 @@ class SecurityAdvisoryTest extends BrowserTestBase { * 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 @@ class SecurityAdvisoryTest extends BrowserTestBase { * 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 @@ class SecurityAdvisoryTest extends BrowserTestBase { * 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 55219cd376f..5b7c31c92f8 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 @@ class SessionAuthenticationTest extends BrowserTestBase { * 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 0b679ad373e..8b123f0882a 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 @@ class SessionHttpsTest extends BrowserTestBase { /** * 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 b07b8cb55b9..10c8f55b470 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 @@ class SessionTest extends BrowserTestBase { /** * 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 @@ class SessionTest extends BrowserTestBase { /** * 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 5d97125dd57..26daf6ec1c9 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 @@ class ErrorHandlerTest extends BrowserTestBase { /** * 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 @@ class ErrorHandlerTest extends BrowserTestBase { * * 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 092f57ac702..e932fa3b348 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 @@ class HtaccessTest extends BrowserTestBase { * 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 ca1c94eaf14..6859bf697ec 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 @@ class ThemeTest extends BrowserTestBase { * @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 39fce07d4c2..98388dbd146 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 @@ class ThemeUiTest extends BrowserTestBase { * 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 e123f7e0515..d2eab668434 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 @@ class TwigRegistryLoaderTest extends BrowserTestBase { /** * 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 cb292abf31d..35078dc7271 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 @@ class TwigTransTest extends BrowserTestBase { /** * 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 c6b31078c24..63286e8fb77 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 @@ class UpdateScriptTest extends BrowserTestBase { * 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 @@ class UpdateScriptTest extends BrowserTestBase { * 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 @@ class UpdateScriptTest extends BrowserTestBase { * * @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 348c11addef..c4f6a047aaa 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php @@ -150,8 +150,10 @@ class OffCanvasTest extends OffCanvasTestBase { * 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 9c833045562..f5f79c1d2a2 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 @@ class FormElementsRenderTest extends KernelTestBase { /** * 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 6c4e263ccf0..a7842b480a8 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 @@ class PageRenderTest extends KernelTestBase { * 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 81356bb9226..a970c30257c 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 @@ class ConfigEntityImportTest extends KernelTestBase { * 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 ff33361d4f4..8ca75e10658 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 @@ class ModuleHandlerTest extends KernelTestBase { * * @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 b0cd4ff2a90..d4aac6d578a 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 @@ class MigrateMenuTest extends MigrateDrupal7TestBase { /** * Asserts various aspects of a menu. * - * @param $id + * @param string $id * The menu ID. * @param string $language * The menu language. @@ -32,8 +32,10 @@ class MigrateMenuTest extends MigrateDrupal7TestBase { * 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 294b90dbb28..70a11c4d63b 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 @@ class SecurityAdvisoriesFetcherTest extends KernelTestBase implements LoggerInte * * @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 40c476f0b5a..f758ddd287c 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 @@ class TwigNamespaceTest extends KernelTestBase { /** * 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 39a4c5d3c87..a07f0bd69c6 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermAccessTest.php @@ -110,14 +110,16 @@ class TermAccessTest extends TaxonomyTestBase { * * @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 88d3033cf94..ef0d06ff245 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermParentsTest.php @@ -282,8 +282,10 @@ class TermParentsTest extends BrowserTestBase { * @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 @@ class TermParentsTest extends BrowserTestBase { * * @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 61f90cb5013..e79e77fc770 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 @@ class RelationshipNodeTermDataTest extends TaxonomyTestBase { * 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 dafa38e2241..2f47bae8fb7 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 @@ class TaxonomyFieldFilterTest extends ViewTestBase { * 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 79f9829555e..481a4c69d33 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 @@ class TaxonomyTermFilterDepthTest extends TaxonomyTestBase { * 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 3b66a94fb44..c2afbe1f336 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal6TestBase { $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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal6TestBase { * 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 e9f7f89f8fd..39c91d517bb 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 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { /** * 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 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { $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 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { * @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 c85a52f6d1d..bd37bf6e319 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal7TestBase { $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 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal7TestBase { * 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 ef8d3eda6df..979d5b5ac1f 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 @@ class MigrateTaxonomyVocabularyTest extends MigrateDrupal7TestBase { /** * 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 @@ class MigrateTaxonomyVocabularyTest extends MigrateDrupal7TestBase { * 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 5c011bf9368..fb0d80b1b5a 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal7TestBase { $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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal7TestBase { * 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 @@ class MigrateTermLocalizedTranslationTest extends MigrateDrupal7TestBase { * 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 444bb85a86b..02683a62912 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php @@ -134,8 +134,10 @@ class TaxonomyQueryAlterTest extends KernelTestBase { * @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 1a04055ef57..bd03bb13bc2 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 @@ class TaxonomyTermArgumentDepthTest extends TaxonomyTestBase { * 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 f679633af8b..51c7c530098 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 @@ class TaxonomyTermFilterDepthTest extends TaxonomyTestBase { * 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 2c51a91ea49..12f8b9dc213 100644 --- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php @@ -40,8 +40,10 @@ class TextareaWithSummaryTest extends WebDriverTestBase { /** * 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 c1e79d24157..5537e74acc0 100644 --- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php +++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php @@ -238,8 +238,10 @@ class TextSummaryTest extends KernelTestBase { /** * 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('
@actual
is identical to
@expected
', ['@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 65975d1e25b..2b2ef5a3c99 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php @@ -453,8 +453,10 @@ class ToolbarAdminMenuTest extends BrowserTestBase { /** * 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 5de4c2d8b62..c7ff8b304f4 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php @@ -107,8 +107,10 @@ class ToolbarCacheContextsTest extends BrowserTestBase { * 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 f33a80f5f7d..eefdc4d52c9 100644 --- a/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php +++ b/core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php @@ -92,8 +92,10 @@ class TourLegacyTest extends WebDriverTestBase { * 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 4c01a0d06dc..b3515564535 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -474,8 +474,10 @@ class TrackerTest extends BrowserTestBase { * 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 3b07f69161d..30898f0c2d9 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -871,8 +871,10 @@ class UpdateContribTest extends UpdateTestBase { * 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 7bcdf26583c..302944f924e 100644 --- a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php +++ b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php @@ -256,7 +256,7 @@ class RestRegisterUserTest extends ResourceTestBase { /** * {@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 87c68c2c718..7751707a139 100644 --- a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php @@ -325,12 +325,14 @@ class UserLoginHttpTest extends BrowserTestBase { * 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 @@ class UserLoginHttpTest extends BrowserTestBase { * 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 778f1744853..cbc3b29cbeb 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -188,15 +188,16 @@ class UserLoginTest extends BrowserTestBase { * * @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 775f2806c1d..e984c466edd 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -486,8 +486,10 @@ class UserPasswordResetTest extends BrowserTestBase { /** * 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 @@ class UserPasswordResetTest extends BrowserTestBase { * * @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 @@ class UserPasswordResetTest extends BrowserTestBase { /** * 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 4575ee9ba8e..bd4d375b896 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -397,8 +397,10 @@ class UserRegistrationTest extends BrowserTestBase { /** * 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 ffeb2442ba7..d31525e0208 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 @@ class MigrateUserPictureD6FileTest extends MigrateDrupal6TestBase { // 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 @@ class MigrateUserPictureD6FileTest extends MigrateDrupal6TestBase { * 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 cab4de4a5e5..ea6f946358a 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 @@ class MigrateUserRoleTest extends MigrateDrupal6TestBase { * 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 @@ class MigrateUserRoleTest extends MigrateDrupal6TestBase { * * @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 9b3495028ef..4d7fcd66b73 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 @@ class MigrateUserRoleTest extends MigrateDrupal7TestBase { * 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 655b460f47a..f8c533bc6ef 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 @@ class MigrateUserTest extends MigrateDrupal7TestBase { * 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 00c75cd6045..1aabea79a8a 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -89,8 +89,10 @@ class UserAccountFormFieldsTest extends KernelTestBase { * * @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 73886da53ea..579b8b4be0d 100644 --- a/core/modules/user/tests/src/Kernel/UserValidationTest.php +++ b/core/modules/user/tests/src/Kernel/UserValidationTest.php @@ -198,8 +198,10 @@ class UserValidationTest extends KernelTestBase { * (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 @@ class UserValidationTest extends KernelTestBase { * 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 36d9254229d..369b4f299a2 100644 --- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php +++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php @@ -332,8 +332,10 @@ EOF * * @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 2e29bb43e16..0767c5ca6a5 100644 --- a/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php +++ b/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php @@ -135,8 +135,10 @@ class UserAccessControlHandlerTest extends UnitTestCase { /** * 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 5a3ed15f306..c6ef3693712 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 @@ class FieldEntityTranslationTest extends ViewTestBase { * * @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 f61145fe9cc..f6e063f450d 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 @@ class FieldRenderedEntityTranslationTest extends ViewTestBase { * * @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 520db9cadcf..3baa6f3943f 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 @@ class FieldWebTest extends ViewTestBase { * 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 @@ class FieldWebTest extends ViewTestBase { * 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 38f371799b4..6fc75547dee 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 @@ class DisplayPageWebTest extends ViewTestBase { * * @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 92381e1da74..ea733a5b4a3 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 @@ class ExposedFormTest extends ViewTestBase { * * @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 @@ class ExposedFormTest extends ViewTestBase { * * @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 70dc2b6bb88..569c9ef11b2 100644 --- a/core/modules/views/tests/src/Functional/SearchIntegrationTest.php +++ b/core/modules/views/tests/src/Functional/SearchIntegrationTest.php @@ -144,15 +144,13 @@ class SearchIntegrationTest extends ViewTestBase { * @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 ff7f60357ac..f96b468e3ca 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php @@ -136,8 +136,10 @@ class PaginationAJAXTest extends WebDriverTestBase { /** * 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 338223709ab..fa47eca31b8 100644 --- a/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php +++ b/core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php @@ -95,8 +95,10 @@ class CacheableMetadataCalculationTest extends KernelTestBase { * @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 6bab4cfdbde..372a4c4add8 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 @@ class EntityViewsDataTest extends KernelTestBase { * 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 @@ class EntityViewsDataTest extends KernelTestBase { /** * 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 @@ class EntityViewsDataTest extends KernelTestBase { /** * 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 @@ class EntityViewsDataTest extends KernelTestBase { * * @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 @@ class EntityViewsDataTest extends KernelTestBase { * * @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 @@ class EntityViewsDataTest extends KernelTestBase { * * @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 @@ class EntityViewsDataTest extends KernelTestBase { /** * 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 @@ class EntityViewsDataTest extends KernelTestBase { /** * 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 1b47f80b4e4..41606428b74 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 @@ class LatestRevisionFilterTest extends ViewsKernelTestBase { * 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 d373072d09e..42eaa3b12d7 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 @@ class RowEntityRenderersTest extends ViewsKernelTestBase { * 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 @@ class RowEntityRenderersTest extends ViewsKernelTestBase { } } - $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 9c25d3aead6..b22c6b1c3b3 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 @@ class ViewsEntitySchemaSubscriberIntegrationTest extends ViewsKernelTestBase { * * @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 82caa80f19b..659e1490efb 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 @@ class AreaDisplayLinkTest extends ViewsKernelTestBase { * 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 @@ class AreaDisplayLinkTest extends ViewsKernelTestBase { * 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 @@ class AreaDisplayLinkTest extends ViewsKernelTestBase { * * @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 @@ class AreaDisplayLinkTest extends ViewsKernelTestBase { * 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 5ce5e83c832..cd584e68598 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 @@ class FieldDateTest extends ViewsKernelTestBase { /** * 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 @@ class FieldDateTest extends ViewsKernelTestBase { /** * 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 4f910234e9a..fa37204e0a0 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 @@ class FieldKernelTest extends ViewsKernelTestBase { * 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 @@ class FieldKernelTest extends ViewsKernelTestBase { * 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 241c65cec51..1c598edcb29 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 @@ class FieldRenderedEntityTest extends ViewsKernelTestBase { * * @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 @@ class FieldRenderedEntityTest extends ViewsKernelTestBase { * * @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 f59370d62d0..8113f573d06 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\area\Broken as BrokenArea; 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 @@ class ModuleTest extends ViewsKernelTestBase { /** * 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 521ab74ed43..69f940ed05e 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 @@ class StyleGridTest extends PluginKernelTestBase { * 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 5858ae115f2..315fae72037 100644 --- a/core/modules/views/tests/src/Kernel/PluginInstanceTest.php +++ b/core/modules/views/tests/src/Kernel/PluginInstanceTest.php @@ -93,8 +93,10 @@ class PluginInstanceTest extends ViewsKernelTestBase { * * @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 ed1fa20e285..2ed8125a3b3 100644 --- a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php @@ -87,8 +87,10 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase { * * @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 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase { /** * 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 92e4b51d259..5fa97a3928c 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -362,8 +362,10 @@ class ViewExecutableTest extends ViewsKernelTestBase { * * @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 f0e3ba9ce91..c0dff398575 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 @@ class ViewAjaxControllerTest extends UnitTestCase { * 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 5cd30b04aed..219951d1554 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 @@ class ExposedFormUITest extends UITestBase { * * @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 e20089a77c4..e5235989fca 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 @@ class HandlerTest extends UITestBase { * 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 bd57872746c..4aea55c6819 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 @@ class RearrangeFieldsTest extends UITestBase { /** * 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 43eab572b48..9ca8b80a65e 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 @@ class PreviewTest extends WebDriverTestBase { * * @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 @@ class PreviewTest extends WebDriverTestBase { * 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 e97c7782054..8cd3a716385 100644 --- a/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php +++ b/core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php @@ -305,8 +305,10 @@ class PathWorkspacesTest extends BrowserTestBase { * * @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 @@ class PathWorkspacesTest extends BrowserTestBase { * * @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 dd32a2682b4..3c86921cf60 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php @@ -753,8 +753,10 @@ class WorkspaceIntegrationTest extends KernelTestBase { * 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 @@ class WorkspaceIntegrationTest extends KernelTestBase { * 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 @@ class WorkspaceIntegrationTest extends KernelTestBase { * 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 @@ class WorkspaceIntegrationTest extends KernelTestBase { * 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 205575be3a9..b7235cf7706 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 @@ class UninstallDefaultContentTest extends BrowserTestBase { * @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 @@ class UninstallDefaultContentTest extends BrowserTestBase { * @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 @@ class UninstallDefaultContentTest extends BrowserTestBase { * @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 be483fd9c03..89f6a6a20ea 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 @@ class DemoUmamiProfileTest extends BrowserTestBase { * @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 7a9370a90dc..cec79deacf5 100644 --- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php +++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php @@ -50,7 +50,7 @@ class StandardJavascriptTest extends WebDriverTestBase { * @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 04c5ff9bc00..a80a9482bb8 100644 --- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php @@ -259,8 +259,10 @@ class ComposerProjectTemplatesTest extends BuildTestBase { * 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 efeb6167690..87ec2d21087 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php @@ -162,8 +162,10 @@ JS; * 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 @@ JS; * * @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 11e31855175..5f4b48bf8bd 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php @@ -145,8 +145,10 @@ JS; * * @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 a0c1d57cbb8..03c6b3af15b 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php @@ -109,8 +109,10 @@ class MessageCommandTest extends WebDriverTestBase { * * @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 @@ class MessageCommandTest extends WebDriverTestBase { * * @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 e52149b74f9..951330cbd48 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php @@ -108,8 +108,10 @@ class JsMessageTest extends WebDriverTestBase { * 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 cf36dc19299..4003ecf9e69 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php @@ -156,8 +156,10 @@ class TableDragTest extends WebDriverTestBase { * @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 @@ class TableDragTest extends WebDriverTestBase { * 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 @@ class TableDragTest extends WebDriverTestBase { * @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 @@ class TableDragTest extends WebDriverTestBase { * @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 21b02065b22..06dde6ce8d0 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -282,8 +282,10 @@ class UncaughtExceptionTest extends BrowserTestBase { * * @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 @@ class UncaughtExceptionTest extends BrowserTestBase { * * @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 d79ea5b0e0b..0de9040330c 100644 --- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php +++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php @@ -71,8 +71,10 @@ class DefaultConfigTest extends KernelTestBase { * 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 faf8cadb6fc..487f3c6cd47 100644 --- a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php @@ -88,14 +88,16 @@ class CommandsTest extends KernelTestBase { * 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 fd58a786a41..82d9d3c670b 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php @@ -262,25 +262,24 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { * 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 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { * 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 06fda37ec7a..120cf77de8a 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -151,8 +151,10 @@ class ConfigDiffTest extends KernelTestBase { * @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 67a81adbfbe..9b88592c73a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php @@ -95,8 +95,10 @@ class ConnectionUnitTest extends KernelTestBase { * * @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 @@ class ConnectionUnitTest extends KernelTestBase { * * @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 039e916a33a..bf73ba4609c 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php @@ -672,10 +672,12 @@ class SchemaTest extends KernelTestBase { * 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 @@ class SchemaTest extends KernelTestBase { /** * 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 @@ class SchemaTest extends KernelTestBase { /** * 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 d55fe82cbdb..e76618152a6 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -316,12 +316,14 @@ class TransactionTest extends DatabaseTestBase { /** * 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 @@ class TransactionTest extends DatabaseTestBase { /** * 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 0e790af4c86..161f3b3edef 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 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * 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 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * 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 3d755a55c16..bee4cd224e0 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php @@ -42,8 +42,10 @@ class BundleConstraintValidatorTest extends KernelTestBase { * * @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 667bae83533..c40a4bebdeb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -726,8 +726,10 @@ class ConfigEntityQueryTest extends KernelTestBase { * * @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 269dc77eb56..daa74a9aacc 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -38,8 +38,10 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * 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 268cedd7057..ccc1f537aff 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php @@ -46,8 +46,10 @@ class EntityApiTest extends EntityKernelTestBase { * 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 6f0ac63ac6b..a77b0eb5fd9 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php @@ -68,10 +68,12 @@ class EntityCrudHookTest extends EntityKernelTestBase { * 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 c5e27218c2a..93d07c4d23a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php @@ -40,8 +40,10 @@ class EntityFieldDefaultValueTest extends EntityKernelTestBase { * * @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 9a50a78fe6a..275d9274a6a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php @@ -626,8 +626,10 @@ class EntityQueryAggregateTest extends EntityKernelTestBase { * @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 @@ class EntityQueryAggregateTest extends EntityKernelTestBase { * * @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 54c4484c6ca..b0983c75776 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php @@ -224,8 +224,10 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { * * @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 176413cf698..bf35a517f3c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -720,7 +720,10 @@ class EntityQueryTest extends EntityKernelTestBase { } - protected function assertResult() { + /** + * @internal + */ + protected function assertResult(): void { $assert = []; $expected = func_get_args(); if ($expected && is_array($expected[0])) { @@ -732,16 +735,21 @@ class EntityQueryTest extends EntityKernelTestBase { $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 9258c4acf70..c3005afd879 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -331,10 +331,12 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { * * @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 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { * * @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 5bebe5d370c..bd36cad7b0c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php @@ -300,8 +300,10 @@ class EntityRepositoryTest extends KernelTestBase { * 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 f9b7b328aa3..86f116702b3 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -35,8 +35,10 @@ class EntityUUIDTest extends EntityKernelTestBase { * * @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 3559c03a894..0cfff0994fa 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php @@ -70,8 +70,10 @@ class FieldTranslationSqlStorageTest extends EntityLanguageTestBase { * 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 7cb95a4afd8..ffeea531665 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php @@ -381,8 +381,10 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { * 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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { * @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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * 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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * 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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * 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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * 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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { * * @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 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * 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 bc38a47d66e..15d56e68d60 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php @@ -166,8 +166,10 @@ class RevisionableContentEntityBaseTest extends EntityKernelTestBase { * 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 15ab322db08..36f1f9cc839 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php @@ -83,10 +83,12 @@ class FieldItemTest extends EntityKernelTestBase { * * @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 b9f59efbd8b..e49ff3b4c39 100644 --- a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php @@ -97,8 +97,10 @@ class HtaccessTest extends KernelTestBase { * 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 ea400d607a6..0704cec75d2 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php @@ -412,8 +412,10 @@ class MenuTreeStorageTest extends KernelTestBase { * 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 b589d0e5f69..73c8c010e7c 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 @@ class RenderElementTypesTest extends KernelTestBase { * 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 a2c80f89349..95120187bf7 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @@ -193,8 +193,10 @@ class DateTimePlusTest extends TestCase { * @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 9876f7985d3..74cd216fe55 100644 --- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php +++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php @@ -41,7 +41,7 @@ class DrupalComponentTest extends TestCase { * * @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 @@ class DrupalComponentTest extends TestCase { * * @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 aacd9b59203..2773d46ba30 100644 --- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php +++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php @@ -103,12 +103,14 @@ class GraphTest extends TestCase { /** * 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 @@ class GraphTest extends TestCase { /** * 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 @@ class GraphTest extends TestCase { /** * 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 @@ class GraphTest extends TestCase { /** * 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 ce8588a6e72..413991ff5e0 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php @@ -314,8 +314,10 @@ class SortArrayTest extends TestCase { * 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 b0c434da5d7..9ecffc195ec 100644 --- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php @@ -594,10 +594,10 @@ class XssTest extends TestCase { * 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 @@ class XssTest extends TestCase { * 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 0fd2cfed5b3..12868c0face 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 @@ include __DIR__ . "/settings-custom-additions.php";', * 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 @@ include __DIR__ . "/settings-custom-additions.php";', * * @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 @@ include __DIR__ . "/settings-custom-additions.php";', * 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 @@ include __DIR__ . "/settings-custom-additions.php";', * 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 8eef0c87f30..dbe8008b00e 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -45,7 +45,10 @@ class AccessResultTest extends UnitTestCase { \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 3c3058f9655..ad2fba9322f 100644 --- a/core/tests/Drupal/Tests/Core/Common/TagsTest.php +++ b/core/tests/Drupal/Tests/Core/Common/TagsTest.php @@ -43,8 +43,10 @@ class TagsTest extends UnitTestCase { /** * 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 0fba72d8fc1..d7b6ee5f0e8 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php @@ -581,8 +581,10 @@ class ConfigTest extends UnitTestCase { * * @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 @@ class ConfigTest extends UnitTestCase { * 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 @@ class ConfigTest extends UnitTestCase { * 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 b9b63e0b18f..bbd4f5ce4ae 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -180,10 +180,12 @@ class ControllerResolverTest extends UnitTestCase { * @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 b262aa89872..154a1b0c618 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 @@ class EntityFormDisplayAccessControlHandlerTest extends UnitTestCase { * 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 a05fe7cac13..3ffe645995c 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -484,8 +484,10 @@ class EntityTypeTest extends UnitTestCase { * * @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 0084e4ecba1..865779dc090 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -460,8 +460,10 @@ class EntityUrlTest extends UnitTestCase { * 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 465c60adb4f..aa4ec558a8a 100644 --- a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php @@ -138,8 +138,10 @@ class FileSystemTest extends UnitTestCase { * 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 ee723020f64..1f51ed6f40a 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 @@ class FormAjaxSubscriberTest extends UnitTestCase { ->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 @@ class FormAjaxSubscriberTest extends UnitTestCase { ->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 @@ class FormAjaxSubscriberTest extends UnitTestCase { ->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 @@ class FormAjaxSubscriberTest extends UnitTestCase { * @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 39d4f5b5f87..7f9a23df222 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 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase { * 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 a6626959fa5..f9006bb3db5 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -554,8 +554,10 @@ class RendererPlaceholdersTest extends RendererTestBase { * 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 8938dd44e64..ac69590e8ba 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -731,10 +731,12 @@ class RendererTest extends RendererTestBase { * * @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 108eb7f7164..bd3268d86d9 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -529,18 +529,20 @@ class UrlGeneratorTest extends UnitTestCase { /** * 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 03450142e00..7cfc554cd3e 100644 --- a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php +++ b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php @@ -357,8 +357,10 @@ class RequestSanitizerTest extends UnitTestCase { * 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 b48b5966859..c05a4bfbe3c 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php @@ -382,8 +382,10 @@ class AttributeTest extends UnitTestCase { * 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 @@ class AttributeTest extends UnitTestCase { * 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 @@ class AttributeTest extends UnitTestCase { * 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 @@ class AttributeTest extends UnitTestCase { * 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 cc466edd644..540442693af 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -650,8 +650,10 @@ class LinkGeneratorTest extends UnitTestCase { * 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 @@ class LinkGeneratorTest extends UnitTestCase { * @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);