diff options
Diffstat (limited to 'core/tests')
887 files changed, 3411 insertions, 3411 deletions
diff --git a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php index 7ca3023207d..930f07e7edc 100644 --- a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php +++ b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php @@ -86,7 +86,7 @@ class GenerateThemeTest extends QuickStartTestBase { /** * Tests the generate-theme command. */ - public function test() { + public function test(): void { // Do not rely on \Drupal::VERSION: change the version to a concrete version // number, to simulate using a tagged core release. $starterkit_info_yml = $this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.info.yml'; @@ -134,7 +134,7 @@ class GenerateThemeTest extends QuickStartTestBase { /** * Tests generating a theme from another Starterkit enabled theme. */ - public function testGeneratingFromAnotherTheme() { + public function testGeneratingFromAnotherTheme(): void { // Do not rely on \Drupal::VERSION: change the version to a concrete version // number, to simulate using a tagged core release. $starterkit_info_yml = $this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.info.yml'; @@ -178,7 +178,7 @@ YAML /** * Tests the generate-theme command on a dev snapshot of Drupal core. */ - public function testDevSnapshot() { + public function testDevSnapshot(): void { // Do not rely on \Drupal::VERSION: change the version to a development // snapshot version number, to simulate using a branch snapshot of core. $starterkit_info_yml = $this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.info.yml'; diff --git a/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php b/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php index c659d125724..661d159bf80 100644 --- a/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php +++ b/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php @@ -26,7 +26,7 @@ class ComposerValidateTest extends BuildTestBase { /** * @dataProvider provideComposerJson */ - public function testValidateComposer($path) { + public function testValidateComposer($path): void { $this->executeCommand('composer validate --strict --no-check-all ' . $path); $this->assertCommandSuccessful(); } diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php index cfbd463ddb3..62fce914785 100644 --- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php @@ -85,7 +85,7 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase { /** * Make sure that static::MINIMUM_STABILITY is sufficiently strict. */ - public function testMinimumStabilityStrictness() { + public function testMinimumStabilityStrictness(): void { // Ensure that static::MINIMUM_STABILITY is not less stable than the // current core stability. For example, if we've already released a beta on // the branch, ensure that we no longer allow alpha dependencies. @@ -146,7 +146,7 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase { /** * Make sure we've accounted for all the templates. */ - public function testVerifyTemplateTestProviderIsAccurate() { + public function testVerifyTemplateTestProviderIsAccurate(): void { $root = $this->getDrupalRoot(); $data = $this->provideTemplateCreateProject(); @@ -174,7 +174,7 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase { /** * @dataProvider provideTemplateCreateProject */ - public function testTemplateCreateProject($project, $package_dir, $docroot_dir) { + public function testTemplateCreateProject($project, $package_dir, $docroot_dir): void { // Make a working COMPOSER_HOME directory for setting global composer config $composer_home = $this->getWorkspaceDirectory() . '/composer-home'; mkdir($composer_home); diff --git a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php index 4803397db44..119ec0c40cc 100644 --- a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php +++ b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php @@ -18,7 +18,7 @@ class BuildTestTest extends BuildTestBase { /** * Ensure that workspaces work. */ - public function testWorkspace() { + public function testWorkspace(): void { $test_directory = 'test_directory'; // Execute an empty command through the shell to build out a working @@ -36,7 +36,7 @@ class BuildTestTest extends BuildTestBase { /** * @covers ::copyCodebase */ - public function testCopyCodebase() { + public function testCopyCodebase(): void { $test_directory = 'copied_codebase'; $this->copyCodebase(NULL, $test_directory); $full_path = $this->getWorkspaceDirectory() . '/' . $test_directory; @@ -58,7 +58,7 @@ class BuildTestTest extends BuildTestBase { * * @covers ::copyCodebase */ - public function testCopyCodebaseExclude() { + public function testCopyCodebaseExclude(): void { // Create a virtual file system containing items that should be // excluded. Exception being modules directory. vfsStream::setup('drupal', NULL, [ @@ -131,7 +131,7 @@ class BuildTestTest extends BuildTestBase { * * @covers ::copyCodebase */ - public function testCopyCodebaseDocRoot() { + public function testCopyCodebaseDocRoot(): void { // Create a virtual file system containing items that should be // excluded. Exception being modules directory. vfsStream::setup('drupal', NULL, [ @@ -208,7 +208,7 @@ class BuildTestTest extends BuildTestBase { /** * @covers ::findAvailablePort */ - public function testPortMany() { + public function testPortMany(): void { $iterator = (new Finder())->in($this->getDrupalRoot()) ->ignoreDotFiles(FALSE) ->exclude(['sites/simpletest']) @@ -236,7 +236,7 @@ class BuildTestTest extends BuildTestBase { /** * @covers ::standUpServer */ - public function testStandUpServer() { + public function testStandUpServer(): void { // Stand up a server with working directory 'first'. $this->standUpServer('first'); diff --git a/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php b/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php index 19c439c876d..f34f5e7f896 100644 --- a/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php +++ b/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php @@ -17,7 +17,7 @@ class HtRouterTest extends QuickStartTestBase { /** * @covers ::instantiateServer */ - public function testHtRouter() { + public function testHtRouter(): void { $sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0]; if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) { $this->markTestSkipped(); diff --git a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php index f16e3b15c38..bbcce3d2ca2 100644 --- a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php +++ b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Process\PhpExecutableFinder; */ class InstallTest extends BuildTestBase { - public function testInstall() { + public function testInstall(): void { $sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0]; if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) { $this->markTestSkipped(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php index dace985114b..d1c07c20124 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php @@ -26,7 +26,7 @@ class AjaxCallbacksTest extends WebDriverTestBase { /** * Tests if Ajax callback works on date element. */ - public function testDateAjaxCallback() { + public function testDateAjaxCallback(): void { // Test Ajax callback when date changes. $this->drupalGet('ajax_forms_test_ajax_element_form'); @@ -38,7 +38,7 @@ class AjaxCallbacksTest extends WebDriverTestBase { /** * Tests if Ajax callback works on datetime element. */ - public function testDateTimeAjaxCallback() { + public function testDateTimeAjaxCallback(): void { // Test Ajax callback when datetime changes. $this->drupalGet('ajax_forms_test_ajax_element_form'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php index ccad0ab51ad..b2ae9386bd0 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php @@ -27,7 +27,7 @@ class AjaxFormCacheTest extends WebDriverTestBase { /** * Tests the usage of form cache for AJAX forms. */ - public function testFormCacheUsage() { + public function testFormCacheUsage(): void { /** @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable */ $key_value_expirable = \Drupal::service('keyvalue.expirable')->get('form'); $this->drupalLogin($this->rootUser); @@ -48,7 +48,7 @@ class AjaxFormCacheTest extends WebDriverTestBase { /** * Tests AJAX forms in blocks. */ - public function testBlockForms() { + public function testBlockForms(): void { $this->container->get('module_installer')->install(['block', 'search']); $this->rebuildContainer(); $this->drupalLogin($this->rootUser); @@ -83,7 +83,7 @@ class AjaxFormCacheTest extends WebDriverTestBase { /** * Tests AJAX forms on pages with a query string. */ - public function testQueryString() { + public function testQueryString(): void { $this->container->get('module_installer')->install(['block']); $this->drupalLogin($this->rootUser); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php index 4e4ff6f8d29..c9a4b3ef272 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php @@ -26,7 +26,7 @@ class AjaxFormImageButtonTest extends WebDriverTestBase { /** * Tests image buttons can be operated with the keyboard ENTER key. */ - public function testAjaxImageButtonKeypressEnter() { + public function testAjaxImageButtonKeypressEnter(): void { // Get a Field UI manage-display page. $this->drupalGet('ajax_forms_image_button_form'); $assertSession = $this->assertSession(); @@ -41,7 +41,7 @@ class AjaxFormImageButtonTest extends WebDriverTestBase { /** * Tests image buttons can be operated with the keyboard SPACE key. */ - public function testAjaxImageButtonKeypressSpace() { + public function testAjaxImageButtonKeypressSpace(): void { // Get a Field UI manage-display page. $this->drupalGet('ajax_forms_image_button_form'); $assertSession = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php index 622311c1143..a80a627a89c 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php @@ -46,7 +46,7 @@ class AjaxFormPageCacheTest extends WebDriverTestBase { /** * Create a simple form, then submit the form via AJAX to change to it. */ - public function testSimpleAJAXFormValue() { + public function testSimpleAJAXFormValue(): void { $this->drupalGet('ajax_forms_test_get_form'); $build_id_initial = $this->getFormBuildId(); @@ -116,7 +116,7 @@ class AjaxFormPageCacheTest extends WebDriverTestBase { * * @see \Drupal\system\Tests\Ajax\ElementValidationTest::testAjaxElementValidation() */ - public function testAjaxElementValidation() { + public function testAjaxElementValidation(): void { $this->drupalGet('ajax_validation_test'); // Changing the value of the textfield will trigger an AJAX // request/response. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php index cd0b859bc59..a8282b2b6cf 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php @@ -35,7 +35,7 @@ class AjaxInGroupTest extends WebDriverTestBase { /** * Submits forms with select and checkbox elements via Ajax. */ - public function testSimpleAjaxFormValue() { + public function testSimpleAjaxFormValue(): void { $this->drupalGet('/ajax_forms_test_get_form'); $assert_session = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php index fab6190c61d..3d056401a2b 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php @@ -24,7 +24,7 @@ class AjaxTest extends WebDriverTestBase { */ protected $defaultTheme = 'stark'; - public function testAjaxWithAdminRoute() { + public function testAjaxWithAdminRoute(): void { \Drupal::service('theme_installer')->install(['stable9', 'claro']); $theme_config = \Drupal::configFactory()->getEditable('system.theme'); $theme_config->set('admin', 'claro'); @@ -55,7 +55,7 @@ class AjaxTest extends WebDriverTestBase { * * @see https://www.drupal.org/node/2647916 */ - public function testDrupalSettingsCachingRegression() { + public function testDrupalSettingsCachingRegression(): void { $this->drupalGet('ajax-test/dialog'); $assert = $this->assertSession(); $session = $this->getSession(); @@ -100,7 +100,7 @@ class AjaxTest extends WebDriverTestBase { * reattached and all top-level elements of type Node.ELEMENT_NODE need to be * part of the context. */ - public function testInsertAjaxResponse() { + public function testInsertAjaxResponse(): void { $render_single_root = [ 'pre-wrapped-div' => '<div class="pre-wrapped">pre-wrapped<script> var test;</script></div>', 'pre-wrapped-span' => '<span class="pre-wrapped">pre-wrapped<script> var test;</script></span>', @@ -162,7 +162,7 @@ JS; /** * Tests that jQuery's global Ajax events are triggered at the correct time. */ - public function testGlobalEvents() { + public function testGlobalEvents(): void { $session = $this->getSession(); $assert = $this->assertSession(); $expected_event_order = implode('', ['ajaxSuccess', 'ajaxComplete', 'ajaxStop']); @@ -260,7 +260,7 @@ JS; /** * Tests that Ajax errors are visible in the UI. */ - public function testUiAjaxException() { + public function testUiAjaxException(): void { $themes = [ 'olivero', 'claro', @@ -300,7 +300,7 @@ JS; /** * Tests ajax focus handling. */ - public function testAjaxFocus() { + public function testAjaxFocus(): void { $this->markTestSkipped("Skipped due to frequent random test failures. See https://www.drupal.org/project/drupal/issues/3396536"); $this->drupalGet('/ajax_forms_test_get_form'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php index 736f8351c69..612bfba7a62 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php @@ -26,7 +26,7 @@ class CommandsTest extends WebDriverTestBase { /** * Tests the various Ajax Commands. */ - public function testAjaxCommands() { + public function testAjaxCommands(): void { $session = $this->getSession(); $page = $this->getSession()->getPage(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php index 7438e1af1ca..c42255d5404 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php @@ -28,7 +28,7 @@ class DialogTest extends WebDriverTestBase { /** * Tests sending non-JS and AJAX requests to open and manipulate modals. */ - public function testDialog() { + public function testDialog(): void { $this->drupalLogin($this->drupalCreateUser(['administer contact forms'])); // Ensure the elements render without notices or exceptions. $this->drupalGet('ajax-test/dialog'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php index 345cef2107d..60fd1f40b95 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php @@ -29,7 +29,7 @@ class ElementValidationTest extends WebDriverTestBase { * Drupal AJAX commands update the DOM echoing back the validated values in * the form of messages that appear on the page. */ - public function testAjaxElementValidation() { + public function testAjaxElementValidation(): void { $this->drupalGet('ajax_validation_test'); $page = $this->getSession()->getPage(); $assert = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php index 90175f1d7f0..7a9b91c52b9 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php @@ -25,7 +25,7 @@ class FocusFirstCommandTest extends WebDriverTestBase { /** * Tests AjaxFocusFirstCommand on a page. */ - public function testFocusFirst() { + public function testFocusFirst(): void { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php index c2a1d3e5a88..2ee6b8ddb2c 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php @@ -36,7 +36,7 @@ class FormValuesTest extends WebDriverTestBase { * * @dataProvider formModeProvider */ - public function testSimpleAjaxFormValue($form_mode) { + public function testSimpleAjaxFormValue($form_mode): void { $this->drupalGet('ajax_forms_test_get_form'); $session = $this->getSession(); @@ -78,7 +78,7 @@ class FormValuesTest extends WebDriverTestBase { /** * Tests that AJAX elements with invalid callbacks return error code 500. */ - public function testSimpleInvalidCallbacksAjaxFormValue() { + public function testSimpleInvalidCallbacksAjaxFormValue(): void { $this->drupalGet('ajax_forms_test_get_form'); $session = $this->getSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php index ce9064118eb..ac347e8c45d 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php @@ -27,7 +27,7 @@ class MessageCommandTest extends WebDriverTestBase { /** * Tests AJAX MessageCommand use in a form. */ - public function testMessageCommand() { + public function testMessageCommand(): void { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php index 7d18e56aef6..238474e5ae7 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php @@ -58,7 +58,7 @@ class MultiFormTest extends WebDriverTestBase { /** * Tests that pages with the 'node_page_form' included twice work correctly. */ - public function testMultiForm() { + public function testMultiForm(): void { // HTML IDs for elements within the field are potentially modified with // each Ajax submission, but these variables are stable and help target the // desired elements. diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php index d6ecae566a7..0372ae1cd99 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php @@ -33,7 +33,7 @@ class ThrobberTest extends WebDriverTestBase { /** * Tests theming throbber element. */ - public function testThemingThrobberElement() { + public function testThemingThrobberElement(): void { $session = $this->getSession(); $web_assert = $this->assertSession(); $page = $session->getPage(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php b/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php index ecf579c8cb4..163a98e247b 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php @@ -25,7 +25,7 @@ class BrowserWithJavascriptTest extends WebDriverTestBase { */ protected $defaultTheme = 'stark'; - public function testJavascript() { + public function testJavascript(): void { $this->drupalGet('<front>'); $session = $this->getSession(); @@ -48,7 +48,7 @@ JS; $this->assertFalse($this->isTestUsingGuzzleClient()); } - public function testAssertJsCondition() { + public function testAssertJsCondition(): void { $this->drupalGet('<front>'); $session = $this->getSession(); @@ -74,7 +74,7 @@ JS; /** * Tests creating screenshots. */ - public function testCreateScreenshot() { + public function testCreateScreenshot(): void { $this->drupalGet('<front>'); $this->createScreenshot('public://screenshot.jpg'); $this->assertFileExists('public://screenshot.jpg'); @@ -86,7 +86,7 @@ JS; * @see \Drupal\Tests\WebAssert::assertNoEscaped() * @see \Drupal\Tests\WebAssert::assertEscaped() */ - public function testEscapingAssertions() { + public function testEscapingAssertions(): void { $assert = $this->assertSession(); $this->drupalGet('test-escaped-characters'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php index c479411006a..5b77de188aa 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php @@ -29,7 +29,7 @@ class ComponentRenderTest extends WebDriverTestBase { * This also covers all the path translations necessary to produce the correct * path to the assets. */ - public function testCssLibraryAttachesCorrectly() { + public function testCssLibraryAttachesCorrectly(): void { $build = [ '#type' => 'inline_template', '#template' => "{{ include('sdc_theme_test:lib-overrides') }}", @@ -47,7 +47,7 @@ class ComponentRenderTest extends WebDriverTestBase { * This also covers all the path translations necessary to produce the correct * path to the assets. */ - public function testJsLibraryAttachesCorrectly() { + public function testJsLibraryAttachesCorrectly(): void { $build = [ '#type' => 'inline_template', '#template' => "{{ include('sdc_test:my-button', { diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php index f0208d6d2dd..f16b300441d 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php @@ -26,7 +26,7 @@ class CsrfTokenRaceTest extends WebDriverTestBase { /** * Tests race condition for CSRF tokens for simultaneous requests. */ - public function testCsrfRace() { + public function testCsrfRace(): void { $user = $this->createUser(['access content']); $this->drupalLogin($user); $this->drupalGet('/csrf_race/test'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php index 57f139442ed..7c8af15a2e3 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php @@ -42,7 +42,7 @@ class FormGroupingElementsTest extends WebDriverTestBase { * becomes visible when the tab is clicked, a fragment link to the child is * clicked or when the URI fragment pointing to that child changes. */ - public function testVerticalTabChildVisibility() { + public function testVerticalTabChildVisibility(): void { $session = $this->getSession(); $web_assert = $this->assertSession(); @@ -92,7 +92,7 @@ class FormGroupingElementsTest extends WebDriverTestBase { * becomes visible when a fragment link to the child is clicked or when the * URI fragment pointing to that child changes. */ - public function testDetailsChildVisibility() { + public function testDetailsChildVisibility(): void { $session = $this->getSession(); $web_assert = $this->assertSession(); @@ -139,7 +139,7 @@ class FormGroupingElementsTest extends WebDriverTestBase { /** * Confirms tabs containing a field with a validation error are open. */ - public function testVerticalTabValidationVisibility() { + public function testVerticalTabValidationVisibility(): void { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php index 3fb9f8feac8..179886e8b90 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php @@ -63,7 +63,7 @@ class JavascriptStatesTest extends WebDriverTestBase { * this is a single public test method that invokes a series of protected * methods to do assertions on specific kinds of triggering elements. */ - public function testJavascriptStates() { + public function testJavascriptStates(): void { $this->doCheckboxTriggerTests(); $this->doCheckboxesTriggerTests(); $this->doTextfieldTriggerTests(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php index bcd063ee434..ce4cf583cd8 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php @@ -40,7 +40,7 @@ class JsMessageTest extends WebDriverTestBase { /** * Tests click on links to show messages and remove messages. */ - public function testAddRemoveMessages() { + public function testAddRemoveMessages(): void { $web_assert = $this->assertSession(); $this->drupalGet('js_message_test_link'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php index 57affeb98f6..31f04417586 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php @@ -46,7 +46,7 @@ class MachineNameTest extends WebDriverTestBase { * Makes sure that the machine name field automatically provides a valid * machine name and that the manual editing mode functions. */ - public function testMachineName() { + public function testMachineName(): void { // Visit the machine name test page which contains two machine name fields. $this->drupalGet('form-test/machine-name'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php index d6b6241b1a8..8adf7a5685a 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php @@ -50,7 +50,7 @@ class SessionTest extends WebDriverTestBase { * performed by the Mink browser. The SIMPLETEST_USER_AGENT cookie must always * be valid. */ - public function testSessionExpiration() { + public function testSessionExpiration(): void { // Visit the front page and click the link back to the front page a large // number of times. $this->drupalGet('<front>'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php index c3f9dcd8f8c..ed73ac1ff70 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php @@ -26,7 +26,7 @@ class DialogPositionTest extends WebDriverTestBase { /** * Tests if the dialog UI works properly with block layout page. */ - public function testDialogOpenAndClose() { + public function testDialogOpenAndClose(): void { $admin_user = $this->drupalCreateUser(['administer blocks']); $this->drupalLogin($admin_user); $this->drupalGet('admin/structure/block'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php index a40e9915238..ecf77d322b8 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php @@ -58,7 +58,7 @@ class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase { /** * Tests that the default autocomplete widget return the correct results. */ - public function testEntityReferenceAutocompleteWidget() { + public function testEntityReferenceAutocompleteWidget(): void { /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ $display_repository = \Drupal::service('entity_display.repository'); @@ -164,7 +164,7 @@ class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase { * Ensures that the entity the autocomplete widget stores the entity it is * rendered on, and is available in the autocomplete results' AJAX request. */ - public function testEntityReferenceAutocompleteWidgetAttachedEntity() { + public function testEntityReferenceAutocompleteWidgetAttachedEntity(): void { $user = $this->drupalCreateUser([ 'administer entity_test content', ]); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php index ab4dba1be7c..7bdf7cd6415 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php @@ -22,7 +22,7 @@ class JavascriptDeprecationTest extends WebDriverTestBase { /** * Tests Javascript deprecation notices. */ - public function testJavascriptDeprecation() { + public function testJavascriptDeprecation(): void { $this->expectDeprecation('Javascript Deprecation: This function is deprecated for testing purposes.'); $this->expectDeprecation('Javascript Deprecation: This property is deprecated for testing purposes.'); $this->drupalGet('js_deprecation_test'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php index c9ed7f1d3fc..31ec8c91675 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php @@ -26,7 +26,7 @@ class JavascriptGetDrupalSettingsTest extends WebDriverTestBase { * * @see \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getDrupalSettings() */ - public function testGetDrupalSettings() { + public function testGetDrupalSettings(): void { $this->drupalLogin($this->drupalCreateUser()); $this->drupalGet('test-page'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php index 74546cb8104..9cb079d954d 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php @@ -51,7 +51,7 @@ class MachineNameTransliterationTest extends WebDriverTestBase { * * @dataProvider machineNameInputOutput */ - public function testMachineNameTransliterations($langcode, $input, $output) { + public function testMachineNameTransliterations($langcode, $input, $output): void { $page = $this->getSession()->getPage(); if ($langcode !== 'en') { ConfigurableLanguage::createFromLangcode($langcode)->save(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php index 82ceebe341c..0a3dd44e6ab 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php @@ -63,7 +63,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests row weight switch. */ - public function testRowWeightSwitch() { + public function testRowWeightSwitch(): void { $this->state->set('tabledrag_test_table', array_flip(range(1, 3))); $this->drupalGet('tabledrag_test'); @@ -100,7 +100,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests draggable table drag'n'drop. */ - public function testDragAndDrop() { + public function testDragAndDrop(): void { $this->state->set('tabledrag_test_table', array_flip(range(1, 3))); $this->drupalGet('tabledrag_test'); @@ -147,7 +147,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests accessibility through keyboard of the tabledrag functionality. */ - public function testKeyboardAccessibility() { + public function testKeyboardAccessibility(): void { $this->assertKeyboardAccessibility(); } @@ -248,7 +248,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests the root and leaf behaviors for rows. */ - public function testRootLeafDraggableRowsWithKeyboard() { + public function testRootLeafDraggableRowsWithKeyboard(): void { $this->state->set('tabledrag_test_table', [ 1 => [], 2 => ['parent' => 1, 'depth' => 1, 'classes' => ['tabledrag-leaf']], @@ -298,7 +298,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests the warning that appears upon making changes to a tabledrag table. */ - public function testTableDragChangedWarning() { + public function testTableDragChangedWarning(): void { $this->drupalGet('tabledrag_test'); // By default no text is visible. @@ -347,7 +347,7 @@ class TableDragTest extends WebDriverTestBase { /** * Tests nested draggable tables through keyboard. */ - public function testNestedDraggableTables() { + public function testNestedDraggableTables(): void { $this->state->set('tabledrag_test_table', array_flip(range(1, 5))); $this->drupalGet('tabledrag_test_nested'); $this->assertKeyboardAccessibility(''); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php index 16089b7a26f..58182ab305f 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php @@ -47,7 +47,7 @@ class DrupalSelenium2DriverTest extends WebDriverTestBase { /** * Tests uploading remote files. */ - public function testGetRemoteFilePath() { + public function testGetRemoteFilePath(): void { $web_driver = $this->getSession()->getDriver(); $this->assertInstanceOf(Selenium2Driver::class, $web_driver); $this->assertFalse($web_driver->isW3C(), 'Driver is not operating in W3C mode'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php index 52289bc933a..866f04e3a72 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php @@ -29,7 +29,7 @@ class JSInteractionTest extends WebDriverTestBase { /** * Assert an exception is thrown when the blocker element is never removed. */ - public function testNotClickable() { + public function testNotClickable(): void { $this->expectException(Exception::class); $this->drupalGet('/js_interaction_test'); $this->assertSession()->elementExists('named', ['link', 'Target link'])->click(); @@ -38,7 +38,7 @@ class JSInteractionTest extends WebDriverTestBase { /** * Assert an exception is thrown when the field is never enabled. */ - public function testFieldValueNotSettable() { + public function testFieldValueNotSettable(): void { $this->expectException(Exception::class); $this->drupalGet('/js_interaction_test'); $this->assertSession()->fieldExists('target_field')->setValue('Test'); @@ -47,7 +47,7 @@ class JSInteractionTest extends WebDriverTestBase { /** * Assert no exception is thrown when elements become interactive. */ - public function testElementsInteraction() { + public function testElementsInteraction(): void { $this->drupalGet('/js_interaction_test'); // Remove blocking element after 100 ms. $this->clickLink('Remove Blocker Trigger'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php index 46b1ac5d01e..07d84d19fc4 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php @@ -31,7 +31,7 @@ class JSWebAssertTest extends WebDriverTestBase { /** * Tests that JSWebAssert assertions work correctly. */ - public function testJsWebAssert() { + public function testJsWebAssert(): void { $this->drupalGet('js_webassert_test_form'); $session = $this->getSession(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php index df19a498621..6e3ac8113c3 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php @@ -42,7 +42,7 @@ class ClaroEntityDisplayTest extends EntityDisplayTest { * with a line changed to reflect row weight toggle being a link instead * of a button. */ - public function testEntityForm() { + public function testEntityForm(): void { $this->drupalGet('entity_test/manage/1/edit'); $this->assertSession()->fieldExists('field_test_text[0][value]'); @@ -68,7 +68,7 @@ class ClaroEntityDisplayTest extends EntityDisplayTest { * with a line changed to reflect row weight toggle being a link instead * of a button. */ - public function testEntityView() { + public function testEntityView(): void { $this->drupalGet('entity_test/1'); $this->assertSession()->elementNotExists('css', '.field--name-field-test-text'); @@ -95,7 +95,7 @@ class ClaroEntityDisplayTest extends EntityDisplayTest { * This is Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testExtraFields() * with a line changed to reflect Claro's tabledrag selector. */ - public function testExtraFields() { + public function testExtraFields(): void { entity_test_create_bundle('bundle_with_extra_fields'); $this->drupalGet('entity_test/structure/bundle_with_extra_fields/display'); $this->assertSession()->waitForElement('css', '.tabledrag-handle'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php index f8f4c950c58..32f6256396b 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php @@ -37,7 +37,7 @@ class ClaroMenuUiJavascriptTest extends MenuUiJavascriptTest { * Contextual links do not work in admin themes, so this is empty to prevent * this test running in the parent class. */ - public function testBlockContextualLinks() { + public function testBlockContextualLinks(): void { } } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php index 7956989b4a2..c78ff99c80a 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php @@ -27,7 +27,7 @@ class ClaroModalDisplayTest extends MediaLibraryTestBase { /** * Tests the position f "add another" button in dialogs. */ - public function testModalAddAnother() { + public function testModalAddAnother(): void { // Add unlimited field to the media type four. $unlimited_field_storage = FieldStorageConfig::create([ diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php index 57952ad7b50..af01db8d2a8 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php @@ -21,7 +21,7 @@ class ClaroPasswordConfirmWidgetTest extends PasswordConfirmWidgetTest { /** * Tests that password match message is invisible when widget is initialized. */ - public function testPasswordConfirmMessage() { + public function testPasswordConfirmMessage(): void { $this->drupalGet($this->testUser->toUrl('edit-form')); $password_confirm_widget_selector = '.js-form-type-password-confirm.js-form-item-pass'; $password_confirm_selector = '.js-form-item-pass-pass2'; @@ -36,7 +36,7 @@ class ClaroPasswordConfirmWidgetTest extends PasswordConfirmWidgetTest { /** * {@inheritdoc} */ - public function testFillConfirmOnly() { + public function testFillConfirmOnly(): void { // This test is not applicable to Claro because confirm field is hidden // until the password has been filled in the main field. } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php index 5872284d677..9938ad22d09 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php @@ -33,7 +33,7 @@ class ClaroTableDragTest extends TableDragTest { /** * Ensures that there are no duplicate tabledrag handles. */ - public function testNoDuplicates() { + public function testNoDuplicates(): void { $this->drupalGet('tabledrag_test_nested'); $this->assertCount(1, $this->findRowById(1)->findAll('css', '.tabledrag-handle')); } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php index 058557e3cdd..e752b79a65a 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php @@ -51,7 +51,7 @@ class ClaroViewsBulkOperationsTest extends WebDriverTestBase { /** * Tests the dynamic Bulk Operations form. */ - public function testBulkOperationsUi() { + public function testBulkOperationsUi(): void { $this->drupalGet('admin/content'); $page = $this->getSession()->getPage(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php index 9b1a97e0c19..28b3c46a999 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php @@ -47,7 +47,7 @@ class ClaroViewsUiTest extends WebDriverTestBase { * Ensures that the CSS classes added to display menu tabs are preserved when * Views UI is updated with AJAX. */ - public function testViewsUiTabsCssClasses() { + public function testViewsUiTabsCssClasses(): void { $this->drupalGet('admin/structure/views/view/who_s_online'); $assert_session = $this->assertSession(); $assert_session->elementExists('css', '#views-display-menu-tabs.views-tabs.views-tabs--secondary'); @@ -69,7 +69,7 @@ class ClaroViewsUiTest extends WebDriverTestBase { * Ensures that the CSS classes added to the Views UI extra actions dropbutton * in .views-display-top are preserved when Views UI is refreshed with AJAX. */ - public function testViewsUiDropButtonCssClasses() { + public function testViewsUiDropButtonCssClasses(): void { $this->drupalGet('admin/structure/views/view/who_s_online'); $assert_session = $this->assertSession(); $extra_actions_dropbutton_list = $assert_session->elementExists('css', '#views-display-extra-actions.dropbutton--small'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php index ac880f12223..6b0472702c0 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php @@ -46,7 +46,7 @@ class OliveroMessagesTest extends JsMessageTest { /** * Tests data-drupal-selector="messages" exists. */ - public function testDataDrupalSelectors() { + public function testDataDrupalSelectors(): void { $web_assert = $this->assertSession(); $this->drupalGet('js_message_test_link'); diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index 875f7f2bedc..113371ba5da 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -61,7 +61,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests uncaught exception handling when system is in a bad state. */ - public function testUncaughtException() { + public function testUncaughtException(): void { $this->expectedExceptionMessage = 'Oh oh, bananas in the instruments.'; \Drupal::state()->set('error_service_test.break_bare_html_renderer', TRUE); @@ -94,7 +94,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests displaying an uncaught fatal error. */ - public function testUncaughtFatalError() { + public function testUncaughtFatalError(): void { $fatal_error = [ '%type' => 'TypeError', '@message' => 'Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}(): Argument #1 ($test) must be of type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 65', @@ -113,7 +113,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests uncaught exception handling with custom exception handler. */ - public function testUncaughtExceptionCustomExceptionHandler() { + public function testUncaughtExceptionCustomExceptionHandler(): void { $settings_filename = $this->siteDirectory . '/settings.php'; chmod($settings_filename, 0777); $settings_php = file_get_contents($settings_filename); @@ -136,7 +136,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests a missing dependency on a service. */ - public function testMissingDependency() { + public function testMissingDependency(): void { $this->expectedExceptionMessage = 'Too few arguments to function Drupal\error_service_test\LonelyMonkeyClass::__construct(), 0 passed'; $this->drupalGet('broken-service-class'); $this->assertSession()->statusCodeEquals(500); @@ -149,7 +149,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests a container which has an error. */ - public function testErrorContainer() { + public function testErrorContainer(): void { $settings = []; $settings['settings']['container_base_class'] = (object) [ 'value' => '\Drupal\FunctionalTests\Bootstrap\ErrorContainer', @@ -169,7 +169,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests a container which has an exception really early. */ - public function testExceptionContainer() { + public function testExceptionContainer(): void { $settings = []; $settings['settings']['container_base_class'] = (object) [ 'value' => '\Drupal\FunctionalTests\Bootstrap\ExceptionContainer', @@ -190,7 +190,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests the case when the database connection is gone. */ - public function testLostDatabaseConnection() { + public function testLostDatabaseConnection(): void { $incorrect_username = $this->randomMachineName(16); switch ($this->container->get('database')->driver()) { case 'pgsql': @@ -225,7 +225,7 @@ class UncaughtExceptionTest extends BrowserTestBase { /** * Tests fallback to PHP error log when an exception is thrown while logging. */ - public function testLoggerException() { + public function testLoggerException(): void { // Ensure the test error log is empty before these tests. $this->assertNoErrorsLogged(); diff --git a/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php index c0814dd7b63..b38a93c2565 100644 --- a/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php +++ b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php @@ -29,7 +29,7 @@ class Breadcrumb404Test extends BrowserTestBase { /** * Tests that different 404s don't create unnecessary cache entries. */ - public function testBreadcrumbOn404Pages() { + public function testBreadcrumbOn404Pages(): void { $this->placeBlock('system_breadcrumb_block', ['id' => 'breadcrumb']); // Prime the cache first. diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php index 824ad1418a3..1cc4925b129 100644 --- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -47,7 +47,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests that JavaScript Drupal settings can be read. */ - public function testDrupalSettings() { + public function testDrupalSettings(): void { // Trigger a 403 because those pages have very little else going on. $this->drupalGet('admin'); $this->assertSame([], $this->getDrupalSettings()); @@ -63,7 +63,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests basic page test. */ - public function testGoTo() { + public function testGoTo(): void { $account = $this->drupalCreateUser(); $this->drupalLogin($account); @@ -113,7 +113,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests drupalGet(). */ - public function testDrupalGet() { + public function testDrupalGet(): void { $this->drupalGet('test-page'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->addressEquals('test-page'); @@ -141,7 +141,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests basic form functionality. */ - public function testForm() { + public function testForm(): void { // Ensure the proper response code for a _form route. $this->drupalGet('form-test/object-builder'); $this->assertSession()->statusCodeEquals(200); @@ -209,7 +209,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests clickLink() functionality. */ - public function testClickLink() { + public function testClickLink(): void { $this->drupalGet('test-page'); $this->clickLink('Visually identical test links'); $this->assertStringContainsString('user/login', $this->getSession()->getCurrentUrl()); @@ -221,7 +221,7 @@ class BrowserTestBaseTest extends BrowserTestBase { $this->assertStringContainsString('user/register', $this->getSession()->getCurrentUrl()); } - public function testError() { + public function testError(): void { $this->expectException('\Exception'); $this->expectExceptionMessage('User notice: foo'); $this->drupalGet('test-error'); @@ -230,7 +230,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests legacy field asserts which use xpath directly. */ - public function testXpathAsserts() { + public function testXpathAsserts(): void { $this->drupalGet('test-field-xpath'); $this->assertSession()->elementTextContains('xpath', '//table/tbody/tr[2]/td[1]', 'one'); @@ -261,7 +261,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests field asserts using textfields. */ - public function testFieldAssertsForTextfields() { + public function testFieldAssertsForTextfields(): void { $this->drupalGet('test-field-xpath'); // *** 1. fieldNotExists(). @@ -372,7 +372,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests legacy field asserts for checkbox field type. */ - public function testFieldAssertsForCheckbox() { + public function testFieldAssertsForCheckbox(): void { $this->drupalGet('test-field-xpath'); // Part 1 - Test by name. @@ -464,7 +464,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the ::cronRun() method. */ - public function testCronRun() { + public function testCronRun(): void { $last_cron_time = \Drupal::state()->get('system.cron_last'); $this->cronRun(); $this->assertSession()->statusCodeEquals(204); @@ -476,7 +476,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the Drupal install done in \Drupal\Tests\BrowserTestBase::setUp(). */ - public function testInstall() { + public function testInstall(): void { $htaccess_filename = $this->tempFilesDirectory . '/.htaccess'; $this->assertFileExists($htaccess_filename); @@ -487,7 +487,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the assumption that local time is in 'Australia/Sydney'. */ - public function testLocalTimeZone() { + public function testLocalTimeZone(): void { $expected = 'Australia/Sydney'; // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php $this->assertEquals($expected, date_default_timezone_get()); @@ -507,7 +507,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the ::checkForMetaRefresh() method. */ - public function testCheckForMetaRefresh() { + public function testCheckForMetaRefresh(): void { // Disable following redirects in the client. $this->getSession()->getDriver()->getClient()->followRedirects(FALSE); // Set the maximumMetaRefreshCount to zero to make sure the redirect doesn't @@ -522,7 +522,7 @@ class BrowserTestBaseTest extends BrowserTestBase { $this->assertSession()->pageTextContains('Test page text.'); } - public function testGetDefaultDriveInstance() { + public function testGetDefaultDriveInstance(): void { putenv('MINK_DRIVER_ARGS=' . json_encode([NULL, ['key1' => ['key2' => ['key3' => 3, 'key3.1' => 3.1]]]])); $this->getDefaultDriverInstance(); $this->assertEquals([NULL, ['key1' => ['key2' => ['key3' => 3, 'key3.1' => 3.1]]]], $this->minkDefaultDriverArgs); @@ -531,7 +531,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Ensures we can't access modules we shouldn't be able to after install. */ - public function testProfileModules() { + public function testProfileModules(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The module demo_umami_content does not exist.'); $this->assertFileExists('core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.info.yml'); @@ -541,7 +541,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the protections provided by .htkey. */ - public function testHtKey() { + public function testHtKey(): void { // Remove the Simpletest private key file so we can test the protection // against requests that forge a valid testing user agent to gain access // to the installer. @@ -576,7 +576,7 @@ class BrowserTestBaseTest extends BrowserTestBase { * * @see \Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware::__invoke() */ - public function testDeprecationHeaders() { + public function testDeprecationHeaders(): void { $this->drupalGet('/test-deprecations'); $deprecation_messages = []; @@ -603,7 +603,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Tests the dump() function provided by the var-dumper Symfony component. */ - public function testVarDump() { + public function testVarDump(): void { // Append the stream capturer to the STDERR stream, so that we can test the // dump() output and also prevent it from actually outputting in this // particular test. @@ -638,7 +638,7 @@ class BrowserTestBaseTest extends BrowserTestBase { /** * Test if setting an invalid scheme in SIMPLETEST_BASE_URL throws an exception. */ - public function testSimpleTestBaseUrlValidation() { + public function testSimpleTestBaseUrlValidation(): void { putenv('SIMPLETEST_BASE_URL=mysql://user:pass@localhost/database'); $this->expectException(\Exception::class); $this->expectExceptionMessage('You must provide valid scheme for the SIMPLETEST_BASE_URL environment variable. Valid schema are: http, https.'); diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php index 80de5219b26..ac65e81abe0 100644 --- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php @@ -28,7 +28,7 @@ class BrowserTestBaseUserAgentTest extends BrowserTestBase { /** * Tests validation of the User-Agent header we use to perform test requests. */ - public function testUserAgentValidation() { + public function testUserAgentValidation(): void { $assert_session = $this->assertSession(); $system_path = $this->buildUrl(\Drupal::service('extension.list.module')->getPath('system')); $http_path = $system_path . '/tests/http.php/user/login'; diff --git a/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php b/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php index 43eab184a55..d441c23d307 100644 --- a/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php @@ -33,7 +33,7 @@ class ServiceDeprecationTest extends BrowserTestBase { /** * @covers ::get */ - public function testGetDeprecated() { + public function testGetDeprecated(): void { $this->expectDeprecation('The "deprecation_test.service" service is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.'); $this->expectDeprecation('The "deprecation_test.alias" alias is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.'); // @phpstan-ignore-next-line diff --git a/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php b/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php index 732df7743d1..a229a5d183e 100644 --- a/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php @@ -33,7 +33,7 @@ class ModuleInstallBatchTest extends BrowserTestBase { /** * Tests loading entities created in a batch in test_batch_test_install(). */ - public function testLoadingEntitiesCreatedInBatch() { + public function testLoadingEntitiesCreatedInBatch(): void { foreach ([1, 2] as $id) { $this->assertNotNull(EntityTest::load($id), 'Successfully loaded entity ' . $id); } diff --git a/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php b/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php index a674fa7a8a5..c306529a02e 100644 --- a/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php @@ -25,7 +25,7 @@ class PhpUnitBridgeTest extends BrowserTestBase { /** * Tests deprecation message from deprecation_test_function(). */ - public function testSilencedError() { + public function testSilencedError(): void { $this->expectDeprecation('This is the deprecation message for deprecation_test_function().'); $this->assertEquals('known_return_value', deprecation_test_function()); } @@ -33,7 +33,7 @@ class PhpUnitBridgeTest extends BrowserTestBase { /** * Tests deprecation message from deprecated route. */ - public function testErrorOnSiteUnderTest() { + public function testErrorOnSiteUnderTest(): void { $this->expectDeprecation('This is the deprecation message for deprecation_test_function().'); $this->drupalGet(Url::fromRoute('deprecation_test.route')); } diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php index 12d5fba2776..57b4191a7fd 100644 --- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php +++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php @@ -104,7 +104,7 @@ class TimestampAgoFormatterTest extends BrowserTestBase { /** * Tests the formatter settings. */ - public function testSettings() { + public function testSettings(): void { $this->drupalGet('entity_test/structure/entity_test/display'); $edit = [ diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php index 81383c79f57..d7e8a2342e1 100644 --- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php +++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php @@ -106,7 +106,7 @@ class TimestampTest extends BrowserTestBase { /** * Tests the "datetime_timestamp" widget. */ - public function testWidget() { + public function testWidget(): void { // Build up a date in the UTC timezone. $value = '2012-12-31 00:00:00'; $date = new DrupalDateTime($value, 'UTC'); diff --git a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php index 87833a8b8bd..2109cf1a1b1 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php @@ -78,7 +78,7 @@ class ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest extends B /** * Tests the correct user input mapping on complex fields. */ - public function testCorrectUserInputMappingOnComplexFields() { + public function testCorrectUserInputMappingOnComplexFields(): void { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId); diff --git a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php index b299c82a890..7108b212bf1 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php @@ -130,7 +130,7 @@ class ContentEntityFormFieldValidationFilteringTest extends BrowserTestBase { /** * Tests field widgets with #limit_validation_errors. */ - public function testFieldWidgetsWithLimitedValidationErrors() { + public function testFieldWidgetsWithLimitedValidationErrors(): void { $assert_session = $this->assertSession(); $this->drupalGet($this->entityTypeId . '/add'); diff --git a/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php index 3afa1e01caa..e40b5fee04c 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php @@ -57,7 +57,7 @@ class DeleteMultipleFormTest extends BrowserTestBase { /** * Tests the delete form for translatable entities. */ - public function testTranslatableEntities() { + public function testTranslatableEntities(): void { ConfigurableLanguage::createFromLangcode('es')->save(); ConfigurableLanguage::createFromLangcode('fr')->save(); @@ -117,7 +117,7 @@ class DeleteMultipleFormTest extends BrowserTestBase { /** * Tests the delete form for untranslatable entities. */ - public function testUntranslatableEntities() { + public function testUntranslatableEntities(): void { $selection = []; $entity1 = EntityTestRev::create(['type' => 'default', 'name' => 'entity1']); diff --git a/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php b/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php index aa5d0fbaacb..d81ccf2a3dc 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php @@ -49,7 +49,7 @@ class EntityBundleListCacheTest extends BrowserTestBase { /** * Tests that tags are invalidated when an entity with that bundle changes. */ - public function testBundleListingCache() { + public function testBundleListingCache(): void { // Access to lists of test entities with each bundle. $bundle_a_url = Url::fromRoute('cache_test_list.bundle_tags', ['entity_type_id' => 'entity_test_with_bundle', 'bundle' => 'bundle_a']); $bundle_b_url = Url::fromRoute('cache_test_list.bundle_tags', ['entity_type_id' => 'entity_test_with_bundle', 'bundle' => 'bundle_b']); diff --git a/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php b/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php index 2989a378b39..01c694b4ef4 100644 --- a/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php +++ b/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php @@ -57,7 +57,7 @@ class ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest extends BrowserTes /** * Confirms that the site works with Drupal 8 style database connection array. */ - public function testExistingDrupal8StyleDatabaseConnectionInSettingsPhp() { + public function testExistingDrupal8StyleDatabaseConnectionInSettingsPhp(): void { $this->drupalLogin($this->drupalCreateUser()); $this->assertSession()->addressEquals('user/2'); $this->assertSession()->statusCodeEquals(200); @@ -75,7 +75,7 @@ class ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest extends BrowserTes /** * Confirms that the replica database connection works. */ - public function testReplicaDrupal8StyleDatabaseConnectionInSettingsPhp() { + public function testReplicaDrupal8StyleDatabaseConnectionInSettingsPhp(): void { $this->drupalLogin($this->drupalCreateUser()); $replica = Database::getConnection('replica', 'default'); diff --git a/core/tests/Drupal/FunctionalTests/FolderTest.php b/core/tests/Drupal/FunctionalTests/FolderTest.php index 131d1c0c053..1f1674306a6 100644 --- a/core/tests/Drupal/FunctionalTests/FolderTest.php +++ b/core/tests/Drupal/FunctionalTests/FolderTest.php @@ -27,7 +27,7 @@ class FolderTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; - public function testFolderSetup() { + public function testFolderSetup(): void { $directory = 'public://styles'; $this->assertTrue(\Drupal::service('file_system')->prepareDirectory($directory, FALSE), 'Directory created.'); } diff --git a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php index 1fc66bb0b71..f65c4951c0d 100644 --- a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php +++ b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php @@ -21,7 +21,7 @@ class GetTestMethodCallerExtendsTest extends GetTestMethodCallerTest { /** * A test method that is not present in the parent class. */ - public function testGetTestMethodCallerChildClass() { + public function testGetTestMethodCallerChildClass(): void { $method_caller = $this->getTestMethodCaller(); $expected = [ 'file' => __FILE__, diff --git a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php index 51a61a7d83b..3966ebfe387 100644 --- a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php +++ b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php @@ -21,7 +21,7 @@ class GetTestMethodCallerTest extends BrowserTestBase { /** * Tests BrowserTestBase::getTestMethodCaller(). */ - public function testGetTestMethodCaller() { + public function testGetTestMethodCaller(): void { $method_caller = $this->getTestMethodCaller(); $expected = [ 'file' => __FILE__, diff --git a/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php b/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php index 84d7f5c5230..07f7380a234 100644 --- a/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php +++ b/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php @@ -28,7 +28,7 @@ class CorsIntegrationTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; - public function testCrossSiteRequest() { + public function testCrossSiteRequest(): void { // Test default parameters. $cors_config = $this->container->getParameter('cors.config'); $this->assertFalse($cors_config['enabled']); diff --git a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php index 2c2fac2822a..3e6ebe4e2ab 100644 --- a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php @@ -46,7 +46,7 @@ class ToolkitSetupFormTest extends BrowserTestBase { /** * Tests Image toolkit setup form. */ - public function testToolkitSetupForm() { + public function testToolkitSetupForm(): void { // Get form. $this->drupalGet('admin/config/media/image-toolkit'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php index 3000e392717..ae9645dd0bd 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php @@ -115,7 +115,7 @@ class DistributionProfileExistingSettingsTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); // Confirm that we are logged-in after installation. diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php index 91ef89b3063..fbbe1b2728e 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @@ -72,7 +72,7 @@ class DistributionProfileTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('root-user'); $this->assertSession()->statusCodeEquals(200); // Confirm that we are logged-in after installation. diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php index 3b3b1cfac89..b895f7caa4b 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php @@ -111,7 +111,7 @@ class DistributionProfileTranslationQueryTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php index 3e5124d4da1..0dd028e5ad0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php @@ -101,7 +101,7 @@ class DistributionProfileTranslationTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php index a0a9a0d5046..fd868ee97b5 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php @@ -56,7 +56,7 @@ EOF; /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertTrue(\Drupal::state()->get('cache_flush_test')); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php index 7087cecf8fc..942555323be 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php @@ -27,7 +27,7 @@ class InstallProfileDependenciesTest extends BrowserTestBase { /** * Tests that an install profile can require modules. */ - public function testUninstallingModules() { + public function testUninstallingModules(): void { $user = $this->drupalCreateUser(['administer modules']); $this->drupalLogin($user); $this->drupalGet('admin/modules/uninstall'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php index df46df638f9..aa80899b826 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php @@ -56,7 +56,7 @@ class InstallerBrokenDatabaseCredentialsTest extends InstallerTestBase { /** * Tests the expected requirements problem. */ - public function testRequirementsProblem() { + public function testRequirementsProblem(): void { $this->assertSession()->titleEquals('Requirements problem | Drupal'); $this->assertSession()->pageTextContains('Database settings'); $this->assertSession()->pageTextContains('Resolve all issues below to continue the installation. For help configuring your database server,'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php index 3f976408886..6c706832f06 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php @@ -56,7 +56,7 @@ class InstallerBrokenDatabasePortSettingsTest extends InstallerTestBase { /** * Tests the expected requirements problem. */ - public function testRequirementsProblem() { + public function testRequirementsProblem(): void { $this->assertSession()->titleEquals('Requirements problem | Drupal'); $this->assertSession()->pageTextContains('Database settings'); $this->assertSession()->pageTextContains('Resolve all issues below to continue the installation. For help configuring your database server,'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php index 99a2524787b..b38dc25af6f 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php @@ -69,7 +69,7 @@ class InstallerConfigDirectorySetNoDirectoryErrorTest extends InstallerTestBase /** * Verifies that installation failed. */ - public function testError() { + public function testError(): void { $this->assertSession()->pageTextContains("An automated attempt to create the directory {$this->configDirectory}/sync failed, possibly due to a permissions problem."); $this->assertDirectoryDoesNotExist($this->configDirectory . '/sync'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php index 8ebed8eb4c4..b8149ee6529 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php @@ -40,7 +40,7 @@ class InstallerConfigDirectorySetNoDirectoryTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); $this->assertDirectoryExists($this->syncDirectory); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php index 441d2fa0003..ab7258b4beb 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php @@ -50,7 +50,7 @@ class InstallerDatabaseErrorMessagesTest extends InstallerTestBase { /** * Verifies that the error message in the settings step is correct. */ - public function testSetUpSettingsErrorMessage() { + public function testSetUpSettingsErrorMessage(): void { $this->assertSession()->responseContains('<ul><li>Failed to <strong>CREATE</strong> a test table'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php index d158e865e8b..1b2ee2cb249 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php @@ -29,7 +29,7 @@ class InstallerEmptySettingsTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php index 771e88ea99d..636300b1448 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php @@ -73,7 +73,7 @@ class InstallerExistingBrokenDatabaseSettingsTest extends InstallerTestBase { /** * Tests the expected requirements problem. */ - public function testRequirementsProblem() { + public function testRequirementsProblem(): void { $this->assertSession()->titleEquals('Requirements problem | Drupal'); $this->assertSession()->pageTextContains('Database settings'); $this->assertSession()->pageTextContains('Resolve all issues below to continue the installation. For help configuring your database server,'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php index 227f73e09db..e391e0f6692 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php @@ -39,7 +39,7 @@ class InstallerExistingConfigDirectoryTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); $this->assertEquals($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only')); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php index a02e75213b4..7b534dd06ba 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php @@ -28,7 +28,7 @@ class InstallerExistingConfigMultilingualTest extends InstallerExistingConfigTes /** * {@inheritdoc} */ - public function testConfigSync() { + public function testConfigSync(): void { parent::testConfigSync(); // Ensure no warning, error, critical, alert or emergency messages have been diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php index 5fbdfd9d9b2..25d9287b3e3 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php @@ -35,7 +35,7 @@ class InstallerExistingConfigNoConfigTest extends InstallerExistingConfigTestBas /** * Tests that profiles with an empty config/sync directory do not work. */ - public function testConfigSync() { + public function testConfigSync(): void { $this->assertSession()->titleEquals('Configuration validation | Drupal'); $this->assertSession()->pageTextContains('The configuration synchronization failed validation.'); $this->assertSession()->pageTextContains('This import is empty and if applied would delete all of your configuration, so has been rejected.'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php index 02328983ca6..68aaa6282a0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php @@ -30,7 +30,7 @@ class InstallerExistingConfigNoSystemSiteTest extends InstallerExistingConfigTes /** * Tests that profiles with no system.site do not work. */ - public function testConfigSync() { + public function testConfigSync(): void { $this->htmlOutput(NULL); $this->assertSession()->titleEquals('Configuration validation | Drupal'); $this->assertSession()->pageTextContains('The configuration synchronization failed validation.'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php index 838e91e5124..d4283e8510a 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstall.php @@ -64,7 +64,7 @@ EOF; /** * Confirms the installation has failed and the expected error is displayed. */ - public function testConfigSync() { + public function testConfigSync(): void { $this->assertSession()->titleEquals('Requirements problem | Drupal'); $this->assertSession()->pageTextContains($this->profile); $this->assertSession()->pageTextContains('The selected profile has a hook_install() implementation and therefore can not be installed from configuration.'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php index 52e3ebe5a42..b998e8eafd5 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php @@ -65,7 +65,7 @@ class InstallerExistingConfigSyncDirectoryMultilingualTest extends InstallerExis /** * Confirms that the installation installed the configuration correctly. */ - public function testConfigSync() { + public function testConfigSync(): void { $comparer = $this->configImporter()->getStorageComparer(); $expected_changelist_default_collection = [ 'create' => [], diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php index 5d00a77adb1..8c16ee96932 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php @@ -81,7 +81,7 @@ EOF; /** * Tests installing from config is not available due to hook_INSTALL(). */ - public function testConfigSync() { + public function testConfigSync(): void { $this->assertSession()->titleEquals('Select an installation profile | Drupal'); $this->assertSession()->responseNotContains('Use existing configuration'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php index dac5d25219e..fd7ade39a46 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php @@ -49,7 +49,7 @@ class InstallerExistingConfigSyncDirectoryProfileMismatchTest extends InstallerE /** * Tests that profile mismatch fails to install. */ - public function testConfigSync() { + public function testConfigSync(): void { $this->htmlOutput(NULL); $this->assertSession()->titleEquals('Configuration validation | Drupal'); $this->assertSession()->pageTextContains('The configuration synchronization failed validation.'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php index e3d42fe68f0..4404c0fa117 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php @@ -134,7 +134,7 @@ abstract class InstallerExistingConfigTestBase extends InstallerTestBase { /** * Confirms that the installation installed the configuration correctly. */ - public function testConfigSync() { + public function testConfigSync(): void { // After installation there is no snapshot and nothing to import. $change_list = $this->configImporter()->getStorageComparer()->getChangelist(); $expected = [ diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php index 5e1ca85dc99..7d896c1e1d2 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php @@ -59,7 +59,7 @@ class InstallerExistingDatabaseSettingsTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php index 9ee4a4b691f..a932da76d33 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php @@ -19,7 +19,7 @@ class InstallerExistingInstallationTest extends InstallerTestBase { /** * Tests that Drupal fails to install when there is an existing installation. */ - public function testInstaller() { + public function testInstaller(): void { // Verify that Drupal can't be immediately reinstalled. $this->visitInstaller(); $this->assertSession()->pageTextContains('Drupal already installed'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php index cf7813321c6..03dc683e43c 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php @@ -65,7 +65,7 @@ class InstallerExistingSettingsNoProfileTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); $this->assertEquals('testing', \Drupal::installProfile()); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php index 4425352b4be..8a44b6b70e6 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php @@ -78,7 +78,7 @@ class InstallerExistingSettingsTest extends InstallerTestBase { /** * Verifies that installation succeeded. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); $this->assertEquals('testing', \Drupal::installProfile()); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php index 7935aaf03a4..81dc3d974f7 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php @@ -44,7 +44,7 @@ class InstallerLanguageDirectionTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php index 1338991438a..a1e1c1597dd 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php @@ -45,7 +45,7 @@ class InstallerLanguagePageTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php index a0ddc15b33c..d15135cdbd0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php @@ -57,7 +57,7 @@ class InstallerNonDefaultDatabaseDriverTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php index aa395890a6b..b5152b56e69 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php @@ -61,7 +61,7 @@ class InstallerNonEnglishProfileWithoutLocaleModuleTest extends InstallerTestBas /** * Tests installing a profile with non-English language and no locale module. */ - public function testNonEnglishProfileWithoutLocaleModule() { + public function testNonEnglishProfileWithoutLocaleModule(): void { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->addressEquals('user/1'); // Confirm that we are logged-in after installation. diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php index 8769c8ccbc4..37622c5e282 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php @@ -36,7 +36,7 @@ class InstallerPerformanceTest extends BrowserTestBase { /** * Ensures that the user page is available after installation. */ - public function testInstaller() { + public function testInstaller(): void { // Ensures that router is not rebuilt unnecessarily during the install. // Currently it is built once during the install in install_finished(). $this->assertSame(1, \Drupal::service('core.performance.test.recorder')->getCount('event', RoutingEvents::FINISHED)); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php index 1e62de937c6..f527f52ece0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php @@ -24,7 +24,7 @@ class InstallerPostInstallTest extends InstallerTestBase { /** * Confirms that visiting the installer does not break things post-install. */ - public function testVisitInstallerPostInstall() { + public function testVisitInstallerPostInstall(): void { \Drupal::service('module_installer')->install(['system_test']); // Clear caches to ensure that system_test's routes are available. $this->resetAll(); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php index 8fc1d041dfc..f69a5ff0bb2 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php @@ -47,7 +47,7 @@ class InstallerProfileRequirementsTest extends InstallerTestBase { /** * Assert that the profile failed hook_requirements(). */ - public function testHookRequirementsFailure() { + public function testHookRequirementsFailure(): void { $this->assertSession()->pageTextContains('Testing requirements failed requirements.'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php index 41839effe11..127ef7f919e 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php @@ -52,7 +52,7 @@ class InstallerRouterTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->statusCodeEquals(200); // Ensures that router is not rebuilt unnecessarily during the install. It // is rebuilt during: diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php index 5c46d446e52..7da75723dd4 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php @@ -61,7 +61,7 @@ class InstallerSiteConfigProfileTest extends InstallerTestBase { /** * Verify the correct site config was set. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertEquals(self::EXPECTED_SITE_MAIL, $this->config('system.site')->get('mail')); $this->assertEquals(self::EXPECTED_TIMEZONE, $this->config('system.date')->get('timezone.default')); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php index 74750099f30..fe585c118f4 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php @@ -40,7 +40,7 @@ class InstallerSkipPermissionHardeningTest extends InstallerTestBase { /** * Verifies the expected behaviors of the installation result. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php index d70cf621e31..2793e16c9ef 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @@ -26,7 +26,7 @@ class InstallerTest extends InstallerTestBase { /** * Ensures that the user page is available after installation. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertNotEquals('0', \Drupal::service('asset.query_string')->get(), 'The dummy query string should be set during install'); $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); @@ -127,7 +127,7 @@ class InstallerTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php index 8418b92566d..116028ecd4c 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php @@ -26,7 +26,7 @@ class InstallerThemesBlocksProfileTest extends InstallerTestBase { /** * Verify that there is no automatic block generation. */ - public function testInstaller() { + public function testInstaller(): void { // Account menu is a block that testing_theme_required_blocks provides, // but not testing_theme_optional_blocks. There shouldn't be a account menu diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php index 9c2c4a2a4ea..77d4153f7d0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php @@ -80,7 +80,7 @@ PO; /** * Ensures language selection has not failed. */ - public function testInstall() { + public function testInstall(): void { // At this point we'll be on the profile selection or requirements screen. $this->assertSession()->statusCodeEquals(200); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php index 358ccfd9021..6c4ad5c6d83 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php @@ -79,7 +79,7 @@ PO; /** * Tests that translations ended up at the expected places. */ - public function testTranslationsLoaded() { + public function testTranslationsLoaded(): void { $this->drupalLogin($this->createUser([], NULL, TRUE)); // Ensure the title is correct. $this->assertEquals('SITE_NAME_en', \Drupal::config('system.site')->get('name')); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php index b019bd97430..bb2f5fb381c 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -76,7 +76,7 @@ PO; /** * Tests that translations ended up at the expected places. */ - public function testTranslationsLoaded() { + public function testTranslationsLoaded(): void { // Ensure the title is correct. $this->assertEquals('SITE_NAME_' . $this->langcode, \Drupal::config('system.site')->get('name')); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php index e5ff25fadeb..f085ae3d034 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php @@ -57,7 +57,7 @@ class InstallerTranslationQueryTest extends InstallerTestBase { /** * Verifies the expected behaviors of the installation result. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php index fe9eac77f5a..fa9368b2e9d 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php @@ -80,7 +80,7 @@ class InstallerTranslationTest extends InstallerTestBase { /** * Verifies the expected behaviors of the installation result. */ - public function testInstaller() { + public function testInstaller(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php index de134e757f9..3513ff168de 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php @@ -28,7 +28,7 @@ class MinimalInstallerTest extends ConfigAfterInstallerTestBase { /** * Ensures that the exported minimal configuration is up to date. */ - public function testMinimalConfig() { + public function testMinimalConfig(): void { $this->assertInstalledConfig([]); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php index 37f60bcf31d..bcab6db5caf 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php @@ -76,7 +76,7 @@ class MultipleDistributionsProfileTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); // Confirm that we are logged-in after installation. diff --git a/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php index 0a7bb8d527a..7f2d7c35fa8 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php @@ -57,7 +57,7 @@ class SingleVisibleProfileTest extends InstallerTestBase { /** * Confirms that the installation succeeded. */ - public function testInstalled() { + public function testInstalled(): void { $this->assertSession()->addressEquals('user/1'); $this->assertSession()->statusCodeEquals(200); // Confirm that we are logged-in after installation. diff --git a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php index 09e6bc6f961..fa513876d49 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php @@ -38,7 +38,7 @@ class SiteNameTest extends BrowserTestBase { /** * Tests that the desired site name appears on the page after installation. */ - public function testSiteName() { + public function testSiteName(): void { $this->drupalGet(''); $this->assertSession()->pageTextContains($this->siteName); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php b/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php index eb157f6fd64..404fd7c8ac2 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php @@ -26,7 +26,7 @@ class SiteSettingsFormTest extends BrowserTestBase { /** * Confirms that the form is extensible. */ - public function testSiteSettingsForm() { + public function testSiteSettingsForm(): void { // Test that the form page can be loaded without errors. $this->drupalGet('test-form'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php index 5aba88177c5..ac997d6ab1e 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php @@ -19,7 +19,7 @@ class StandardInstallerTest extends ConfigAfterInstallerTestBase { /** * Ensures that the user page is available after installation. */ - public function testInstaller() { + public function testInstaller(): void { // Verify that Olivero's default frontpage appears. $this->assertSession()->pageTextContains('Congratulations and welcome to the Drupal community.'); $this->assertSession()->elementTextContains('css', '#block-olivero-powered', 'Powered by Drupal'); @@ -38,7 +38,7 @@ class StandardInstallerTest extends ConfigAfterInstallerTestBase { /** * Ensures that the exported standard configuration is up to date. */ - public function testStandardConfig() { + public function testStandardConfig(): void { $skipped_config = []; // FunctionalTestSetupTrait::installParameters() uses Drupal as site name // and simpletest@example.com as mail address. diff --git a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php index 2d1fc6e1738..ddfa20ca546 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php @@ -26,7 +26,7 @@ class TestingProfileInstallTest extends BrowserTestBase { /** * Ensure the Update module is installed. */ - public function testUpdateModuleInstall() { + public function testUpdateModuleInstall(): void { $this->assertTrue(\Drupal::moduleHandler()->moduleExists('update')); } diff --git a/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php b/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php index 1429d3d6ec3..f733aa13848 100644 --- a/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php +++ b/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php @@ -94,7 +94,7 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase { * order. The necessary loading order was determined by the requirements * specified in each jQuery UI JavaScript file. */ - public function testProperlySetWeights() { + public function testProperlySetWeights(): void { $assets = []; // Confirm that no asset is assigned multiple weights. @@ -169,7 +169,7 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase { /** * Confirm that uses of a jQuery UI asset are configured with the same weight. */ - public function testSameAssetSameWeight() { + public function testSameAssetSameWeight(): void { $asset_weights = []; $libraries_to_check = $this->coreLibrariesWithJqueryUiAssets; @@ -218,7 +218,7 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase { * * @dataProvider providerTestAssetLoading */ - public function testLibraryAssetLoadingOrder($library, array $expected_css, array $expected_js) { + public function testLibraryAssetLoadingOrder($library, array $expected_css, array $expected_js): void { $this->drupalGet("jqueryui_library_assets_test/$library"); $this->assertSession()->statusCodeEquals(200); @@ -299,7 +299,7 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase { * * @dataProvider providerTestAssetLoading */ - public function testAssetLoadingUnchanged($library, array $expected_css, array $expected_js) { + public function testAssetLoadingUnchanged($library, array $expected_css, array $expected_js): void { $this->drupalGet("jqueryui_library_assets_test/$library"); $this->assertSession()->statusCodeEquals(200); diff --git a/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php b/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php index 7951249f23f..c128587612f 100644 --- a/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php +++ b/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php @@ -28,7 +28,7 @@ class ManyAssetsLoadOrderTest extends BrowserTestBase { * * Confirms the load order reflects the configured weights for each asset. */ - public function testLoadOrder() { + public function testLoadOrder(): void { $this->drupalGet('many_assets_test'); $js = $this->getSession()->getPage()->findAll('css', 'script[data-weight]'); diff --git a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php index b6d5c4f147b..bea51a83645 100644 --- a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php +++ b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php @@ -28,7 +28,7 @@ class MailCaptureTest extends BrowserTestBase { /** * Tests to see if the wrapper function is executed correctly. */ - public function testMailSend() { + public function testMailSend(): void { // Create an email. $subject = $this->randomString(64); $body = $this->randomString(128); diff --git a/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php b/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php index 5a151815efc..2a7e446e348 100644 --- a/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php +++ b/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php @@ -86,7 +86,7 @@ class MenuActiveTrail403Test extends BrowserTestBase { /** * Tests that visiting 403 page does not override original active trail. */ - public function testMenuActiveTrail403Cache() { + public function testMenuActiveTrail403Cache(): void { $this->drupalLogin($this->privilegedUser); $system_status_url = Url::fromRoute('system.status'); $this->drupalGet($system_status_url); diff --git a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php index f4773b3c595..447224e931f 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php @@ -37,7 +37,7 @@ class CaseInsensitivePathTest extends BrowserTestBase { /** * Tests mixed case paths. */ - public function testMixedCasePaths() { + public function testMixedCasePaths(): void { // Tests paths defined by routes from standard modules as anonymous. $this->drupalGet('user/login'); $this->assertSession()->statusCodeEquals(200); @@ -103,7 +103,7 @@ class CaseInsensitivePathTest extends BrowserTestBase { /** * Tests paths with slugs. */ - public function testPathsWithArguments() { + public function testPathsWithArguments(): void { $this->drupalGet('system-test/echo/foobarbaz'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextMatches('/foobarbaz/'); diff --git a/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php b/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php index 8a3cea331cd..734058c0c4e 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php @@ -21,7 +21,7 @@ class DefaultFormatTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; - public function testFoo() { + public function testFoo(): void { $this->drupalGet('/default_format_test/human'); $this->assertSame('format:html', $this->getSession()->getPage()->getContent()); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); @@ -37,7 +37,7 @@ class DefaultFormatTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); } - public function testMultipleRoutesWithSameSingleFormat() { + public function testMultipleRoutesWithSameSingleFormat(): void { $this->drupalGet('/default_format_test/machine'); $this->assertSame('format:json', $this->getSession()->getPage()->getContent()); } diff --git a/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php b/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php index b5ec69f803b..e344c7d4190 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php @@ -24,7 +24,7 @@ class LazyRouteProviderInstallTest extends BrowserTestBase { /** * Tests that the lazy route provider is used during a module install. */ - public function testInstallation() { + public function testInstallation(): void { $this->container->get('module_installer')->install(['router_test']); // Note that on DrupalCI the test site is installed in a sub directory so // we cannot use ::assertEquals(). diff --git a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php index fd5e94a6f95..0ac2339a810 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php @@ -28,7 +28,7 @@ class PathEncodedTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; - public function testGetEncoded() { + public function testGetEncoded(): void { $route_paths = [ 'path_encoded_test.colon' => '/hi/llama:party', 'path_encoded_test.at_sign' => '/blog/@Dries', @@ -40,7 +40,7 @@ class PathEncodedTest extends BrowserTestBase { } } - public function testAliasToEncoded() { + public function testAliasToEncoded(): void { $route_paths = [ 'path_encoded_test.colon' => '/hi/llama:party', 'path_encoded_test.at_sign' => '/blog/@Dries', diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php index 3df21995346..9e6e8b91af8 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php @@ -129,7 +129,7 @@ class RouteCachingLanguageTest extends BrowserTestBase { * * @dataProvider providerLanguage */ - public function testLinkTranslationWithAlias($source_langcode) { + public function testLinkTranslationWithAlias($source_langcode): void { $source_url_options = [ 'language' => ConfigurableLanguage::load($source_langcode), ]; diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php index 0eeb7e4358b..97cf9f8abf2 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php @@ -81,7 +81,7 @@ class RouteCachingNonPathLanguageNegotiationTest extends BrowserTestBase { /** * Tests aliases when the negotiated language is not in the path. */ - public function testAliases() { + public function testAliases(): void { // Switch to French and try to access the now inaccessible block. $this->drupalGet(''); diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php index 030e7a12d9f..3e099fa46fc 100644 --- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php +++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php @@ -47,7 +47,7 @@ class RouteCachingQueryAlteredTest extends BrowserTestBase { /** * Tests route collection cache after an exception. */ - public function testRouteCollectionCacheAfterException() { + public function testRouteCollectionCacheAfterException(): void { // Force an exception early in the Kernel middleware on a cold cache by // simulating bad Bearer authentication. $this->drupalGet('/router-test/rejects-query-strings', [], [ diff --git a/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php b/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php index 49e4fabb261..99e4974e3fc 100644 --- a/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php +++ b/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php @@ -71,7 +71,7 @@ class ClaroLayoutBuilderTest extends BrowserTestBase { * * @see claro.theme */ - public function testContextualLinks() { + public function testContextualLinks(): void { $assert_session = $this->assertSession(); $page = $this->getSession()->getPage(); diff --git a/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php b/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php index 94d2a182bd6..53a038af263 100644 --- a/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php +++ b/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php @@ -36,7 +36,7 @@ class ClaroTest extends BrowserTestBase { * * @see claro.info.yml */ - public function testRegressionMissingElementsCss() { + public function testRegressionMissingElementsCss(): void { $this->drupalGet(''); $this->assertSession()->statusCodeEquals(200); // This can be any CSS file from the global library. @@ -46,7 +46,7 @@ class ClaroTest extends BrowserTestBase { /** * Tests Claro's configuration schema. */ - public function testConfigSchema() { + public function testConfigSchema(): void { $permissions = [ 'administer modules', ]; @@ -66,7 +66,7 @@ class ClaroTest extends BrowserTestBase { /** * Tests that the Claro theme can be uninstalled. */ - public function testIsUninstallable() { + public function testIsUninstallable(): void { $this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer themes'])); $this->drupalGet('admin/appearance'); diff --git a/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php b/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php index c9e42bcc49b..a6e2a81482d 100644 --- a/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php +++ b/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php @@ -39,7 +39,7 @@ class OliveroTest extends BrowserTestBase { * * @see olivero.libraries.yml */ - public function testBaseLibraryAvailable() { + public function testBaseLibraryAvailable(): void { $this->drupalGet(''); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseContains('olivero/css/base/base.css'); @@ -49,7 +49,7 @@ class OliveroTest extends BrowserTestBase { /** * Test Olivero's configuration schema. */ - public function testConfigSchema() { + public function testConfigSchema(): void { // Required configuration. $this->drupalGet(''); $this->assertSession()->statusCodeEquals(200); @@ -74,7 +74,7 @@ class OliveroTest extends BrowserTestBase { * * @see olivero.libraries.yml */ - public function testPreprocessBlock() { + public function testPreprocessBlock(): void { $this->drupalGet(''); $this->assertSession()->statusCodeEquals(200); @@ -122,7 +122,7 @@ class OliveroTest extends BrowserTestBase { /** * Tests that the Olivero theme can be uninstalled. */ - public function testIsUninstallable() { + public function testIsUninstallable(): void { $this->drupalLogin($this->drupalCreateUser([ 'access administration pages', 'administer themes', diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php index e74802e8513..9bf75311d59 100644 --- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php @@ -32,14 +32,14 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { /** * Tests that the database was properly loaded. */ - public function testDatabaseProperlyLoaded() { + public function testDatabaseProperlyLoaded(): void { $this->testDatabaseLoaded(); } /** * Tests that updates are properly run. */ - public function testUpdateHookN() { + public function testUpdateHookN(): void { $connection = Database::getConnection(); // Increment the schema version. @@ -76,7 +76,7 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { /** * Tests that path aliases are not processed during database updates. */ - public function testPathAliasProcessing() { + public function testPathAliasProcessing(): void { // Add a path alias for the '/admin' system path. $values = [ 'path' => '/admin/structure', @@ -122,7 +122,7 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { * * @see update_test_schema_update_8003() */ - public function testModuleListChange() { + public function testModuleListChange(): void { // Set a value in the cache to prove caches are cleared. \Drupal::service('cache.default')->set(__CLASS__, 'Test'); @@ -169,7 +169,7 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { * @see \Drupal\FunctionalTests\Update\UpdatePathTestBase::runUpdates() * @see \Drupal\Core\Test\TestSetupTrait::$configSchemaCheckerExclusions */ - public function testSchemaChecking() { + public function testSchemaChecking(): void { // Create some configuration that should be skipped. $this->config('config_schema_test.no_schema')->set('foo', 'bar')->save(); $this->runUpdates(); @@ -180,7 +180,7 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { /** * Tests that setup is done correctly. */ - public function testSetup() { + public function testSetup(): void { $this->assertCount(3, $this->databaseDumpFiles); $this->assertSame(1, Settings::get('entity_update_batch_size')); } diff --git a/core/tests/Drupal/FunctionalTests/UserHelpersTest.php b/core/tests/Drupal/FunctionalTests/UserHelpersTest.php index d69d619058f..151a0827246 100644 --- a/core/tests/Drupal/FunctionalTests/UserHelpersTest.php +++ b/core/tests/Drupal/FunctionalTests/UserHelpersTest.php @@ -21,7 +21,7 @@ class UserHelpersTest extends BrowserTestBase { /** * Tests BrowserTestBase::drupalUserIsLoggedIn(). */ - public function testDrupalUserIsLoggedIn() { + public function testDrupalUserIsLoggedIn(): void { $first_user = $this->drupalCreateUser(); $second_user = $this->drupalCreateUser(); diff --git a/core/tests/Drupal/FunctionalTests/WebAssertTest.php b/core/tests/Drupal/FunctionalTests/WebAssertTest.php index d5b42bd6a6b..a8ca8bcac10 100644 --- a/core/tests/Drupal/FunctionalTests/WebAssertTest.php +++ b/core/tests/Drupal/FunctionalTests/WebAssertTest.php @@ -37,7 +37,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::responseHeaderExists */ - public function testResponseHeaderExists() { + public function testResponseHeaderExists(): void { $this->drupalGet('test-null-header'); $this->assertSession()->responseHeaderExists('Null-Header'); @@ -51,7 +51,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::responseHeaderDoesNotExist */ - public function testResponseHeaderDoesNotExist() { + public function testResponseHeaderDoesNotExist(): void { $this->drupalGet('test-null-header'); $this->assertSession()->responseHeaderDoesNotExist('does-not-exist'); @@ -63,7 +63,7 @@ class WebAssertTest extends BrowserTestBase { /** * @covers ::pageTextMatchesCount */ - public function testPageTextMatchesCount() { + public function testPageTextMatchesCount(): void { $this->drupalLogin($this->drupalCreateUser()); // Visit a Drupal page that requires login. @@ -78,7 +78,7 @@ class WebAssertTest extends BrowserTestBase { /** * @covers ::pageTextContainsOnce */ - public function testPageTextContainsOnce() { + public function testPageTextContainsOnce(): void { $this->drupalLogin($this->drupalCreateUser()); // Visit a Drupal page that requires login. @@ -142,7 +142,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::linkExists */ - public function testPipeCharInLocator() { + public function testPipeCharInLocator(): void { $this->drupalGet('test-pipe-char'); $this->assertSession()->linkExists('foo|bar|baz'); } @@ -152,7 +152,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::linkExistsExact */ - public function testLinkExistsExact() { + public function testLinkExistsExact(): void { $this->drupalGet('test-pipe-char'); $this->assertSession()->linkExistsExact('foo|bar|baz'); } @@ -162,7 +162,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::linkExistsExact */ - public function testInvalidLinkExistsExact() { + public function testInvalidLinkExistsExact(): void { $this->drupalGet('test-pipe-char'); $this->expectException(ExpectationException::class); $this->expectExceptionMessage('Link with label foo|bar not found'); @@ -174,7 +174,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::linkNotExistsExact */ - public function testLinkNotExistsExact() { + public function testLinkNotExistsExact(): void { $this->drupalGet('test-pipe-char'); $this->assertSession()->linkNotExistsExact('foo|bar'); } @@ -184,7 +184,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::linkNotExistsExact */ - public function testInvalidLinkNotExistsExact() { + public function testInvalidLinkNotExistsExact(): void { $this->drupalGet('test-pipe-char'); $this->expectException(ExpectationException::class); $this->expectExceptionMessage('Link with label foo|bar|baz found'); @@ -295,7 +295,7 @@ class WebAssertTest extends BrowserTestBase { * @covers ::responseContains * @covers ::responseNotContains */ - public function testTextAsserts() { + public function testTextAsserts(): void { $this->drupalGet('test-encoded'); $dangerous = 'Bad html <script>alert(123);</script>'; $sanitized = Html::escape($dangerous); @@ -309,7 +309,7 @@ class WebAssertTest extends BrowserTestBase { * @covers ::buttonExists * @covers ::buttonNotExists */ - public function testFieldAssertsForButton() { + public function testFieldAssertsForButton(): void { $this->drupalGet('test-field-xpath'); // Verify if the test passes with button ID. @@ -346,7 +346,7 @@ class WebAssertTest extends BrowserTestBase { * * @covers ::pageContainsNoDuplicateId */ - public function testPageContainsNoDuplicateId() { + public function testPageContainsNoDuplicateId(): void { $assert_session = $this->assertSession(); $this->drupalGet(Url::fromRoute('test_page_test.page_without_duplicate_ids')); $assert_session->pageContainsNoDuplicateId(); @@ -363,7 +363,7 @@ class WebAssertTest extends BrowserTestBase { * @covers ::assertNoEscaped * @covers ::assertEscaped */ - public function testEscapingAssertions() { + public function testEscapingAssertions(): void { $assert = $this->assertSession(); $this->drupalGet('test-escaped-characters'); diff --git a/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php b/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php index cfbb121e387..4c9e7b1717b 100644 --- a/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php +++ b/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php @@ -44,7 +44,7 @@ class FormattableMarkupKernelTest extends KernelTestBase { * * @dataProvider providerTestFormattableMarkupUri */ - public function testFormattableMarkupUri($string, $uri, $options, $expected) { + public function testFormattableMarkupUri($string, $uri, $options, $expected): void { $args = self::getFormattableMarkupUriArgs($uri, $options); $this->assertSame($expected, (string) new FormattableMarkup($string, $args)); } @@ -103,7 +103,7 @@ class FormattableMarkupKernelTest extends KernelTestBase { /** * @dataProvider providerTestFormattableMarkupUriWithException */ - public function testFormattableMarkupUriWithExceptionUri($string, $uri) { + public function testFormattableMarkupUriWithExceptionUri($string, $uri): void { // Should throw an \InvalidArgumentException, due to Uri::toString(). $this->expectException(\InvalidArgumentException::class); $args = self::getFormattableMarkupUriArgs($uri); diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php index a1973722aba..853d3e3afe0 100644 --- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php +++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php @@ -60,7 +60,7 @@ class DefaultConfigTest extends KernelTestBase { * * @dataProvider themeListDataProvider */ - public function testThemeConfig($theme) { + public function testThemeConfig($theme): void { $this->assertExtensionConfig($theme, 'theme'); } diff --git a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php index 44c6b7d87f1..db02ae73b14 100644 --- a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php +++ b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php @@ -43,7 +43,7 @@ class TypedConfigTest extends KernelTestBase { /** * Verifies that the Typed Data API is implemented correctly. */ - public function testTypedDataAPI() { + public function testTypedDataAPI(): void { /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager */ $typed_config_manager = \Drupal::service('config.typed'); @@ -144,7 +144,7 @@ class TypedConfigTest extends KernelTestBase { /** * Tests config validation via the Typed Data API. */ - public function testSimpleConfigValidation() { + public function testSimpleConfigValidation(): void { $config = \Drupal::configFactory()->getEditable('config_test.validation'); /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager */ $typed_config_manager = \Drupal::service('config.typed'); diff --git a/core/tests/Drupal/KernelTests/ConfigFormTestBase.php b/core/tests/Drupal/KernelTests/ConfigFormTestBase.php index 9cad9328d85..b588372865b 100644 --- a/core/tests/Drupal/KernelTests/ConfigFormTestBase.php +++ b/core/tests/Drupal/KernelTests/ConfigFormTestBase.php @@ -42,7 +42,7 @@ abstract class ConfigFormTestBase extends KernelTestBase { /** * Submit the system_config_form ensure the configuration has expected values. */ - public function testConfigForm() { + public function testConfigForm(): void { // Programmatically submit the given values. $values = []; foreach ($this->values as $form_key => $data) { diff --git a/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php b/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php index 4626a6af43f..9ce189b5df1 100644 --- a/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php @@ -41,7 +41,7 @@ class DeleteActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityDeleteActionDeriver::getDerivativeDefinitions */ - public function testGetDerivativeDefinitions() { + public function testGetDerivativeDefinitions(): void { $deriver = new EntityDeleteActionDeriver(\Drupal::entityTypeManager(), \Drupal::translation()); $this->assertEquals([ 'entity_test_mulrevpub' => [ @@ -70,7 +70,7 @@ class DeleteActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\DeleteAction::execute */ - public function testDeleteAction() { + public function testDeleteAction(): void { $entity = EntityTestMulRevPub::create(['name' => 'test']); $entity->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Action/EmailActionTest.php b/core/tests/Drupal/KernelTests/Core/Action/EmailActionTest.php index faf116ec8f5..34bf7a5a379 100644 --- a/core/tests/Drupal/KernelTests/Core/Action/EmailActionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Action/EmailActionTest.php @@ -32,7 +32,7 @@ class EmailActionTest extends KernelTestBase { /** * Tests the email action plugin. */ - public function testEmailAction() { + public function testEmailAction(): void { $this->config('system.site')->set('mail', 'test@example.com')->save(); /** @var \Drupal\Core\Action\ActionManager $plugin_manager */ diff --git a/core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php b/core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php index 09d63e96ba7..09c62d5d9dc 100644 --- a/core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Action/PublishActionTest.php @@ -30,7 +30,7 @@ class PublishActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityPublishedActionDeriver::getDerivativeDefinitions */ - public function testGetDerivativeDefinitions() { + public function testGetDerivativeDefinitions(): void { $deriver = new EntityPublishedActionDeriver(\Drupal::entityTypeManager(), \Drupal::translation()); $definitions = $deriver->getDerivativeDefinitions([ 'action_label' => 'Save', @@ -45,7 +45,7 @@ class PublishActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\PublishAction::execute */ - public function testPublishAction() { + public function testPublishAction(): void { $entity = EntityTestMulRevPub::create(['name' => 'test']); $entity->setUnpublished()->save(); @@ -63,7 +63,7 @@ class PublishActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\UnpublishAction::execute */ - public function testUnpublishAction() { + public function testUnpublishAction(): void { $entity = EntityTestMulRevPub::create(['name' => 'test']); $entity->setPublished()->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php b/core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php index 54453e1ab72..586523d1869 100644 --- a/core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php @@ -30,7 +30,7 @@ class SaveActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\Derivative\EntityChangedActionDeriver::getDerivativeDefinitions */ - public function testGetDerivativeDefinitions() { + public function testGetDerivativeDefinitions(): void { $deriver = new EntityChangedActionDeriver(\Drupal::entityTypeManager(), \Drupal::translation()); $definitions = $deriver->getDerivativeDefinitions([ 'action_label' => 'Save', @@ -45,7 +45,7 @@ class SaveActionTest extends KernelTestBase { /** * @covers \Drupal\Core\Action\Plugin\Action\SaveAction::execute */ - public function testSaveAction() { + public function testSaveAction(): void { $entity = EntityTestMulChanged::create(['name' => 'test']); $entity->save(); $saved_time = $entity->getChangedTime(); diff --git a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php index 90cfefbcd4c..4571f2d025e 100644 --- a/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Ajax/CommandsTest.php @@ -32,7 +32,7 @@ class CommandsTest extends KernelTestBase { /** * Regression test: Settings command exists regardless of JS aggregation. */ - public function testAttachedSettings() { + public function testAttachedSettings(): void { $assert = function ($message) { $response = new AjaxResponse(); $response->setAttachments([ @@ -69,7 +69,7 @@ class CommandsTest extends KernelTestBase { * * @doesNotPerformAssertions */ - public function testEmptyInsertCommand() { + public function testEmptyInsertCommand(): void { (new InsertCommand('foobar', []))->render(); } diff --git a/core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php b/core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php index a3d300edb63..ba7e84587c4 100644 --- a/core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php +++ b/core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php @@ -19,7 +19,7 @@ class TarTest extends ArchiverTestBase { /** * Tests that the Tar archive is created if it does not exist. */ - public function testCreateArchive() { + public function testCreateArchive(): void { $textFile = current($this->getTestFiles('text')); $archiveFilename = $this->fileSystem->realpath('public://' . $this->randomMachineName() . '.tar'); $tar = new Tar($archiveFilename); diff --git a/core/tests/Drupal/KernelTests/Core/Archiver/ZipTest.php b/core/tests/Drupal/KernelTests/Core/Archiver/ZipTest.php index 689f76e9a1d..2bc2fda371d 100644 --- a/core/tests/Drupal/KernelTests/Core/Archiver/ZipTest.php +++ b/core/tests/Drupal/KernelTests/Core/Archiver/ZipTest.php @@ -19,7 +19,7 @@ class ZipTest extends ArchiverTestBase { /** * Tests that the Zip archive is created if it does not exist. */ - public function testCreateArchive() { + public function testCreateArchive(): void { $textFile = current($this->getTestFiles('text')); $archiveFilename = $this->fileSystem->realpath('public://' . $this->randomMachineName() . '.zip'); $zip = new Zip($archiveFilename, [ @@ -35,7 +35,7 @@ class ZipTest extends ArchiverTestBase { /** * Tests that the Zip archiver is created and overwritten. */ - public function testOverwriteArchive() { + public function testOverwriteArchive(): void { // Create an archive similarly to how it's done in ::testCreateArchive. $files = $this->getTestFiles('text'); $textFile = current($files); diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php index 1a8fa790333..60f18afa57c 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php @@ -63,7 +63,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests that default CSS and JavaScript is empty. */ - public function testDefault() { + public function testDefault(): void { $assets = new AttachedAssets(); $this->assertEquals([], $this->assetResolver->getCssAssets($assets, FALSE, \Drupal::languageManager()->getCurrentLanguage()), 'Default CSS is empty.'); [$js_assets_header, $js_assets_footer] = $this->assetResolver->getJsAssets($assets, FALSE, \Drupal::languageManager()->getCurrentLanguage()); @@ -74,7 +74,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests non-existing libraries. */ - public function testLibraryUnknown() { + public function testLibraryUnknown(): void { $build['#attached']['library'][] = 'core/unknown'; $assets = AttachedAssets::createFromRenderArray($build); @@ -84,7 +84,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests adding a CSS and a JavaScript file. */ - public function testAddFiles() { + public function testAddFiles(): void { $build['#attached']['library'][] = 'common_test/files'; $assets = AttachedAssets::createFromRenderArray($build); @@ -105,7 +105,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests adding JavaScript settings. */ - public function testAddJsSettings() { + public function testAddJsSettings(): void { // Add a file in order to test default settings. $build['#attached']['library'][] = 'core/drupalSettings'; $assets = AttachedAssets::createFromRenderArray($build); @@ -124,7 +124,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests adding external CSS and JavaScript files. */ - public function testAddExternalFiles() { + public function testAddExternalFiles(): void { $build['#attached']['library'][] = 'common_test/external'; $assets = AttachedAssets::createFromRenderArray($build); @@ -144,7 +144,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests adding JavaScript files with additional attributes. */ - public function testAttributes() { + public function testAttributes(): void { $build['#attached']['library'][] = 'common_test/js-attributes'; $assets = AttachedAssets::createFromRenderArray($build); @@ -160,7 +160,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests that attributes are maintained when JS aggregation is enabled. */ - public function testAggregatedAttributes() { + public function testAggregatedAttributes(): void { $build['#attached']['library'][] = 'common_test/js-attributes'; $assets = AttachedAssets::createFromRenderArray($build); @@ -176,7 +176,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Integration test for CSS/JS aggregation. */ - public function testAggregation() { + public function testAggregation(): void { $build['#attached']['library'][] = 'core/drupal.timezone'; $build['#attached']['library'][] = 'core/drupal.vertical-tabs'; $assets = AttachedAssets::createFromRenderArray($build); @@ -194,7 +194,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests JavaScript settings. */ - public function testSettings() { + public function testSettings(): void { $build = []; $build['#attached']['library'][] = 'core/drupalSettings'; // Nonsensical value to verify if it's possible to override path settings. @@ -234,7 +234,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests JS assets depending on the 'core/<head>' virtual library. */ - public function testHeaderHTML() { + public function testHeaderHTML(): void { $build['#attached']['library'][] = 'common_test/js-header'; $assets = AttachedAssets::createFromRenderArray($build); @@ -250,7 +250,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests that for assets with cache = FALSE, Drupal sets preprocess = FALSE. */ - public function testNoCache() { + public function testNoCache(): void { $build['#attached']['library'][] = 'common_test/no-cache'; $assets = AttachedAssets::createFromRenderArray($build); @@ -261,7 +261,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests JavaScript versioning. */ - public function testVersionQueryString() { + public function testVersionQueryString(): void { $build['#attached']['library'][] = 'core/once'; $assets = AttachedAssets::createFromRenderArray($build); @@ -275,7 +275,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests JavaScript and CSS asset ordering. */ - public function testRenderOrder() { + public function testRenderOrder(): void { $build['#attached']['library'][] = 'common_test/order'; $assets = AttachedAssets::createFromRenderArray($build); @@ -353,7 +353,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests rendering the JavaScript with a file's weight above jQuery's. */ - public function testRenderDifferentWeight() { + public function testRenderDifferentWeight(): void { // If a library contains assets A and B, and A is listed first, then B can // still make itself appear first by defining a lower weight. $build['#attached']['library'][] = 'core/jquery'; @@ -376,7 +376,7 @@ class AttachedAssetsTest extends KernelTestBase { * * @see common_test_js_alter() */ - public function testAlter() { + public function testAlter(): void { // Add both tableselect.js and alter.js. $build['#attached']['library'][] = 'core/drupal.tableselect'; $build['#attached']['library'][] = 'common_test/hook_js_alter'; @@ -397,7 +397,7 @@ class AttachedAssetsTest extends KernelTestBase { * * @see common_test_library_info_alter() */ - public function testLibraryAlter() { + public function testLibraryAlter(): void { // Verify that common_test altered the title of loadjs. /** @var \Drupal\Core\Asset\LibraryDiscoveryInterface $library_discovery */ $library_discovery = \Drupal::service('library.discovery'); @@ -416,7 +416,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Dynamically defines an asset library and alters it. */ - public function testDynamicLibrary() { + public function testDynamicLibrary(): void { /** @var \Drupal\Core\Asset\LibraryDiscoveryInterface $library_discovery */ $library_discovery = \Drupal::service('library.discovery'); // Retrieve a dynamic library definition. @@ -438,7 +438,7 @@ class AttachedAssetsTest extends KernelTestBase { * * @see common_test.library.yml */ - public function testLibraryNameConflicts() { + public function testLibraryNameConflicts(): void { /** @var \Drupal\Core\Asset\LibraryDiscoveryInterface $library_discovery */ $library_discovery = \Drupal::service('library.discovery'); $loadjs = $library_discovery->getLibraryByName('common_test', 'loadjs'); @@ -448,7 +448,7 @@ class AttachedAssetsTest extends KernelTestBase { /** * Tests JavaScript files that have query strings attached get added right. */ - public function testAddJsFileWithQueryString() { + public function testAddJsFileWithQueryString(): void { $build['#attached']['library'][] = 'common_test/querystring'; $assets = AttachedAssets::createFromRenderArray($build); diff --git a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php index 9fd06a29d39..6c3096ff5df 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php @@ -40,7 +40,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests that hook_library_info is invoked and the cache is cleared. */ - public function testHookLibraryInfoByTheme() { + public function testHookLibraryInfoByTheme(): void { // Activate test_theme and verify that the library 'kitten' is added using // hook_library_info_alter(). $this->activateTheme('test_theme'); @@ -55,7 +55,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests that libraries-override are applied to library definitions. */ - public function testLibrariesOverride() { + public function testLibrariesOverride(): void { // Assert some starterkit_theme libraries that will be overridden or // removed. $this->activateTheme('starterkit_theme'); @@ -96,7 +96,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests libraries-override on drupalSettings. */ - public function testLibrariesOverrideDrupalSettings() { + public function testLibrariesOverrideDrupalSettings(): void { // Activate test theme that attempts to override drupalSettings. $this->activateTheme('test_theme_libraries_override_with_drupal_settings'); @@ -114,7 +114,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests libraries-override on malformed assets. */ - public function testLibrariesOverrideMalformedAsset() { + public function testLibrariesOverrideMalformedAsset(): void { // Activate test theme that overrides with a malformed asset. $this->activateTheme('test_theme_libraries_override_with_invalid_asset'); @@ -132,7 +132,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests libraries overrides with multiple parent themes. */ - public function testLibrariesOverridesMultiple() { + public function testLibrariesOverridesMultiple(): void { /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ $theme_installer = $this->container->get('theme_installer'); $theme_installer->install(['test_basetheme']); @@ -155,7 +155,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests library assets with other ways for specifying paths. */ - public function testLibrariesOverrideOtherAssetLibraryNames() { + public function testLibrariesOverrideOtherAssetLibraryNames(): void { // Activate a test theme that defines libraries overrides on other types of // assets. $this->activateTheme('test_theme'); @@ -176,7 +176,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests that base theme libraries-override still apply in sub themes. */ - public function testBaseThemeLibrariesOverrideInSubTheme() { + public function testBaseThemeLibrariesOverrideInSubTheme(): void { // Activate a test theme that has subthemes. $this->activateTheme('test_subtheme'); @@ -189,7 +189,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { /** * Tests libraries-extend. */ - public function testLibrariesExtend() { + public function testLibrariesExtend(): void { // Simulate starterkit_theme defining the test-navigation library. // @see theme_test_library_info_alter() $this->container->get('state') @@ -253,7 +253,7 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase { * * @group legacy */ - public function testDeprecatedLibrary() { + public function testDeprecatedLibrary(): void { $this->expectDeprecation('Targeting theme_test/moved_from css/foo.css from test_theme_with_deprecated_libraries library_overrides is deprecated in drupal:X.0.0 and will be removed in drupal:Y.0.0. Target theme_test/moved_to css/base-remove.css instead. See https://example.com'); $this->expectDeprecation('Targeting theme_test/moved_from js/bar.js from test_theme_with_deprecated_libraries library_overrides is deprecated in drupal:X.0.0 and will be removed in drupal:Y.0.0. Target theme_test/moved_to js/foo.js instead. See https://example.com'); $this->expectDeprecation('Theme "theme_test" is overriding a deprecated library. The "theme_test/deprecated_library" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use another library instead. See https://www.example.com'); diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index dea01689cc5..3a7e1328ec1 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -154,7 +154,7 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { /** * Ensures that all core module and theme library files exist. */ - public function testCoreLibraryCompleteness() { + public function testCoreLibraryCompleteness(): void { // First verify all libraries with no active theme. $this->verifyLibraryFilesExist($this->getAllLibraries()); diff --git a/core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php b/core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php index e625b1861c0..a8c8af5fe7b 100644 --- a/core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php +++ b/core/tests/Drupal/KernelTests/Core/Batch/BatchKernelTest.php @@ -25,7 +25,7 @@ class BatchKernelTest extends KernelTestBase { /** * Tests _batch_needs_update(). */ - public function testNeedsUpdate() { + public function testNeedsUpdate(): void { // Before ever being called, the return value should be FALSE. $this->assertEquals(FALSE, _batch_needs_update()); diff --git a/core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php b/core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php index 466bc216aad..98ebeffd8fe 100644 --- a/core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php @@ -25,7 +25,7 @@ class BatchNegotiatorTest extends KernelTestBase { /** * Test that the negotiator applies to the batch route. */ - public function testApplies() { + public function testApplies(): void { $request = Request::create('/batch'); // Use the router to enhance the object so that a RouteMatch can be created. $this->container->get('router')->matchRequest($request); diff --git a/core/tests/Drupal/KernelTests/Core/Block/MultipleBlockFormTest.php b/core/tests/Drupal/KernelTests/Core/Block/MultipleBlockFormTest.php index 0938a7d5767..07237a966f3 100644 --- a/core/tests/Drupal/KernelTests/Core/Block/MultipleBlockFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Block/MultipleBlockFormTest.php @@ -22,7 +22,7 @@ class MultipleBlockFormTest extends KernelTestBase { /** * Tests that blocks can have multiple forms. */ - public function testMultipleForms() { + public function testMultipleForms(): void { $configuration = ['label' => 'A very cool block']; $block = \Drupal::service('plugin.manager.block')->createInstance('test_multiple_forms_block', $configuration); diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php index 8773c449dc0..f143ef109da 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php @@ -96,7 +96,7 @@ class ExtensionPathResolverTest extends KernelTestBase { /** * Tests the getPath() method with an unknown extension. */ - public function testUnknownExtension() { + public function testUnknownExtension(): void { $module_extension_list = $this->prophesize(ModuleExtensionList::class); $profile_extension_list = $this->prophesize(ProfileExtensionList::class); $theme_extension_list = $this->prophesize(ThemeExtensionList::class); diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php index 72b973c67d1..b3b4617de11 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php @@ -19,7 +19,7 @@ class ResettableStaticTest extends KernelTestBase { * Tests that a variable reference returned by drupal_static() gets reset when * drupal_static_reset() is called. */ - public function testDrupalStatic() { + public function testDrupalStatic(): void { $name = __CLASS__ . '_' . __METHOD__; $var = &drupal_static($name, 'foo'); $this->assertEquals('foo', $var, 'Variable returned by drupal_static() was set to its default.'); diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/ShutdownFunctionTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/ShutdownFunctionTest.php index 04d94108934..ab4223b0193 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/ShutdownFunctionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/ShutdownFunctionTest.php @@ -30,7 +30,7 @@ class ShutdownFunctionTest extends KernelTestBase { /** * Tests that shutdown functions can be added by other shutdown functions. */ - public function testShutdownFunctionInShutdownFunction() { + public function testShutdownFunctionInShutdownFunction(): void { // Ensure there are no shutdown functions registered before starting the // test. $this->assertEmpty(drupal_register_shutdown_function()); diff --git a/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php b/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php index c28e77b3e71..33a7d71de93 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php @@ -35,7 +35,7 @@ class ApcuBackendTest extends GenericCacheBackendUnitTestBase { /** * {@inheritdoc} */ - public function testSetGet() { + public function testSetGet(): void { parent::testSetGet(); // Make sure entries are permanent (i.e. no TTL). diff --git a/core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php index 7b2040f79ba..a6e24cddbd1 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php @@ -39,7 +39,7 @@ class CacheCollectorTest extends KernelTestBase { * * @dataProvider providerTestInvalidCharacters */ - public function testCacheCollector($cid, $key, $value) { + public function testCacheCollector($cid, $key, $value): void { $collector = new CacheCollectorHelper($cid, $this->container->get('cache.default'), $this->container->get('lock')); $this->assertNull($collector->get($key)); $collector->set($key, $value); diff --git a/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php b/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php index 05a7f643809..fc88361463f 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php @@ -36,7 +36,7 @@ class CacheContextOptimizationTest extends KernelTestBase { /** * Ensures that 'user.permissions' cache context is able to define cache tags. */ - public function testUserPermissionCacheContextOptimization() { + public function testUserPermissionCacheContextOptimization(): void { $user1 = $this->createUser(); $this->assertEquals(1, $user1->id()); @@ -79,7 +79,7 @@ class CacheContextOptimizationTest extends KernelTestBase { /** * Ensures that 'user.roles' still works when it is optimized away. */ - public function testUserRolesCacheContextOptimization() { + public function testUserRolesCacheContextOptimization(): void { $root_user = $this->createUser(); $this->assertEquals(1, $root_user->id()); diff --git a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php index 934042aac10..98d6e6ca66a 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php @@ -36,7 +36,7 @@ class DatabaseBackendTagTest extends KernelTestBase { ->addMethodCall('setContainer', [new Reference('service_container')]); } - public function testTagInvalidations() { + public function testTagInvalidations(): void { // Create cache entry in multiple bins. $tags = ['test_tag:1', 'test_tag:2', 'test_tag:3']; $bins = ['data', 'bootstrap', 'render']; diff --git a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php index 3fd81fb6027..5183e59f80b 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php @@ -48,7 +48,7 @@ class DatabaseBackendTest extends GenericCacheBackendUnitTestBase { /** * {@inheritdoc} */ - public function testSetGet() { + public function testSetGet(): void { parent::testSetGet(); $backend = $this->getCacheBackend(); @@ -77,7 +77,7 @@ class DatabaseBackendTest extends GenericCacheBackendUnitTestBase { /** * Tests the row count limiting of cache bin database tables. */ - public function testGarbageCollection() { + public function testGarbageCollection(): void { $backend = $this->getCacheBackend(); $max_rows = static::$maxRows; @@ -125,7 +125,7 @@ class DatabaseBackendTest extends GenericCacheBackendUnitTestBase { /** * Test that the service "cache_tags.invalidator.checksum" is backend overridable. */ - public function testCacheTagsInvalidatorChecksumIsBackendOverridable() { + public function testCacheTagsInvalidatorChecksumIsBackendOverridable(): void { $definition = $this->container->getDefinition('cache_tags.invalidator.checksum'); $this->assertTrue($definition->hasTag('backend_overridable')); } @@ -133,7 +133,7 @@ class DatabaseBackendTest extends GenericCacheBackendUnitTestBase { /** * Test that the service "cache.backend.database" is backend overridable. */ - public function testCacheBackendDatabaseIsBackendOverridable() { + public function testCacheBackendDatabaseIsBackendOverridable(): void { $definition = $this->container->getDefinition('cache.backend.database'); $this->assertTrue($definition->hasTag('backend_overridable')); } diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php index 00a105175ab..88888b99735 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php @@ -135,7 +135,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface. */ - public function testSetGet() { + public function testSetGet(): void { $backend = $this->getCacheBackend(); $this->assertFalse($backend->get('test1'), "Backend does not contain data for cache id test1."); @@ -239,7 +239,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::delete(). */ - public function testDelete() { + public function testDelete(): void { $backend = $this->getCacheBackend(); $this->assertFalse($backend->get('test1'), "Backend does not contain data for cache id test1."); @@ -267,7 +267,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests data type preservation. */ - public function testValueTypeIsKept() { + public function testValueTypeIsKept(): void { $backend = $this->getCacheBackend(); $variables = [ @@ -295,7 +295,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::getMultiple(). */ - public function testGetMultiple() { + public function testGetMultiple(): void { $backend = $this->getCacheBackend(); // Set numerous testing keys. @@ -389,7 +389,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests \Drupal\Core\Cache\CacheBackendInterface::setMultiple(). */ - public function testSetMultiple() { + public function testSetMultiple(): void { $backend = $this->getCacheBackend(); $future_expiration = \Drupal::time()->getRequestTime() + 100; @@ -454,7 +454,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { * @covers \Drupal\Core\Cache\MemoryBackend::deleteMultiple * @covers \Drupal\Core\Cache\PhpBackend::deleteMultiple */ - public function testDeleteMultiple() { + public function testDeleteMultiple(): void { $backend = $this->getCacheBackend(); // Set numerous testing keys. @@ -501,7 +501,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::deleteAll(). */ - public function testDeleteAll() { + public function testDeleteAll(): void { $backend_a = $this->getCacheBackend(); $backend_b = $this->getCacheBackend('bootstrap'); @@ -531,7 +531,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { * @covers \Drupal\Core\Cache\MemoryBackend::invalidateMultiple * @covers \Drupal\Core\Cache\PhpBackend::invalidateMultiple */ - public function testInvalidate() { + public function testInvalidate(): void { $backend = $this->getCacheBackend(); $backend->set('test1', 1); $backend->set('test2', 2); @@ -563,7 +563,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). */ - public function testInvalidateTags() { + public function testInvalidateTags(): void { $backend = $this->getCacheBackend(); // Create two cache entries with the same tag and tag value. @@ -630,7 +630,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::invalidateAll(). */ - public function testInvalidateAll() { + public function testInvalidateAll(): void { $backend_a = $this->getCacheBackend(); $backend_b = $this->getCacheBackend('bootstrap'); @@ -651,7 +651,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase { /** * Tests Drupal\Core\Cache\CacheBackendInterface::removeBin(). */ - public function testRemoveBin() { + public function testRemoveBin(): void { $backend_a = $this->getCacheBackend(); $backend_b = $this->getCacheBackend('bootstrap'); diff --git a/core/tests/Drupal/KernelTests/Core/Common/DrupalFlushAllCachesTest.php b/core/tests/Drupal/KernelTests/Core/Common/DrupalFlushAllCachesTest.php index b4f8536e560..bacbc6d1d1f 100644 --- a/core/tests/Drupal/KernelTests/Core/Common/DrupalFlushAllCachesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Common/DrupalFlushAllCachesTest.php @@ -28,7 +28,7 @@ class DrupalFlushAllCachesTest extends KernelTestBase { /** * Tests that drupal_flush_all_caches() uses core.extension properly. */ - public function testDrupalFlushAllCachesModuleList() { + public function testDrupalFlushAllCachesModuleList(): void { $this->assertFalse(function_exists('system_test_help')); $core_extension = \Drupal::configFactory()->getEditable('core.extension'); $module = $core_extension->get('module'); diff --git a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php index 36f73adac43..1c76f8c6332 100644 --- a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php @@ -36,7 +36,7 @@ class XssUnitTest extends KernelTestBase { /** * Tests t() functionality. */ - public function testT() { + public function testT(): void { $text = t('Simple text'); $this->assertSame('Simple text', (string) $text, 't leaves simple text alone.'); $text = t('Escaped text: @value', ['@value' => '<script>']); @@ -48,7 +48,7 @@ class XssUnitTest extends KernelTestBase { /** * Checks that harmful protocols are stripped. */ - public function testBadProtocolStripping() { + public function testBadProtocolStripping(): void { // Ensure that check_url() strips out harmful protocols, and encodes for // HTML. // Ensure \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() can diff --git a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php index bb0b194dd7c..6234e106a46 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php @@ -40,7 +40,7 @@ class CacheabilityMetadataConfigOverrideTest extends KernelTestBase { /** * Tests if config overrides correctly set cacheability metadata. */ - public function testConfigOverride() { + public function testConfigOverride(): void { // It's pirate day today! $GLOBALS['it_is_pirate_day'] = TRUE; @@ -60,7 +60,7 @@ class CacheabilityMetadataConfigOverrideTest extends KernelTestBase { /** * Tests if config overrides set cacheability metadata on config entities. */ - public function testConfigEntityOverride() { + public function testConfigEntityOverride(): void { // It's pirate day today! $GLOBALS['it_is_pirate_day'] = TRUE; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php index fec1d336a2e..c337f574d62 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php @@ -38,7 +38,7 @@ class ConfigCRUDTest extends KernelTestBase { /** * Tests CRUD operations. */ - public function testCRUD() { + public function testCRUD(): void { $event_dispatcher = $this->container->get('event_dispatcher'); $typed_config_manager = $this->container->get('config.typed'); @@ -190,7 +190,7 @@ class ConfigCRUDTest extends KernelTestBase { /** * Tests the validation of configuration object names. */ - public function testNameValidation() { + public function testNameValidation(): void { // Verify that an object name without namespace causes an exception. $name = 'no_namespace'; try { @@ -240,7 +240,7 @@ class ConfigCRUDTest extends KernelTestBase { /** * Tests the validation of configuration object values. */ - public function testValueValidation() { + public function testValueValidation(): void { // Verify that setData() will catch dotted keys. try { $this->config('namespace.object')->setData(['key.value' => 12])->save(); @@ -263,7 +263,7 @@ class ConfigCRUDTest extends KernelTestBase { /** * Tests data type handling. */ - public function testDataTypes() { + public function testDataTypes(): void { \Drupal::service('module_installer')->install(['config_test']); $storage = new DatabaseStorage($this->container->get('database'), 'config'); $name = 'config_test.types'; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php index f08353a9516..15dd093d763 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -28,7 +28,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** * Tests that calculating dependencies for system module. */ - public function testNonEntity() { + public function testNonEntity(): void { $this->installConfig(['system']); $config_manager = \Drupal::service('config.manager'); $dependents = $config_manager->findConfigEntityDependencies('module', ['system']); @@ -42,7 +42,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** * Tests creating dependencies on configuration entities. */ - public function testDependencyManagement() { + public function testDependencyManagement(): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); @@ -190,7 +190,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** * Tests ConfigManager::uninstall() and config entity dependency management. */ - public function testConfigEntityUninstall() { + public function testConfigEntityUninstall(): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ @@ -250,7 +250,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { * * @dataProvider providerConfigEntityUninstallComplex */ - public function testConfigEntityUninstallComplex(array $entity_id_suffixes) { + public function testConfigEntityUninstallComplex(array $entity_id_suffixes): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ @@ -375,7 +375,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { * @covers ::uninstall * @covers ::getConfigEntitiesToChangeOnDependencyRemoval */ - public function testConfigEntityUninstallThirdParty() { + public function testConfigEntityUninstallThirdParty(): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ @@ -490,7 +490,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** * Tests deleting a configuration entity and dependency management. */ - public function testConfigEntityDelete() { + public function testConfigEntityDelete(): void { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ @@ -597,7 +597,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { * * @see \Drupal\Core\Config\ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval() */ - public function testContentEntityDelete() { + public function testContentEntityDelete(): void { $this->installEntitySchema('entity_test'); /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index 3e046f4ce8f..486b3b988f9 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -23,7 +23,7 @@ class ConfigDiffTest extends KernelTestBase { /** * Tests calculating the difference between two sets of configuration. */ - public function testDiff() { + public function testDiff(): void { $active = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); $config_name = 'config_test.system'; @@ -110,7 +110,7 @@ class ConfigDiffTest extends KernelTestBase { /** * Tests calculating the difference between two sets of config collections. */ - public function testCollectionDiff() { + public function testCollectionDiff(): void { /** @var \Drupal\Core\Config\StorageInterface $active */ $active = $this->container->get('config.storage'); /** @var \Drupal\Core\Config\StorageInterface $sync */ diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php index 72bfd31c6cc..6b8e09b9384 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php @@ -28,7 +28,7 @@ class ConfigEntityNormalizeTest extends KernelTestBase { $this->installConfig(static::$modules); } - public function testNormalize() { + public function testNormalize(): void { $config_entity = \Drupal::entityTypeManager()->getStorage('config_test')->create(['id' => 'system', 'label' => 'foobar', 'weight' => 1]); $config_entity->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php index c3187283a52..faf68e746d5 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php @@ -54,7 +54,7 @@ class ConfigEntityStaticCacheTest extends KernelTestBase { /** * Tests that the static cache is working. */ - public function testCacheHit() { + public function testCacheHit(): void { $storage = $this->container->get('entity_type.manager') ->getStorage($this->entityTypeId); $entity_1 = $storage->load($this->entityId); @@ -68,7 +68,7 @@ class ConfigEntityStaticCacheTest extends KernelTestBase { /** * Tests that the static cache is reset on entity save and delete. */ - public function testReset() { + public function testReset(): void { $storage = $this->container->get('entity_type.manager') ->getStorage($this->entityTypeId); $entity = $storage->load($this->entityId); @@ -89,7 +89,7 @@ class ConfigEntityStaticCacheTest extends KernelTestBase { /** * Tests that the static cache is sensitive to config overrides. */ - public function testConfigOverride() { + public function testConfigOverride(): void { /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ $storage = \Drupal::entityTypeManager()->getStorage($this->entityTypeId); // Prime the cache prior to adding a config override. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php index b97afec1329..6d0fd3cb5f1 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php @@ -23,7 +23,7 @@ class ConfigEntityStatusTest extends KernelTestBase { /** * Tests the enabling/disabling of entities. */ - public function testCRUD() { + public function testCRUD(): void { $entity = \Drupal::entityTypeManager()->getStorage('config_test')->create([ 'id' => $this->randomMachineName(), ]); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php index aaa68aec21a..981e1b451a4 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php @@ -24,7 +24,7 @@ class ConfigEntityStorageTest extends KernelTestBase { /** * Tests creating configuration entities with changed UUIDs. */ - public function testUUIDConflict() { + public function testUUIDConflict(): void { $entity_type = 'config_test'; $id = 'test_1'; // Load the original configuration entity. @@ -57,7 +57,7 @@ class ConfigEntityStorageTest extends KernelTestBase { * * @covers \Drupal\Core\Config\Entity\ConfigEntityStorage::hasData */ - public function testHasData() { + public function testHasData(): void { $storage = \Drupal::entityTypeManager()->getStorage('config_test'); $this->assertFalse($storage->hasData()); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php index 26c98c8ec42..2195b56e5b8 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php @@ -47,7 +47,7 @@ class ConfigEntityUnitTest extends KernelTestBase { /** * Tests storage methods. */ - public function testStorageMethods() { + public function testStorageMethods(): void { $entity_type = \Drupal::entityTypeManager()->getDefinition('config_test'); // Test the static extractID() method. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php index ce8bbacd0b1..338de54aedb 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php @@ -25,7 +25,7 @@ class ConfigEventsTest extends KernelTestBase { /** * Tests configuration events. */ - public function testConfigEvents() { + public function testConfigEvents(): void { $name = 'config_events_test.test'; $config = new Config($name, \Drupal::service('config.storage'), \Drupal::service('event_dispatcher'), \Drupal::service('config.typed')); @@ -57,7 +57,7 @@ class ConfigEventsTest extends KernelTestBase { /** * Tests configuration rename event that is fired from the ConfigFactory. */ - public function testConfigRenameEvent() { + public function testConfigRenameEvent(): void { $name = 'config_events_test.test'; $new_name = 'config_events_test.test_rename'; $GLOBALS['config'][$name] = ['key' => 'overridden']; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php index da1af33e63e..1c559822b03 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php @@ -31,7 +31,7 @@ class ConfigExportStorageTest extends KernelTestBase { /** * Tests configuration override. */ - public function testExportStorage() { + public function testExportStorage(): void { /** @var \Drupal\Core\Config\StorageInterface $active */ $active = $this->container->get('config.storage'); /** @var \Drupal\Core\Config\StorageInterface $export */ diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php index a68d87435ea..6de861d7945 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php @@ -27,7 +27,7 @@ class ConfigFileContentTest extends KernelTestBase { /** * Tests setting, writing, and reading of a configuration setting. */ - public function testReadWriteConfig() { + public function testReadWriteConfig(): void { $storage = $this->container->get('config.storage'); $name = 'foo.bar'; @@ -190,7 +190,7 @@ class ConfigFileContentTest extends KernelTestBase { /** * Tests serialization of configuration to file. */ - public function testSerialization() { + public function testSerialization(): void { $name = $this->randomMachineName(10) . '.' . $this->randomMachineName(10); $config_data = [ // Indexed arrays; the order of elements is essential. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php index cdb689f013f..48aa85b29a6 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php @@ -61,7 +61,7 @@ class ConfigImportRecreateTest extends KernelTestBase { ); } - public function testRecreateEntity() { + public function testRecreateEntity(): void { $type_name = $this->randomMachineName(16); $content_type = NodeType::create([ 'type' => $type_name, diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php index 7dce04602ea..326e2a823d9 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php @@ -73,7 +73,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { /** * Tests configuration renaming validation. */ - public function testRenameValidation() { + public function testRenameValidation(): void { // Create a test entity. $test_entity_id = $this->randomMachineName(); $test_entity = \Drupal::entityTypeManager()->getStorage('config_test')->create([ @@ -123,7 +123,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { /** * Tests configuration renaming validation for simple configuration. */ - public function testRenameSimpleConfigValidation() { + public function testRenameSimpleConfigValidation(): void { $uuid = new Php(); // Create a simple configuration with a UUID. $config = $this->config('config_test.new'); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php index b76e2e00fce..2ab178cbaf6 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php @@ -105,7 +105,7 @@ class ConfigImporterMissingContentTest extends KernelTestBase implements LoggerI * @see \Drupal\Core\Config\ConfigImporter::processMissingContent() * @see \Drupal\config_import_test\EventSubscriber */ - public function testMissingContent() { + public function testMissingContent(): void { \Drupal::state()->set('config_import_test.config_import_missing_content', TRUE); // Update a configuration entity in the sync directory to have a dependency @@ -143,7 +143,7 @@ class ConfigImporterMissingContentTest extends KernelTestBase implements LoggerI * @see \Drupal\Core\Config\ConfigImporter::processMissingContent() * @see \Drupal\config_import_test\EventSubscriber */ - public function testMissingBlockContent() { + public function testMissingBlockContent(): void { $this->enableModules([ 'block', 'block_content', diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php index 2f588e3fff9..620126e5012 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php @@ -49,7 +49,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests omission of module APIs for bare configuration operations. */ - public function testNoImport() { + public function testNoImport(): void { $dynamic_name = 'config_test.dynamic.dotted.default'; // Verify the default configuration values exist. @@ -63,7 +63,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that trying to import from empty sync configuration directory fails. */ - public function testEmptyImportFails() { + public function testEmptyImportFails(): void { $this->expectException(ConfigImporterException::class); $this->container->get('config.storage.sync')->deleteAll(); $this->configImporter()->import(); @@ -72,7 +72,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests verification of site UUID before importing configuration. */ - public function testSiteUuidValidate() { + public function testSiteUuidValidate(): void { $sync = \Drupal::service('config.storage.sync'); // Create updated configuration object. $config_data = $this->config('system.site')->get(); @@ -102,7 +102,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests deletion of configuration during import. */ - public function testDeleted() { + public function testDeleted(): void { $dynamic_name = 'config_test.dynamic.dotted.default'; $storage = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); @@ -140,7 +140,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests creation of configuration during import. */ - public function testNew() { + public function testNew(): void { $dynamic_name = 'config_test.dynamic.new'; $storage = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); @@ -195,7 +195,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that secondary writes are overwritten. */ - public function testSecondaryWritePrimaryFirst() { + public function testSecondaryWritePrimaryFirst(): void { $name_primary = 'config_test.dynamic.primary'; $name_secondary = 'config_test.dynamic.secondary'; $sync = $this->container->get('config.storage.sync'); @@ -242,7 +242,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that secondary writes are overwritten. */ - public function testSecondaryWriteSecondaryFirst() { + public function testSecondaryWriteSecondaryFirst(): void { $name_primary = 'config_test.dynamic.primary'; $name_secondary = 'config_test.dynamic.secondary'; $sync = $this->container->get('config.storage.sync'); @@ -289,7 +289,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that secondary updates for deleted files work as expected. */ - public function testSecondaryUpdateDeletedParentFirst() { + public function testSecondaryUpdateDeletedParentFirst(): void { $name_dependency = 'config_test.dynamic.dependency'; $name_dependent = 'config_test.dynamic.dependent'; $name_other = 'config_test.dynamic.other'; @@ -376,7 +376,7 @@ class ConfigImporterTest extends KernelTestBase { * configuration tree imports. Therefore, any configuration updates that cause * secondary deletes should be reflected already in the staged configuration. */ - public function testSecondaryUpdateDeletedChildFirst() { + public function testSecondaryUpdateDeletedChildFirst(): void { $name_dependency = 'config_test.dynamic.dependency'; $name_dependent = 'config_test.dynamic.dependent'; $storage = $this->container->get('config.storage'); @@ -423,7 +423,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that secondary deletes for deleted files work as expected. */ - public function testSecondaryDeletedChildSecond() { + public function testSecondaryDeletedChildSecond(): void { $name_dependency = 'config_test.dynamic.dependency'; $name_dependent = 'config_test.dynamic.dependent'; $storage = $this->container->get('config.storage'); @@ -466,7 +466,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests updating of configuration during import. */ - public function testUpdated() { + public function testUpdated(): void { $name = 'config_test.system'; $dynamic_name = 'config_test.dynamic.dotted.default'; $storage = $this->container->get('config.storage'); @@ -524,7 +524,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests the isInstallable method() */ - public function testIsInstallable() { + public function testIsInstallable(): void { $config_name = 'config_test.dynamic.isinstallable'; $this->assertFalse($this->container->get('config.storage')->exists($config_name)); \Drupal::state()->set('config_test.isinstallable', TRUE); @@ -538,7 +538,7 @@ class ConfigImporterTest extends KernelTestBase { * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber * @see \Drupal\Core\Config\ConfigImporter::createExtensionChangelist() */ - public function testUnmetDependency() { + public function testUnmetDependency(): void { $storage = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); @@ -650,7 +650,7 @@ class ConfigImporterTest extends KernelTestBase { * * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber */ - public function testMissingCoreExtension() { + public function testMissingCoreExtension(): void { $sync = $this->container->get('config.storage.sync'); $sync->delete('core.extension'); $config_importer = $this->configImporter(); @@ -671,7 +671,7 @@ class ConfigImporterTest extends KernelTestBase { * * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber */ - public function testRequiredModuleValidation() { + public function testRequiredModuleValidation(): void { $sync = $this->container->get('config.storage.sync'); $extensions = $sync->read('core.extension'); @@ -695,7 +695,7 @@ class ConfigImporterTest extends KernelTestBase { * * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber */ - public function testInstallBaseAndSubThemes() { + public function testInstallBaseAndSubThemes(): void { $sync = $this->container->get('config.storage.sync'); $extensions = $sync->read('core.extension'); $extensions['theme']['test_basetheme'] = 0; @@ -726,7 +726,7 @@ class ConfigImporterTest extends KernelTestBase { * * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber */ - public function testInstallProfile() { + public function testInstallProfile(): void { $sync = $this->container->get('config.storage.sync'); $extensions = $sync->read('core.extension'); @@ -753,7 +753,7 @@ class ConfigImporterTest extends KernelTestBase { * * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber */ - public function testInstallProfileMisMatch() { + public function testInstallProfileMisMatch(): void { // Install profiles can not be changed. They can only be uninstalled. We // need to set an install profile prior to testing because KernelTestBase // tests do not use one. @@ -781,7 +781,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests the isSyncing flags. */ - public function testIsSyncingInHooks() { + public function testIsSyncingInHooks(): void { $dynamic_name = 'config_test.dynamic.dotted.default'; $storage = $this->container->get('config.storage'); @@ -880,7 +880,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that the isConfigSyncing flag is cleanup after an invalid step. */ - public function testInvalidStep() { + public function testInvalidStep(): void { $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE'); $context = []; $config_importer = $this->configImporter(); @@ -897,7 +897,7 @@ class ConfigImporterTest extends KernelTestBase { /** * Tests that the isConfigSyncing flag is set correctly during a custom step. */ - public function testCustomStep() { + public function testCustomStep(): void { $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \Drupal::isConfigSyncing() returns FALSE'); $context = []; $this->configImporter()->doSyncStep(self::customStep(...), $context); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php index 5587ff1daca..66c977c4414 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php @@ -37,7 +37,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests module installation. */ - public function testModuleInstallation() { + public function testModuleInstallation(): void { $default_config = 'config_test.system'; $default_configuration_entity = 'config_test.dynamic.dotted.default'; @@ -87,7 +87,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests that collections are ignored if the event does not return anything. */ - public function testCollectionInstallationNoCollections() { + public function testCollectionInstallationNoCollections(): void { // Install the test module. $this->enableModules(['config_collection_install_test']); $this->installConfig(['config_collection_install_test']); @@ -99,7 +99,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests config objects in collections are installed as expected. */ - public function testCollectionInstallationCollections() { + public function testCollectionInstallationCollections(): void { $collections = [ 'another_collection', 'collection.test1', @@ -178,7 +178,7 @@ class ConfigInstallTest extends KernelTestBase { * matching name but does not support config entities it should be created * using simple configuration. */ - public function testCollectionInstallationCollectionConfigEntity() { + public function testCollectionInstallationCollectionConfigEntity(): void { $collections = [ 'entity', ]; @@ -205,7 +205,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests the configuration with unmet dependencies is not installed. */ - public function testDependencyChecking() { + public function testDependencyChecking(): void { $this->installModules(['config_test']); try { $this->installModules(['config_install_dependency_test']); @@ -247,7 +247,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests imported configuration entities with/without language information. */ - public function testLanguage() { + public function testLanguage(): void { $this->installModules(['config_test_language']); // Test imported configuration with implicit language code. $storage = new InstallStorage(); @@ -264,7 +264,7 @@ class ConfigInstallTest extends KernelTestBase { /** * Tests installing configuration where the filename and ID do not match. */ - public function testIdMisMatch() { + public function testIdMisMatch(): void { $this->expectException(\LogicException::class); $this->expectExceptionMessage('The configuration name "config_test.dynamic.no_id_match" does not match the ID "does_not_match"'); $this->installModules(['config_test_id_mismatch']); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php index 3b49870ef1b..fc72ccf4258 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php @@ -38,7 +38,7 @@ class ConfigLanguageOverrideTest extends KernelTestBase { /** * Tests locale override based on language. */ - public function testConfigLanguageOverride() { + public function testConfigLanguageOverride(): void { // The language module implements a config factory override object that // overrides configuration when the Language module is enabled. This test ensures that // English overrides work. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php index 12cb8e35a9e..a1dbb2ca6c2 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php @@ -20,7 +20,7 @@ class ConfigModuleOverridesTest extends KernelTestBase { */ protected static $modules = ['system', 'config', 'config_override_test']; - public function testSimpleModuleOverrides() { + public function testSimpleModuleOverrides(): void { $GLOBALS['config_test_run_module_overrides'] = TRUE; $name = 'system.site'; $overridden_name = 'Wow overridden site name'; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php index ea595dc3360..85117c48843 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php @@ -32,7 +32,7 @@ class ConfigOverrideTest extends KernelTestBase { /** * Tests configuration override. */ - public function testConfOverride() { + public function testConfOverride(): void { $expected_original_data = [ 'foo' => 'bar', 'baz' => NULL, diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php index 3e4e5bc0af5..67fcaacd2b4 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverridesPriorityTest.php @@ -32,7 +32,7 @@ class ConfigOverridesPriorityTest extends KernelTestBase { 'language', ]; - public function testOverridePriorities() { + public function testOverridePriorities(): void { $GLOBALS['config_test_run_module_overrides'] = FALSE; $non_overridden_mail = 'site@example.com'; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaDeprecationTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaDeprecationTest.php index d2068e1696c..d09ee7846ec 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaDeprecationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaDeprecationTest.php @@ -24,7 +24,7 @@ class ConfigSchemaDeprecationTest extends KernelTestBase { /** * Tests config schema deprecation. */ - public function testConfigSchemaDeprecation() { + public function testConfigSchemaDeprecation(): void { $this->expectDeprecation('The \'complex_structure_deprecated\' config schema is deprecated in drupal:9.1.0 and is removed from drupal 10.0.0. Use the \'complex_structure\' config schema instead. See http://drupal.org/node/the-change-notice-nid.'); $config = $this->config('config_schema_deprecated_test.settings'); $config diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 90763605718..5de26c1c230 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -48,7 +48,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests the basic metadata retrieval layer. */ - public function testSchemaMapping() { + public function testSchemaMapping(): void { // Nonexistent configuration key will have Undefined as metadata. $this->assertFalse(\Drupal::service('config.typed')->hasConfigSchema('config_schema_test.no_such_key')); $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.no_such_key'); @@ -320,7 +320,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests metadata retrieval with several levels of %parent indirection. */ - public function testSchemaMappingWithParents() { + public function testSchemaMappingWithParents(): void { $config_data = \Drupal::service('config.typed')->get('config_schema_test.some_schema.with_parents'); // Test fetching parent one level up. @@ -366,7 +366,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests metadata applied to configuration objects. */ - public function testSchemaData() { + public function testSchemaData(): void { // Try a simple property. $meta = \Drupal::service('config.typed')->get('system.site'); $property = $meta->get('page')->get('front'); @@ -414,7 +414,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests configuration value data type enforcement using schemas. */ - public function testConfigSaveWithSchema() { + public function testConfigSaveWithSchema(): void { $untyped_values = [ // Test a custom type. 'config_schema_test_integer' => '1', @@ -484,7 +484,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Test configuration value data type enforcement using schemas. */ - public function testConfigSaveMappingSort() { + public function testConfigSaveMappingSort(): void { // Top level map sorting. $data = [ 'foo' => '1', @@ -502,7 +502,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests configuration sequence sorting using schemas. */ - public function testConfigSaveWithSequenceSorting() { + public function testConfigSaveWithSequenceSorting(): void { $data = [ 'keyed_sort' => [ 'b' => '1', @@ -572,7 +572,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests fallback to a greedy wildcard. */ - public function testSchemaFallback() { + public function testSchemaFallback(): void { $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.wildcard_fallback.something'); // This should be the schema of config_schema_test.wildcard_fallback.*. $expected = []; @@ -607,7 +607,7 @@ class ConfigSchemaTest extends KernelTestBase { * * @see \Drupal\Core\Config\TypedConfigManager::getFallbackName() */ - public function testColonsInSchemaTypeDetermination() { + public function testColonsInSchemaTypeDetermination(): void { $tests = \Drupal::service('config.typed')->get('config_schema_test.plugin_types')->get('tests')->getElements(); $definition = $tests[0]->getDataDefinition()->toArray(); $this->assertEquals('test.plugin_types.boolean', $definition['type']); @@ -638,7 +638,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests hook_config_schema_info_alter(). */ - public function testConfigSchemaInfoAlter() { + public function testConfigSchemaInfoAlter(): void { /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */ $typed_config = \Drupal::service('config.typed'); $typed_config->clearCachedDefinitions(); @@ -682,7 +682,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests saving config when the type is wrapped by a dynamic type. */ - public function testConfigSaveWithWrappingSchema() { + public function testConfigSaveWithWrappingSchema(): void { $untyped_values = [ 'tests' => [ [ @@ -713,7 +713,7 @@ class ConfigSchemaTest extends KernelTestBase { /** * Tests dynamic config schema type with multiple sub-key references. */ - public function testConfigSaveWithWrappingSchemaDoubleBrackets() { + public function testConfigSaveWithWrappingSchemaDoubleBrackets(): void { $untyped_values = [ 'tests' => [ [ diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php index d28e8a342cc..12f87482d90 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php @@ -36,7 +36,7 @@ class ConfigSnapshotTest extends KernelTestBase { /** * Tests config snapshot creation and updating. */ - public function testSnapshot() { + public function testSnapshot(): void { $active = $this->container->get('config.storage'); $sync = $this->container->get('config.storage.sync'); $snapshot = $this->container->get('config.storage.snapshot'); diff --git a/core/tests/Drupal/KernelTests/Core/Config/Entity/ConfigEntityUpdaterTest.php b/core/tests/Drupal/KernelTests/Core/Config/Entity/ConfigEntityUpdaterTest.php index 4ba44d26d07..142c1b97586 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Entity/ConfigEntityUpdaterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Entity/ConfigEntityUpdaterTest.php @@ -26,7 +26,7 @@ class ConfigEntityUpdaterTest extends KernelTestBase { /** * @covers ::update */ - public function testUpdate() { + public function testUpdate(): void { // Create some entities to update. $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); for ($i = 0; $i < 15; $i++) { @@ -79,7 +79,7 @@ class ConfigEntityUpdaterTest extends KernelTestBase { /** * @covers ::update */ - public function testUpdateDefaultCallback() { + public function testUpdateDefaultCallback(): void { // Create some entities to update. $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); for ($i = 0; $i < 15; $i++) { @@ -119,7 +119,7 @@ class ConfigEntityUpdaterTest extends KernelTestBase { /** * @covers ::update */ - public function testUpdateException() { + public function testUpdateException(): void { $this->enableModules(['entity_test']); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The provided entity type ID \'entity_test_mul_changed\' is not a configuration entity type'); @@ -131,7 +131,7 @@ class ConfigEntityUpdaterTest extends KernelTestBase { /** * @covers ::update */ - public function testUpdateOncePerUpdateException() { + public function testUpdateOncePerUpdateException(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Updating multiple entity types in the same update function is not supported'); $updater = $this->container->get('class_resolver')->getInstanceFromDefinition(ConfigEntityUpdater::class); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ExcludedModulesEventSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/Config/ExcludedModulesEventSubscriberTest.php index ed778a83a57..469c6e76478 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ExcludedModulesEventSubscriberTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ExcludedModulesEventSubscriberTest.php @@ -34,7 +34,7 @@ class ExcludedModulesEventSubscriberTest extends KernelTestBase { /** * Tests excluding modules from the config export. */ - public function testExcludedModules() { + public function testExcludedModules(): void { // Assert that config_test is in the active config. $active = $this->container->get('config.storage'); $this->assertNotEmpty($active->listAll('config_test.')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php b/core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php index b71c69d82bd..2a2c549bf89 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php @@ -37,7 +37,7 @@ class ExportStorageManagerTest extends KernelTestBase { /** * Tests getting the export storage. */ - public function testGetStorage() { + public function testGetStorage(): void { // Get the raw system.site config and set it in the sync storage. $rawConfig = $this->config('system.site')->getRawData(); $this->container->get('config.storage.sync')->write('system.site', $rawConfig); @@ -81,7 +81,7 @@ class ExportStorageManagerTest extends KernelTestBase { /** * Tests the export storage when it is locked. */ - public function testGetStorageLock() { + public function testGetStorageLock(): void { $lock = $this->createMock('Drupal\Core\Lock\LockBackendInterface'); $lock->expects($this->exactly(2)) ->method('acquire') diff --git a/core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php b/core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php index 3fa20b39f81..306ebe7359c 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/FileStorageFactoryTest.php @@ -19,7 +19,7 @@ class FileStorageFactoryTest extends KernelTestBase { /** * @covers ::getSync */ - public function testGetSync() { + public function testGetSync(): void { // Write some random data to the sync storage. $name = $this->randomMachineName(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php b/core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php index f88cd03242c..af87421ca55 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php @@ -39,7 +39,7 @@ class ImportStorageTransformerTest extends KernelTestBase { /** * Tests the import transformation. */ - public function testTransform() { + public function testTransform(): void { // Get the raw system.site config and set it in the sync storage. $rawConfig = $this->config('system.site')->getRawData(); @@ -67,7 +67,7 @@ class ImportStorageTransformerTest extends KernelTestBase { /** * Tests that the import transformer throws an exception. */ - public function testTransformLocked() { + public function testTransformLocked(): void { // Mock the request lock not being available. $lock = $this->createMock('Drupal\Core\Lock\LockBackendInterface'); $lock->expects($this->exactly(2)) @@ -94,7 +94,7 @@ class ImportStorageTransformerTest extends KernelTestBase { /** * Tests the import transformer during a running config import. */ - public function testTransformWhileImporting() { + public function testTransformWhileImporting(): void { // Set up the database table with the current active config. // This simulates the config importer having its transformation done. $storage = $this->container->get('config.import_transformer')->transform($this->container->get('config.storage')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php b/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php index e4e551f72d3..5fa03772474 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php @@ -44,7 +44,7 @@ class SchemaCheckTraitTest extends KernelTestBase { * * @dataProvider providerCheckConfigSchema */ - public function testCheckConfigSchema(string $type_to_validate_against, bool $validate_constraints, array|bool $nulled_expectations, array|bool $no_data_expectations, array $expectations) { + public function testCheckConfigSchema(string $type_to_validate_against, bool $validate_constraints, array|bool $nulled_expectations, array|bool $no_data_expectations, array $expectations): void { // Test a non existing schema. $ret = $this->checkConfigSchema($this->typedConfig, 'config_schema_test.no_schema', $this->config('config_schema_test.no_schema')->get()); $this->assertFalse($ret); diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php index b78fcb1a556..f3a06135d9d 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php @@ -44,7 +44,7 @@ class CachedStorageTest extends ConfigStorageTestBase { /** * {@inheritdoc} */ - public function testInvalidStorage() { + public function testInvalidStorage(): void { $this->markTestSkipped('No-op as this test does not make sense'); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php index 0879e06ffc5..6b8c3105172 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php @@ -35,7 +35,7 @@ abstract class ConfigStorageTestBase extends KernelTestBase { * * @todo Coverage: Trigger PDOExceptions / Database exceptions. */ - public function testCRUD() { + public function testCRUD(): void { $name = 'config_test.storage'; // Checking whether a non-existing name exists returns FALSE. @@ -122,7 +122,7 @@ abstract class ConfigStorageTestBase extends KernelTestBase { /** * Tests an invalid storage. */ - public function testInvalidStorage() { + public function testInvalidStorage(): void { $name = 'config_test.storage'; // Write something to the valid storage to prove that the storages do not @@ -164,7 +164,7 @@ abstract class ConfigStorageTestBase extends KernelTestBase { /** * Tests storage writing and reading data preserving data type. */ - public function testDataTypes() { + public function testDataTypes(): void { $name = 'config_test.types'; $data = [ 'array' => [], @@ -188,7 +188,7 @@ abstract class ConfigStorageTestBase extends KernelTestBase { /** * Tests that the storage supports collections. */ - public function testCollection() { + public function testCollection(): void { $name = 'config_test.storage'; $data = ['foo' => 'bar']; $result = $this->storage->write($name, $data); diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php index 813b49a97fd..e8c1f674950 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php @@ -45,7 +45,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { /** * Tests that operations throw exceptions if the query fails. */ - public function testExceptionIsThrownIfQueryFails() { + public function testExceptionIsThrownIfQueryFails(): void { $connection = Database::getConnection(); if ($connection->databaseType() === 'sqlite') { // See: https://www.drupal.org/project/drupal/issues/3349286 diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php index 6438cf00df9..8d63645761e 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php @@ -58,7 +58,7 @@ class FileStorageTest extends ConfigStorageTestBase { /** * Tests the FileStorage::listAll method with a relative and absolute path. */ - public function testListAll() { + public function testListAll(): void { $expected_files = [ 'core.extension', 'system.performance', @@ -77,7 +77,7 @@ class FileStorageTest extends ConfigStorageTestBase { /** * Tests UnsupportedDataTypeConfigException. */ - public function testUnsupportedDataTypeConfigException() { + public function testUnsupportedDataTypeConfigException(): void { $name = 'core.extension'; $path = $this->storage->getFilePath($name); $this->expectException(UnsupportedDataTypeConfigException::class); diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php index 4999fedd548..094f08b8454 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php @@ -63,7 +63,7 @@ class ManagedStorageTest extends ConfigStorageTestBase implements StorageManager /** * {@inheritdoc} */ - public function testInvalidStorage() { + public function testInvalidStorage(): void { $this->markTestSkipped('ManagedStorage cannot be invalid.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/MemoryStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/MemoryStorageTest.php index 8ed48541225..3848b8eacc7 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/MemoryStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/MemoryStorageTest.php @@ -52,7 +52,7 @@ class MemoryStorageTest extends ConfigStorageTestBase { /** * {@inheritdoc} */ - public function testInvalidStorage() { + public function testInvalidStorage(): void { $this->markTestSkipped('MemoryStorage cannot be invalid.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php index 15c287e45b3..0688e3e3df7 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php @@ -53,7 +53,7 @@ class StorageReplaceDataWrapperTest extends ConfigStorageTestBase { /** * {@inheritdoc} */ - public function testInvalidStorage() { + public function testInvalidStorage(): void { $this->markTestSkipped('No-op as this test does not make sense'); } @@ -65,7 +65,7 @@ class StorageReplaceDataWrapperTest extends ConfigStorageTestBase { * * @dataProvider providerCollections */ - public function testCreateCollection($collection) { + public function testCreateCollection($collection): void { $initial_collection_name = $this->storage->getCollectionName(); // Create new storage with given collection and check it is set correctly. diff --git a/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php b/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php index d463740e17c..499b6efd87c 100644 --- a/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php @@ -27,7 +27,7 @@ class ControllerBaseTest extends KernelTestBase { /** * @covers ::create */ - public function testCreate() { + public function testCreate(): void { /** @var \Drupal\system_test\Controller\SystemTestController $controller */ $controller = $this->container->get('class_resolver')->getInstanceFromDefinition(SystemTestController::class); @@ -48,7 +48,7 @@ class ControllerBaseTest extends KernelTestBase { /** * @covers ::create */ - public function testCreateException() { + public function testCreateException(): void { $this->expectException(AutowiringFailedException::class); $this->expectExceptionMessage('Cannot autowire service "Drupal\Core\Lock\LockBackendInterface": argument "$lock" of method "Drupal\system_test\Controller\BrokenSystemTestController::_construct()", you should configure its value explicitly.'); $this->container->get('class_resolver')->getInstanceFromDefinition(BrokenSystemTestController::class); diff --git a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php index 0c69abec2a4..d091a5bac80 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php @@ -15,7 +15,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can do basic alters. */ - public function testSimpleAlter() { + public function testSimpleAlter(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -29,7 +29,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can alter the joins on a query. */ - public function testAlterWithJoin() { + public function testAlterWithJoin(): void { $query = $this->connection->select('test_task'); $tid_field = $query->addField('test_task', 'tid'); $task_field = $query->addField('test_task', 'task'); @@ -53,7 +53,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can alter a query's conditionals. */ - public function testAlterChangeConditional() { + public function testAlterChangeConditional(): void { $query = $this->connection->select('test_task'); $tid_field = $query->addField('test_task', 'tid'); $pid_field = $query->addField('test_task', 'pid'); @@ -78,7 +78,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can alter the fields of a query. */ - public function testAlterChangeFields() { + public function testAlterChangeFields(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); @@ -93,7 +93,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can alter expressions in the query. */ - public function testAlterExpression() { + public function testAlterExpression(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_field = $query->addExpression("[age]*2", 'double_age'); @@ -113,7 +113,7 @@ class AlterTest extends DatabaseTestBase { * * This also tests hook_query_TAG_alter(). */ - public function testAlterRemoveRange() { + public function testAlterRemoveRange(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -128,7 +128,7 @@ class AlterTest extends DatabaseTestBase { /** * Tests that we can do basic alters on subqueries. */ - public function testSimpleAlterSubquery() { + public function testSimpleAlterSubquery(): void { // Create a sub-query with an alter tag. $subquery = $this->connection->select('test', 'p'); $subquery->addField('p', 'name'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php index 1e7abebfe50..079009dc7a5 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php @@ -18,7 +18,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests string concatenation. */ - public function testConcatLiterals() { + public function testConcatLiterals(): void { $result = $this->connection->query('SELECT CONCAT(:a1, CONCAT(:a2, CONCAT(:a3, CONCAT(:a4, :a5))))', [ ':a1' => 'This', ':a2' => ' ', @@ -37,7 +37,7 @@ class BasicSyntaxTest extends DatabaseTestBase { * since its type 'varchar_ascii' may lead to using field-level collations not * compatible with the other fields. */ - public function testConcatFields() { + public function testConcatFields(): void { $result = $this->connection->query( 'SELECT CONCAT(:a1, CONCAT([job], CONCAT(:a2, CONCAT([age], :a3)))) FROM {test} WHERE [age] = :age', [ ':a1' => 'The age of ', @@ -52,7 +52,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests string concatenation with separator. */ - public function testConcatWsLiterals() { + public function testConcatWsLiterals(): void { $result = $this->connection->query("SELECT CONCAT_WS(', ', :a1, NULL, :a2, :a3, :a4)", [ ':a1' => 'Hello', ':a2' => NULL, @@ -65,7 +65,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests string concatenation with separator, with field values. */ - public function testConcatWsFields() { + public function testConcatWsFields(): void { $result = $this->connection->query("SELECT CONCAT_WS('-', :a1, [name], :a2, [age]) FROM {test} WHERE [age] = :age", [ ':a1' => 'name', ':a2' => 'age', @@ -77,7 +77,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests escaping of LIKE wildcards. */ - public function testLikeEscape() { + public function testLikeEscape(): void { $this->connection->insert('test') ->fields([ 'name' => 'Ring_', @@ -103,7 +103,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests a LIKE query containing a backslash. */ - public function testLikeBackslash() { + public function testLikeBackslash(): void { $this->connection->insert('test') ->fields(['name']) ->values([ @@ -134,7 +134,7 @@ class BasicSyntaxTest extends DatabaseTestBase { /** * Tests \Drupal\Core\Database\Connection::getFullQualifiedTableName(). */ - public function testGetFullQualifiedTableName() { + public function testGetFullQualifiedTableName(): void { $database = \Drupal::database(); $num_matches = $database->select($database->getFullQualifiedTableName('test'), 't') ->countQuery() diff --git a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php index c837534147a..cd20af22f0f 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php @@ -14,7 +14,7 @@ class CaseSensitivityTest extends DatabaseTestBase { /** * Tests BINARY collation in MySQL. */ - public function testCaseSensitiveInsert() { + public function testCaseSensitiveInsert(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->connection->insert('test') diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php index 86f4701b57c..ef8ce03f1c1 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php @@ -17,7 +17,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests that connections return appropriate connection objects. */ - public function testConnectionRouting() { + public function testConnectionRouting(): void { // Clone the primary credentials to a replica connection. // Note this will result in two independent connection objects that happen // to point to the same place. @@ -51,7 +51,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests that connections return appropriate connection objects. */ - public function testConnectionRoutingOverride() { + public function testConnectionRoutingOverride(): void { // Clone the primary credentials to a replica connection. // Note this will result in two independent connection objects that happen // to point to the same place. @@ -69,7 +69,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests the closing of a database connection. */ - public function testConnectionClosing() { + public function testConnectionClosing(): void { // Open the default target so we have an object to compare. $db1 = Database::getConnection('default', 'default'); @@ -84,7 +84,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests the connection options of the active database. */ - public function testConnectionOptions() { + public function testConnectionOptions(): void { $connection_info = Database::getConnectionInfo('default'); // Be sure we're connected to the default database. @@ -119,7 +119,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests per-table prefix connection option. */ - public function testPerTablePrefixOption() { + public function testPerTablePrefixOption(): void { $connection_info = Database::getConnectionInfo('default'); $new_connection_info = $connection_info['default']; $new_connection_info['prefix'] = [ @@ -134,7 +134,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests the prefix connection option in array form. */ - public function testPrefixArrayOption() { + public function testPrefixArrayOption(): void { $connection_info = Database::getConnectionInfo('default'); $new_connection_info = $connection_info['default']; $new_connection_info['prefix'] = [ @@ -148,7 +148,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Ensure that you cannot execute multiple statements in a query. */ - public function testMultipleStatementsQuery() { + public function testMultipleStatementsQuery(): void { $this->expectException(\InvalidArgumentException::class); Database::getConnection('default', 'default')->query('SELECT * FROM {test}; SELECT * FROM {test_people}'); } @@ -156,7 +156,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Ensure that you cannot prepare multiple statements. */ - public function testMultipleStatements() { + public function testMultipleStatements(): void { $this->expectException(\InvalidArgumentException::class); Database::getConnection('default', 'default')->prepareStatement('SELECT * FROM {test}; SELECT * FROM {test_people}', []); } @@ -164,7 +164,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests that the method ::condition() returns a Condition object. */ - public function testCondition() { + public function testCondition(): void { $connection = Database::getConnection('default', 'default'); $namespace = (new \ReflectionObject($connection))->getNamespaceName() . "\\Condition"; if (!class_exists($namespace)) { @@ -177,7 +177,7 @@ class ConnectionTest extends DatabaseTestBase { /** * Tests that the method ::hasJson() returns TRUE. */ - public function testHasJson() { + public function testHasJson(): void { $this->assertTrue($this->connection->hasJson()); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php b/core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php index 746bf12e8f6..41234f3ef4b 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php @@ -18,7 +18,7 @@ class DatabaseExceptionWrapperTest extends KernelTestBase { /** * Tests the expected database exception thrown for inexistent tables. */ - public function testQueryThrowsDatabaseExceptionWrapperException() { + public function testQueryThrowsDatabaseExceptionWrapperException(): void { $this->expectException(DatabaseExceptionWrapper::class); Database::getConnection()->query('SELECT * FROM {does_not_exist}'); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php index cfe18af5a43..4a40641a92b 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php @@ -24,7 +24,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that we can use a subselect in a delete successfully. */ - public function testSubselectDelete() { + public function testSubselectDelete(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_task}')->fetchField(); $pid_to_delete = $this->connection->query("SELECT * FROM {test_task} WHERE [task] = 'sleep' ORDER BY [tid]")->fetchField(); @@ -45,7 +45,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that we can delete a single record successfully. */ - public function testSimpleDelete() { + public function testSimpleDelete(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_deleted = $this->connection->delete('test') @@ -60,7 +60,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that we can truncate a whole table successfully. */ - public function testTruncate() { + public function testTruncate(): void { $num_records_before = $this->connection->query("SELECT COUNT(*) FROM {test}")->fetchField(); $this->assertNotEmpty($num_records_before); @@ -73,7 +73,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that we can truncate a whole table while in transaction. */ - public function testTruncateInTransaction() { + public function testTruncateInTransaction(): void { $num_records_before = $this->connection->select('test')->countQuery()->execute()->fetchField(); $this->assertGreaterThan(0, $num_records_before, 'The table is not empty.'); @@ -107,7 +107,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that transaction rollback voids a truncate operation. */ - public function testTruncateTransactionRollback() { + public function testTruncateTransactionRollback(): void { $num_records_before = $this->connection->select('test')->countQuery()->execute()->fetchField(); $this->assertGreaterThan(0, $num_records_before, 'The table is not empty.'); @@ -141,7 +141,7 @@ class DeleteTruncateTest extends DatabaseTestBase { /** * Confirms that we can delete a single special column name record successfully. */ - public function testSpecialColumnDelete() { + public function testSpecialColumnDelete(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {select}')->fetchField(); $num_deleted = $this->connection->delete('select') diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php index 87cabe89026..f2c94ef04e2 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php @@ -178,7 +178,7 @@ abstract class DriverSpecificConnectionUnitTestBase extends DriverSpecificKernel /** * Tests pdo options override. */ - public function testConnectionOpen() { + public function testConnectionOpen(): void { $reflection = new \ReflectionObject($this->connection); $connection_property = $reflection->getProperty('connection'); $error_mode = $connection_property->getValue($this->connection) diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php index aa58043022c..7723d872cc1 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php @@ -19,7 +19,7 @@ abstract class DriverSpecificSyntaxTestBase extends DriverSpecificDatabaseTestBa * * @see \Drupal\Core\Database\Connection::prepareQuery() */ - public function testAllowSquareBrackets() { + public function testAllowSquareBrackets(): void { $this->connection->insert('test') ->fields(['name']) ->values([ diff --git a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php index dd2b382e6a3..dcea763eccb 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php @@ -20,7 +20,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch a record properly in default object mode. */ - public function testQueryFetchDefault() { + public function testQueryFetchDefault(): void { $records = []; $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25]); $this->assertInstanceOf(StatementInterface::class, $result); @@ -36,7 +36,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch a record to an object explicitly. */ - public function testQueryFetchObject() { + public function testQueryFetchObject(): void { $records = []; $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25], ['fetch' => \PDO::FETCH_OBJ]); foreach ($result as $record) { @@ -51,7 +51,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch a record to an associative array explicitly. */ - public function testQueryFetchArray() { + public function testQueryFetchArray(): void { $records = []; $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25], ['fetch' => \PDO::FETCH_ASSOC]); foreach ($result as $record) { @@ -69,7 +69,7 @@ class FetchTest extends DatabaseTestBase { * * @see \Drupal\system\Tests\Database\FakeRecord */ - public function testQueryFetchClass() { + public function testQueryFetchClass(): void { $records = []; $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25], ['fetch' => FakeRecord::class]); foreach ($result as $record) { @@ -87,7 +87,7 @@ class FetchTest extends DatabaseTestBase { * @see \Drupal\Tests\system\Functional\Database\FakeRecord * @see \Drupal\Core\Database\StatementPrefetch::fetchObject */ - public function testQueryFetchObjectClass() { + public function testQueryFetchObjectClass(): void { $records = 0; $query = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25]); while ($result = $query->fetchObject(FakeRecord::class, [1])) { @@ -120,7 +120,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch a record into an indexed array explicitly. */ - public function testQueryFetchNum() { + public function testQueryFetchNum(): void { $records = []; $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => 25], ['fetch' => \PDO::FETCH_NUM]); foreach ($result as $record) { @@ -136,7 +136,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch all records into an array explicitly. */ - public function testQueryFetchAllColumn() { + public function testQueryFetchAllColumn(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->orderBy('name'); @@ -149,7 +149,7 @@ class FetchTest extends DatabaseTestBase { /** * Confirms that we can fetch an entire column of a result set at once. */ - public function testQueryFetchCol() { + public function testQueryFetchCol(): void { $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] > :age', [':age' => 25]); $column = $result->fetchCol(); $this->assertCount(3, $column, 'fetchCol() returns the right number of records.'); @@ -233,7 +233,7 @@ class FetchTest extends DatabaseTestBase { /** * Tests that rowCount() throws exception on SELECT query. */ - public function testRowCount() { + public function testRowCount(): void { $result = $this->connection->query('SELECT [name] FROM {test}'); try { $result->rowCount(); diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php index b5aeb6af144..2aa2ff497af 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php @@ -18,7 +18,7 @@ class InsertDefaultsTest extends DatabaseTestBase { * * @see \database_test_schema() */ - public function testDefaultInsert() { + public function testDefaultInsert(): void { $query = $this->connection->insert('test')->useDefaults(['job']); $id = $query->execute(); $job = $this->connection->query('SELECT [job] FROM {test} WHERE [id] = :id', [':id' => $id])->fetchField(); @@ -28,7 +28,7 @@ class InsertDefaultsTest extends DatabaseTestBase { /** * Tests that no action will be preformed if no fields are specified. */ - public function testDefaultEmptyInsert() { + public function testDefaultEmptyInsert(): void { $num_records_before = (int) $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); try { @@ -49,7 +49,7 @@ class InsertDefaultsTest extends DatabaseTestBase { * * @see \database_test_schema() */ - public function testDefaultInsertWithFields() { + public function testDefaultInsertWithFields(): void { $query = $this->connection->insert('test') ->fields(['name' => 'Bob']) ->useDefaults(['job']); diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php index 9c417a1b6ca..2859a303878 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php @@ -14,7 +14,7 @@ class InsertLobTest extends DatabaseTestBase { /** * Tests that we can insert a single blob field successfully. */ - public function testInsertOneBlob() { + public function testInsertOneBlob(): void { $data = "This is\000a test."; $this->assertSame(15, strlen($data), 'Test data contains a NULL.'); $id = $this->connection->insert('test_one_blob') @@ -27,7 +27,7 @@ class InsertLobTest extends DatabaseTestBase { /** * Tests that we can insert a null into blob field. */ - public function testInsertNullBlob() { + public function testInsertNullBlob(): void { $id = $this->connection->insert('test_one_blob') ->fields(['blob1' => NULL]) ->execute(); @@ -38,7 +38,7 @@ class InsertLobTest extends DatabaseTestBase { /** * Tests that we can insert multiple blob fields in the same query. */ - public function testInsertMultipleBlob() { + public function testInsertMultipleBlob(): void { $id = $this->connection->insert('test_two_blobs') ->fields([ 'blob1' => 'This is', diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php index 41b384e3f49..2a0f685d2ac 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php @@ -16,7 +16,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests very basic insert functionality. */ - public function testSimpleInsert() { + public function testSimpleInsert(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $query = $this->connection->insert('test'); @@ -38,7 +38,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that we can insert multiple records in one query object. */ - public function testMultiInsert() { + public function testMultiInsert(): void { $num_records_before = (int) $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $query = $this->connection->insert('test'); @@ -77,7 +77,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that an insert object can be reused with new data after it executes. */ - public function testRepeatedInsert() { + public function testRepeatedInsert(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $query = $this->connection->insert('test'); @@ -120,7 +120,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that we can specify fields without values and specify values later. */ - public function testInsertFieldOnlyDefinition() { + public function testInsertFieldOnlyDefinition(): void { // This is useful for importers, when we want to create a query and define // its fields once, then loop over a multi-insert execution. $this->connection->insert('test') @@ -140,7 +140,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that inserts return the proper auto-increment ID. */ - public function testInsertLastInsertID() { + public function testInsertLastInsertID(): void { $id = $this->connection->insert('test') ->fields([ 'name' => 'Larry', @@ -154,7 +154,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that the INSERT INTO ... SELECT (fields) ... syntax works. */ - public function testInsertSelectFields() { + public function testInsertSelectFields(): void { $query = $this->connection->select('test_people', 'tp'); // The query builder will always append expressions after fields. // Add the expression first to test that the insert fields are correctly @@ -180,7 +180,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that the INSERT INTO ... SELECT * ... syntax works. */ - public function testInsertSelectAll() { + public function testInsertSelectAll(): void { $query = $this->connection->select('test_people', 'tp') ->fields('tp') ->condition('tp.name', 'Meredith'); @@ -201,7 +201,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests that we can INSERT INTO a special named column. */ - public function testSpecialColumnInsert() { + public function testSpecialColumnInsert(): void { $this->connection->insert('select') ->fields([ 'id' => 2, @@ -215,7 +215,7 @@ class InsertTest extends DatabaseTestBase { /** * Tests insertion integrity violation with no default value for a column. */ - public function testInsertIntegrityViolation() { + public function testInsertIntegrityViolation(): void { // Remove the default from the 'age' column, so that inserting a record // without its value specified will lead to integrity failure. $this->connection->schema()->changeField('test', 'age', 'age', [ diff --git a/core/tests/Drupal/KernelTests/Core/Database/InvalidDataTest.php b/core/tests/Drupal/KernelTests/Core/Database/InvalidDataTest.php index 7a6bd9c987a..85c50dd2e4a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InvalidDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InvalidDataTest.php @@ -16,7 +16,7 @@ class InvalidDataTest extends DatabaseTestBase { /** * Tests aborting of traditional SQL database systems with invalid data. */ - public function testInsertDuplicateData() { + public function testInsertDuplicateData(): void { // Try to insert multiple records where at least one has bad data. $this->expectException(IntegrityConstraintViolationException::class); try { @@ -55,7 +55,7 @@ class InvalidDataTest extends DatabaseTestBase { /** * Tests inserting with invalid data from a select query. */ - public function testInsertDuplicateDataFromSelect() { + public function testInsertDuplicateDataFromSelect(): void { // Insert multiple records in 'test_people' where one has bad data // (duplicate key). A 'Meredith' record has already been inserted // in ::setUp. diff --git a/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php b/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php index b27fef00955..87abede275a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php @@ -18,7 +18,7 @@ class LoggingTest extends DatabaseTestBase { /** * Tests that we can log the existence of a query. */ - public function testEnableLogging() { + public function testEnableLogging(): void { Database::startLog('testing'); $start = microtime(TRUE); @@ -42,7 +42,7 @@ class LoggingTest extends DatabaseTestBase { /** * Tests that we can run two logs in parallel. */ - public function testEnableMultiLogging() { + public function testEnableMultiLogging(): void { Database::startLog('testing1'); $this->connection->query('SELECT [name] FROM {test} WHERE [age] > :age', [':age' => 25])->fetchCol(); @@ -61,7 +61,7 @@ class LoggingTest extends DatabaseTestBase { /** * Tests logging queries against multiple targets on the same connection. */ - public function testEnableTargetLogging() { + public function testEnableTargetLogging(): void { // Clone the primary credentials to a replica connection and to another fake // connection. $connection_info = Database::getConnectionInfo('default'); @@ -87,7 +87,7 @@ class LoggingTest extends DatabaseTestBase { * a fake target so the query should fall back to running on the default * target. */ - public function testEnableTargetLoggingNoTarget() { + public function testEnableTargetLoggingNoTarget(): void { Database::startLog('testing1'); $this->connection->query('SELECT [name] FROM {test} WHERE [age] > :age', [':age' => 25])->fetchCol(); @@ -109,7 +109,7 @@ class LoggingTest extends DatabaseTestBase { /** * Tests that we can log queries separately on different connections. */ - public function testEnableMultiConnectionLogging() { + public function testEnableMultiConnectionLogging(): void { // Clone the primary credentials to a fake connection. // That both connections point to the same physical database is irrelevant. $connection_info = Database::getConnectionInfo('default'); @@ -136,7 +136,7 @@ class LoggingTest extends DatabaseTestBase { /** * Tests that getLog with a wrong key return an empty array. */ - public function testGetLoggingWrongKey() { + public function testGetLoggingWrongKey(): void { $result = Database::getLog('wrong'); $this->assertEquals([], $result, 'The function getLog with a wrong key returns an empty array.'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/MergeTest.php b/core/tests/Drupal/KernelTests/Core/Database/MergeTest.php index 92e99ea0121..b8da5e18366 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/MergeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/MergeTest.php @@ -17,7 +17,7 @@ class MergeTest extends DatabaseTestBase { /** * Confirms that we can merge-insert a record successfully. */ - public function testMergeInsert() { + public function testMergeInsert(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $result = $this->connection->merge('test_people') @@ -42,7 +42,7 @@ class MergeTest extends DatabaseTestBase { /** * Confirms that we can merge-update a record successfully. */ - public function testMergeUpdate() { + public function testMergeUpdate(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $result = $this->connection->merge('test_people') @@ -70,7 +70,7 @@ class MergeTest extends DatabaseTestBase { * This test varies from the previous test because it manually defines which * fields are inserted, and which fields are updated. */ - public function testMergeUpdateExcept() { + public function testMergeUpdateExcept(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $this->connection->merge('test_people') @@ -91,7 +91,7 @@ class MergeTest extends DatabaseTestBase { /** * Confirms that we can merge-update a record, with alternate replacement. */ - public function testMergeUpdateExplicit() { + public function testMergeUpdateExplicit(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $this->connection->merge('test_people') @@ -117,7 +117,7 @@ class MergeTest extends DatabaseTestBase { /** * Confirms that we can merge-update a record successfully, with expressions. */ - public function testMergeUpdateExpression() { + public function testMergeUpdateExpression(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $age_before = $this->connection->query('SELECT [age] FROM {test_people} WHERE [job] = :job', [':job' => 'Speaker'])->fetchField(); @@ -146,7 +146,7 @@ class MergeTest extends DatabaseTestBase { /** * Tests that we can merge-insert without any update fields. */ - public function testMergeInsertWithoutUpdate() { + public function testMergeInsertWithoutUpdate(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $this->connection->merge('test_people') @@ -165,7 +165,7 @@ class MergeTest extends DatabaseTestBase { /** * Confirms that we can merge-update without any update fields. */ - public function testMergeUpdateWithoutUpdate() { + public function testMergeUpdateWithoutUpdate(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $this->connection->merge('test_people') @@ -197,7 +197,7 @@ class MergeTest extends DatabaseTestBase { /** * Tests that an invalid merge query throws an exception. */ - public function testInvalidMerge() { + public function testInvalidMerge(): void { $this->expectException(InvalidMergeQueryException::class); // This merge will fail because there is no key field specified. $this->connection @@ -209,7 +209,7 @@ class MergeTest extends DatabaseTestBase { /** * Tests that we can merge-insert with reserved keywords. */ - public function testMergeWithReservedWords() { + public function testMergeWithReservedWords(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {select}')->fetchField(); $this->connection->merge('select') diff --git a/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php index 5893197ef74..b2a7fe09bbb 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php @@ -17,7 +17,7 @@ class QueryTest extends DatabaseTestBase { /** * Tests that we can pass an array of values directly in the query. */ - public function testArraySubstitution() { + public function testArraySubstitution(): void { $names = $this->connection->query('SELECT [name] FROM {test} WHERE [age] IN ( :ages[] ) ORDER BY [age]', [':ages[]' => [25, 26, 27]])->fetchAll(); $this->assertCount(3, $names, 'Correct number of names returned'); @@ -28,7 +28,7 @@ class QueryTest extends DatabaseTestBase { /** * Tests that we can not pass a scalar value when an array is expected. */ - public function testScalarSubstitution() { + public function testScalarSubstitution(): void { try { $names = $this->connection->query('SELECT [name] FROM {test} WHERE [age] IN ( :ages[] ) ORDER BY [age]', [':ages[]' => 25])->fetchAll(); $this->fail('Array placeholder with scalar argument should result in an exception.'); @@ -42,7 +42,7 @@ class QueryTest extends DatabaseTestBase { /** * Tests SQL injection via database query array arguments. */ - public function testArrayArgumentsSQLInjection() { + public function testArrayArgumentsSQLInjection(): void { // Attempt SQL injection and verify that it does not work. $condition = [ "1 ;INSERT INTO {test} (name) VALUES ('test12345678'); -- " => '', @@ -69,7 +69,7 @@ class QueryTest extends DatabaseTestBase { /** * Tests SQL injection via condition operator. */ - public function testConditionOperatorArgumentsSQLInjection() { + public function testConditionOperatorArgumentsSQLInjection(): void { $injection = "IS NOT NULL) ;INSERT INTO {test} (name) VALUES ('test12345678'); -- "; try { @@ -138,7 +138,7 @@ class QueryTest extends DatabaseTestBase { * @see \Drupal\sqlite\Driver\Database\sqlite\Statement::getStatement() * @see http://bugs.php.net/bug.php?id=45259 */ - public function testNumericExpressionSubstitution() { + public function testNumericExpressionSubstitution(): void { $count_expected = $this->connection->query('SELECT COUNT(*) + 3 FROM {test}')->fetchField(); $count = $this->connection->query('SELECT COUNT(*) + :count FROM {test}', [ @@ -150,7 +150,7 @@ class QueryTest extends DatabaseTestBase { /** * Tests quoting identifiers in queries. */ - public function testQuotingIdentifiers() { + public function testQuotingIdentifiers(): void { // Use the table named an ANSI SQL reserved word with a column that is as // well. $result = $this->connection->query('SELECT [update] FROM {select}')->fetchObject(); diff --git a/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php index 0043cc00df4..ef061068d16 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php @@ -14,7 +14,7 @@ class RangeQueryTest extends DatabaseTestBase { /** * Confirms that range queries work and return the correct result. */ - public function testRangeQuery() { + public function testRangeQuery(): void { // Test if return correct number of rows. $range_rows = $this->connection->queryRange("SELECT [name] FROM {test} ORDER BY [name]", 1, 3)->fetchAll(); $this->assertCount(3, $range_rows, 'Range query work and return correct number of rows.'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php index a245c19a569..1ac344658e0 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php @@ -21,7 +21,7 @@ class RegressionTest extends DatabaseTestBase { /** * Ensures that non-ASCII UTF-8 data is stored in the database properly. */ - public function testRegression_310447() { + public function testRegression_310447(): void { // That's a 255 character UTF-8 string. $job = str_repeat("é", 255); $this->connection @@ -39,7 +39,7 @@ class RegressionTest extends DatabaseTestBase { /** * Tests the Schema::tableExists() method. */ - public function testDBTableExists() { + public function testDBTableExists(): void { $this->assertTrue($this->connection->schema()->tableExists('test'), 'Returns true for existent table.'); $this->assertFalse($this->connection->schema()->tableExists('no_such_table'), 'Returns false for nonexistent table.'); } @@ -47,7 +47,7 @@ class RegressionTest extends DatabaseTestBase { /** * Tests the \Drupal\Core\Database\Schema::fieldExists() method. */ - public function testDBFieldExists() { + public function testDBFieldExists(): void { $schema = $this->connection->schema(); $this->assertTrue($schema->fieldExists('test', 'name'), 'Returns true for existent column.'); $this->assertFalse($schema->fieldExists('test', 'no_such_column'), 'Returns false for nonexistent column.'); @@ -56,7 +56,7 @@ class RegressionTest extends DatabaseTestBase { /** * Tests the Schema::indexExists() method. */ - public function testDBIndexExists() { + public function testDBIndexExists(): void { $this->assertTrue($this->connection->schema()->indexExists('test', 'ages'), 'Returns true for existent index.'); $this->assertFalse($this->connection->schema()->indexExists('test', 'no_such_index'), 'Returns false for nonexistent index.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php b/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php index 3e2b2bb664f..e359c292ea5 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ReplicaKillSwitchTest.php @@ -22,7 +22,7 @@ class ReplicaKillSwitchTest extends KernelTestBase { /** * Tests database.replica_kill_switch service. */ - public function testSystemInitIgnoresSecondaries() { + public function testSystemInitIgnoresSecondaries(): void { // Clone the master credentials to a replica connection. // Note this will result in two independent connection objects that happen // to point to the same place. diff --git a/core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php b/core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php index 322b80a6dff..182ffb67546 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php @@ -14,7 +14,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT count query from a table with a reserved name. */ - public function testSelectReservedWordTableCount() { + public function testSelectReservedWordTableCount(): void { $query = $this->connection->select('virtual'); $num_records = $query->countQuery()->execute()->fetchField(); @@ -24,7 +24,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT query with a specific field from a table with a reserved name. */ - public function testSelectReservedWordTableSpecificField() { + public function testSelectReservedWordTableSpecificField(): void { $query = $this->connection->select('virtual'); $query->addField('virtual', 'function'); $rows = $query->execute()->fetchCol(); @@ -35,7 +35,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT query with all fields from a table with a reserved name. */ - public function testSelectReservedWordTableAllFields() { + public function testSelectReservedWordTableAllFields(): void { $query = $this->connection->select('virtual'); $query->fields('virtual'); $result = $query->execute()->fetchObject(); @@ -46,7 +46,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT count query from a table with a reserved alias. */ - public function testSelectReservedWordAliasCount() { + public function testSelectReservedWordAliasCount(): void { $query = $this->connection->select('test', 'character'); $num_records = $query->countQuery()->execute()->fetchField(); @@ -56,7 +56,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT query with specific fields from a table with a reserved alias. */ - public function testSelectReservedWordAliasSpecificFields() { + public function testSelectReservedWordAliasSpecificFields(): void { $query = $this->connection->select('test', 'high_priority'); $query->addField('high_priority', 'name'); $query->addField('high_priority', 'age', 'age'); @@ -71,7 +71,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT query with all fields from a table with a reserved alias. */ - public function testSelectReservedWordAliasAllFields() { + public function testSelectReservedWordAliasAllFields(): void { $record = $this->connection->select('test', 'signal') ->fields('signal') ->condition('age', 27) @@ -85,7 +85,7 @@ class ReservedWordTest extends DatabaseTestBase { /** * Tests SELECT query with GROUP BY clauses on fields with reserved names. */ - public function testGroupBy() { + public function testGroupBy(): void { $this->connection->insert('select') ->fields([ 'id' => 2, diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php index 1619ca78d25..15364ad53af 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php @@ -14,7 +14,7 @@ class SelectCloneTest extends DatabaseTestBase { /** * Tests that subqueries as value within conditions are cloned properly. */ - public function testSelectConditionSubQueryCloning() { + public function testSelectConditionSubQueryCloning(): void { $subquery = $this->connection->select('test', 't'); $subquery->addField('t', 'id', 'id'); $subquery->condition('age', 28, '<'); @@ -43,7 +43,7 @@ class SelectCloneTest extends DatabaseTestBase { /** * Tests that nested SELECT queries are cloned properly. */ - public function testNestedQueryCloning() { + public function testNestedQueryCloning(): void { $sub_query = $this->connection->select('test', 't'); $sub_query->addField('t', 'id', 'id'); $sub_query->condition('age', 28, '<'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php index ab892aeab46..a0cfc20cbb7 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php @@ -26,7 +26,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests simple JOIN statements. */ - public function testDefaultJoin() { + public function testDefaultJoin(): void { $query = $this->connection->select('test_task', 't'); $people_alias = $query->join('test', 'p', '[t].[pid] = [p].[id]'); $name_field = $query->addField($people_alias, 'name', 'name'); @@ -52,7 +52,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests LEFT OUTER joins. */ - public function testLeftOuterJoin() { + public function testLeftOuterJoin(): void { $query = $this->connection->select('test', 'p'); $people_alias = $query->leftJoin('test_task', 't', '[t].[pid] = [p].[id]'); $name_field = $query->addField('p', 'name', 'name'); @@ -77,7 +77,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests GROUP BY clauses. */ - public function testGroupBy() { + public function testGroupBy(): void { $query = $this->connection->select('test_task', 't'); $count_field = $query->addExpression('COUNT([task])', 'num'); $task_field = $query->addField('t', 'task'); @@ -118,7 +118,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests GROUP BY and HAVING clauses together. */ - public function testGroupByAndHaving() { + public function testGroupByAndHaving(): void { $query = $this->connection->select('test_task', 't'); $count_field = $query->addExpression('COUNT([task])', 'num'); $task_field = $query->addField('t', 'task'); @@ -155,7 +155,7 @@ class SelectComplexTest extends DatabaseTestBase { * * The SQL clause varies with the database. */ - public function testRange() { + public function testRange(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -168,7 +168,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests whether the range property of a select clause can be undone. */ - public function testRangeUndo() { + public function testRangeUndo(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -182,7 +182,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests distinct queries. */ - public function testDistinct() { + public function testDistinct(): void { $query = $this->connection->select('test_task'); $query->addField('test_task', 'task'); $query->orderBy('task'); @@ -196,7 +196,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that we can generate a count query from a built query. */ - public function testCountQuery() { + public function testCountQuery(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); @@ -216,7 +216,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests having queries. */ - public function testHavingCountQuery() { + public function testHavingCountQuery(): void { $query = $this->connection->select('test') ->extend(PagerSelectExtender::class) ->groupBy('age') @@ -230,7 +230,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that countQuery removes 'all_fields' statements and ordering clauses. */ - public function testCountQueryRemovals() { + public function testCountQueryRemovals(): void { $query = $this->connection->select('test'); $query->fields('test'); $query->orderBy('name'); @@ -260,7 +260,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that countQuery properly removes fields and expressions. */ - public function testCountQueryFieldRemovals() { + public function testCountQueryFieldRemovals(): void { // countQuery should remove all fields and expressions, so this can be // tested by adding a non-existent field and expression: if it ends // up in the query, an error will be thrown. If not, it will return the @@ -278,7 +278,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that we can generate a count query from a query with distinct. */ - public function testCountQueryDistinct() { + public function testCountQueryDistinct(): void { $query = $this->connection->select('test_task'); $query->addField('test_task', 'task'); $query->distinct(); @@ -291,7 +291,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that we can generate a count query from a query with GROUP BY. */ - public function testCountQueryGroupBy() { + public function testCountQueryGroupBy(): void { $query = $this->connection->select('test_task'); $query->addField('test_task', 'pid'); $query->groupBy('pid'); @@ -316,7 +316,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Confirms that we can properly nest conditional clauses. */ - public function testNestedConditions() { + public function testNestedConditions(): void { // This query should translate to: // "SELECT job FROM {test} WHERE name = 'Paul' AND (age = 26 OR age = 27)" // That should find only one record. Yes it's a non-optimal way of writing @@ -333,7 +333,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Confirms we can join on a single table twice with a dynamic alias. */ - public function testJoinTwice() { + public function testJoinTwice(): void { $query = $this->connection->select('test')->fields('test'); $alias = $query->join('test', 'test', '[test].[job] = [%alias].[job]'); $query->addField($alias, 'name', 'other_name'); @@ -347,7 +347,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that we can join on a query. */ - public function testJoinSubquery() { + public function testJoinSubquery(): void { $account = User::create([ 'name' => $this->randomMachineName(), 'mail' => $this->randomMachineName() . '@example.com', @@ -385,7 +385,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that rowCount() throws exception on SELECT query. */ - public function testSelectWithRowCount() { + public function testSelectWithRowCount(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $result = $query->execute(); @@ -402,7 +402,7 @@ class SelectComplexTest extends DatabaseTestBase { /** * Tests that join conditions can use Condition objects. */ - public function testJoinConditionObject() { + public function testJoinConditionObject(): void { // Same test as testDefaultJoin, but with a Condition object. $query = $this->connection->select('test_task', 't'); $join_cond = ($this->connection->condition('AND'))->where('[t].[pid] = [p].[id]'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectLeastTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectLeastTest.php index 5294b75995e..a67976589ec 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectLeastTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectLeastTest.php @@ -16,7 +16,7 @@ class SelectLeastTest extends DatabaseTestBase { * * @dataProvider selectLeastProvider */ - public function testSelectLeast($values, $expected) { + public function testSelectLeast($values, $expected): void { $least = $this->connection->query("SELECT LEAST(:values[])", [':values[]' => $values])->fetchField(); $this->assertEquals($expected, $least); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectOrderedTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectOrderedTest.php index 2d3bd8d78cb..b3cc7c2d2ce 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectOrderedTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectOrderedTest.php @@ -14,7 +14,7 @@ class SelectOrderedTest extends DatabaseTestBase { /** * Tests basic ORDER BY. */ - public function testSimpleSelectOrdered() { + public function testSimpleSelectOrdered(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); @@ -36,7 +36,7 @@ class SelectOrderedTest extends DatabaseTestBase { /** * Tests multiple ORDER BY. */ - public function testSimpleSelectMultiOrdered() { + public function testSimpleSelectMultiOrdered(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); @@ -67,7 +67,7 @@ class SelectOrderedTest extends DatabaseTestBase { /** * Tests ORDER BY descending. */ - public function testSimpleSelectOrderedDesc() { + public function testSimpleSelectOrderedDesc(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php index 98e153bf5a4..acc6ef22cb2 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php @@ -14,7 +14,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests that we can use a subquery in a FROM clause. */ - public function testFromSubquerySelect() { + public function testFromSubquerySelect(): void { // Create a subquery, which is just a normal query object. $subquery = $this->connection->select('test_task', 'tt'); $subquery->addField('tt', 'pid', 'pid'); @@ -50,7 +50,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests that we can use a subquery in a FROM clause with a LIMIT. */ - public function testFromSubquerySelectWithLimit() { + public function testFromSubquerySelectWithLimit(): void { // Create a subquery, which is just a normal query object. $subquery = $this->connection->select('test_task', 'tt'); $subquery->addField('tt', 'pid', 'pid'); @@ -78,7 +78,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests that we can use a subquery with an IN operator in a WHERE clause. */ - public function testConditionSubquerySelect() { + public function testConditionSubquerySelect(): void { // Create a subquery, which is just a normal query object. $subquery = $this->connection->select('test_task', 'tt'); $subquery->addField('tt', 'pid', 'pid'); @@ -101,7 +101,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests we can use a subquery with a relational operator in a WHERE clause. */ - public function testConditionSubquerySelect2() { + public function testConditionSubquerySelect2(): void { // Create a subquery, which is just a normal query object. $subquery = $this->connection->select('test', 't2'); $subquery->addExpression('AVG([t2].[age])'); @@ -122,7 +122,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests we can use 2 subqueries with a relational operator in a WHERE clause. */ - public function testConditionSubquerySelect3() { + public function testConditionSubquerySelect3(): void { // Create subquery 1, which is just a normal query object. $subquery1 = $this->connection->select('test_task', 'tt'); $subquery1->addExpression('AVG([tt].[priority])'); @@ -152,7 +152,7 @@ class SelectSubqueryTest extends DatabaseTestBase { * the right hand side. The test query may not be that logical but that's due * to the limited amount of data and tables. 'Valid' use cases do exist :) */ - public function testConditionSubquerySelect4() { + public function testConditionSubquerySelect4(): void { // Create subquery 1, which is just a normal query object. $subquery1 = $this->connection->select('test_task', 'tt'); $subquery1->addExpression('AVG([tt].[priority])'); @@ -188,7 +188,7 @@ class SelectSubqueryTest extends DatabaseTestBase { /** * Tests that we can use a subquery in a JOIN clause. */ - public function testJoinSubquerySelect() { + public function testJoinSubquerySelect(): void { // Create a subquery, which is just a normal query object. $subquery = $this->connection->select('test_task', 'tt'); $subquery->addField('tt', 'pid', 'pid'); @@ -217,7 +217,7 @@ class SelectSubqueryTest extends DatabaseTestBase { * We essentially select all rows from the {test} table that have matching * rows in the {test_people} table based on the shared name column. */ - public function testExistsSubquerySelect() { + public function testExistsSubquerySelect(): void { // Put George into {test_people}. $this->connection->insert('test_people') ->fields([ @@ -247,7 +247,7 @@ class SelectSubqueryTest extends DatabaseTestBase { * We essentially select all rows from the {test} table that don't have * matching rows in the {test_people} table based on the shared name column. */ - public function testNotExistsSubquerySelect() { + public function testNotExistsSubquerySelect(): void { // Put George into {test_people}. $this->connection->insert('test_people') ->fields([ diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php index ee4ce8145e7..be877c2866a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php @@ -19,7 +19,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests rudimentary SELECT statements. */ - public function testSimpleSelect() { + public function testSimpleSelect(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -31,7 +31,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests rudimentary SELECT statement with a COMMENT. */ - public function testSimpleComment() { + public function testSimpleComment(): void { $query = $this->connection->select('test')->comment('Testing query comments'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -49,7 +49,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests query COMMENT system against vulnerabilities. */ - public function testVulnerableComment() { + public function testVulnerableComment(): void { $query = $this->connection->select('test')->comment('Testing query comments */ SELECT nid FROM {node}; --'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -106,7 +106,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests basic conditionals on SELECT statements. */ - public function testSimpleSelectConditional() { + public function testSimpleSelectConditional(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_field = $query->addField('test', 'age', 'age'); @@ -126,7 +126,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests SELECT statements with expressions. */ - public function testSimpleSelectExpression() { + public function testSimpleSelectExpression(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_field = $query->addExpression("[age]*2", 'double_age'); @@ -146,7 +146,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests SELECT statements with multiple expressions. */ - public function testSimpleSelectExpressionMultiple() { + public function testSimpleSelectExpressionMultiple(): void { $query = $this->connection->select('test'); $name_field = $query->addField('test', 'name'); $age_double_field = $query->addExpression("[age]*2"); @@ -168,7 +168,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests adding multiple fields to a SELECT statement at the same time. */ - public function testSimpleSelectMultipleFields() { + public function testSimpleSelectMultipleFields(): void { $record = $this->connection->select('test') ->fields('test', ['id', 'name', 'age', 'job']) ->condition('age', 27) @@ -191,7 +191,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests adding all fields from a given table to a SELECT statement. */ - public function testSimpleSelectAllFields() { + public function testSimpleSelectAllFields(): void { $record = $this->connection->select('test') ->fields('test') ->condition('age', 27) @@ -214,7 +214,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that a comparison with NULL is always FALSE. */ - public function testNullCondition() { + public function testNullCondition(): void { $this->ensureSampleDataNull(); $names = $this->connection->select('test_null', 'tn') @@ -228,7 +228,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can find a record with a NULL value. */ - public function testIsNullCondition() { + public function testIsNullCondition(): void { $this->ensureSampleDataNull(); $names = $this->connection->select('test_null', 'tn') @@ -243,7 +243,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can find a record without a NULL value. */ - public function testIsNotNullCondition() { + public function testIsNotNullCondition(): void { $this->ensureSampleDataNull(); $names = $this->connection->select('test_null', 'tn') @@ -260,7 +260,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can force a query to return an empty result. */ - public function testAlwaysFalseCondition() { + public function testAlwaysFalseCondition(): void { $names = $this->connection->select('test', 'test') ->fields('test', ['name']) ->condition('age', 27) @@ -281,7 +281,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can force an extended query to return an empty result. */ - public function testExtenderAlwaysFalseCondition() { + public function testExtenderAlwaysFalseCondition(): void { $names = $this->connection->select('test', 'test') ->extend(SelectExtender::class) ->fields('test', ['name']) @@ -307,7 +307,7 @@ class SelectTest extends DatabaseTestBase { * This is semantically equal to UNION DISTINCT, so we don't explicitly test * that. */ - public function testUnion() { + public function testUnion(): void { $query_1 = $this->connection->select('test', 't') ->fields('t', ['name']) ->condition('age', [27, 28], 'IN'); @@ -329,7 +329,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can UNION ALL multiple SELECT queries together. */ - public function testUnionAll() { + public function testUnionAll(): void { $query_1 = $this->connection->select('test', 't') ->fields('t', ['name']) ->condition('age', [27, 28], 'IN'); @@ -353,7 +353,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can get a count query for a UNION Select query. */ - public function testUnionCount() { + public function testUnionCount(): void { $query_1 = $this->connection->select('test', 't') ->fields('t', ['name', 'age']) ->condition('age', [27, 28], 'IN'); @@ -373,7 +373,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can UNION multiple Select queries together and set the ORDER. */ - public function testUnionOrder() { + public function testUnionOrder(): void { // This gives George and Ringo. $query_1 = $this->connection->select('test', 't') ->fields('t', ['name']) @@ -402,7 +402,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that we can UNION multiple Select queries together with and a LIMIT. */ - public function testUnionOrderLimit() { + public function testUnionOrderLimit(): void { // This gives George and Ringo. $query_1 = $this->connection->select('test', 't') ->fields('t', ['name']) @@ -443,7 +443,7 @@ class SelectTest extends DatabaseTestBase { * order each time, the only way this could happen is if we have successfully * triggered the database's random ordering functionality. */ - public function testRandomOrder() { + public function testRandomOrder(): void { // Use 52 items, so the chance that this test fails by accident will be the // same as the chance that a deck of cards will come out in the same order // after shuffling it (in other words, nearly impossible). @@ -523,7 +523,7 @@ class SelectTest extends DatabaseTestBase { * * @dataProvider providerRegularExpressionCondition */ - public function testRegularExpressionCondition($expected, $column, $pattern, $operator) { + public function testRegularExpressionCondition($expected, $column, $pattern, $operator): void { $database = $this->container->get('database'); $database->insert('test') ->fields([ @@ -545,7 +545,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that aliases are renamed when they are duplicates. */ - public function testSelectDuplicateAlias() { + public function testSelectDuplicateAlias(): void { $query = $this->connection->select('test', 't'); $alias1 = $query->addField('t', 'name', 'the_alias'); $alias2 = $query->addField('t', 'age', 'the_alias'); @@ -555,7 +555,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests that an invalid count query throws an exception. */ - public function testInvalidSelectCount() { + public function testInvalidSelectCount(): void { $this->expectException(DatabaseExceptionWrapper::class); // This query will fail because the table does not exist. $this->connection->select('some_table_that_does_not_exist', 't') @@ -567,7 +567,7 @@ class SelectTest extends DatabaseTestBase { /** * Tests thrown exception for IN query conditions with an empty array. */ - public function testEmptyInCondition() { + public function testEmptyInCondition(): void { try { $this->connection->select('test', 't') ->fields('t') @@ -619,7 +619,7 @@ class SelectTest extends DatabaseTestBase { * * @dataProvider providerNonArrayOperatorWithArrayValueCondition */ - public function testNonArrayOperatorWithArrayValueCondition($operator, $operator_in_exception_message) { + public function testNonArrayOperatorWithArrayValueCondition($operator, $operator_in_exception_message): void { $this->expectException(InvalidQueryException::class); $this->expectExceptionMessage("Query condition 'age " . $operator_in_exception_message . " 26, 27' must have an array compatible operator."); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php index 00fe2780d1c..0db69d82c97 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php @@ -14,7 +14,7 @@ class SerializeQueryTest extends DatabaseTestBase { /** * Confirms that a query can be serialized and unserialized. */ - public function testSerializeQuery() { + public function testSerializeQuery(): void { $query = $this->connection->select('test'); $query->addField('test', 'age'); $query->condition('name', 'Ringo'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/StatementTest.php b/core/tests/Drupal/KernelTests/Core/Database/StatementTest.php index 72f693015f4..e14f39cb30d 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/StatementTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/StatementTest.php @@ -17,7 +17,7 @@ class StatementTest extends DatabaseTestBase { /** * Tests that a prepared statement object can be reused for multiple inserts. */ - public function testRepeatedInsertStatementReuse() { + public function testRepeatedInsertStatementReuse(): void { $num_records_before = $this->connection->select('test')->countQuery()->execute()->fetchField(); $sql = "INSERT INTO {test} ([name], [age]) VALUES (:name, :age)"; diff --git a/core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php b/core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php index 92d7302c4fc..0f3368dd974 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TaggingTest.php @@ -19,7 +19,7 @@ class TaggingTest extends DatabaseTestBase { /** * Confirms that a query has a tag added to it. */ - public function testHasTag() { + public function testHasTag(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -33,7 +33,7 @@ class TaggingTest extends DatabaseTestBase { /** * Tests query tagging "has all of these tags" functionality. */ - public function testHasAllTags() { + public function testHasAllTags(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -48,7 +48,7 @@ class TaggingTest extends DatabaseTestBase { /** * Tests query tagging "has at least one of these tags" functionality. */ - public function testHasAnyTag() { + public function testHasAnyTag(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); @@ -62,7 +62,7 @@ class TaggingTest extends DatabaseTestBase { /** * Confirms that an extended query has a tag added to it. */ - public function testExtenderHasTag() { + public function testExtenderHasTag(): void { $query = $this->connection->select('test') ->extend(SelectExtender::class); $query->addField('test', 'name'); @@ -77,7 +77,7 @@ class TaggingTest extends DatabaseTestBase { /** * Tests extended query tagging "has all of these tags" functionality. */ - public function testExtenderHasAllTags() { + public function testExtenderHasAllTags(): void { $query = $this->connection->select('test') ->extend(SelectExtender::class); $query->addField('test', 'name'); @@ -93,7 +93,7 @@ class TaggingTest extends DatabaseTestBase { /** * Tests extended query tagging for "has at least one of these tags". */ - public function testExtenderHasAnyTag() { + public function testExtenderHasAnyTag(): void { $query = $this->connection->select('test') ->extend(SelectExtender::class); $query->addField('test', 'name'); @@ -110,7 +110,7 @@ class TaggingTest extends DatabaseTestBase { * * This is how we pass additional context to alter hooks. */ - public function testMetaData() { + public function testMetaData(): void { $query = $this->connection->select('test'); $query->addField('test', 'name'); $query->addField('test', 'age', 'age'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php index cfb990c565e..a48855c2040 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TemporaryQueryTestBase.php @@ -30,7 +30,7 @@ abstract class TemporaryQueryTestBase extends DriverSpecificDatabaseTestBase { /** * Confirms that temporary tables work. */ - public function testTemporaryQuery() { + public function testTemporaryQuery(): void { $connection = $this->getConnection(); // Now try to run two temporary queries in the same request. diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php index 48405104017..53a7abaec87 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php @@ -14,7 +14,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests updates with OR conditionals. */ - public function testOrConditionUpdate() { + public function testOrConditionUpdate(): void { $update = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition(($this->connection->condition('OR')) @@ -31,7 +31,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests WHERE IN clauses. */ - public function testInConditionUpdate() { + public function testInConditionUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition('name', ['John', 'Paul'], 'IN') @@ -45,7 +45,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests WHERE NOT IN clauses. */ - public function testNotInConditionUpdate() { + public function testNotInConditionUpdate(): void { // The o is lowercase in the 'NoT IN' operator, to make sure the operators // work in mixed case. $num_updated = $this->connection->update('test') @@ -61,7 +61,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests BETWEEN conditional clauses. */ - public function testBetweenConditionUpdate() { + public function testBetweenConditionUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition('age', [25, 26], 'BETWEEN') @@ -75,7 +75,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests LIKE conditionals. */ - public function testLikeConditionUpdate() { + public function testLikeConditionUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition('name', '%ge%', 'LIKE') @@ -89,7 +89,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests UPDATE with expression values. */ - public function testUpdateExpression() { + public function testUpdateExpression(): void { $before_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetchField(); $num_updated = $this->connection->update('test') ->condition('name', 'Ringo') @@ -110,7 +110,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests UPDATE with only expression values. */ - public function testUpdateOnlyExpression() { + public function testUpdateOnlyExpression(): void { $before_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetchField(); $num_updated = $this->connection->update('test') ->condition('name', 'Ringo') @@ -125,7 +125,7 @@ class UpdateComplexTest extends DatabaseTestBase { /** * Tests UPDATE with a subselect value. */ - public function testSubSelectUpdate() { + public function testSubSelectUpdate(): void { $subselect = $this->connection->select('test_task', 't'); $subselect->addExpression('MAX([priority]) + :increment', 'max_priority', [':increment' => 30]); // Clone this to make sure we are running a different query when diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateLobTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateLobTest.php index f7073b79c26..60bb3c6f9c2 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateLobTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateLobTest.php @@ -14,7 +14,7 @@ class UpdateLobTest extends DatabaseTestBase { /** * Confirms that we can update a blob column. */ - public function testUpdateOneBlob() { + public function testUpdateOneBlob(): void { $data = "This is\000a test."; $this->assertSame(15, strlen($data), 'Test data contains a NULL.'); $id = $this->connection->insert('test_one_blob') @@ -34,7 +34,7 @@ class UpdateLobTest extends DatabaseTestBase { /** * Tests that we can update a blob column to null. */ - public function testUpdateNullBlob() { + public function testUpdateNullBlob(): void { $id = $this->connection->insert('test_one_blob') ->fields(['blob1' => 'test']) ->execute(); @@ -52,7 +52,7 @@ class UpdateLobTest extends DatabaseTestBase { /** * Confirms that we can update two blob columns in the same table. */ - public function testUpdateMultipleBlob() { + public function testUpdateMultipleBlob(): void { $id = $this->connection->insert('test_two_blobs') ->fields([ 'blob1' => 'This is', diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php index eaaacc52f1c..260237c06b3 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms that we can update a single record successfully. */ - public function testSimpleUpdate() { + public function testSimpleUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['name' => 'Tiffany']) ->condition('id', 1) @@ -31,7 +31,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms updating to NULL. */ - public function testSimpleNullUpdate() { + public function testSimpleNullUpdate(): void { $this->ensureSampleDataNull(); $num_updated = $this->connection->update('test_null') ->fields(['age' => NULL]) @@ -46,7 +46,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms that we can update multiple records successfully. */ - public function testMultiUpdate() { + public function testMultiUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition('job', 'Singer') @@ -60,7 +60,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms that we can update multiple records with a non-equality condition. */ - public function testMultiGTUpdate() { + public function testMultiGTUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->condition('age', 26, '>') @@ -74,7 +74,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms that we can update multiple records with a where call. */ - public function testWhereUpdate() { + public function testWhereUpdate(): void { $num_updated = $this->connection->update('test') ->fields(['job' => 'Musician']) ->where('[age] > :age', [':age' => 26]) @@ -88,7 +88,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirms that we can stack condition and where calls. */ - public function testWhereAndConditionUpdate() { + public function testWhereAndConditionUpdate(): void { $update = $this->connection->update('test') ->fields(['job' => 'Musician']) ->where('[age] > :age', [':age' => 26]) @@ -103,7 +103,7 @@ class UpdateTest extends DatabaseTestBase { /** * Tests updating with expressions. */ - public function testExpressionUpdate() { + public function testExpressionUpdate(): void { // Ensure that expressions are handled properly. This should set every // record's age to a square of itself. $num_rows = $this->connection->update('test') @@ -118,7 +118,7 @@ class UpdateTest extends DatabaseTestBase { /** * Tests return value on update. */ - public function testUpdateAffectedRows() { + public function testUpdateAffectedRows(): void { // At 5am in the morning, all band members but those with a priority 1 task // are sleeping. So we set their tasks to 'sleep'. 5 records match the // condition and therefore are affected by the query, even though two of @@ -135,7 +135,7 @@ class UpdateTest extends DatabaseTestBase { /** * Confirm that we can update values in a column with special name. */ - public function testSpecialColumnUpdate() { + public function testSpecialColumnUpdate(): void { $num_updated = $this->connection->update('select') ->fields([ 'update' => 'New update value', diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpsertTest.php index 47a83be9e59..edb2717ed63 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpsertTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpsertTest.php @@ -17,7 +17,7 @@ class UpsertTest extends DatabaseTestBase { /** * Confirms that we can upsert (update-or-insert) records successfully. */ - public function testUpsert() { + public function testUpsert(): void { $connection = Database::getConnection(); $num_records_before = $connection->query('SELECT COUNT(*) FROM {test_people}')->fetchField(); @@ -61,7 +61,7 @@ class UpsertTest extends DatabaseTestBase { /** * Confirms that we can upsert records with keywords successfully. */ - public function testUpsertWithKeywords() { + public function testUpsertWithKeywords(): void { $num_records_before = $this->connection->query('SELECT COUNT(*) FROM {select}')->fetchField(); $upsert = $this->connection->upsert('select') @@ -127,7 +127,7 @@ class UpsertTest extends DatabaseTestBase { /** * Tests that we can upsert a null into blob field. */ - public function testUpsertNullBlob() { + public function testUpsertNullBlob(): void { $id = $this->connection->insert('test_one_blob') ->fields(['blob1' => 'test']) ->execute(); diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php index f9228eea5d9..e3c68cb72fd 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php @@ -55,7 +55,7 @@ class DateFormatterTest extends KernelTestBase { * * @covers ::format */ - public function testFormat() { + public function testFormat(): void { /** @var \Drupal\Core\Datetime\DateFormatterInterface $formatter */ $formatter = $this->container->get('date.formatter'); /** @var \Drupal\Core\Language\LanguageManagerInterface $language_manager */ @@ -121,7 +121,7 @@ class DateFormatterTest extends KernelTestBase { * * @covers ::format */ - public function testRfc2822DateFormat() { + public function testRfc2822DateFormat(): void { $days_of_week_abbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; foreach ($days_of_week_abbr as $day_of_week_abbr) { $this->setSetting('locale_custom_strings_' . self::LANGCODE, [ diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php index eb8dd5f64b1..a789f14d411 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php @@ -109,7 +109,7 @@ class DatelistElementFormTest extends KernelTestBase implements FormInterface, T /** * Tests that trusted callbacks are executed. */ - public function testDatelistElement() { + public function testDatelistElement(): void { $form_state = new FormState(); $form = \Drupal::formBuilder()->buildForm($this, $form_state); $this->render($form); diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php index 12792adb067..b4048f17e2b 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php @@ -134,7 +134,7 @@ class DatetimeElementFormTest extends KernelTestBase implements FormInterface, T /** * Tests that default handlers are added even if custom are specified. */ - public function testDatetimeElement() { + public function testDatetimeElement(): void { $form_state = new FormState(); $form = \Drupal::formBuilder()->buildForm($this, $form_state); $this->render($form); @@ -195,7 +195,7 @@ class DatetimeElementFormTest extends KernelTestBase implements FormInterface, T /** * Tests proper timezone handling of the Datetime element. */ - public function testTimezoneHandling() { + public function testTimezoneHandling(): void { // Render the form once with the site's timezone. $form = \Drupal::formBuilder()->getForm($this); $this->render($form); diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php index 6a24e520565..491e37ae818 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php @@ -205,7 +205,7 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * save the form, otherwise stored times may be changed without the user * changing the element's values. */ - public function testDatetimeElementTimesUnderstoodCorrectly() { + public function testDatetimeElementTimesUnderstoodCorrectly(): void { $this->assertTimesUnderstoodCorrectly('datetime', ['date', 'time']); } @@ -214,7 +214,7 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * * See testDatetimeElementTimesUnderstoodCorrectly() for more explanation. */ - public function testDatelistElementTimesUnderstoodCorrectly() { + public function testDatelistElementTimesUnderstoodCorrectly(): void { $this->assertTimesUnderstoodCorrectly('datelist', [ 'day', 'month', @@ -232,7 +232,7 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * accurately reflect the timezone that will be used to interpret times * entered through the element. */ - public function testDatetimeTimezonePropertyProcessed() { + public function testDatetimeTimezonePropertyProcessed(): void { $this->assertDateTimezonePropertyProcessed('datetime'); } @@ -241,7 +241,7 @@ class TimezoneTest extends EntityKernelTestBase implements FormInterface { * * See testDatetimeTimezonePropertyProcessed() for more explanation. */ - public function testDatelistTimezonePropertyProcessed() { + public function testDatelistTimezonePropertyProcessed(): void { $this->assertDateTimezonePropertyProcessed('datelist'); } diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/TimestampSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/TimestampSchemaTest.php index 794d5e84ab1..1ce68703462 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/TimestampSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/TimestampSchemaTest.php @@ -34,7 +34,7 @@ class TimestampSchemaTest extends KernelTestBase { /** * Tests if the timestamp field schema is validated. */ - public function testTimestampSchema() { + public function testTimestampSchema(): void { $this->installConfig(['field_timestamp_test']); // Make at least an assertion. $this->assertTrue(TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php b/core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php index c88e4650387..07828a27492 100644 --- a/core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php +++ b/core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php @@ -19,7 +19,7 @@ class ServicesDefaultsTest extends KernelTestBase { /** * Tests that 'services_defaults_test.service' has its dependencies injected. */ - public function testAutowiring() { + public function testAutowiring(): void { // Ensure interface autowiring works. $this->assertSame( $this->container->get('Drupal\services_defaults_test\TestInjection'), @@ -50,7 +50,7 @@ class ServicesDefaultsTest extends KernelTestBase { /** * Tests that default tags for 'services_defaults_test.service' are applied. */ - public function testDefaultTags() { + public function testDefaultTags(): void { // Ensure default tags work. $testServiceDefinition = $this->container->getDefinition('Drupal\services_defaults_test\TestService'); $testInjection1Definition = $this->container->getDefinition('Drupal\services_defaults_test\TestInjection'); @@ -76,7 +76,7 @@ class ServicesDefaultsTest extends KernelTestBase { /** * Tests that service from 'services_defaults_test.service' is private. */ - public function testPrivateServices() { + public function testPrivateServices(): void { // Ensure default and overridden public flag works. $this->expectException(ServiceNotFoundException::class); $this->container->getDefinition('Drupal\services_defaults_test\TestPrivateService'); diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php index c58461ea29e..337d920c27a 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php @@ -17,7 +17,7 @@ class DrupalKernelSiteTest extends KernelTestBase { /** * Tests services.yml in site directory. */ - public function testServicesYml() { + public function testServicesYml(): void { $container_yamls = Settings::get('container_yamls'); $container_yamls[] = $this->siteDirectory . '/services.yml'; $this->setSetting('container_yamls', $container_yamls); diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php index 41566b3ba95..8d1c4fd2ab0 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php @@ -73,7 +73,7 @@ class DrupalKernelTest extends KernelTestBase { /** * Tests DIC compilation. */ - public function testCompileDIC() { + public function testCompileDIC(): void { // @todo Write a memory based storage backend for testing. $modules_enabled = [ 'system' => 'system', @@ -155,7 +155,7 @@ class DrupalKernelTest extends KernelTestBase { /** * Tests repeated loading of compiled DIC with different environment. */ - public function testRepeatedBootWithDifferentEnvironment() { + public function testRepeatedBootWithDifferentEnvironment(): void { $request = Request::createFromGlobals(); $class_loader = require $this->root . '/autoload.php'; @@ -177,7 +177,7 @@ class DrupalKernelTest extends KernelTestBase { /** * Tests setting of site path after kernel boot. */ - public function testPreventChangeOfSitePath() { + public function testPreventChangeOfSitePath(): void { // @todo Write a memory based storage backend for testing. $modules_enabled = [ 'system' => 'system', @@ -226,7 +226,7 @@ class DrupalKernelTest extends KernelTestBase { * @param bool $value * The value to set class_loader_auto_detect to. */ - public function testClassLoaderAutoDetect($value) { + public function testClassLoaderAutoDetect($value): void { // Create a virtual file system containing items that should be // excluded. Exception being modules directory. vfsStream::setup('root', NULL, [ @@ -264,7 +264,7 @@ class DrupalKernelTest extends KernelTestBase { /** * @covers ::resetContainer */ - public function testResetContainer() { + public function testResetContainer(): void { $modules_enabled = [ 'system' => 'system', 'user' => 'user', diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php index a3243f9eac7..5439351aef4 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php @@ -17,7 +17,7 @@ class ServiceDestructionTest extends KernelTestBase { /** * Verifies that services are destructed when used. */ - public function testDestructionUsed() { + public function testDestructionUsed(): void { // Enable the test module to add it to the container. $this->enableModules(['service_provider_test']); @@ -39,7 +39,7 @@ class ServiceDestructionTest extends KernelTestBase { /** * Verifies that services are not unnecessarily destructed when not used. */ - public function testDestructionUnused() { + public function testDestructionUnused(): void { // Enable the test module to add it to the container. $this->enableModules(['service_provider_test']); diff --git a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php index 69e5c938c77..8ce07d663e8 100644 --- a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php @@ -140,7 +140,7 @@ class PathElementFormTest extends KernelTestBase implements FormInterface { /** * Tests that default handlers are added even if custom are specified. */ - public function testPathElement() { + public function testPathElement(): void { $form_state = (new FormState()) ->setValues([ 'required_validate' => 'user/' . $this->testUser->id(), diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php index c95bf42e700..3704d5c6478 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php @@ -46,7 +46,7 @@ class BundleClassTest extends EntityKernelTestBase { /** * Tests making use of a custom bundle class. */ - public function testEntitySubclass() { + public function testEntitySubclass(): void { entity_test_create_bundle('bundle_class'); // Ensure we start life with empty counters. @@ -206,7 +206,7 @@ class BundleClassTest extends EntityKernelTestBase { /** * Tests making use of a custom bundle class for an entity without bundles. */ - public function testEntityNoBundleSubclass() { + public function testEntityNoBundleSubclass(): void { $this->container->get('state')->set('entity_test_bundle_class_enable_user_class', TRUE); $this->container->get('kernel')->rebuildContainer(); $this->entityTypeManager->clearCachedDefinitions(); @@ -220,7 +220,7 @@ class BundleClassTest extends EntityKernelTestBase { * * @covers Drupal\Core\Entity\ContentEntityStorageBase::create */ - public function testAmbiguousBundleClassExceptionCreate() { + public function testAmbiguousBundleClassExceptionCreate(): void { $this->container->get('state')->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE); $this->entityTypeManager->clearCachedDefinitions(); entity_test_create_bundle('bundle_class'); @@ -237,7 +237,7 @@ class BundleClassTest extends EntityKernelTestBase { * * @covers Drupal\Core\Entity\EntityTypeRepository::getEntityTypeFromClass */ - public function testAmbiguousBundleClassExceptionEntityTypeRepository() { + public function testAmbiguousBundleClassExceptionEntityTypeRepository(): void { $this->container->get('state')->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE); entity_test_create_bundle('entity_test_no_label'); entity_test_create_bundle('entity_test_no_label', NULL, 'entity_test_no_label'); @@ -262,7 +262,7 @@ class BundleClassTest extends EntityKernelTestBase { /** * Checks exception thrown if a bundle class doesn't extend the entity class. */ - public function testBundleClassShouldExtendEntityClass() { + public function testBundleClassShouldExtendEntityClass(): void { $this->container->get('state')->set('entity_test_bundle_class_non_inheriting', TRUE); $this->entityTypeManager->clearCachedDefinitions(); $this->expectException(BundleClassInheritanceException::class); @@ -273,7 +273,7 @@ class BundleClassTest extends EntityKernelTestBase { /** * Checks exception thrown if a bundle class doesn't exist. */ - public function testBundleClassShouldExist() { + public function testBundleClassShouldExist(): void { $this->container->get('state')->set('entity_test_bundle_class_does_not_exist', TRUE); $this->entityTypeManager->clearCachedDefinitions(); $this->expectException(MissingBundleClassException::class); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php index 321a830a7d1..c962a2a14e6 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php @@ -35,7 +35,7 @@ class BundleConstraintValidatorTest extends KernelTestBase { /** * Tests bundle constraint validation. */ - public function testValidation() { + public function testValidation(): void { // Test with multiple values. $this->assertValidation(['foo', 'bar']); // Test with a single string value as well. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php index b3356a58708..d69ea0d9f76 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php @@ -25,7 +25,7 @@ class BundlePermissionHandlerTraitTest extends KernelTestBase { /** * @covers ::generatePermissions */ - public function testGeneratePermissions() { + public function testGeneratePermissions(): void { EntityTestBundle::create([ 'id' => 'test1', ])->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php index 8c8e59a048f..f8c9848bfcf 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php @@ -53,7 +53,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver::getDerivativeDefinitions */ - public function testEntityDeriver() { + public function testEntityDeriver(): void { $definition = \Drupal::typedDataManager()->getDefinition('entity:config_test'); $this->assertEquals(ConfigEntityAdapter::class, $definition['class']); } @@ -61,7 +61,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::validate */ - public function testValidate() { + public function testValidate(): void { $adapter = ConfigEntityAdapter::createFromEntity($this->entity); $violations = $adapter->validate(); $this->assertEmpty($violations); @@ -85,7 +85,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::getProperties */ - public function testGetProperties() { + public function testGetProperties(): void { $expected_properties = [ 'uuid' => StringData::class, 'langcode' => StringData::class, @@ -111,7 +111,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::getValue */ - public function testGetValue() { + public function testGetValue(): void { $adapter = ConfigEntityAdapter::createFromEntity($this->entity); $this->assertEquals($this->entity->weight, $adapter->get('weight')->getValue()); $this->assertEquals($this->entity->id(), $adapter->get('id')->getValue()); @@ -121,7 +121,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { $adapter = ConfigEntityAdapter::createFromEntity($this->entity); // Get the value via typed data to ensure that the typed representation is // updated correctly when the value is set. @@ -137,7 +137,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::getString */ - public function testGetString() { + public function testGetString(): void { $adapter = ConfigEntityAdapter::createFromEntity($this->entity); $this->assertEquals('foobar', $adapter->getString()); } @@ -145,7 +145,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::applyDefaultValue */ - public function testApplyDefaultValue() { + public function testApplyDefaultValue(): void { $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Method not supported'); $adapter = ConfigEntityAdapter::createFromEntity($this->entity); @@ -155,7 +155,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { /** * @covers ::getIterator */ - public function testGetIterator() { + public function testGetIterator(): void { $adapter = ConfigEntityAdapter::createFromEntity($this->entity); $iterator = $adapter->getIterator(); $fields = iterator_to_array($iterator); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index cc01678df88..d7fbca66810 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -144,7 +144,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests basic functionality. */ - public function testConfigEntityQuery() { + public function testConfigEntityQuery(): void { // Run a test without any condition. $this->queryResults = $this->entityStorage->getQuery() ->execute(); @@ -374,7 +374,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests ID conditions. */ - public function testStringIdConditions() { + public function testStringIdConditions(): void { // We need an entity with a non-numeric ID. $entity = ConfigQueryTest::create([ 'label' => 'entity_1', @@ -430,7 +430,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests count query. */ - public function testCount() { + public function testCount(): void { // Test count on no conditions. $count = $this->entityStorage->getQuery() ->count() @@ -456,7 +456,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests sorting and range on config entity queries. */ - public function testSortRange() { + public function testSortRange(): void { // Sort by simple ascending/descending. $this->queryResults = $this->entityStorage->getQuery() ->sort('number', 'DESC') @@ -546,7 +546,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests sorting with tableSort on config entity queries. */ - public function testTableSort() { + public function testTableSort(): void { $header = [ ['data' => 'ID', 'specifier' => 'id'], ['data' => 'Number', 'specifier' => 'number'], @@ -614,7 +614,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests dotted path matching. */ - public function testDotted() { + public function testDotted(): void { $this->queryResults = $this->entityStorage->getQuery() ->condition('array.level1.*', 1) ->execute(); @@ -688,7 +688,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests case sensitivity. */ - public function testCaseSensitivity() { + public function testCaseSensitivity(): void { // Filter by label with a known containing case-sensitive word. $this->queryResults = $this->entityStorage->getQuery() ->condition('label', 'TEST', 'CONTAINS') @@ -704,7 +704,7 @@ class ConfigEntityQueryTest extends KernelTestBase { /** * Tests lookup keys are added to the key value store. */ - public function testLookupKeys() { + public function testLookupKeys(): void { \Drupal::service('state')->set('config_test.lookup_keys', TRUE); \Drupal::entityTypeManager()->clearCachedDefinitions(); $key_value = $this->container->get('keyvalue')->get(QueryFactory::CONFIG_LOOKUP_PREFIX . 'config_test'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php index ede11147aee..32a49bf0a04 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php @@ -64,7 +64,7 @@ class ContentEntityChangedTest extends EntityKernelTestBase { /** * Tests basic EntityChangedInterface functionality. */ - public function testChanged() { + public function testChanged(): void { $user1 = $this->createUser(); $user2 = $this->createUser(); @@ -241,7 +241,7 @@ class ContentEntityChangedTest extends EntityKernelTestBase { /** * Tests revisionable EntityChangedInterface functionality. */ - public function testRevisionChanged() { + public function testRevisionChanged(): void { $user1 = $this->createUser(); $user2 = $this->createUser(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php index e27dc5b6a31..273eb7b6475 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php @@ -36,7 +36,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests if entity references on fields are still correct after cloning. */ - public function testFieldEntityReferenceAfterClone() { + public function testFieldEntityReferenceAfterClone(): void { $user = $this->createUser(); // Create a test entity. @@ -76,7 +76,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests that the flag for enforcing a new entity is not shared. */ - public function testEnforceIsNewOnClonedEntityTranslation() { + public function testEnforceIsNewOnClonedEntityTranslation(): void { // Create a test entity. $entity = EntityTestMul::create([ 'name' => $this->randomString(), @@ -103,7 +103,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests if the entity fields are properly cloned. */ - public function testClonedEntityFields() { + public function testClonedEntityFields(): void { $user = $this->createUser(); // Create a test entity. @@ -148,7 +148,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests that the flag for enforcing a new revision is not shared. */ - public function testNewRevisionOnCloneEntityTranslation() { + public function testNewRevisionOnCloneEntityTranslation(): void { // Create a test entity. $entity = EntityTestMulRev::create([ 'name' => $this->randomString(), @@ -180,7 +180,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests modifications on entity keys of a cloned entity object. */ - public function testEntityKeysModifications() { + public function testEntityKeysModifications(): void { // Create a test entity with a translation, which will internally trigger // entity cloning for the new translation and create references for some of // the entity properties. @@ -220,7 +220,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests the field values after serializing an entity and its clone. */ - public function testFieldValuesAfterSerialize() { + public function testFieldValuesAfterSerialize(): void { // Create a test entity with a translation, which will internally trigger // entity cloning for the new translation and create references for some of // the entity properties. @@ -252,7 +252,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests changing the default revision flag. */ - public function testDefaultRevision() { + public function testDefaultRevision(): void { // Create a test entity with a translation, which will internally trigger // entity cloning for the new translation and create references for some of // the entity properties. @@ -279,7 +279,7 @@ class ContentEntityCloneTest extends EntityKernelTestBase { /** * Tests references of entity properties after entity cloning. */ - public function testEntityPropertiesModifications() { + public function testEntityPropertiesModifications(): void { // Create a test entity with a translation, which will internally trigger // entity cloning for the new translation and create references for some of // the entity properties. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityFieldMethodInvocationOrderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityFieldMethodInvocationOrderTest.php index f302c8e3b49..6327e39f6dc 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityFieldMethodInvocationOrderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityFieldMethodInvocationOrderTest.php @@ -45,7 +45,7 @@ class ContentEntityFieldMethodInvocationOrderTest extends EntityKernelTestBase { /** * Tests correct field method invocation order. */ - public function testFieldMethodInvocationOrder() { + public function testFieldMethodInvocationOrder(): void { // Create a test entity. $entity = $this->entityTestFieldMethodsStorage->create([ diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php index 0247245f473..4978a4bf110 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php @@ -39,7 +39,7 @@ class ContentEntityHasChangesTest extends KernelTestBase { /** * Tests the correct functionality of the hasTranslationChanges() function. */ - public function testHasTranslationChanges() { + public function testHasTranslationChanges(): void { $user1 = User::create([ 'name' => 'username1', 'status' => 1, diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php index b723086d32e..ab7371fadec 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php @@ -73,7 +73,7 @@ class ContentEntityNonRevisionableFieldTest extends EntityKernelTestBase { /** * Tests non-revisionable fields on revisionable and translatable entities. */ - public function testMulNonRevisionableField() { + public function testMulNonRevisionableField(): void { $user1 = $this->createUser(); $user2 = $this->createUser(); @@ -141,7 +141,7 @@ class ContentEntityNonRevisionableFieldTest extends EntityKernelTestBase { /** * Tests non-revisionable fields on revisionable entities. */ - public function testNonRevisionableField() { + public function testNonRevisionableField(): void { $user1 = $this->createUser(); $user2 = $this->createUser(); @@ -202,7 +202,7 @@ class ContentEntityNonRevisionableFieldTest extends EntityKernelTestBase { /** * Tests multi column non revisionable base field for revisionable entity. */ - public function testMultiColumnNonRevisionableBaseField() { + public function testMultiColumnNonRevisionableBaseField(): void { \Drupal::state()->set('entity_test.multi_column', TRUE); $this->applyEntityUpdates('entity_test_mulrev'); // Refresh the storage. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php index dcc8158c9f3..fc5f662be94 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php @@ -31,7 +31,7 @@ class ContentEntityNullStorageTest extends KernelTestBase { * * @see \Drupal\Core\Entity\Query\Null\Query */ - public function testEntityQuery() { + public function testEntityQuery(): void { $this->assertSame(0, \Drupal::entityQuery('contact_message')->accessCheck(FALSE)->count()->execute(), 'Counting a null storage returns 0.'); $this->assertSame([], \Drupal::entityQuery('contact_message')->accessCheck(FALSE)->execute(), 'Querying a null storage returns an empty array.'); $this->assertSame([], \Drupal::entityQuery('contact_message')->accessCheck(FALSE)->condition('contact_form', 'test')->execute(), 'Querying a null storage returns an empty array and conditions are ignored.'); @@ -44,7 +44,7 @@ class ContentEntityNullStorageTest extends KernelTestBase { * * @see \Drupal\Core\Entity\Event\BundleConfigImportValidate */ - public function testDeleteThroughImport() { + public function testDeleteThroughImport(): void { $this->installConfig(['system']); $contact_form = ContactForm::create(['id' => 'test', 'label' => 'Test contact form']); $contact_form->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php index 0ee23a8e8d4..8bf86c67734 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php @@ -52,7 +52,7 @@ class ContentEntityStorageBaseTest extends KernelTestBase { /** * @covers ::create */ - public function testReCreate() { + public function testReCreate(): void { $storage = $this->container->get('entity_type.manager')->getStorage('entity_test'); $values = $storage->create(['type' => 'test_bundle'])->toArray(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php index 7401f2d0206..1fc832dda5c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php @@ -66,7 +66,7 @@ class CreateSampleEntityTest extends KernelTestBase { * * @covers ::createWithSampleValues */ - public function testSampleValueContentEntity() { + public function testSampleValueContentEntity(): void { foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $definition) { if ($definition->entityClassImplements(FieldableEntityInterface::class)) { $label = $definition->getKey('label'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php index 16b3b98ae0a..6dcdbd0bffd 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php @@ -78,7 +78,7 @@ class DefaultTableMappingIntegrationTest extends EntityKernelTestBase { * * @covers ::getFieldTableName */ - public function testGetFieldTableName() { + public function testGetFieldTableName(): void { // Test the field table name for a single-valued base field, which is stored // in the entity's base table. $expected = 'entity_test_mulrev'; @@ -98,7 +98,7 @@ class DefaultTableMappingIntegrationTest extends EntityKernelTestBase { /** * @covers ::getAllFieldTableNames */ - public function testGetAllFieldTableNames() { + public function testGetAllFieldTableNames(): void { // Check a field that is stored in all the shared tables. $expected = [ 'entity_test_mulrev', @@ -137,7 +137,7 @@ class DefaultTableMappingIntegrationTest extends EntityKernelTestBase { * * @covers ::getTableNames */ - public function testGetTableNames() { + public function testGetTableNames(): void { $storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_mulrev'); $dedicated_data_table = $this->tableMapping->getDedicatedDataTableName($storage_definitions['multivalued_base_field']); $dedicated_revision_table = $this->tableMapping->getDedicatedRevisionTableName($storage_definitions['multivalued_base_field']); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php index 4fc3958421e..bd7ec5c89c7 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php @@ -213,7 +213,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements /** * Tests valid entries in the EntityAutocomplete Form API element. */ - public function testValidEntityAutocompleteElement() { + public function testValidEntityAutocompleteElement(): void { $form_state = (new FormState()) ->setValues([ 'single' => $this->getAutocompleteInput($this->referencedEntities[0]), @@ -293,7 +293,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements /** * Tests invalid entries in the EntityAutocomplete Form API element. */ - public function testInvalidEntityAutocompleteElement() { + public function testInvalidEntityAutocompleteElement(): void { $form_builder = $this->container->get('form_builder'); // Test 'single' with an entity label that doesn't exist @@ -343,7 +343,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements /** * Tests that access is properly checked by the EntityAutocomplete element. */ - public function testEntityAutocompleteAccess() { + public function testEntityAutocompleteAccess(): void { $form_builder = $this->container->get('form_builder'); $form = $form_builder->getForm($this); @@ -372,7 +372,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements * * E.g. This can happen with GET form parameters. */ - public function testEntityAutocompleteIdInput() { + public function testEntityAutocompleteIdInput(): void { /** @var \Drupal\Core\Form\FormBuilderInterface $form_builder */ $form_builder = $this->container->get('form_builder'); // $form = $form_builder->getForm($this); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index 933f8566f5e..f26280096eb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -57,7 +57,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * Ensures user labels are accessible for everyone. */ - public function testUserLabelAccess() { + public function testUserLabelAccess(): void { // Set up a non-admin user. \Drupal::currentUser()->setAccount($this->createUser([], NULL, FALSE, ['uid' => 2])); @@ -111,7 +111,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * Ensures entity access is properly working. */ - public function testEntityAccess() { + public function testEntityAccess(): void { // Set up a non-admin user that is allowed to view test entities. \Drupal::currentUser()->setAccount($this->createUser(['view test entity'], NULL, FALSE, ['uid' => 2])); @@ -154,7 +154,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { * @see \Drupal\entity_test\EntityTestAccessControlHandler::checkAccess() * @see entity_test_entity_access() */ - public function testDefaultEntityAccess() { + public function testDefaultEntityAccess(): void { // Set up a non-admin user that is allowed to view test entities. \Drupal::currentUser()->setAccount($this->createUser(['view test entity'], NULL, FALSE, ['uid' => 2])); $entity = EntityTest::create([ @@ -173,7 +173,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * Ensures that the default handler is used as a fallback. */ - public function testEntityAccessDefaultController() { + public function testEntityAccessDefaultController(): void { // The implementation requires that the global user id can be loaded. \Drupal::currentUser()->setAccount($this->createUser([], NULL, FALSE, ['uid' => 2])); @@ -194,7 +194,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * Ensures entity access for entity translations is properly working. */ - public function testEntityTranslationAccess() { + public function testEntityTranslationAccess(): void { // Set up a non-admin user that is allowed to view test entity translations. \Drupal::currentUser()->setAccount($this->createUser(['view test entity translations'], NULL, FALSE, ['uid' => 2])); @@ -224,7 +224,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { * * @see entity_test_entity_access() */ - public function testEntityWithoutUuidAccessCache() { + public function testEntityWithoutUuidAccessCache(): void { $account = $this->createUser(); $entity1 = EntityTestNoUuid::create([ @@ -253,7 +253,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { * * @see entity_test_entity_access() */ - public function testEntityWithUuidAccessCache() { + public function testEntityWithUuidAccessCache(): void { $account = $this->createUser(); $entity1 = EntityTestRev::create([ @@ -280,7 +280,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { /** * Tests hook invocations. */ - public function testHooks() { + public function testHooks(): void { $state = $this->container->get('state'); $entity = EntityTest::create([ 'name' => 'test', @@ -304,7 +304,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { * @covers ::fieldAccess * @dataProvider providerTestFieldAccess */ - public function testFieldAccess($entity_class, array $entity_create_values, $expected_id_create_access) { + public function testFieldAccess($entity_class, array $entity_create_values, $expected_id_create_access): void { // Set up a non-admin user that is allowed to create and update test // entities. \Drupal::currentUser()->setAccount($this->createUser(['administer entity_test content'], NULL, FALSE, ['uid' => 2])); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php index bef50bd5bfd..07ae276d8e7 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php @@ -33,7 +33,7 @@ class EntityApiTest extends EntityKernelTestBase { /** * Tests basic CRUD functionality of the Entity API. */ - public function testCRUD() { + public function testCRUD(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->assertCRUD($entity_type, $this->createUser()); @@ -147,7 +147,7 @@ class EntityApiTest extends EntityKernelTestBase { * * Entities should be returned in the same order as the passed IDs. */ - public function testLoadMultiple() { + public function testLoadMultiple(): void { // Entity load. $storage = $this->container->get('entity_type.manager')->getStorage('entity_test'); @@ -204,7 +204,7 @@ class EntityApiTest extends EntityKernelTestBase { /** * Tests that exceptions are thrown when saving or deleting an entity. */ - public function testEntityStorageExceptionHandling() { + public function testEntityStorageExceptionHandling(): void { $entity = EntityTest::create(['name' => 'test']); try { $GLOBALS['entity_test_throw_exception'] = TRUE; @@ -249,7 +249,7 @@ class EntityApiTest extends EntityKernelTestBase { /** * Tests that resaving a revision with a different revision ID throws an exception. */ - public function testUpdateWithRevisionId() { + public function testUpdateWithRevisionId(): void { $storage = \Drupal::entityTypeManager()->getStorage('entity_test_mulrev'); // Create a new entity. @@ -267,7 +267,7 @@ class EntityApiTest extends EntityKernelTestBase { /** * Tests that resaving an entity with a different entity ID throws an exception. */ - public function testUpdateWithId() { + public function testUpdateWithId(): void { $storage = \Drupal::entityTypeManager()->getStorage('entity_test_mulrev'); // Create a new entity. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php index eaf38ece6d9..43c24e42e87 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php @@ -44,7 +44,7 @@ class EntityAutocompleteTest extends EntityKernelTestBase { /** * Tests autocompletion edge cases with slashes in the names. */ - public function testEntityReferenceAutocompletion() { + public function testEntityReferenceAutocompletion(): void { // Add an entity with a slash in its name. $entity_1 = $this->container->get('entity_type.manager') ->getStorage($this->entityType) @@ -145,7 +145,7 @@ class EntityAutocompleteTest extends EntityKernelTestBase { /** * Tests that missing or invalid selection setting key are handled correctly. */ - public function testSelectionSettingsHandling() { + public function testSelectionSettingsHandling(): void { $entity_reference_controller = EntityAutocompleteController::create($this->container); $request = Request::create('entity_reference_autocomplete/' . $this->entityType . '/default'); $request->query->set('q', $this->randomString()); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBaseTest.php index 2ca05368bdc..893213ee500 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBaseTest.php @@ -32,7 +32,7 @@ class EntityBaseTest extends EntityKernelTestBase { * * @covers ::getTypedData */ - public function testGetTypedData() { + public function testGetTypedData(): void { $bundle = EntityTestBundle::create([ 'id' => $this->randomMachineName(), ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleConditionTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleConditionTest.php index a80fce19cac..1ad86c1966e 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleConditionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleConditionTest.php @@ -33,7 +33,7 @@ class EntityBundleConditionTest extends EntityKernelTestBase { /** * Tests conditions. */ - public function testConditions() { + public function testConditions(): void { $this->createUser(); // Get some entities of various bundles to check against. $page = EntityTestWithBundle::create(['type' => 'page', 'name' => $this->randomMachineName()]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php index 0290d587adf..4ef34422c3c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php @@ -46,7 +46,7 @@ class EntityBundleFieldTest extends EntityKernelTestBase { /** * Tests making use of a custom bundle field. */ - public function testCustomBundleFieldUsage() { + public function testCustomBundleFieldUsage(): void { entity_test_create_bundle('custom', NULL, 'entity_test_update'); // Check that an entity with bundle entity_test does not have the custom diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php index 718dc4767d6..9e87ad7d52b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php @@ -20,7 +20,7 @@ class EntityBundleListenerTest extends EntityKernelTestBase { * * @covers ::onBundleCreate */ - public function testOnBundleCreate() { + public function testOnBundleCreate(): void { $field_map = $this->container->get('entity_field.manager')->getFieldMap(); $expected = [ 'entity_test' => 'entity_test', diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php index 63bc66b8190..02ebbb76e34 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php @@ -99,7 +99,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on blocks. */ - public function testBlockHooks() { + public function testBlockHooks(): void { $entity = Block::create([ 'id' => 'stark_test_html', 'plugin' => 'test_html', @@ -154,7 +154,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on comments. */ - public function testCommentHooks() { + public function testCommentHooks(): void { $account = $this->createUser(); NodeType::create([ 'type' => 'article', @@ -239,7 +239,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on files. */ - public function testFileHooks() { + public function testFileHooks(): void { $this->installEntitySchema('file'); $url = 'public://entity_crud_hook_test.file'; @@ -304,7 +304,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on nodes. */ - public function testNodeHooks() { + public function testNodeHooks(): void { $account = $this->createUser(); $node = Node::create([ @@ -368,7 +368,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on taxonomy terms. */ - public function testTaxonomyTermHooks() { + public function testTaxonomyTermHooks(): void { $this->installEntitySchema('taxonomy_term'); $vocabulary = Vocabulary::create([ @@ -437,7 +437,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on taxonomy vocabularies. */ - public function testTaxonomyVocabularyHooks() { + public function testTaxonomyVocabularyHooks(): void { $this->installEntitySchema('taxonomy_term'); $vocabulary = Vocabulary::create([ @@ -496,7 +496,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests hook invocations for CRUD operations on users. */ - public function testUserHooks() { + public function testUserHooks(): void { $account = User::create([ 'name' => 'Test user', 'mail' => 'test@example.com', @@ -553,7 +553,7 @@ class EntityCrudHookTest extends EntityKernelTestBase { /** * Tests rollback from failed entity save. */ - public function testEntityRollback() { + public function testEntityRollback(): void { // Create a block. try { EntityTest::create(['name' => 'fail_insert'])->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php index 1b4bc5f688a..81338be40eb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php @@ -205,7 +205,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { * * @dataProvider dataTestDecoupledPendingRevisions */ - public function testDecoupledPendingRevisions($sequence) { + public function testDecoupledPendingRevisions($sequence): void { $revision_id = $this->doTestEditSequence($sequence); $this->assertCount($revision_id, $sequence); } @@ -266,7 +266,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { * * @dataProvider dataTestUntranslatableFields */ - public function testUntranslatableFields($sequence, $default_translation_affected) { + public function testUntranslatableFields($sequence, $default_translation_affected): void { // Configure the untranslatable fields edit mode. $this->state->set('entity_test.untranslatable_fields.default_translation_affected', $default_translation_affected); $this->bundleInfo->clearCachedBundles(); @@ -500,7 +500,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { * @covers ::createRevision * @covers \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityUntranslatableFieldsConstraintValidator::validate */ - public function testMultipleTranslationChanges() { + public function testMultipleTranslationChanges(): void { // Configure the untranslatable fields edit mode. $this->state->set('entity_test.untranslatable_fields.default_translation_affected', TRUE); $this->bundleInfo->clearCachedBundles(); @@ -526,7 +526,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { /** * Tests that internal properties are preserved while creating a new revision. */ - public function testInternalProperties() { + public function testInternalProperties(): void { $entity = EntityTestMulRev::create(); $this->doTestInternalProperties($entity); @@ -559,7 +559,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { * * @covers ::createRevision */ - public function testRemovedTranslations() { + public function testRemovedTranslations(): void { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = EntityTestMulRev::create(['name' => 'Test 1.1 EN']); $this->storage->save($entity); @@ -594,7 +594,7 @@ class EntityDecoupledTranslationRevisionsTest extends EntityKernelTestBase { * * @covers ::createRevision */ - public function testCreateRevisionHook() { + public function testCreateRevisionHook(): void { $entity = EntityTestMulRev::create(); $entity->get('name')->value = 'revision_create_test_en'; $this->storage->save($entity); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php index 2994c5c8191..7d0ea21b188 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php @@ -80,7 +80,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests that new entity type definitions are correctly handled. */ - public function testNewEntityType() { + public function testNewEntityType(): void { $entity_type_id = 'entity_test_new'; $schema = $this->database->schema(); @@ -100,7 +100,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests when no definition update is needed. */ - public function testNoUpdates() { + public function testNoUpdates(): void { // Ensure that the definition update manager reports no updates. $this->assertFalse($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that no updates are needed.'); $this->assertSame([], $this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports an empty change summary.'); @@ -110,7 +110,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating entity schema when there are no existing entities. */ - public function testEntityTypeUpdateWithoutData() { + public function testEntityTypeUpdateWithoutData(): void { // The 'entity_test_update' entity type starts out non-revisionable, so // ensure the revision table hasn't been created during setUp(). $this->assertFalse($this->database->schema()->tableExists('entity_test_update_revision'), 'Revision table not created for entity_test_update.'); @@ -138,7 +138,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating entity schema when there are entity storage changes. */ - public function testEntityTypeUpdateWithEntityStorageChange() { + public function testEntityTypeUpdateWithEntityStorageChange(): void { // Update the entity type to be revisionable and try to apply the update. // It's expected to throw an exception. $entity_type = $this->getUpdatedEntityTypeDefinition(TRUE, FALSE); @@ -156,7 +156,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::installFieldableEntityType */ - public function testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation() { + public function testInstallAdditionalBaseFieldDuringFieldableEntityTypeInstallation(): void { $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update'); $field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update'); @@ -178,7 +178,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::installFieldableEntityType */ - public function testInstallFieldableEntityTypeWithoutInCodeDefinition() { + public function testInstallFieldableEntityTypeWithoutInCodeDefinition(): void { $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update'); $field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update'); @@ -196,7 +196,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::updateEntityType */ - public function testUpdateEntityTypeWithoutInCodeDefinition() { + public function testUpdateEntityTypeWithoutInCodeDefinition(): void { $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update'); // Remove the entity type definition. This is the same thing as removing the @@ -216,7 +216,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::updateFieldableEntityType */ - public function testUpdateFieldableEntityTypeWithoutInCodeDefinition() { + public function testUpdateFieldableEntityTypeWithoutInCodeDefinition(): void { $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update'); $field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update'); @@ -238,7 +238,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::uninstallEntityType */ - public function testUninstallEntityTypeWithoutInCodeDefinition() { + public function testUninstallEntityTypeWithoutInCodeDefinition(): void { $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update'); // Remove the entity type definition. This is the same thing as removing the @@ -256,7 +256,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @covers ::uninstallEntityType */ - public function testUninstallRevisionableEntityTypeWithoutInCodeDefinition() { + public function testUninstallRevisionableEntityTypeWithoutInCodeDefinition(): void { $this->updateEntityTypeToRevisionable(TRUE); $entity_type = $this->entityDefinitionUpdateManager->getEntityType('entity_test_update'); @@ -273,7 +273,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests creating, updating, and deleting a base field if no entities exist. */ - public function testBaseFieldCreateUpdateDeleteWithoutData() { + public function testBaseFieldCreateUpdateDeleteWithoutData(): void { // Add a base field, ensure the update manager reports it, and the update // creates its schema. $this->addBaseField(); @@ -334,7 +334,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * See testBaseFieldCreateUpdateDeleteWithoutData() for more details */ - public function testBaseFieldWithoutLabelCreateUpdateDelete() { + public function testBaseFieldWithoutLabelCreateUpdateDelete(): void { // Add a base field, ensure the update manager reports it with the // field id. $this->addBaseField('string', 'entity_test_update', FALSE, FALSE); @@ -362,7 +362,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests creating, updating, and deleting a bundle field if no entities exist. */ - public function testBundleFieldCreateUpdateDeleteWithoutData() { + public function testBundleFieldCreateUpdateDeleteWithoutData(): void { // Add a bundle field, ensure the update manager reports it, and the update // creates its schema. $this->addBundleField(); @@ -403,7 +403,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @see testBaseFieldDeleteWithExistingData() */ - public function testBaseFieldCreateDeleteWithExistingEntities() { + public function testBaseFieldCreateDeleteWithExistingEntities(): void { // Save an entity. $name = $this->randomString(); $storage = $this->entityTypeManager->getStorage('entity_test_update'); @@ -459,7 +459,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @see testBundleFieldDeleteWithExistingData() */ - public function testBundleFieldCreateDeleteWithExistingEntities() { + public function testBundleFieldCreateDeleteWithExistingEntities(): void { // Save an entity. $name = $this->randomString(); $storage = $this->entityTypeManager->getStorage('entity_test_update'); @@ -519,7 +519,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @dataProvider baseFieldDeleteWithExistingDataTestCases */ - public function testBaseFieldDeleteWithExistingData($entity_type_id, $create_entity_revision, $base_field_revisionable, $create_entity_translation) { + public function testBaseFieldDeleteWithExistingData($entity_type_id, $create_entity_revision, $base_field_revisionable, $create_entity_translation): void { // Enable an additional language. ConfigurableLanguage::createFromLangcode('ro')->save(); @@ -739,7 +739,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests deleting a bundle field when it has existing data. */ - public function testBundleFieldDeleteWithExistingData() { + public function testBundleFieldDeleteWithExistingData(): void { /** @var \Drupal\Core\Entity\Sql\SqlEntityStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_update'); $schema_handler = $this->database->schema(); @@ -814,7 +814,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating a base field when it has existing data. */ - public function testBaseFieldUpdateWithExistingData() { + public function testBaseFieldUpdateWithExistingData(): void { // Add the base field and run the update. $this->addBaseField(); $this->applyEntityUpdates(); @@ -837,7 +837,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating a bundle field when it has existing data. */ - public function testBundleFieldUpdateWithExistingData() { + public function testBundleFieldUpdateWithExistingData(): void { // Add the bundle field and run the update. $this->addBundleField(); $this->applyEntityUpdates(); @@ -861,7 +861,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating a bundle field when the entity type schema has changed. */ - public function testBundleFieldUpdateWithEntityTypeSchemaUpdate() { + public function testBundleFieldUpdateWithEntityTypeSchemaUpdate(): void { // Add the bundle field and run the update. $this->addBundleField(); $this->applyEntityUpdates(); @@ -880,7 +880,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests creating and deleting a multi-field index when there are no existing entities. */ - public function testEntityIndexCreateDeleteWithoutData() { + public function testEntityIndexCreateDeleteWithoutData(): void { // Add an entity index and ensure the update manager reports that as an // update to the entity type. $this->addEntityIndex(); @@ -934,7 +934,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests creating a multi-field index when there are existing entities. */ - public function testEntityIndexCreateWithData() { + public function testEntityIndexCreateWithData(): void { // Save an entity. $name = $this->randomString(); $entity = $this->entityTypeManager->getStorage('entity_test_update')->create(['name' => $name]); @@ -952,7 +952,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests entity type and field storage definition events. */ - public function testDefinitionEvents() { + public function testDefinitionEvents(): void { /** @var \Drupal\entity_test\EntityTestDefinitionSubscriber $event_subscriber */ $event_subscriber = $this->container->get('entity_test.definition.subscriber'); $event_subscriber->enableEventTracking(); @@ -1029,7 +1029,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests applying single updates. */ - public function testSingleActionCalls() { + public function testSingleActionCalls(): void { $db_schema = $this->database->schema(); // Ensure that a non-existing entity type cannot be installed. @@ -1107,7 +1107,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @see Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::createSharedTableSchema */ - public function testCreateFieldAndIndexOnSharedTable() { + public function testCreateFieldAndIndexOnSharedTable(): void { $this->addBaseField(); $this->addBaseFieldIndex(); $this->applyEntityUpdates(); @@ -1125,7 +1125,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @see Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::onEntityTypeUpdate */ - public function testCreateIndexUsingEntityStorageSchemaWithData() { + public function testCreateIndexUsingEntityStorageSchemaWithData(): void { // Save an entity. $name = $this->randomString(); $storage = $this->entityTypeManager->getStorage('entity_test_update'); @@ -1152,7 +1152,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests updating a base field when it has existing data. */ - public function testBaseFieldEntityKeyUpdateWithExistingData() { + public function testBaseFieldEntityKeyUpdateWithExistingData(): void { // Add the base field and run the update. $this->addBaseField(); $this->applyEntityUpdates(); @@ -1204,7 +1204,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Check that field schema is correctly handled with long-named fields. */ - public function testLongNameFieldIndexes() { + public function testLongNameFieldIndexes(): void { $this->addLongNameBaseField(); $entity_type_id = 'entity_test_update'; $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); @@ -1217,7 +1217,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests adding a base field with initial values. */ - public function testInitialValue() { + public function testInitialValue(): void { $storage = \Drupal::entityTypeManager()->getStorage('entity_test_update'); $db_schema = $this->database->schema(); @@ -1248,7 +1248,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { * * @dataProvider initialValueFromFieldTestCases */ - public function testInitialValueFromField($default_initial_value, $expected_value) { + public function testInitialValueFromField($default_initial_value, $expected_value): void { $storage = \Drupal::entityTypeManager()->getStorage('entity_test_update'); $db_schema = $this->database->schema(); @@ -1322,7 +1322,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests the error handling when using initial values from another field. */ - public function testInitialValueFromFieldErrorHandling() { + public function testInitialValueFromFieldErrorHandling(): void { // Check that setting invalid values for 'initial value from field' doesn't // work. try { @@ -1376,7 +1376,7 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { /** * @covers ::getEntityTypes */ - public function testGetEntityTypes() { + public function testGetEntityTypes(): void { $entity_type_definitions = $this->entityDefinitionUpdateManager->getEntityTypes(); // Ensure that we have at least one entity type to check below. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php index 0337fbd63e3..b7b65c33bbb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php @@ -60,7 +60,7 @@ class EntityDeriverTest extends KernelTestBase { * * @dataProvider derivativesProvider */ - public function testDerivatives($data_type, $expect_exception) { + public function testDerivatives($data_type, $expect_exception): void { if ($expect_exception) { $this->expectException(PluginNotFoundException::class); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php index 9d70fba8620..7514533966c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php @@ -43,7 +43,7 @@ class EntityDisplayBaseTest extends KernelTestBase { /** * @covers ::preSave */ - public function testPreSave() { + public function testPreSave(): void { $entity_display = EntityViewDisplay::create([ 'targetEntityType' => 'entity_test', 'bundle' => 'entity_test', @@ -80,7 +80,7 @@ class EntityDisplayBaseTest extends KernelTestBase { /** * @covers ::onDependencyRemoval */ - public function testOnDependencyRemoval() { + public function testOnDependencyRemoval(): void { // Create a comment field for entity_test. $comment_bundle = CommentType::create([ 'id' => 'entity_test', diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php index e5fa1ec446a..51d90fdd24c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayFormBaseTest.php @@ -24,7 +24,7 @@ class EntityDisplayFormBaseTest extends KernelTestBase { /** * @covers ::copyFormValuesToEntity */ - public function testCopyFormValuesToEntity() { + public function testCopyFormValuesToEntity(): void { $field_values = []; $entity = $this->prophesize(EntityDisplayInterface::class); $entity->getPluginCollections()->willReturn([]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php index 8c3a1c1ed24..5ffd220dcc3 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php @@ -61,7 +61,7 @@ class EntityDisplayRepositoryTest extends KernelTestBase { /** * @covers ::getViewDisplay */ - public function testViewDisplay() { + public function testViewDisplay(): void { $display = $this->displayRepository->getViewDisplay('user', 'user'); $this->assertInstanceOf(EntityViewDisplayInterface::class, $display); $this->assertTrue($display->isNew(), 'Default view display was created on demand.'); @@ -83,7 +83,7 @@ class EntityDisplayRepositoryTest extends KernelTestBase { /** * @covers ::getFormDisplay */ - public function testFormDisplay() { + public function testFormDisplay(): void { $display = $this->displayRepository->getFormDisplay('user', 'user'); $this->assertInstanceOf(EntityFormDisplayInterface::class, $display); $this->assertTrue($display->isNew(), 'Default form display was created on demand.'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDuplicateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDuplicateTest.php index 7eb127d301b..a1b32dd60c3 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDuplicateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDuplicateTest.php @@ -30,7 +30,7 @@ class EntityDuplicateTest extends EntityKernelTestBase { /** * Tests duplicating a non-default revision. */ - public function testDuplicateNonDefaultRevision() { + public function testDuplicateNonDefaultRevision(): void { $entity = EntityTestRev::create([ 'name' => 'First Revision', ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php index be19a2b5983..4641f58f40a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php @@ -32,7 +32,7 @@ class EntityFieldDefaultValueTest extends EntityKernelTestBase { /** * Tests default values on entities and fields. */ - public function testDefaultValues() { + public function testDefaultValues(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->assertDefaultValues($entity_type); @@ -61,7 +61,7 @@ class EntityFieldDefaultValueTest extends EntityKernelTestBase { /** * Tests custom default value callbacks. */ - public function testDefaultValueCallback() { + public function testDefaultValueCallback(): void { $entity = $this->entityTypeManager->getStorage('entity_test_default_value')->create(); // The description field has a default value callback for testing, see // entity_test_field_default_value(). diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index af8331e4663..0217513df6d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -103,7 +103,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Test setting field values on revisionable entities. */ - public function testFieldEntityRevisionWrite() { + public function testFieldEntityRevisionWrite(): void { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); @@ -136,7 +136,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests reading and writing properties and field items. */ - public function testReadWrite() { + public function testReadWrite(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestReadWrite($entity_type); @@ -402,7 +402,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tries to save and load an entity again. */ - public function testSave() { + public function testSave(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestSave($entity_type); @@ -439,7 +439,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests introspection and getting metadata upfront. */ - public function testIntrospection() { + public function testIntrospection(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestIntrospection($entity_type); @@ -543,7 +543,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests iterating over properties. */ - public function testIterator() { + public function testIterator(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestIterator($entity_type); @@ -582,7 +582,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests working with the entity based upon the TypedData API. */ - public function testDataStructureInterfaces() { + public function testDataStructureInterfaces(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestDataStructureInterfaces($entity_type); @@ -654,7 +654,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Makes sure data types are correctly derived for all entity types. */ - public function testDataTypes() { + public function testDataTypes(): void { $types = \Drupal::typedDataManager()->getDefinitions(); foreach (entity_test_entity_types() as $entity_type) { $this->assertNotEmpty($types['entity:' . $entity_type]['class'], 'Entity data type registered.'); @@ -670,7 +670,7 @@ class EntityFieldTest extends EntityKernelTestBase { * * @see entity_test_entity_base_field_info_alter() */ - public function testBaseFieldNonExistingBaseField() { + public function testBaseFieldNonExistingBaseField(): void { $this->entityTypeManager->getStorage('node_type')->create([ 'type' => 'page', 'name' => 'page', @@ -692,7 +692,7 @@ class EntityFieldTest extends EntityKernelTestBase { * * @see entity_test_entity_base_field_info_alter() */ - public function testFieldOverrideBundleField() { + public function testFieldOverrideBundleField(): void { // First make sure the bundle field override in code, which is provided by // the test entity works. entity_test_create_bundle('some_test_bundle', 'Some test bundle', 'entity_test_field_override'); @@ -720,7 +720,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests validation constraints provided by the Entity API. */ - public function testEntityConstraintValidation() { + public function testEntityConstraintValidation(): void { $entity = $this->createTestEntity('entity_test'); $entity->save(); // Create a reference field item and let it reference the entity. @@ -774,7 +774,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests getting processed property values via a computed property. */ - public function testComputedProperties() { + public function testComputedProperties(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestComputedProperties($entity_type); @@ -784,7 +784,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests all the interaction points of a computed field. */ - public function testComputedFields() { + public function testComputedFields(): void { $this->installEntitySchema('entity_test_computed_field'); \Drupal::state()->set('entity_test_computed_field_item_list_value', ['foo computed']); @@ -916,7 +916,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests an entity reference computed field. */ - public function testEntityReferenceComputedField() { + public function testEntityReferenceComputedField(): void { $this->installEntitySchema('entity_test_computed_field'); // Create 2 entities to be referenced. @@ -964,7 +964,7 @@ class EntityFieldTest extends EntityKernelTestBase { /** * Tests explicit entity ID assignment. */ - public function testEntityIdAssignment() { + public function testEntityIdAssignment(): void { $entity_type = 'entity_test'; /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityHasFieldConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityHasFieldConstraintValidatorTest.php index 8b0daa31dd3..c53122ad5d5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityHasFieldConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityHasFieldConstraintValidatorTest.php @@ -28,7 +28,7 @@ class EntityHasFieldConstraintValidatorTest extends EntityKernelTestBase { $this->createUser(); } - public function testValidation() { + public function testValidation(): void { $this->state->set('entity_test_constraints.build', [ 'EntityHasField' => 'body', ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBaseTest.php index 52e4cc792e7..edcfa268f22 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBaseTest.php @@ -22,7 +22,7 @@ class EntityKernelTestBaseTest extends EntityKernelTestBase { /** * Tests that the current user is set up correctly. */ - public function testSetUpCurrentUser() { + public function testSetUpCurrentUser(): void { $account = $this->setUpCurrentUser(); $current_user = \Drupal::currentUser(); $this->assertSame($account->id(), $current_user->id()); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKeysTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKeysTest.php index caef4ae12a2..abac7914257 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityKeysTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKeysTest.php @@ -19,7 +19,7 @@ class EntityKeysTest extends EntityKernelTestBase { * * @dataProvider multipleKeysCacheTestCases */ - public function testMultipleKeysCache($translatable) { + public function testMultipleKeysCache($translatable): void { $this->state->set('entity_test.additional_base_field_definitions', [ 'test_field' => BaseFieldDefinition::create('string')->setTranslatable($translatable), ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityLoadByUuidTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityLoadByUuidTest.php index 8e9c95e6f21..0ff1c38fb4b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityLoadByUuidTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityLoadByUuidTest.php @@ -32,7 +32,7 @@ class EntityLoadByUuidTest extends KernelTestBase { /** * Ensures that ::loadEntityByUuid() doesn't apply access checking. */ - public function testLoadEntityByUuidAccessChecking() { + public function testLoadEntityByUuidAccessChecking(): void { \Drupal::state()->set('entity_test_query_access', TRUE); // Create two test entities. $entity_0 = EntityTest::create([ diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityNonRevisionableTranslatableFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityNonRevisionableTranslatableFieldTest.php index ae51362480b..255e68b35e4 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityNonRevisionableTranslatableFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityNonRevisionableTranslatableFieldTest.php @@ -39,7 +39,7 @@ class EntityNonRevisionableTranslatableFieldTest extends EntityKernelTestBase { /** * Tests translating a non-revisionable field. */ - public function testTranslatingNonRevisionableField() { + public function testTranslatingNonRevisionableField(): void { /** @var \Drupal\Core\Entity\ContentEntityBase $entity */ $entity = EntityTestMulRev::create(); $entity->set('non_rev_field', 'Hello'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php index ca3b771bd36..f0a2ae6d9d2 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php @@ -115,7 +115,7 @@ class EntityQueryAggregateTest extends EntityKernelTestBase { /** * Tests aggregation support. */ - public function testAggregation() { + public function testAggregation(): void { // Apply a simple groupby. $this->queryResult = $this->entityStorage->getAggregateQuery() ->accessCheck(FALSE) @@ -593,7 +593,7 @@ class EntityQueryAggregateTest extends EntityKernelTestBase { /** * Tests preparing a query and executing twice. */ - public function testRepeatedExecution() { + public function testRepeatedExecution(): void { $query = $this->entityStorage->getAggregateQuery() ->accessCheck(FALSE) ->groupBy('user_id'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php index 6f959e7ce2b..17be6152563 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php @@ -115,7 +115,7 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { /** * Tests querying. */ - public function testQuery() { + public function testQuery(): void { $storage = $this->container->get('entity_type.manager')->getStorage('entity_test'); // This returns the 0th entity as that's the only one pointing to the 0th // account. @@ -214,7 +214,7 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { /** * Tests the invalid specifier in the query relationship. */ - public function testInvalidSpecifier() { + public function testInvalidSpecifier(): void { $this->expectException(PluginNotFoundException::class); $this->container ->get('entity_type.manager') diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index 19b92455914..0b6941d6f04 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -177,7 +177,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests basic functionality. */ - public function testEntityQuery() { + public function testEntityQuery(): void { $greetings = $this->greetings; $figures = $this->figures; $this->queryResults = $this->storage @@ -401,7 +401,7 @@ class EntityQueryTest extends EntityKernelTestBase { * * Warning: this is complicated. */ - public function testSort() { + public function testSort(): void { $greetings = $this->greetings; $figures = $this->figures; // Order up and down on a number. @@ -496,7 +496,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests tablesort(). */ - public function testTableSort() { + public function testTableSort(): void { // While ordering on bundles do not give us a definite order, we can still // assert that all entities from one bundle are after the other as the // order dictates. @@ -552,7 +552,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests that count queries are separated across entity types. */ - public function testCount() { + public function testCount(): void { // Create a field with the same name in a different entity type. $field_name = $this->figures; $field_storage = FieldStorageConfig::create([ @@ -592,7 +592,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests that nested condition groups work as expected. */ - public function testNestedConditionGroups() { + public function testNestedConditionGroups(): void { // Query for all entities of the first bundle that have either a red // triangle as a figure or the Turkish greeting as a greeting. $query = $this->storage->getQuery()->accessCheck(FALSE); @@ -620,7 +620,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests that condition count returns expected number of conditions. */ - public function testConditionCount() { + public function testConditionCount(): void { // Query for all entities of the first bundle that // have red as a color AND are triangle shaped. $query = $this->storage->getQuery()->accessCheck(FALSE); @@ -645,7 +645,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests queries with delta conditions. */ - public function testDelta() { + public function testDelta(): void { $figures = $this->figures; // Test numeric delta value in field condition. $this->queryResults = $this->storage @@ -798,7 +798,7 @@ class EntityQueryTest extends EntityKernelTestBase { * * The tags and metadata should propagate to the SQL query object. */ - public function testMetaData() { + public function testMetaData(): void { field_test_memorize(); $query = $this->storage->getQuery()->accessCheck(FALSE); @@ -814,7 +814,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests case sensitive and in-sensitive query conditions. */ - public function testCaseSensitivity() { + public function testCaseSensitivity(): void { $bundle = $this->randomMachineName(); entity_test_create_bundle($bundle, entity_type: 'entity_test_mulrev'); @@ -1058,7 +1058,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests base fields with multiple columns. */ - public function testBaseFieldMultipleColumns() { + public function testBaseFieldMultipleColumns(): void { $this->enableModules(['taxonomy']); $this->installEntitySchema('taxonomy_term'); @@ -1117,7 +1117,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests pending revisions. */ - public function testPendingRevisions() { + public function testPendingRevisions(): void { // Ensure entity 14 is returned. $result = $this->storage ->getQuery() @@ -1228,7 +1228,7 @@ class EntityQueryTest extends EntityKernelTestBase { * * This covers a database driver's EntityQuery\Condition class. */ - public function testInjectionInCondition() { + public function testInjectionInCondition(): void { $this->expectException(\Exception::class); $this->queryResults = $this->storage ->getQuery() @@ -1241,7 +1241,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests that EntityQuery works when querying the same entity from two fields. */ - public function testWithTwoEntityReferenceFieldsToSameEntityType() { + public function testWithTwoEntityReferenceFieldsToSameEntityType(): void { // Create two entity reference fields referring 'entity_test' entities. $this->createEntityReferenceField('entity_test', 'entity_test', 'ref1', $this->randomMachineName(), 'entity_test'); $this->createEntityReferenceField('entity_test', 'entity_test', 'ref2', $this->randomMachineName(), 'entity_test'); @@ -1351,7 +1351,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests entity queries with condition on the revision metadata keys. */ - public function testConditionOnRevisionMetadataKeys() { + public function testConditionOnRevisionMetadataKeys(): void { $this->installModule('entity_test_revlog'); $this->installEntitySchema('entity_test_revlog'); @@ -1391,7 +1391,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Tests __toString(). */ - public function testToString() { + public function testToString(): void { $query = $this->storage->getQuery()->accessCheck(FALSE); $group_blue = $query->andConditionGroup()->condition("{$this->figures}.color", ['blue'], 'IN'); $group_red = $query->andConditionGroup()->condition("{$this->figures}.color", ['red'], 'IN'); @@ -1438,7 +1438,7 @@ class EntityQueryTest extends EntityKernelTestBase { /** * Test the accessCheck method is called. */ - public function testAccessCheckSpecified() { + public function testAccessCheckSpecified(): void { $this->expectException(QueryException::class); $this->expectExceptionMessage('Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().'); // We are purposely testing an entity query without access check, so we need diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php index 890c3188313..40d849d25f1 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -89,7 +89,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests reference field validation. */ - public function testEntityReferenceFieldValidation() { + public function testEntityReferenceFieldValidation(): void { // Test a valid reference. $referenced_entity = $this->container->get('entity_type.manager') ->getStorage($this->referencedEntityType) @@ -124,7 +124,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests the multiple target entities loader. */ - public function testReferencedEntitiesMultipleLoad() { + public function testReferencedEntitiesMultipleLoad(): void { // Create the parent entity. $entity = $this->container->get('entity_type.manager') ->getStorage($this->entityType) @@ -196,7 +196,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests referencing entities with string IDs. */ - public function testReferencedEntitiesStringId() { + public function testReferencedEntitiesStringId(): void { $field_name = 'entity_reference_string_id'; $this->installEntitySchema('entity_test_string_id'); $this->createEntityReferenceField( @@ -246,7 +246,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests all the possible ways to autocreate an entity via the API. */ - public function testAutocreateApi() { + public function testAutocreateApi(): void { $entity = $this->entityTypeManager ->getStorage($this->entityType) ->create(['name' => $this->randomString()]); @@ -374,7 +374,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests exception thrown with a missing target entity type. */ - public function testTargetEntityTypeMissing() { + public function testTargetEntityTypeMissing(): void { // Setup a test entity type with an entity reference field to an entity type // that doesn't exist. $definitions = [ @@ -394,7 +394,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests that the target entity is not unnecessarily loaded. */ - public function testTargetEntityNoLoad() { + public function testTargetEntityNoLoad(): void { // Setup a test entity type with an entity reference field to itself. We use // a special storage class throwing exceptions when a load operation is // triggered to be able to detect them. @@ -445,7 +445,7 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { /** * Tests the dependencies entity reference fields are created with. */ - public function testEntityReferenceFieldDependencies() { + public function testEntityReferenceFieldDependencies(): void { $field_name = 'user_reference_field'; $entity_type = 'entity_test'; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php index a218493c6dd..6fae5bf1177 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php @@ -46,7 +46,7 @@ class EntityReferenceSelectionSortTest extends EntityKernelTestBase { /** * Assert sorting by field and property. */ - public function testSort() { + public function testSort(): void { // Add text field to entity, to sort by. FieldStorageConfig::create([ 'field_name' => 'field_text', diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php index fa3d33df27d..b54ccc4deb0 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php @@ -78,7 +78,7 @@ class EntityRepositoryTest extends KernelTestBase { * @covers ::getActive * @covers ::getActiveMultiple */ - public function testGetActive() { + public function testGetActive(): void { $en_contexts = $this->getLanguageContexts('en'); // Check that when the entity does not exist NULL is returned. @@ -211,7 +211,7 @@ class EntityRepositoryTest extends KernelTestBase { * @covers ::getCanonical * @covers ::getCanonicalMultiple */ - public function testGetCanonical() { + public function testGetCanonical(): void { // Check that when the entity does not exist NULL is returned. $entity_type_id = 'entity_test_mul'; $canonical = $this->entityRepository->getActive($entity_type_id, -1); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php index f362161b9ec..3d75bf3b29d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php @@ -37,7 +37,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { /** * Tests if the translation object has the right revision id after new revision. */ - public function testNewRevisionAfterTranslation() { + public function testNewRevisionAfterTranslation(): void { $user = $this->createUser(); // Create a test entity. @@ -63,7 +63,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { /** * Tests if the translation object has the right revision id after new revision. */ - public function testRevertRevisionAfterTranslation() { + public function testRevertRevisionAfterTranslation(): void { $user = $this->createUser(); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_mulrev'); @@ -99,7 +99,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { /** * Tests the translation values when saving a pending revision. */ - public function testTranslationValuesWhenSavingPendingRevisions() { + public function testTranslationValuesWhenSavingPendingRevisions(): void { $user = $this->createUser(); /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_mulrev'); @@ -145,7 +145,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { /** * Tests changing the default revision flag is propagated to all translations. */ - public function testDefaultRevision() { + public function testDefaultRevision(): void { // Create a test entity with a translation, which will internally trigger // entity cloning for the new translation and create references for some of // the entity properties. @@ -170,7 +170,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { /** * @covers \Drupal\Core\Entity\ContentEntityBase::setNewRevision */ - public function testSetNewRevision() { + public function testSetNewRevision(): void { $user = $this->createUser(); // All revisionable entity variations have to have the same results. @@ -202,7 +202,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase { * * @covers \Drupal\Core\Entity\ContentEntityStorageBase::isAnyStoredRevisionTranslated */ - public function testIsAnyStoredRevisionTranslated() { + public function testIsAnyStoredRevisionTranslated(): void { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_mul'); $method = new \ReflectionMethod(get_class($storage), 'isAnyStoredRevisionTranslated'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php index ff9fa1c603d..163a0b5919a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php @@ -40,7 +40,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { /** * Tests getLoadedRevisionId() returns the correct ID throughout the process. */ - public function testLoadedRevisionId() { + public function testLoadedRevisionId(): void { // Create a basic EntityTestMulRev entity and save it. $entity = EntityTestMulRev::create(); $entity->save(); @@ -82,7 +82,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { /** * Tests the loaded revision ID after an entity re-save, clone and duplicate. */ - public function testLoadedRevisionIdWithNoNewRevision() { + public function testLoadedRevisionIdWithNoNewRevision(): void { // Create a basic EntityTestMulRev entity and save it. $entity = EntityTestMulRev::create(); $entity->save(); @@ -120,7 +120,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { /** * Tests the loaded revision ID for translatable entities. */ - public function testTranslatedLoadedRevisionId() { + public function testTranslatedLoadedRevisionId(): void { ConfigurableLanguage::createFromLangcode('fr')->save(); // Create a basic EntityTestMulRev entity and save it. @@ -161,7 +161,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { /** * Tests re-saving the entity in entity_test_entity_insert(). */ - public function testSaveInHookEntityInsert() { + public function testSaveInHookEntityInsert(): void { // Create an entity which will be saved again in entity_test_entity_insert(). $entity = EntityTestMulRev::create(['name' => 'EntityLoadedRevisionTest']); $entity->save(); @@ -175,7 +175,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { * * @covers ::isLatestRevision */ - public function testIsLatestRevision() { + public function testIsLatestRevision(): void { // Create a basic EntityTestMulRev entity and save it. $entity = EntityTestMulRev::create(); $entity->save(); @@ -208,7 +208,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { * @covers \Drupal\Core\Entity\ContentEntityStorageBase::getLatestRevisionId * @covers \Drupal\Core\Entity\ContentEntityStorageBase::getLatestTranslationAffectedRevisionId */ - public function testIsLatestAffectedRevisionTranslation() { + public function testIsLatestAffectedRevisionTranslation(): void { ConfigurableLanguage::createFromLangcode('it')->save(); // Create a basic EntityTestMulRev entity and save it. @@ -268,7 +268,7 @@ class EntityRevisionsTest extends EntityKernelTestBase { * * @covers \Drupal\Core\Entity\ContentEntityStorageBase::doSave */ - public function testDefaultRevisionFlag() { + public function testDefaultRevisionFlag(): void { // Create a basic EntityTestMulRev entity and save it. $entity = EntityTestMulRev::create(); $entity->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php index 6a2f44d16e3..27d9f983096 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php @@ -61,7 +61,7 @@ class EntitySchemaTest extends EntityKernelTestBase { /** * Tests the custom bundle field creation and deletion. */ - public function testCustomFieldCreateDelete() { + public function testCustomFieldCreateDelete(): void { // Install the module which adds the field. $this->installModule('entity_schema_test'); $storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update'); @@ -102,7 +102,7 @@ class EntitySchemaTest extends EntityKernelTestBase { /** * Tests that entity schema responds to changes in the entity type definition. */ - public function testEntitySchemaUpdate() { + public function testEntitySchemaUpdate(): void { $this->installModule('entity_schema_test'); $storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update'); \Drupal::service('field_storage_definition.listener')->onFieldStorageDefinitionCreate($storage_definitions['custom_base_field']); @@ -147,7 +147,7 @@ class EntitySchemaTest extends EntityKernelTestBase { * * @dataProvider providerTestPrimaryKeyUpdate */ - public function testPrimaryKeyUpdate($entity_type_id, $field_name) { + public function testPrimaryKeyUpdate($entity_type_id, $field_name): void { // EntityKernelTestBase::setUp() already installs the schema for the // 'entity_test' entity type. if ($entity_type_id !== 'entity_test') { @@ -304,7 +304,7 @@ class EntitySchemaTest extends EntityKernelTestBase { /** * Tests that modifying the UUID field for a translatable entity works. */ - public function testModifyingTranslatableColumnSchema() { + public function testModifyingTranslatableColumnSchema(): void { $this->installModule('entity_schema_test'); $this->updateEntityType(TRUE); $fields = ['revision_log', 'uuid']; @@ -321,7 +321,7 @@ class EntitySchemaTest extends EntityKernelTestBase { /** * Tests fields from an uninstalled module are removed from the schema. */ - public function testCleanUpStorageDefinition() { + public function testCleanUpStorageDefinition(): void { // Find all the entity types provided by the entity_test module and install // the schema for them. $entity_type_ids = []; @@ -376,7 +376,7 @@ class EntitySchemaTest extends EntityKernelTestBase { /** * Tests the installed storage schema for identifier fields. */ - public function testIdentifierSchema() { + public function testIdentifierSchema(): void { $this->installEntitySchema('entity_test_rev'); $key_value_store = \Drupal::keyValue('entity.storage_schema.sql'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php index d2e4dad930a..3ddc5f0e751 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php @@ -23,7 +23,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests language related methods of the Entity class. */ - public function testEntityLanguageMethods() { + public function testEntityLanguageMethods(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->doTestEntityLanguageMethods($entity_type); @@ -143,7 +143,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests multilingual properties. */ - public function testMultilingualProperties() { + public function testMultilingualProperties(): void { // Test all entity variations with data table support. foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) { $this->doTestMultilingualProperties($entity_type); @@ -306,7 +306,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests the Entity Translation API behavior. */ - public function testEntityTranslationAPI() { + public function testEntityTranslationAPI(): void { // Test all entity variations with data table support. foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) { $this->doTestEntityTranslationAPI($entity_type); @@ -574,7 +574,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests language fallback applied to field and entity translations. */ - public function testLanguageFallback() { + public function testLanguageFallback(): void { // Test all entity variations with data table support. foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) { $this->doTestLanguageFallback($entity_type); @@ -670,7 +670,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Check that field translatability is handled properly. */ - public function testFieldDefinitions() { + public function testFieldDefinitions(): void { // Check that field translatability can be altered to be enabled or disabled // in field definitions. $entity_type = 'entity_test_mulrev'; @@ -715,7 +715,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests that changing entity language does not break field language. */ - public function testLanguageChange() { + public function testLanguageChange(): void { // Test all entity variations with data table support. foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) { $this->doTestLanguageChange($entity_type); @@ -776,7 +776,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests how entity adapters work with translations. */ - public function testEntityAdapter() { + public function testEntityAdapter(): void { $entity_type = 'entity_test'; $default_langcode = 'en'; $values[$default_langcode] = ['name' => $this->randomString()]; @@ -800,7 +800,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests if entity references are correct after adding a new translation. */ - public function testFieldEntityReference() { + public function testFieldEntityReference(): void { $entity_type = 'entity_test_mul'; $controller = $this->entityTypeManager->getStorage($entity_type); /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ @@ -827,7 +827,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests that translation statuses are correct after removing translations. */ - public function testDeleteEntityTranslation() { + public function testDeleteEntityTranslation(): void { $entity_type = 'entity_test_mul'; $controller = $this->entityTypeManager->getStorage($entity_type); @@ -919,7 +919,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests the getTranslationStatus method. */ - public function testTranslationStatus() { + public function testTranslationStatus(): void { $entity_type = 'entity_test_mul'; $storage = $this->entityTypeManager->getStorage($entity_type); @@ -1000,7 +1000,7 @@ class EntityTranslationTest extends EntityLanguageTestBase { /** * Tests the translation object cache. */ - public function testTranslationObjectCache() { + public function testTranslationObjectCache(): void { $default_langcode = $this->langcodes[1]; $translation_langcode = $this->langcodes[2]; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php index 5bf885aadaa..fa088a8343f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php @@ -33,7 +33,7 @@ class EntityTypeConstraintValidatorTest extends EntityKernelTestBase { /** * Tests the EntityTypeConstraintValidator. */ - public function testValidation() { + public function testValidation(): void { // Create a typed data definition with an EntityType constraint. $entity_type = 'node'; $definition = DataDefinition::create('entity_reference') diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php index 120305db67f..6367d15eb9f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php @@ -22,7 +22,7 @@ class EntityTypeConstraintsTest extends EntityKernelTestBase { /** * Tests defining entity constraints via entity type annotations and hooks. */ - public function testConstraintDefinition() { + public function testConstraintDefinition(): void { // Test reading the annotation. There should be two constraints, the defined // constraint and the automatically added EntityChanged constraint. $entity_type = $this->entityTypeManager->getDefinition('entity_test_constraints'); @@ -60,7 +60,7 @@ class EntityTypeConstraintsTest extends EntityKernelTestBase { /** * Tests entity constraints are validated. */ - public function testConstraintValidation() { + public function testConstraintValidation(): void { $entity = $this->entityTypeManager->getStorage('entity_test_constraints')->create(); $entity->user_id->target_id = 0; $violations = $entity->validate(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php index 49723a93529..270c1c8f71f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php @@ -33,7 +33,7 @@ class EntityTypeTest extends KernelTestBase { /** * Tests that the EntityType object can be serialized. */ - public function testIsSerializable() { + public function testIsSerializable(): void { $entity_type = $this->setUpEntityType([]); $translation_service = new class () extends TranslationManager { diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php index 71939d354a7..a7c34efcd31 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php @@ -51,7 +51,7 @@ class EntityTypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata about fields. */ - public function testFields() { + public function testFields(): void { $field_definition = BaseFieldDefinition::create('integer'); // Fields are lists of complex data. $this->assertInstanceOf(ListDataDefinitionInterface::class, $field_definition); @@ -90,7 +90,7 @@ class EntityTypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata about entities. */ - public function testEntities() { + public function testEntities(): void { NodeType::create([ 'type' => 'article', 'name' => 'Article', @@ -132,7 +132,7 @@ class EntityTypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata from entity references. */ - public function testEntityReferences() { + public function testEntityReferences(): void { $reference_definition = DataReferenceDefinition::create('entity'); $this->assertInstanceOf(DataReferenceDefinitionInterface::class, $reference_definition); @@ -151,7 +151,7 @@ class EntityTypedDataDefinitionTest extends KernelTestBase { * * @dataProvider entityDefinitionIsInternalProvider */ - public function testEntityDefinitionIsInternal($internal, $expected) { + public function testEntityDefinitionIsInternal($internal, $expected): void { $entity_type_id = $this->randomMachineName(); $entity_type = $this->prophesize(EntityTypeInterface::class); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index ae4fb009464..984d8abca38 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -28,7 +28,7 @@ class EntityUUIDTest extends EntityKernelTestBase { /** * Tests UUID generation in entity CRUD operations. */ - public function testCRUD() { + public function testCRUD(): void { // All entity variations have to have the same results. foreach (entity_test_entity_types() as $entity_type) { $this->assertCRUD($entity_type); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php index 11afa0d2168..bce2dfa6d60 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php @@ -99,7 +99,7 @@ class EntityValidationTest extends EntityKernelTestBase { /** * Tests validating test entity types. */ - public function testValidation() { + public function testValidation(): void { // Ensure that the constraint manager is marked as cached cleared. // Use the protected property on the cache_clearer first to check whether @@ -195,7 +195,7 @@ class EntityValidationTest extends EntityKernelTestBase { /** * Tests composite constraints. */ - public function testCompositeConstraintValidation() { + public function testCompositeConstraintValidation(): void { $entity = $this->createTestEntity('entity_test_composite_constraint'); $violations = $entity->validate(); $this->assertEquals(0, $violations->count()); @@ -218,7 +218,7 @@ class EntityValidationTest extends EntityKernelTestBase { /** * Tests the EntityChangedConstraintValidator with multiple translations. */ - public function testEntityChangedConstraintOnConcurrentMultilingualEditing() { + public function testEntityChangedConstraintOnConcurrentMultilingualEditing(): void { $this->installEntitySchema('entity_test_mulrev_changed'); $storage = \Drupal::entityTypeManager() ->getStorage('entity_test_mulrev_changed'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php index 1c73452786e..fba7909ba65 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php @@ -41,7 +41,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests entity render cache handling. */ - public function testEntityViewBuilderCache() { + public function testEntityViewBuilderCache(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); $cache_contexts_manager = \Drupal::service("cache_contexts_manager"); @@ -96,7 +96,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests entity render cache with references. */ - public function testEntityViewBuilderCacheWithReferences() { + public function testEntityViewBuilderCacheWithReferences(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); $cache_contexts_manager = \Drupal::service("cache_contexts_manager"); @@ -163,7 +163,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests entity render cache toggling. */ - public function testEntityViewBuilderCacheToggling() { + public function testEntityViewBuilderCacheToggling(): void { $entity_test = $this->createTestEntity('entity_test'); $entity_test->save(); @@ -190,7 +190,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests weighting of display components. */ - public function testEntityViewBuilderWeight() { + public function testEntityViewBuilderWeight(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); @@ -212,7 +212,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests EntityViewBuilder::viewField() language awareness. */ - public function testViewField() { + public function testViewField(): void { // Allow access to view translations as well. Role::load(RoleInterface::ANONYMOUS_ID) ->grantPermission('view test entity translations') @@ -359,7 +359,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests that viewing an entity without template does not specify #theme. */ - public function testNoTemplate() { + public function testNoTemplate(): void { // Ensure that an entity type without explicit view builder uses the // default. $entity_type_manager = \Drupal::entityTypeManager(); @@ -378,7 +378,7 @@ class EntityViewBuilderTest extends EntityKernelTestBase { /** * Tests an entity type with an external canonical rel. */ - public function testExternalEntity() { + public function testExternalEntity(): void { $this->installEntitySchema('entity_test_external'); /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php index a895b7d4892..2e7fa432763 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewHookTest.php @@ -24,7 +24,7 @@ class EntityViewHookTest extends EntityKernelTestBase { /** * Tests hook_entity_display_build_alter(). */ - public function testHookEntityDisplayBuildAlter() { + public function testHookEntityDisplayBuildAlter(): void { entity_test_create_bundle('display_build_alter_bundle'); /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index bd6543f4e17..b9e8f2b8066 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -107,7 +107,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests field loading works correctly by inserting directly in the tables. */ - public function testFieldLoad() { + public function testFieldLoad(): void { $entity_type = $bundle = 'entity_test_rev'; /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); @@ -183,7 +183,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests field saving works correctly by reading directly from the tables. */ - public function testFieldWrite() { + public function testFieldWrite(): void { $entity_type = $bundle = 'entity_test_rev'; $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type) @@ -279,7 +279,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests that long entity type and field names do not break. */ - public function testLongNames() { + public function testLongNames(): void { // Use one of the longest entity_type names in core. $entity_type = $bundle = 'entity_test_multivalue_basefield'; $this->installEntitySchema('entity_test_multivalue_basefield'); @@ -320,7 +320,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests trying to update a field with data. */ - public function testUpdateFieldSchemaWithData() { + public function testUpdateFieldSchemaWithData(): void { $entity_type = 'entity_test_rev'; // Create a decimal 5.2 field and add some data. $field_storage = FieldStorageConfig::create([ @@ -353,7 +353,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests that failure to create fields is handled gracefully. */ - public function testFieldUpdateFailure() { + public function testFieldUpdateFailure(): void { // Create a text field. $field_storage = FieldStorageConfig::create([ 'field_name' => 'test_text', @@ -392,7 +392,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests adding and removing indexes while data is present. */ - public function testFieldUpdateIndexesWithData() { + public function testFieldUpdateIndexesWithData(): void { // Create a decimal field. $field_name = 'test_field'; $entity_type = 'entity_test_rev'; @@ -449,7 +449,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests foreign key support. */ - public function testFieldSqlStorageForeignKeys() { + public function testFieldSqlStorageForeignKeys(): void { // Create a 'shape' field, with a configurable foreign key (see // field_test_field_schema()). $field_name = 'test_field'; @@ -483,7 +483,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { /** * Tests table name generation. */ - public function testTableNames() { + public function testTableNames(): void { // Note: we need to test entity types with long names. We therefore use // fields on imaginary entity types (works as long as we don't actually save // them), and just check the generated table names. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php index 90043437197..c864b515277 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php @@ -18,7 +18,7 @@ class FieldTranslationSqlStorageTest extends EntityLanguageTestBase { /** * Tests field SQL storage. */ - public function testFieldSqlStorage() { + public function testFieldSqlStorage(): void { $entity_type = 'entity_test_mul'; $controller = $this->entityTypeManager->getStorage($entity_type); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php index 36b7e4346be..9a0a81c5894 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php @@ -38,7 +38,7 @@ class FieldWidgetConstraintValidatorTest extends KernelTestBase { /** * Tests widget constraint validation. */ - public function testValidation() { + public function testValidation(): void { $entity_type = 'entity_test_constraint_violation'; $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type) @@ -106,7 +106,7 @@ class FieldWidgetConstraintValidatorTest extends KernelTestBase { /** * Tests widget constraint validation with composite constraints. */ - public function testValidationWithCompositeConstraint() { + public function testValidationWithCompositeConstraint(): void { // First provide a valid value, this should cause no validation. $entity = EntityTestCompositeConstraint::create([ 'name' => 'valid-value', @@ -149,7 +149,7 @@ class FieldWidgetConstraintValidatorTest extends KernelTestBase { /** * Tests entity level constraint validation. */ - public function testEntityLevelConstraintValidation() { + public function testEntityLevelConstraintValidation(): void { $entity = EntityTestCompositeConstraint::create([ 'name' => 'entity-level-violation', ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php index 9842aed0bef..4a70ae7091c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php @@ -130,7 +130,7 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { * @covers ::updateFieldableEntityType * @dataProvider providerTestFieldableEntityTypeUpdates */ - public function testFieldableEntityTypeUpdates($initial_rev, $initial_mul, $new_rev, $new_mul, $data_migration_supported) { + public function testFieldableEntityTypeUpdates($initial_rev, $initial_mul, $new_rev, $new_mul, $data_migration_supported): void { // The 'entity_test_update' entity type is neither revisionable nor // translatable by default, so we need to get it into the initial testing // state. This also covers the "no existing data" scenario for fieldable @@ -666,7 +666,7 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests that a failed entity schema update preserves the existing data. */ - public function testFieldableEntityTypeUpdatesErrorHandling() { + public function testFieldableEntityTypeUpdatesErrorHandling(): void { $schema = $this->database->schema(); // First, convert the entity type to be translatable for better coverage and @@ -834,7 +834,7 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { /** * Tests the removal of the backup tables after a successful update. */ - public function testFieldableEntityTypeUpdatesRemoveBackupTables() { + public function testFieldableEntityTypeUpdatesRemoveBackupTables(): void { $schema = $this->database->schema(); // Convert the entity type to be revisionable. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php index 5053b3367a3..467b225134e 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php @@ -38,7 +38,7 @@ class RevisionableContentEntityBaseTest extends EntityKernelTestBase { /** * Tests the correct functionality CRUD operations of entity revisions. */ - public function testRevisionableContentEntity() { + public function testRevisionableContentEntity(): void { $entity_type = 'entity_test_mul_revlog'; $definition = \Drupal::entityTypeManager()->getDefinition($entity_type); $user = User::create(['name' => 'test name']); @@ -99,7 +99,7 @@ class RevisionableContentEntityBaseTest extends EntityKernelTestBase { * * @covers \Drupal\Core\Entity\ContentEntityBase::wasDefaultRevision */ - public function testWasDefaultRevision() { + public function testWasDefaultRevision(): void { $entity_type_id = 'entity_test_mul_revlog'; $entity = EntityTestMulWithRevisionLog::create([ 'type' => $entity_type_id, diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php index ee99001dee9..ae8149e0331 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php @@ -63,7 +63,7 @@ class RouteProviderTest extends KernelTestBase { /** * @covers \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getRoutes */ - public function testHtmlRoutes() { + public function testHtmlRoutes(): void { /** @var \Drupal\Core\Routing\RouteProviderInterface $route_provider */ $route_provider = \Drupal::service('router.route_provider'); @@ -104,7 +104,7 @@ class RouteProviderTest extends KernelTestBase { * @covers \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getEditFormRoute * @covers \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getDeleteFormRoute */ - public function testAdminHtmlRoutes() { + public function testAdminHtmlRoutes(): void { /** @var \Drupal\Core\Routing\RouteProviderInterface $route_provider */ $route_provider = \Drupal::service('router.route_provider'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php index 0d0c1c053e8..a0bfc4125b2 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -41,7 +41,7 @@ class SqlContentEntityStorageSchemaTest extends EntityKernelTestBase { /** * Tests updating a shared table field definition. */ - public function testOnFieldStorageDefinitionUpdateShared() { + public function testOnFieldStorageDefinitionUpdateShared(): void { // Install the test entity type with an additional field. Use a multi-column // field so that field name and column name(s) do not match. $field = BaseFieldDefinition::create('shape') diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php index ea891ba0ff8..f815bf33f4d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php @@ -54,7 +54,7 @@ class ValidReferenceConstraintValidatorTest extends EntityKernelTestBase { /** * Tests the ValidReferenceConstraintValidator. */ - public function testValidation() { + public function testValidation(): void { // Create a test entity to be referenced. $entity = $this->createUser(); // By default entity references already have the ValidReference constraint. @@ -85,7 +85,7 @@ class ValidReferenceConstraintValidatorTest extends EntityKernelTestBase { /** * Tests the validation of pre-existing items in an entity reference field. */ - public function testPreExistingItemsValidation() { + public function testPreExistingItemsValidation(): void { // Create two types of users, with and without access to bypass content // access. /** @var \Drupal\user\RoleInterface $role_with_access */ diff --git a/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php index 1f5afcdd001..785a52c981b 100644 --- a/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php +++ b/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php @@ -32,7 +32,7 @@ class ExceptionLoggingSubscriberTest extends KernelTestBase { /** * Tests \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::onException(). */ - public function testExceptionLogging() { + public function testExceptionLogging(): void { $http_kernel = \Drupal::service('http_kernel'); $channel_map = [ diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php index fecd16f08c5..0981068243e 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php @@ -15,7 +15,7 @@ class ModuleExtensionListTest extends KernelTestBase { /** * @covers ::getList */ - public function testGetList() { + public function testGetList(): void { \Drupal::configFactory()->getEditable('core.extension') ->set('module.testing', 1000) ->set('profile', 'testing') diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php index 1f89983cbb7..91c4b426ff8 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php @@ -21,7 +21,7 @@ class ModuleHandlerDeprecatedHookTest extends KernelTestBase { /** * @covers ::invokeDeprecated */ - public function testInvokeDeprecated() { + public function testInvokeDeprecated(): void { $this->expectDeprecation('The deprecated hook hook_deprecated_hook() is implemented in these functions: deprecation_test_deprecated_hook(). Use something else.'); /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ $module_handler = $this->container->get('module_handler'); @@ -35,7 +35,7 @@ class ModuleHandlerDeprecatedHookTest extends KernelTestBase { /** * @covers ::invokeAllDeprecated */ - public function testInvokeAllDeprecated() { + public function testInvokeAllDeprecated(): void { $this->expectDeprecation('The deprecated hook hook_deprecated_hook() is implemented in these functions: deprecation_test_deprecated_hook(). Use something else.'); /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ $module_handler = $this->container->get('module_handler'); @@ -49,7 +49,7 @@ class ModuleHandlerDeprecatedHookTest extends KernelTestBase { /** * @covers ::alterDeprecated */ - public function testAlterDeprecated() { + public function testAlterDeprecated(): void { $this->expectDeprecation('The deprecated alter hook hook_deprecated_alter_alter() is implemented in these functions: deprecation_test_deprecated_alter_alter. Alter something else.'); /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ $module_handler = $this->container->get('module_handler'); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php index feff674ecfc..2f58084c353 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookUnimplementedTest.php @@ -21,7 +21,7 @@ class ModuleHandlerDeprecatedHookUnimplementedTest extends KernelTestBase { * @covers ::invokeAllDeprecated * @covers ::invokeDeprecated */ - public function testUnimplementedHooks() { + public function testUnimplementedHooks(): void { $unimplemented_hook_name = 'unimplemented_hook_name'; /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php index a2d8e0da4e3..8ee28a968fd 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php @@ -19,7 +19,7 @@ class ModuleHandlerTest extends KernelTestBase { * * @covers ::getName */ - public function testInvalidGetName() { + public function testInvalidGetName(): void { $this->expectException(UnknownExtensionException::class); $this->expectExceptionMessage('The module module_nonsense does not exist.'); $module_handler = $this->container->get('module_handler'); @@ -31,7 +31,7 @@ class ModuleHandlerTest extends KernelTestBase { * * @group legacy */ - public function testGetNameDeprecation() { + public function testGetNameDeprecation(): void { $this->expectDeprecation('Drupal\Core\Extension\ModuleHandler::getName() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Core\Extension\ModuleExtensionList::getName($module) instead. See https://www.drupal.org/node/3310017'); $this->assertNotNull(\Drupal::service('module_handler')->getName('module_test')); } diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php index 6fd04ef0de4..f37e257d0ee 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php @@ -24,7 +24,7 @@ class ModuleImplementsAlterTest extends KernelTestBase { * @see \Drupal\Core\Extension\ModuleHandler::buildImplementationInfo() * @see module_test_module_implements_alter() */ - public function testModuleImplementsAlter() { + public function testModuleImplementsAlter(): void { // Get an instance of the module handler, to observe how it is going to be // replaced. @@ -71,7 +71,7 @@ class ModuleImplementsAlterTest extends KernelTestBase { * @see \Drupal\Core\Extension\ModuleHandler::buildImplementationInfo() * @see module_test_module_implements_alter() */ - public function testModuleImplementsAlterNonExistingImplementation() { + public function testModuleImplementsAlterNonExistingImplementation(): void { // Install the module_test module. \Drupal::service('module_installer')->install(['module_test']); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php index d232e0cd0f1..b95fad54b6e 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php @@ -27,7 +27,7 @@ class ModuleInstallerTest extends KernelTestBase { * @covers ::install * @covers ::uninstall */ - public function testRouteRebuild() { + public function testRouteRebuild(): void { // Remove the routing table manually to ensure it can be created lazily // properly. Database::getConnection()->schema()->dropTable('router'); @@ -46,7 +46,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @covers ::install */ - public function testConfigChangeOnInstall() { + public function testConfigChangeOnInstall(): void { // Install the child module so the parent is installed automatically. $this->container->get('module_installer')->install(['module_handler_test_multiple_child']); $modules = $this->config('core.extension')->get('module'); @@ -62,7 +62,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @covers ::removeCacheBins */ - public function testCacheBinCleanup() { + public function testCacheBinCleanup(): void { $schema = $this->container->get('database')->schema(); $table = 'cache_module_cache_bin'; @@ -85,7 +85,7 @@ class ModuleInstallerTest extends KernelTestBase { /** * Ensure that rebuilding the container in hook_install() works. */ - public function testKernelRebuildDuringHookInstall() { + public function testKernelRebuildDuringHookInstall(): void { \Drupal::state()->set('module_test_install:rebuild_container', TRUE); $module_installer = $this->container->get('module_installer'); $this->assertTrue($module_installer->install(['module_test'])); @@ -97,7 +97,7 @@ class ModuleInstallerTest extends KernelTestBase { * @dataProvider providerTestInvalidCoreInstall * @covers ::install */ - public function testInvalidCoreInstall($module_name, $install_dependencies) { + public function testInvalidCoreInstall($module_name, $install_dependencies): void { $this->expectException(MissingDependencyException::class); $this->expectExceptionMessage("Unable to install modules: module '$module_name' is incompatible with this version of Drupal core."); $this->container->get('module_installer')->install([$module_name], $install_dependencies); @@ -124,7 +124,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @covers ::install */ - public function testDependencyInvalidCoreInstall() { + public function testDependencyInvalidCoreInstall(): void { $this->expectException(MissingDependencyException::class); $this->expectExceptionMessage("Unable to install modules: module 'system_incompatible_core_version_dependencies_test'. Its dependency module 'system_core_incompatible_semver_test' is incompatible with this version of Drupal core."); $this->container->get('module_installer')->install(['system_incompatible_core_version_dependencies_test']); @@ -135,7 +135,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @covers ::install */ - public function testDependencyInvalidCoreInstallNoDependencies() { + public function testDependencyInvalidCoreInstallNoDependencies(): void { $this->assertTrue($this->container->get('module_installer')->install(['system_incompatible_core_version_dependencies_test'], FALSE)); } @@ -144,7 +144,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @covers ::install */ - public function testObsoleteInstall() { + public function testObsoleteInstall(): void { $this->expectException(ObsoleteExtensionException::class); $this->expectExceptionMessage("Unable to install modules: module 'system_status_obsolete_test' is obsolete."); $this->container->get('module_installer')->install(['system_status_obsolete_test']); @@ -157,7 +157,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @group legacy */ - public function testDeprecatedInstall() { + public function testDeprecatedInstall(): void { $this->expectDeprecation("The module 'deprecated_module' is deprecated. See http://example.com/deprecated"); \Drupal::service('module_installer')->install(['deprecated_module']); $this->assertTrue(\Drupal::service('module_handler')->moduleExists('deprecated_module')); @@ -171,7 +171,7 @@ class ModuleInstallerTest extends KernelTestBase { * * @group legacy */ - public function testUninstallValidatorsBC() { + public function testUninstallValidatorsBC(): void { $this->expectDeprecation('The "module_installer.uninstall_validators" service is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Inject "!tagged_iterator module_install.uninstall_validator" instead. See https://www.drupal.org/node/3432595'); $module_installer = new ModuleInstaller( $this->container->getParameter('app.root'), diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php index c551d06b188..9c39a9246b3 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php @@ -15,7 +15,7 @@ class ThemeEngineExtensionListTest extends KernelTestBase { /** * @covers ::getList */ - public function testGetList() { + public function testGetList(): void { // Confirm that all theme engines are available. $theme_engines = \Drupal::service('extension.list.theme_engine')->getList(); $this->assertArrayHasKey('twig', $theme_engines); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php index 98e3627823d..0ccae25b155 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php @@ -15,7 +15,7 @@ class ThemeExtensionListTest extends KernelTestBase { /** * @covers ::getList */ - public function testGetList() { + public function testGetList(): void { \Drupal::configFactory()->getEditable('core.extension') ->set('module.testing', 1000) ->set('theme.test_theme', 0) @@ -35,7 +35,7 @@ class ThemeExtensionListTest extends KernelTestBase { /** * Tests that themes have an empty default version set. */ - public function testThemeWithoutVersion() { + public function testThemeWithoutVersion(): void { $theme = \Drupal::service('extension.list.theme')->get('test_theme_settings_features'); $this->assertNull($theme->info['version']); } diff --git a/core/tests/Drupal/KernelTests/Core/Extension/UpdateDescriptionTest.php b/core/tests/Drupal/KernelTests/Core/Extension/UpdateDescriptionTest.php index 3009dcd588d..e9ce1e2e4e0 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/UpdateDescriptionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/UpdateDescriptionTest.php @@ -23,7 +23,7 @@ class UpdateDescriptionTest extends KernelTestBase { * * @see update_get_update_list() */ - public function testUpdateGetUpdateList() { + public function testUpdateGetUpdateList(): void { require_once $this->root . '/core/includes/update.inc'; \Drupal::service('update.update_hook_registry')->setInstalledVersion('update_test_description', 8000); \Drupal::moduleHandler()->loadInclude('update_test_description', 'install'); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php index a9a3282eed0..26b698ca787 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php @@ -23,7 +23,7 @@ class UpdateSchemaTest extends KernelTestBase { * * @see \Drupal\Core\Update\UpdateHookRegistry::getAvailableUpdates() */ - public function testDrupalGetSchemaVersionsInt() { + public function testDrupalGetSchemaVersionsInt(): void { \Drupal::state()->set('update_test_schema_version', 8001); $this->installSchema('update_test_schema', ['update_test_schema_table']); $schema = \Drupal::service('update.update_hook_registry')->getAvailableUpdates('update_test_schema'); diff --git a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php index cee655b539f..b78dd21c164 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php @@ -40,7 +40,7 @@ class BaseFieldOverrideTest extends KernelTestBase { * * @dataProvider getClassTestCases */ - public function testGetClass($field_type, $base_field_class, $expected_override_class) { + public function testGetClass($field_type, $base_field_class, $expected_override_class): void { $base_field = BaseFieldDefinition::create($field_type) ->setName('Test Field') ->setTargetEntityTypeId('entity_test'); @@ -72,7 +72,7 @@ class BaseFieldOverrideTest extends KernelTestBase { /** * Tests the default value callback. */ - public function testDefaultValueCallback() { + public function testDefaultValueCallback(): void { $base_field = BaseFieldDefinition::create('entity_reference') ->setName('Test Field') ->setTargetEntityTypeId('entity_test') @@ -92,7 +92,7 @@ class BaseFieldOverrideTest extends KernelTestBase { * @covers ::isInternal * @covers ::getUniqueIdentifier */ - public function testInheritedProperties() { + public function testInheritedProperties(): void { $base_field = BaseFieldDefinition::create('string') ->setName('Test Field') ->setTargetEntityTypeId('entity_test') diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php index aa1e1265949..37d06f0d1a4 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php @@ -69,7 +69,7 @@ class FieldAccessTest extends KernelTestBase { * @see entity_test_entity_field_access() * @see entity_test_entity_field_access_alter() */ - public function testFieldAccess() { + public function testFieldAccess(): void { $values = [ 'name' => $this->randomMachineName(), 'user_id' => 1, diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php index 42a528945f4..7c16f9a0bc3 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php @@ -59,7 +59,7 @@ class FieldItemTest extends EntityKernelTestBase { /** * Tests the field item save workflow. */ - public function testSaveWorkflow() { + public function testSaveWorkflow(): void { $entity = EntityTestMulRev::create([ 'name' => $this->randomString(), 'field_test_item' => $this->randomString(), diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php index 0cd6eaf4eb0..3fedd71caf2 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php @@ -62,7 +62,7 @@ class FieldMissingTypeTest extends EntityKernelTestBase { * * @see \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords() */ - public function testFieldStorageMissingType() { + public function testFieldStorageMissingType(): void { $this->expectException(PluginNotFoundException::class); $this->expectExceptionMessage("Unable to determine class for field type 'foo_field_storage' found in the 'field.storage.entity_test_mulrev.{$this->fieldName}' configuration"); $entity = EntityTestMulRev::create([ @@ -82,7 +82,7 @@ class FieldMissingTypeTest extends EntityKernelTestBase { * * @see \Drupal\field\FieldConfigStorageBase::mapFromStorageRecords() */ - public function testFieldMissingType() { + public function testFieldMissingType(): void { $this->expectException(PluginNotFoundException::class); $this->expectExceptionMessage("Unable to determine class for field type 'foo_field' found in the 'field.field.entity_test_mulrev.entity_test_mulrev.{$this->fieldName}' configuration"); $entity = EntityTestMulRev::create([ diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php index 8e82ce9f413..dbf6f206255 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php @@ -27,7 +27,7 @@ class FieldSettingsTest extends EntityKernelTestBase { * @covers \Drupal\Core\Field\BaseFieldDefinition::getSettings * @covers \Drupal\Core\Field\BaseFieldDefinition::setSettings */ - public function testBaseFieldSettings() { + public function testBaseFieldSettings(): void { $base_field = BaseFieldDefinition::create('test_field'); // Check that the default settings have been populated. @@ -51,7 +51,7 @@ class FieldSettingsTest extends EntityKernelTestBase { /** * Tests the base field settings on a cloned base field definition object. */ - public function testBaseFieldSettingsOnClone() { + public function testBaseFieldSettingsOnClone(): void { $base_field = BaseFieldDefinition::create('test_field'); // Check that the default settings have been populated. @@ -80,7 +80,7 @@ class FieldSettingsTest extends EntityKernelTestBase { * @covers \Drupal\field\Entity\FieldStorageConfig::getSettings * @covers \Drupal\field\Entity\FieldStorageConfig::setSettings */ - public function testConfigurableFieldStorageSettings() { + public function testConfigurableFieldStorageSettings(): void { $field_storage = FieldStorageConfig::create([ 'field_name' => 'test_field', 'entity_type' => 'entity_test', @@ -108,7 +108,7 @@ class FieldSettingsTest extends EntityKernelTestBase { * @covers \Drupal\field\Entity\FieldStorageConfig::getSettings * @covers \Drupal\field\Entity\FieldStorageConfig::setSettings */ - public function testConfigurableFieldSettings() { + public function testConfigurableFieldSettings(): void { $field_storage = FieldStorageConfig::create([ 'field_name' => 'test_field', 'entity_type' => 'entity_test', diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php index 7db2a7d285a..c3d6fc47392 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php @@ -55,7 +55,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSavePreHashed() { + public function testPreSavePreHashed(): void { $entity = EntityTest::create([ 'name' => $this->randomString(), ]); @@ -70,7 +70,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveNewNull() { + public function testPreSaveNewNull(): void { $entity = EntityTest::create([ 'name' => $this->randomString(), ]); @@ -83,7 +83,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveNewEmptyString() { + public function testPreSaveNewEmptyString(): void { $entity = EntityTest::create([ 'name' => $this->randomString(), ]); @@ -100,7 +100,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveNewMultipleSpacesString() { + public function testPreSaveNewMultipleSpacesString(): void { $entity = EntityTest::create([ 'name' => $this->randomString(), ]); @@ -117,7 +117,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveExistingNull() { + public function testPreSaveExistingNull(): void { $entity = EntityTest::create(); $entity->test_field = $this->randomString(); $entity->save(); @@ -133,7 +133,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveExistingEmptyString() { + public function testPreSaveExistingEmptyString(): void { $entity = EntityTest::create(); $entity->test_field = $this->randomString(); $entity->save(); @@ -149,7 +149,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveExistingMultipleSpacesString() { + public function testPreSaveExistingMultipleSpacesString(): void { $entity = EntityTest::create(); $entity->test_field = $this->randomString(); $entity->save(); @@ -164,7 +164,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveExceptionNew() { + public function testPreSaveExceptionNew(): void { $entity = EntityTest::create(); $entity->test_field = str_repeat('a', PasswordInterface::PASSWORD_MAX_LENGTH + 1); $this->expectException(EntityStorageException::class); @@ -175,7 +175,7 @@ class PasswordItemTest extends FieldKernelTestBase { /** * @covers ::preSave */ - public function testPreSaveExceptionExisting() { + public function testPreSaveExceptionExisting(): void { $entity = EntityTest::create(); $entity->test_field = 'will_be_hashed'; $entity->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php b/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php index 01eefa6e2b7..fc3338dac81 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php @@ -45,7 +45,7 @@ class MapBaseFieldTest extends EntityKernelTestBase { /** * Tests uninstalling map item base field. */ - public function testUninstallMapItemBaseField() { + public function testUninstallMapItemBaseField(): void { $definitions['data_map'] = BaseFieldDefinition::create('map') ->setLabel(t('Data')) ->setRequired(TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index d32a42343f4..8c6490d6e12 100644 --- a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -21,7 +21,7 @@ class DirectoryTest extends FileTestBase { /** * Tests local directory handling functions. */ - public function testFileCheckLocalDirectoryHandling() { + public function testFileCheckLocalDirectoryHandling(): void { $site_path = $this->container->getParameter('site.path'); $directory = $site_path . '/files'; @@ -62,7 +62,7 @@ class DirectoryTest extends FileTestBase { /** * Tests directory handling functions. */ - public function testFileCheckDirectoryHandling() { + public function testFileCheckDirectoryHandling(): void { // A directory to operate on. $default_scheme = 'public'; $directory = $default_scheme . '://' . $this->randomMachineName() . '/' . $this->randomMachineName(); @@ -117,7 +117,7 @@ class DirectoryTest extends FileTestBase { /** * Tests the file paths of newly created files. */ - public function testFileCreateNewFilepath() { + public function testFileCreateNewFilepath(): void { // First we test against an imaginary file that does not exist in a // directory. $basename = 'xyz.txt'; @@ -152,7 +152,7 @@ class DirectoryTest extends FileTestBase { * If the file doesn't currently exist, then it will simply return the * filepath. */ - public function testFileDestination() { + public function testFileDestination(): void { // First test for non-existent file. $destination = 'core/misc/xyz.txt'; /** @var \Drupal\Core\File\FileSystemInterface $file_system */ @@ -181,7 +181,7 @@ class DirectoryTest extends FileTestBase { /** * Ensure that the getTempDirectory() method always returns a value. */ - public function testFileDirectoryTemp() { + public function testFileDirectoryTemp(): void { $tmp_directory = \Drupal::service('file_system')->getTempDirectory(); $this->assertNotEmpty($tmp_directory); $this->assertEquals($tmp_directory, FileSystem::getOsTemporaryDirectory()); @@ -190,7 +190,7 @@ class DirectoryTest extends FileTestBase { /** * Tests directory creation. */ - public function testDirectoryCreation() { + public function testDirectoryCreation(): void { /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = $this->container->get('file_system'); @@ -206,7 +206,7 @@ class DirectoryTest extends FileTestBase { * Image style generation can result in many calls to create similar directory * paths. This test forks the process to create the same situation. */ - public function testMultiplePrepareDirectory() { + public function testMultiplePrepareDirectory(): void { if (!function_exists('pcntl_fork')) { $this->markTestSkipped('Requires the pcntl_fork() function'); } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php index 18fa19a9fff..a7bf5b9dd70 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php @@ -20,7 +20,7 @@ class FileCopyTest extends FileTestBase { /** * Copy a normal file. */ - public function testNormal() { + public function testNormal(): void { // Create a file for testing $uri = $this->createUri(); @@ -50,7 +50,7 @@ class FileCopyTest extends FileTestBase { /** * Copy a non-existent file. */ - public function testNonExistent() { + public function testNonExistent(): void { // Copy non-existent file $desired_filepath = $this->randomMachineName(); $this->assertFileDoesNotExist($desired_filepath); @@ -62,7 +62,7 @@ class FileCopyTest extends FileTestBase { /** * Copy a file onto itself. */ - public function testOverwriteSelf() { + public function testOverwriteSelf(): void { // Create a file for testing $uri = $this->createUri(); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php index 78fed67a906..03f01e30fa1 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php @@ -14,7 +14,7 @@ class FileDeleteRecursiveTest extends FileTestBase { /** * Delete a normal file. */ - public function testSingleFile() { + public function testSingleFile(): void { // Create a file for testing $filepath = 'public://' . $this->randomMachineName(); file_put_contents($filepath, ''); @@ -27,7 +27,7 @@ class FileDeleteRecursiveTest extends FileTestBase { /** * Try deleting an empty directory. */ - public function testEmptyDirectory() { + public function testEmptyDirectory(): void { // A directory to operate on. $directory = $this->createDirectory(); @@ -39,7 +39,7 @@ class FileDeleteRecursiveTest extends FileTestBase { /** * Try deleting a directory with some files. */ - public function testDirectory() { + public function testDirectory(): void { // A directory to operate on. $directory = $this->createDirectory(); $filepathA = $directory . '/A'; @@ -57,7 +57,7 @@ class FileDeleteRecursiveTest extends FileTestBase { /** * Try deleting subdirectories with some files. */ - public function testSubDirectory() { + public function testSubDirectory(): void { // A directory to operate on. $directory = $this->createDirectory(); $subdirectory = $this->createDirectory($directory . '/sub'); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php index b6eb9042c5e..1b6cbd1df17 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php @@ -16,7 +16,7 @@ class FileDeleteTest extends FileTestBase { /** * Delete a normal file. */ - public function testNormal() { + public function testNormal(): void { // Create a file for testing $uri = $this->createUri(); @@ -28,7 +28,7 @@ class FileDeleteTest extends FileTestBase { /** * Try deleting a missing file. */ - public function testMissing() { + public function testMissing(): void { // Try to delete a non-existing file $this->assertTrue(\Drupal::service('file_system')->delete('public://' . $this->randomMachineName()), 'Returns true when deleting a non-existent file.'); } @@ -36,7 +36,7 @@ class FileDeleteTest extends FileTestBase { /** * Try deleting a directory. */ - public function testDirectory() { + public function testDirectory(): void { // A directory to operate on. $directory = $this->createDirectory(); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php index b4462006457..bc0d8073153 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php @@ -20,7 +20,7 @@ class FileMoveTest extends FileTestBase { /** * Move a normal file. */ - public function testNormal() { + public function testNormal(): void { // Create a file for testing $uri = $this->createUri(); @@ -53,7 +53,7 @@ class FileMoveTest extends FileTestBase { /** * Try to move a missing file. */ - public function testMissing() { + public function testMissing(): void { // Move non-existent file. $this->expectException(FileNotExistsException::class); \Drupal::service('file_system')->move($this->randomMachineName(), $this->randomMachineName()); @@ -62,7 +62,7 @@ class FileMoveTest extends FileTestBase { /** * Try to move a file onto itself. */ - public function testOverwriteSelf() { + public function testOverwriteSelf(): void { // Create a file for testing. $uri = $this->createUri(); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSaveDataTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSaveDataTest.php index ae0a7a64fdd..67f95b43cbd 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSaveDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSaveDataTest.php @@ -16,7 +16,7 @@ class FileSaveDataTest extends FileTestBase { /** * Tests the file_unmanaged_save_data() function. */ - public function testFileSaveData() { + public function testFileSaveData(): void { $contents = $this->randomMachineName(8); $this->setSetting('file_chmod_file', 0777); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php index fd3d206c687..20679366393 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php @@ -34,7 +34,7 @@ class FileSystemRequirementsTest extends KernelTestBase { /** * Tests if settings are set, there are not warnings. */ - public function testSettingsExist() { + public function testSettingsExist(): void { $this->setSetting('file_temp_path', $this->randomMachineName()); $requirements = $this->checkSystemRequirements(); $this->assertArrayNotHasKey('temp_directory', $requirements); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemTempDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemTempDirectoryTest.php index 41c54c3080f..c66d1238826 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemTempDirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemTempDirectoryTest.php @@ -45,7 +45,7 @@ class FileSystemTempDirectoryTest extends KernelTestBase { * * @covers ::getTempDirectory */ - public function testGetTempDirectorySettings() { + public function testGetTempDirectorySettings(): void { $tempDir = '/var/tmp/' . $this->randomMachineName(); $this->setSetting('file_temp_path', $tempDir); $this->assertEquals($tempDir, $this->fileSystem->getTempDirectory()); @@ -56,7 +56,7 @@ class FileSystemTempDirectoryTest extends KernelTestBase { * * @covers ::getTempDirectory */ - public function testGetTempDirectoryOsDefault() { + public function testGetTempDirectoryOsDefault(): void { $tempDir = FileSystemComponent::getOsTemporaryDirectory(); $dir = $this->fileSystem->getTempDirectory(); $this->assertEquals($tempDir, $dir); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php index 3231dd4bc5e..c68e69ca89a 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php @@ -40,7 +40,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testEnsureFileExistsBeforeCopy() { + public function testEnsureFileExistsBeforeCopy(): void { // We need to compute the exception message here because it will include // the 'real' path to the file, which varies with $this->siteDirectory. $this->expectException(FileNotExistsException::class); @@ -52,7 +52,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testDestinationDirectoryFailureOnCopy() { + public function testDestinationDirectoryFailureOnCopy(): void { $this->expectException(DirectoryNotReadyException::class); $this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory 'public://subdirectory' is not properly configured. This may be caused by a problem with file or directory permissions."); touch('public://test.txt'); @@ -64,7 +64,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testCopyFailureIfFileAlreadyExists() { + public function testCopyFailureIfFileAlreadyExists(): void { $this->expectException(FileExistsException::class); $this->expectExceptionMessage("File 'public://test.txt' could not be copied because a file by that name already exists in the destination directory ('')"); $uri = 'public://test.txt'; @@ -75,7 +75,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testCopyFailureIfSelfOverwrite() { + public function testCopyFailureIfSelfOverwrite(): void { $this->expectException(FileException::class); $this->expectExceptionMessage("'public://test.txt' could not be copied because it would overwrite itself"); $uri = 'public://test.txt'; @@ -86,7 +86,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testCopySelfRename() { + public function testCopySelfRename(): void { $uri = 'public://test.txt'; touch($uri); $this->fileSystem->copy($uri, $uri); @@ -96,7 +96,7 @@ class FileSystemTest extends KernelTestBase { /** * @covers ::copy */ - public function testSuccessfulCopy() { + public function testSuccessfulCopy(): void { touch('public://test.txt'); $this->fileSystem->copy('public://test.txt', 'public://test-copy.txt'); $this->assertFileExists('public://test-copy.txt'); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileUrlGeneratorTest.php b/core/tests/Drupal/KernelTests/Core/File/FileUrlGeneratorTest.php index 743bed3ee8b..a505e245412 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileUrlGeneratorTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileUrlGeneratorTest.php @@ -41,7 +41,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generate */ - public function testGenerateMissingStreamWrapper() { + public function testGenerateMissingStreamWrapper(): void { $this->expectException(InvalidStreamWrapperException::class); $result = $this->fileUrlGenerator->generate("foo://bar"); } @@ -51,7 +51,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generateString */ - public function testGenerateStringMissingStreamWrapper() { + public function testGenerateStringMissingStreamWrapper(): void { $this->expectException(InvalidStreamWrapperException::class); $result = $this->fileUrlGenerator->generateString("foo://bar"); } @@ -61,7 +61,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generateAbsoluteString */ - public function testGenerateAbsoluteStringMissingStreamWrapper() { + public function testGenerateAbsoluteStringMissingStreamWrapper(): void { $this->expectException(InvalidStreamWrapperException::class); $result = $this->fileUrlGenerator->generateAbsoluteString("foo://bar"); } @@ -71,7 +71,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generateAbsoluteString */ - public function testShippedFileURL() { + public function testShippedFileURL(): void { // Test generating a URL to a shipped file (i.e. a file that is part of // Drupal core, a module or a theme, for example a JavaScript file). @@ -120,7 +120,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generateAbsoluteString */ - public function testPublicManagedFileURL() { + public function testPublicManagedFileURL(): void { // Test generating a URL to a managed file. // Test alteration of file URLs to use a CDN. @@ -152,7 +152,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @covers ::generateAbsoluteString */ - public function testRelativeFileURL() { + public function testRelativeFileURL(): void { // Disable file_test.module's hook_file_url_alter() implementation. \Drupal::state()->set('file_test.hook_file_url_alter', NULL); @@ -182,7 +182,7 @@ class FileUrlGeneratorTest extends FileTestBase { * * @dataProvider providerGenerateURI */ - public function testGenerateURI($filepath, $expected) { + public function testGenerateURI($filepath, $expected): void { // Disable file_test.module's hook_file_url_alter() implementation. \Drupal::state()->set('file_test.hook_file_url_alter', NULL); @@ -200,7 +200,7 @@ class FileUrlGeneratorTest extends FileTestBase { /** * @covers ::generate */ - public function testGenerateURIWithSchema() { + public function testGenerateURIWithSchema(): void { // Disable file_test.module's hook_file_url_alter() implementation. \Drupal::state()->set('file_test.hook_file_url_alter', NULL); diff --git a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php index c992e76510c..dfe537e4d1f 100644 --- a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php @@ -46,7 +46,7 @@ class HtaccessTest extends KernelTestBase { /** * @covers ::write */ - public function testHtaccessSave() { + public function testHtaccessSave(): void { // Prepare test directories. $private = Settings::get('file_public_path') . '/test/private'; $stream = 'public://test/stream'; diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php index 2050989c84d..833e3765a65 100644 --- a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php @@ -21,7 +21,7 @@ class MimeTypeTest extends FileTestBase { /** * Tests mapping of mimetypes from filenames. */ - public function testFileMimeTypeDetection() { + public function testFileMimeTypeDetection(): void { $prefixes = ['public://', 'private://', 'temporary://', 'dummy-remote://']; $test_case = [ diff --git a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php index 54305629dbb..3752b396994 100644 --- a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php @@ -31,7 +31,7 @@ class ReadOnlyStreamWrapperTest extends FileTestBase { /** * Tests read-only specific behavior. */ - public function testReadOnlyBehavior() { + public function testReadOnlyBehavior(): void { $type = DummyReadOnlyStreamWrapper::getType(); // Checks that the stream wrapper type is not declared as writable. $this->assertSame(0, $type & StreamWrapperInterface::WRITE); diff --git a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php index c527b625a6e..9bbf22f07df 100644 --- a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php @@ -50,7 +50,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testReturn() { + public function testReturn(): void { // Grab a listing of all the JavaScript files and check that they're // passed to the callback. $all_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/'); @@ -77,7 +77,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testOptionCallback() { + public function testOptionCallback(): void { // When nothing is matched nothing should be passed to the callback. $all_files = $this->fileSystem->scanDirectory($this->path, '/^NON-EXISTING-FILENAME/', ['callback' => 'file_test_file_scan_callback']); @@ -100,7 +100,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testOptionNoMask() { + public function testOptionNoMask(): void { // Grab a listing of all the JavaScript files. $all_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/'); $this->assertCount(2, $all_files, 'Found two, expected javascript files.'); @@ -115,7 +115,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testOptionKey() { + public function testOptionKey(): void { // "filename", for the path starting with $dir. $expected = [$this->path . '/javascript-1.txt', $this->path . '/javascript-2.script']; $actual = array_keys($this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['key' => 'filepath'])); @@ -146,7 +146,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testOptionRecurse() { + public function testOptionRecurse(): void { $files = $this->fileSystem->scanDirectory($this->path . '/..', '/^javascript-/', ['recurse' => FALSE]); $this->assertEmpty($files, "Without recursion couldn't find javascript files."); @@ -159,7 +159,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testOptionMinDepth() { + public function testOptionMinDepth(): void { $files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['min_depth' => 0]); $this->assertCount(2, $files, 'No minimum-depth gets files in current directory.'); @@ -172,7 +172,7 @@ class ScanDirectoryTest extends FileTestBase { * * @covers ::scanDirectory */ - public function testIgnoreDirectories() { + public function testIgnoreDirectories(): void { $files = $this->fileSystem->scanDirectory('core/modules/system/tests/fixtures/IgnoreDirectories', '/\.txt$/'); $this->assertCount(2, $files, '2 text files found when not ignoring directories.'); diff --git a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php index 9468ba7f30d..59e95b7dde6 100644 --- a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php @@ -54,7 +54,7 @@ class StreamWrapperTest extends FileTestBase { /** * Tests the getClassName() function. */ - public function testGetClassName() { + public function testGetClassName(): void { // Check the dummy scheme. $this->assertEquals($this->classname, \Drupal::service('stream_wrapper_manager')->getClass($this->scheme), 'Got correct class name for dummy scheme.'); // Check core's scheme. @@ -64,7 +64,7 @@ class StreamWrapperTest extends FileTestBase { /** * Tests the getViaScheme() method. */ - public function testGetInstanceByScheme() { + public function testGetInstanceByScheme(): void { $instance = \Drupal::service('stream_wrapper_manager')->getViaScheme($this->scheme); $this->assertEquals($this->classname, get_class($instance), 'Got correct class type for dummy scheme.'); @@ -75,7 +75,7 @@ class StreamWrapperTest extends FileTestBase { /** * Tests the getViaUri() and getViaScheme() methods and target functions. */ - public function testUriFunctions() { + public function testUriFunctions(): void { $config = $this->config('system.file'); /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ @@ -113,7 +113,7 @@ class StreamWrapperTest extends FileTestBase { /** * Tests some file handle functions. */ - public function testFileFunctions() { + public function testFileFunctions(): void { $filename = 'public://' . $this->randomMachineName(); file_put_contents($filename, str_repeat('d', 1000)); @@ -145,7 +145,7 @@ class StreamWrapperTest extends FileTestBase { /** * Tests the scheme functions. */ - public function testGetValidStreamScheme() { + public function testGetValidStreamScheme(): void { /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); diff --git a/core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php b/core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php index 14b1a74d73b..063917d5b59 100644 --- a/core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php @@ -23,7 +23,7 @@ class UrlTransformRelativeTest extends KernelTestBase { * * @dataProvider providerFileUrlTransformRelative */ - public function testFileUrlTransformRelative($host, $port, $https, $base_path, $root_relative, $url, $expected) { + public function testFileUrlTransformRelative($host, $port, $https, $base_path, $root_relative, $url, $expected): void { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['SERVER_ADDR'] = '127.0.0.1'; diff --git a/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php b/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php index 930f0d7f869..5a193154a84 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php @@ -70,7 +70,7 @@ class ExternalFormUrlTest extends KernelTestBase implements FormInterface { /** * Tests form behavior. */ - public function testActionUrlBehavior() { + public function testActionUrlBehavior(): void { // Create a new request which has a request uri with multiple leading // slashes and make it the master request. $request_stack = \Drupal::service('request_stack'); diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormActionXssTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormActionXssTest.php index 2ff12479f5b..8fb9a3659aa 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormActionXssTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormActionXssTest.php @@ -72,7 +72,7 @@ class FormActionXssTest extends KernelTestBase implements FormInterface { /** * Tests form action attribute for XSS. */ - public function testFormActionXss() { + public function testFormActionXss(): void { // Create a new request with a uri which attempts XSS. $request_stack = \Drupal::service('request_stack'); /** @var \Symfony\Component\HttpFoundation\RequestStack $original_request */ diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php index b8f265166bf..5c8e576471e 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php @@ -59,7 +59,7 @@ class FormCacheTest extends KernelTestBase { /** * Tests the form cache with a logged-in user. */ - public function testCacheToken() { + public function testCacheToken(): void { \Drupal::currentUser()->setAccount(new UserSession(['uid' => 1])); \Drupal::formBuilder()->setCache($this->formBuildId, $this->form, $this->formState); @@ -90,7 +90,7 @@ class FormCacheTest extends KernelTestBase { /** * Tests the form cache without a logged-in user. */ - public function testNoCacheToken() { + public function testNoCacheToken(): void { // Switch to an anonymous user account. $account_switcher = \Drupal::service('account_switcher'); $account_switcher->switchTo(new AnonymousUserSession()); @@ -111,7 +111,7 @@ class FormCacheTest extends KernelTestBase { /** * Tests the form cache with an overridden cache expiration. */ - public function testCacheCustomExpiration() { + public function testCacheCustomExpiration(): void { // Override form cache expiration so that the cached form expired yesterday. new Settings(['form_cache_expiration' => -1 * (24 * 60 * 60), 'hash_salt' => $this->randomMachineName()]); \Drupal::formBuilder()->setCache($this->formBuildId, $this->form, $this->formState); diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php index 0e53bcc7106..b092803e22e 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php @@ -72,7 +72,7 @@ class FormDefaultHandlersTest extends KernelTestBase implements FormInterface { /** * Tests that default handlers are added even if custom are specified. */ - public function testDefaultAndCustomHandlers() { + public function testDefaultAndCustomHandlers(): void { $form_state = new FormState(); $form_builder = $this->container->get('form_builder'); $form_builder->submitForm($this, $form_state); diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormValidationMessageOrderTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormValidationMessageOrderTest.php index 7476643b913..c9b3a582d06 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormValidationMessageOrderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormValidationMessageOrderTest.php @@ -77,7 +77,7 @@ class FormValidationMessageOrderTest extends KernelTestBase implements FormInter /** * Tests that fields validation messages are sorted in the fields order. */ - public function testValidationErrorMessagesSortedWithWeight() { + public function testValidationErrorMessagesSortedWithWeight(): void { $form_state = new FormState(); $form_builder = $this->container->get('form_builder'); $form_builder->submitForm($this, $form_state); diff --git a/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php b/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php index f6a2a87af14..dd145c87804 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php @@ -68,7 +68,7 @@ class TriggeringElementProgrammedTest extends KernelTestBase implements FormInte /** * Tests that #limit_validation_errors of the only submit button takes effect. */ - public function testLimitValidationErrors() { + public function testLimitValidationErrors(): void { // Programmatically submit the form. $form_state = new FormState(); $form_state->setValue('section', 'one'); diff --git a/core/tests/Drupal/KernelTests/Core/Http/LinkRelationsTest.php b/core/tests/Drupal/KernelTests/Core/Http/LinkRelationsTest.php index 0f70b66aadd..a8401e7a8c4 100644 --- a/core/tests/Drupal/KernelTests/Core/Http/LinkRelationsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Http/LinkRelationsTest.php @@ -17,7 +17,7 @@ class LinkRelationsTest extends KernelTestBase { /** * Tests correct Link Relations are returned from the Link Relation Type Manager. */ - public function testAvailableLinkRelationships() { + public function testAvailableLinkRelationships(): void { /** @var \Drupal\Core\Http\LinkRelationTypeManager $link_relation_type_manager */ $link_relation_type_manager = $this->container->get('plugin.manager.link_relation_type'); diff --git a/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php index 52a2ac9eb5d..94489e21cdf 100644 --- a/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php @@ -26,7 +26,7 @@ class StackKernelIntegrationTest extends KernelTestBase { /** * Tests a request. */ - public function testRequest() { + public function testRequest(): void { $request = Request::create((new Url('http_kernel_test.empty'))->toString()); /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel */ $http_kernel = \Drupal::service('http_kernel'); @@ -39,7 +39,7 @@ class StackKernelIntegrationTest extends KernelTestBase { /** * Tests that late middlewares are automatically flagged lazy. */ - public function testLazyLateMiddlewares() { + public function testLazyLateMiddlewares(): void { $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set'); $this->assertFalse($this->container->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is not set'); $this->assertFalse($this->container->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is not set'); diff --git a/core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php index d46a5665c23..3e417576d6d 100644 --- a/core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php @@ -53,7 +53,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests that the toolkit manager only returns available toolkits. */ - public function testGetAvailableToolkits() { + public function testGetAvailableToolkits(): void { $manager = $this->container->get('image.toolkit.manager'); $toolkits = $manager->getAvailableToolkits(); @@ -66,7 +66,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests Image's methods. */ - public function testLoad() { + public function testLoad(): void { $image = $this->getImage(); $this->assertInstanceOf(ImageInterface::class, $image); $this->assertEquals('test', $image->getToolkitId()); @@ -76,7 +76,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests the Image::save() function. */ - public function testSave() { + public function testSave(): void { $this->assertFalse($this->image->save()); $this->assertToolkitOperationsCalled(['save']); } @@ -84,7 +84,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests the 'apply' method. */ - public function testApply() { + public function testApply(): void { $data = ['p1' => 1, 'p2' => TRUE, 'p3' => 'text']; // The operation plugin itself does not exist, so apply will return false. @@ -102,7 +102,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests the 'apply' method without parameters. */ - public function testApplyNoParameters() { + public function testApplyNoParameters(): void { // The operation plugin itself does not exist, so apply will return false. $this->assertFalse($this->image->apply('my_operation')); @@ -116,7 +116,7 @@ class ToolkitTest extends KernelTestBase { /** * Tests image toolkit operations inheritance by derivative toolkits. */ - public function testDerivative() { + public function testDerivative(): void { $toolkit_manager = $this->container->get('image.toolkit.manager'); $operation_manager = $this->container->get('image.toolkit.operation.manager'); diff --git a/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php index 6393c754b86..abe6af08571 100644 --- a/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php @@ -18,7 +18,7 @@ class InstallerLanguageTest extends KernelTestBase { /** * Tests that the installer can find translation files. */ - public function testInstallerTranslationFiles() { + public function testInstallerTranslationFiles(): void { // Different translation files would be found depending on which language // we are looking for. $expected_translation_files = [ @@ -44,7 +44,7 @@ class InstallerLanguageTest extends KernelTestBase { /** * Tests profile info caching in non-English languages. */ - public function testInstallerTranslationCache() { + public function testInstallerTranslationCache(): void { require_once 'core/includes/install.inc'; // Prime the \Drupal\Core\Extension\ExtensionList::getPathname() static diff --git a/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php b/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php index a5bcb00f05f..2f71293003a 100644 --- a/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Installer/InstallerRedirectTraitTest.php @@ -69,7 +69,7 @@ class InstallerRedirectTraitTest extends KernelTestBase { * @covers ::shouldRedirectToInstaller * @dataProvider providerShouldRedirectToInstaller */ - public function testShouldRedirectToInstaller($expected, $exception, $connection, $connection_info, $sequences_table_exists = TRUE) { + public function testShouldRedirectToInstaller($expected, $exception, $connection, $connection_info, $sequences_table_exists = TRUE): void { try { throw new $exception(); } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php index 28752925be3..529dd3f0ce7 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php @@ -42,7 +42,7 @@ class DatabaseStorageExpirableTest extends StorageTestBase { /** * Tests CRUD functionality with expiration. */ - public function testCRUDWithExpiration() { + public function testCRUDWithExpiration(): void { $stores = $this->createStorage(); // Verify that an item can be stored with setWithExpire(). @@ -121,7 +121,7 @@ class DatabaseStorageExpirableTest extends StorageTestBase { /** * Tests data expiration. */ - public function testExpiration() { + public function testExpiration(): void { $stores = $this->createStorage(); $day = 604800; diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php index 06b8fdd8e27..c187deed612 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php @@ -37,7 +37,7 @@ class DatabaseStorageTest extends StorageTestBase { /** * Tests asynchronous table creation. */ - public function testConcurrent() { + public function testConcurrent(): void { $this->markTestSkipped("Skipped due to frequent random test failures. See https://www.drupal.org/project/drupal/issues/3398063"); if (!function_exists('pcntl_fork')) { $this->markTestSkipped('Requires the pcntl_fork() function'); diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php index cc91e7e8d16..8da527a58f7 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php @@ -26,7 +26,7 @@ class GarbageCollectionTest extends KernelTestBase { /** * Tests garbage collection. */ - public function testGarbageCollection() { + public function testGarbageCollection(): void { $collection = $this->randomMachineName(); $connection = Database::getConnection(); $store = new DatabaseStorageExpirable($collection, new PhpSerialize(), $connection, \Drupal::time()); diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php index 3edc1d2fc97..1ca7fcbd2de 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php @@ -36,7 +36,7 @@ class KeyValueContentEntityStorageTest extends KernelTestBase { * * @covers \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::hasData */ - public function testCRUD() { + public function testCRUD(): void { $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); $storage = \Drupal::entityTypeManager()->getStorage('entity_test_label'); @@ -170,7 +170,7 @@ class KeyValueContentEntityStorageTest extends KernelTestBase { /** * Tests uninstallation of a module that does not use the SQL entity storage. */ - public function testUninstall() { + public function testUninstall(): void { $uninstall_validator_reasons = \Drupal::service('content_uninstall_validator')->validate('keyvalue_test'); $this->assertEmpty($uninstall_validator_reasons); } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php index c2c56ad2eb3..3f2d0ff2d85 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php @@ -50,7 +50,7 @@ abstract class StorageTestBase extends KernelTestBase { /** * Tests CRUD operations. */ - public function testCRUD() { + public function testCRUD(): void { $stores = $this->createStorage(); // Verify that each store returns its own collection name. $this->assertSame($this->collections[0], $stores[0]->getCollectionName()); @@ -129,7 +129,7 @@ abstract class StorageTestBase extends KernelTestBase { /** * Tests expected behavior for non-existing keys. */ - public function testNonExistingKeys() { + public function testNonExistingKeys(): void { $stores = $this->createStorage(); @@ -157,7 +157,7 @@ abstract class StorageTestBase extends KernelTestBase { /** * Tests the setIfNotExists() method. */ - public function testSetIfNotExists() { + public function testSetIfNotExists(): void { $stores = $this->createStorage(); $key = $this->randomMachineName(); @@ -183,7 +183,7 @@ abstract class StorageTestBase extends KernelTestBase { /** * Tests the rename operation. */ - public function testRename() { + public function testRename(): void { $stores = $this->createStorage(); $store = $stores[0]; @@ -197,7 +197,7 @@ abstract class StorageTestBase extends KernelTestBase { /** * Tests the rename operation. */ - public function testRenameNoChange() { + public function testRenameNoChange(): void { $stores = $this->createStorage(); $store = $stores[0]; diff --git a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php index aa3da7215de..b76ca4df3c3 100644 --- a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php @@ -23,7 +23,7 @@ class IconBuilderTest extends KernelTestBase { * * @dataProvider providerTestBuild */ - public function testBuild(SvgIconBuilder $icon_builder, $icon_map, $expected) { + public function testBuild(SvgIconBuilder $icon_builder, $icon_map, $expected): void { $renderer = $this->container->get('renderer'); $build = $icon_builder->build($icon_map); diff --git a/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php b/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php index 54232d02c58..7de324526b2 100644 --- a/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php +++ b/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php @@ -32,7 +32,7 @@ class LockTest extends KernelTestBase { /** * Tests backend release functionality. */ - public function testBackendLockRelease() { + public function testBackendLockRelease(): void { $success = $this->lock->acquire('lock_a'); $this->assertTrue($success, 'Could acquire first lock.'); @@ -72,7 +72,7 @@ class LockTest extends KernelTestBase { /** * Tests backend release functionality. */ - public function testBackendLockReleaseAll() { + public function testBackendLockReleaseAll(): void { $success = $this->lock->acquire('lock_a'); $this->assertTrue($success, 'Could acquire first lock.'); diff --git a/core/tests/Drupal/KernelTests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/KernelTests/Core/Menu/LocalActionManagerTest.php index e70b4dd0d56..3a509a61215 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/LocalActionManagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/LocalActionManagerTest.php @@ -22,7 +22,7 @@ class LocalActionManagerTest extends KernelTestBase { /** * Tests the cacheability of local actions. */ - public function testCacheability() { + public function testCacheability(): void { /** @var \Drupal\Core\Menu\LocalActionManager $local_action_manager */ $local_action_manager = \Drupal::service('plugin.manager.menu.local_action'); $build = [ diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php index c5837f792e2..7c4f5f83b08 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php @@ -26,7 +26,7 @@ class MenuLinkDefaultIntegrationTest extends KernelTestBase { /** * Tests moving a static menu link without a specified menu to the root. */ - public function testMoveToRoot() { + public function testMoveToRoot(): void { /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */ $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); $menu_link_manager->rebuild(); diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php index 1f790e6a067..809f90c99fd 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php @@ -64,7 +64,7 @@ class MenuLinkTreeTest extends KernelTestBase { /** * Tests deleting all the links in a menu. */ - public function testDeleteLinksInMenu() { + public function testDeleteLinksInMenu(): void { /** @var \Drupal\system\MenuStorage $storage */ $storage = \Drupal::entityTypeManager()->getStorage('menu'); $storage->create(['id' => 'menu1', 'label' => 'Menu 1'])->save(); @@ -91,7 +91,7 @@ class MenuLinkTreeTest extends KernelTestBase { /** * Tests creating links with an expected tree structure. */ - public function testCreateLinksInMenu() { + public function testCreateLinksInMenu(): void { // This creates a tree with the following structure: // - 1 // - 2 @@ -141,7 +141,7 @@ class MenuLinkTreeTest extends KernelTestBase { /** * Tests user/login and user/logout links. */ - public function testUserLoginAndUserLogoutLinks() { + public function testUserLoginAndUserLogoutLinks(): void { $account_switcher = $this->container->get('account_switcher'); $login_menu_link = MenuLinkMock::create(['id' => 'user_login_example', 'route_name' => 'user.login']); diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php index 558c61e8c1c..eceb9c16fc6 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php @@ -47,7 +47,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests the tree storage when no tree was built yet. */ - public function testBasicMethods() { + public function testBasicMethods(): void { $this->doTestEmptyStorage(); $this->doTestTable(); } @@ -74,7 +74,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests with a simple linear hierarchy. */ - public function testSimpleHierarchy() { + public function testSimpleHierarchy(): void { // Add some links with parent on the previous one and test some values. // <tools> // - test1 @@ -96,7 +96,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests the tree with moving links inside the hierarchy. */ - public function testMenuLinkMoving() { + public function testMenuLinkMoving(): void { // Before the move. // <tools> // - test1 @@ -174,7 +174,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests with disabled child links. */ - public function testMenuDisabledChildLinks() { + public function testMenuDisabledChildLinks(): void { // Add some links with parent on the previous one and test some values. // <tools> // - test1 @@ -229,7 +229,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests the loadTreeData method. */ - public function testLoadTree() { + public function testLoadTree(): void { $this->addMenuLink('test1', '', 'test1'); $this->addMenuLink('test2', 'test1', 'test2'); $this->addMenuLink('test3', 'test2', 'test3'); @@ -299,7 +299,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests finding the subtree height with content menu links. */ - public function testSubtreeHeight() { + public function testSubtreeHeight(): void { // root // - child1 // -- child2 @@ -321,7 +321,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Ensure hierarchy persists after a menu rebuild. */ - public function testMenuRebuild() { + public function testMenuRebuild(): void { // root // - child1 // -- child2 @@ -352,7 +352,7 @@ class MenuTreeStorageTest extends KernelTestBase { /** * Tests MenuTreeStorage::loadByProperties(). */ - public function testLoadByProperties() { + public function testLoadByProperties(): void { $tests = [ ['foo' => 'bar'], [0 => 'wrong'], diff --git a/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php b/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php index 674217db6e5..73e95136cb1 100644 --- a/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php @@ -35,7 +35,7 @@ class MessengerTest extends KernelTestBase { * @covers ::deleteByType * @covers ::messagesByType */ - public function testRemoveSingleMessage() { + public function testRemoveSingleMessage(): void { // Set two messages. $this->messenger->addStatus('First message (removed).'); @@ -65,7 +65,7 @@ class MessengerTest extends KernelTestBase { * @covers ::deleteByType * @covers ::deleteAll */ - public function testAddNoDuplicates() { + public function testAddNoDuplicates(): void { $this->messenger->addStatus('Non Duplicated status message'); $this->messenger->addStatus('Non Duplicated status message'); @@ -106,7 +106,7 @@ class MessengerTest extends KernelTestBase { * @covers ::addError * @covers ::deleteByType */ - public function testAddWithDuplicates() { + public function testAddWithDuplicates(): void { $this->messenger->addStatus('Duplicated status message', TRUE); $this->messenger->addStatus('Duplicated status message', TRUE); @@ -132,7 +132,7 @@ class MessengerTest extends KernelTestBase { * @covers ::deleteByType * @covers ::messagesByType */ - public function testAddMarkup() { + public function testAddMarkup(): void { // Add a Markup message. $this->messenger->addStatus(Markup::create('Markup with <em>markup!</em>')); diff --git a/core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php b/core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php index b79200a68cc..7fa906db6cf 100644 --- a/core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php @@ -19,7 +19,7 @@ class PagerManagerTest extends KernelTestBase { /** * @covers ::getUpdatedParameters */ - public function testGetUpdatedParameters() { + public function testGetUpdatedParameters(): void { $element = 2; $index = 5; $test_parameters = [ @@ -46,7 +46,7 @@ class PagerManagerTest extends KernelTestBase { /** * @covers ::findPage */ - public function testFindPage() { + public function testFindPage(): void { $request = Request::create('http://example.com', 'GET', ['page' => '0,10']); $request->setSession(new Session(new MockArraySessionStorage())); diff --git a/core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php b/core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php index 9e4b22d972c..89c2f0f09fd 100644 --- a/core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php @@ -19,7 +19,7 @@ class RequestPagerTest extends KernelTestBase { /** * @covers ::findPage */ - public function testFindPage() { + public function testFindPage(): void { $request = Request::create('http://example.com', 'GET', ['page' => '0,10']); $request->setSession(new Session(new MockArraySessionStorage())); @@ -35,7 +35,7 @@ class RequestPagerTest extends KernelTestBase { /** * @covers ::getQueryParameters */ - public function testGetQueryParameters() { + public function testGetQueryParameters(): void { $test_parameters = [ 'other' => 'arbitrary', ]; diff --git a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php index 31ca6dd011c..19178bf7849 100644 --- a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php +++ b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php @@ -59,7 +59,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests with no matching entity. */ - public function testNoEntity() { + public function testNoEntity(): void { $converted = $this->converter->convert(1, [ 'load_latest_revision' => TRUE, 'type' => 'entity:entity_test_mulrev', @@ -70,7 +70,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests with no pending revision. */ - public function testEntityNoPendingRevision() { + public function testEntityNoPendingRevision(): void { $entity = EntityTestMulRev::create(); $entity->save(); @@ -84,7 +84,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests with a pending revision. */ - public function testEntityWithPendingRevision() { + public function testEntityWithPendingRevision(): void { $entity = EntityTestMulRev::create(); $entity->save(); @@ -103,7 +103,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests with a translated pending revision. */ - public function testWithTranslatedPendingRevision() { + public function testWithTranslatedPendingRevision(): void { // Enable translation for test entities. $this->container->get('state')->set('entity_test.translation', TRUE); $this->container->get('entity_type.bundle.info')->clearCachedBundles(); @@ -151,7 +151,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests that pending revisions are loaded only when needed. */ - public function testOptimizedConvert() { + public function testOptimizedConvert(): void { $entity = EntityTestMulRev::create(); $entity->save(); @@ -179,7 +179,7 @@ class EntityConverterLatestRevisionTest extends KernelTestBase { /** * Tests the latest revision flag and non-revisionable entities. */ - public function testConvertNonRevisionableEntityType() { + public function testConvertNonRevisionableEntityType(): void { $entity = EntityTest::create(); $entity->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php index d909e7631a9..2ec71d9dd10 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php @@ -35,7 +35,7 @@ class PathValidatorTest extends KernelTestBase { $this->installEntitySchema('entity_test'); } - public function testGetUrlIfValidWithoutAccessCheck() { + public function testGetUrlIfValidWithoutAccessCheck(): void { $requestContext = \Drupal::service('router.request_context'); $pathValidator = \Drupal::service('path.validator'); diff --git a/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php index a85d0d7693c..4f36dd3f41a 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php @@ -21,7 +21,7 @@ class UrlAlterTest extends KernelTestBase { */ protected static $modules = ['path', 'url_alter_test', 'user']; - public function testUrlWithQueryString() { + public function testUrlWithQueryString(): void { // Test outbound query string altering. $url = Url::fromRoute('user.login'); $this->assertEquals(\Drupal::request()->getBaseUrl() . '/user/login?foo=bar', $url->toString()); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php index 5872ea06b77..6bb2c6172de 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php @@ -21,7 +21,7 @@ class ContextDefinitionTest extends KernelTestBase { /** * Tests adding constraints via annotations. */ - public function testConstraints() { + public function testConstraints(): void { $definition = $this->container->get('plugin.manager.block')->getDefinition('test_context_aware'); $this->assertArrayHasKey('context_definitions', $definition); $this->assertArrayHasKey('user', $definition['context_definitions']); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php index 998e9fef3f6..239e76243a9 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php @@ -49,7 +49,7 @@ class ConditionTestDualUserTest extends KernelTestBase { /** * Tests the dual user condition. */ - public function testConditions() { + public function testConditions(): void { $this->doTestIdenticalUser(); $this->doTestDifferentUser(); } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php index 8b90107f6bd..f9d40c6c14f 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php @@ -22,7 +22,7 @@ class CurrentThemeConditionTest extends KernelTestBase { /** * Tests the current theme condition. */ - public function testCurrentTheme() { + public function testCurrentTheme(): void { \Drupal::service('theme_installer')->install(['test_theme']); $manager = \Drupal::service('plugin.manager.condition'); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php index 59e64844afb..0fc70903827 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php @@ -26,7 +26,7 @@ class OptionalContextConditionTest extends KernelTestBase { /** * Tests with both contexts mapped to the same user. */ - public function testContextMissing() { + public function testContextMissing(): void { /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */ $condition = \Drupal::service('plugin.manager.condition') ->createInstance('condition_test_optional_context') @@ -40,7 +40,7 @@ class OptionalContextConditionTest extends KernelTestBase { /** * Tests with both contexts mapped to the same user. */ - public function testContextNoValue() { + public function testContextNoValue(): void { /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */ $condition = \Drupal::service('plugin.manager.condition') ->createInstance('condition_test_optional_context') @@ -56,7 +56,7 @@ class OptionalContextConditionTest extends KernelTestBase { /** * Tests with both contexts mapped to the same user. */ - public function testContextAvailable() { + public function testContextAvailable(): void { NodeType::create(['type' => 'example', 'name' => 'Example'])->save(); /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */ $condition = \Drupal::service('plugin.manager.condition') diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php index a837a6b09c2..bfc73c4de0e 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php @@ -79,7 +79,7 @@ class RequestPathTest extends KernelTestBase { /** * Tests the request path condition. */ - public function testConditions() { + public function testConditions(): void { // Get the request path condition and test and configure it to check against // different patterns and requests. diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ResponseStatusTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ResponseStatusTest.php index faec6e8c45f..6617de54650 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ResponseStatusTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ResponseStatusTest.php @@ -55,7 +55,7 @@ class ResponseStatusTest extends KernelTestBase { * * @dataProvider providerTestConditions */ - public function testConditions(array $status_codes, bool $negate, int $response_code, bool $expected_execute) { + public function testConditions(array $status_codes, bool $negate, int $response_code, bool $expected_execute): void { if ($response_code === Response::HTTP_OK) { $request = Request::create('/my/valid/page'); } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php index a64cb87119b..1bf868c8bf2 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php @@ -55,14 +55,14 @@ class ContextAwarePluginTraitTest extends KernelTestBase { /** * @covers ::getContextDefinitions */ - public function testGetContextDefinitions() { + public function testGetContextDefinitions(): void { $this->assertIsArray($this->plugin->getContextDefinitions()); } /** * @covers ::getContextDefinition */ - public function testGetContextDefinition() { + public function testGetContextDefinition(): void { // The context is not defined, so an exception will be thrown. $this->expectException(ContextException::class); $this->expectExceptionMessage('The person context is not a valid context.'); @@ -72,7 +72,7 @@ class ContextAwarePluginTraitTest extends KernelTestBase { /** * @covers ::getContextValue */ - public function testGetContextValue() { + public function testGetContextValue(): void { $this->plugin->setContextValue('nato_letter', 'Alpha'); $this->assertSame('Alpha', $this->plugin->getContextValue('nato_letter')); } @@ -80,7 +80,7 @@ class ContextAwarePluginTraitTest extends KernelTestBase { /** * @covers ::setContextValue */ - public function testSetContextValue() { + public function testSetContextValue(): void { $typed_data_manager = $this->prophesize(TypedDataManagerInterface::class); $container = new ContainerBuilder(); $container->set('typed_data_manager', $typed_data_manager->reveal()); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php index 41f5346af5d..436c9fd70a7 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php @@ -25,7 +25,7 @@ class ContextDefinitionTest extends KernelTestBase { /** * @covers ::isSatisfiedBy */ - public function testIsSatisfiedBy() { + public function testIsSatisfiedBy(): void { $this->installEntitySchema('user'); $value = EntityTest::create([]); @@ -51,7 +51,7 @@ class ContextDefinitionTest extends KernelTestBase { /** * @covers ::__construct */ - public function testEntityContextDefinitionAssert() { + public function testEntityContextDefinitionAssert(): void { $this->expectException(\AssertionError::class); $this->expectExceptionMessage('assert(!str_starts_with($data_type, \'entity:\') || $this instanceof EntityContextDefinition)'); new ContextDefinition('entity:entity_test'); @@ -60,7 +60,7 @@ class ContextDefinitionTest extends KernelTestBase { /** * @covers ::create */ - public function testCreateWithEntityDataType() { + public function testCreateWithEntityDataType(): void { $this->assertInstanceOf(EntityContextDefinition::class, ContextDefinition::create('entity:user')); } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextHandlerTest.php index 0259ca15c9b..2340cbec9ad 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextHandlerTest.php @@ -31,7 +31,7 @@ class ContextHandlerTest extends KernelTestBase { /** * @covers ::applyContextMapping */ - public function testApplyContextMapping() { + public function testApplyContextMapping(): void { $entity = EntityTest::create([]); $context_definition = EntityContextDefinition::fromEntity($entity); $context = EntityContext::fromEntity($entity); @@ -49,7 +49,7 @@ class ContextHandlerTest extends KernelTestBase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingAlreadyApplied() { + public function testApplyContextMappingAlreadyApplied(): void { $entity = EntityTest::create([]); $context_definition = EntityContextDefinition::fromEntity($entity); $context = EntityContext::fromEntity($entity); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php index 2c5bb1c4ac5..d47d0aedffe 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php @@ -31,7 +31,7 @@ class ContextPluginTest extends KernelTestBase { /** * Tests basic context definition and value getters and setters. */ - public function testContext() { + public function testContext(): void { $this->installEntitySchema('user'); $this->installEntitySchema('node'); $type = NodeType::create(['type' => 'page', 'name' => 'Page']); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php index 6954011a15a..3e3e88bf0b0 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php @@ -22,7 +22,7 @@ class ContextTypedDataTest extends KernelTestBase { /** * Tests that contexts can be serialized. */ - public function testSerialize() { + public function testSerialize(): void { $definition = new ContextDefinition('any'); $data_definition = DataDefinition::create('string'); $typed_data = new StringData($data_definition); @@ -44,7 +44,7 @@ class ContextTypedDataTest extends KernelTestBase { * * @covers ::getContextValue */ - public function testGetContextValue() { + public function testGetContextValue(): void { $data_definition = DataDefinition::create('string'); $typed_data = new StringData($data_definition); $typed_data->setValue('example string'); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php index aff66dcf970..703d15f2062 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php @@ -25,7 +25,7 @@ class DefaultPluginManagerTest extends KernelTestBase { /** * Tests annotations and attributes on the default plugin manager. */ - public function testDefaultPluginManager() { + public function testDefaultPluginManager(): void { $subdir = 'Plugin/plugin_test/custom_annotation'; $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src'; $namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory]); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php index 16ec96bdd21..aecad9faa95 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php @@ -19,7 +19,7 @@ class DerivativeTest extends PluginTestBase { /** * Tests getDefinitions() and getDefinition() with a derivativeDecorator. */ - public function testDerivativeDecorator() { + public function testDerivativeDecorator(): void { // Ensure that getDefinitions() returns the expected definitions. $this->assertEquals($this->mockBlockExpectedDefinitions, $this->mockBlockManager->getDefinitions()); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index 76dd4a32407..1a9686cf8cd 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -39,7 +39,7 @@ abstract class DiscoveryTestBase extends KernelTestBase { /** * Tests getDefinitions() and getDefinition(). */ - public function testDiscoveryInterface() { + public function testDiscoveryInterface(): void { // Ensure that getDefinitions() returns the expected definitions. // For the arrays to be identical (instead of only equal), they must be // sorted equally, which seems unnecessary here. diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php index 0effaabea89..868f06e4f7f 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php @@ -23,7 +23,7 @@ class EntityContextTypedDataTest extends KernelTestBase { /** * Tests that entity contexts wrapping a config entity can be validated. */ - public function testValidateConfigEntityContext() { + public function testValidateConfigEntityContext(): void { $display = EntityViewDisplay::create([ 'targetEntityType' => 'entity_test', 'bundle' => 'entity_test', diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php index 4ad37617ee6..60d073b06e7 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php @@ -21,7 +21,7 @@ class FactoryTest extends PluginTestBase { /** * Tests that DefaultFactory can create a plugin instance. */ - public function testDefaultFactory() { + public function testDefaultFactory(): void { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->testPluginManager->createInstance('user_login', ['title' => 'Enter your login name and password']); $this->assertSame('Drupal\\plugin_test\\Plugin\\plugin_test\\mock_block\\MockUserLoginBlock', get_class($plugin), 'Correct plugin class instantiated with default factory.'); @@ -48,7 +48,7 @@ class FactoryTest extends PluginTestBase { * reflection factory and it provides some additional variety in plugin * object creation. */ - public function testReflectionFactory() { + public function testReflectionFactory(): void { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->mockBlockManager->createInstance('user_login', ['title' => 'Enter your login name and password']); $this->assertSame('Drupal\\plugin_test\\Plugin\\plugin_test\\mock_block\\MockUserLoginBlock', get_class($plugin), 'Correct plugin class instantiated.'); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php index 1d6e0be68fa..df96e368654 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php @@ -19,7 +19,7 @@ class InspectionTest extends PluginTestBase { /** * Ensure the test plugins correctly implement getPluginId() and getPluginDefinition(). */ - public function testInspection() { + public function testInspection(): void { foreach (['user_login'] as $id) { $plugin = $this->testPluginManager->createInstance($id); $expected_definition = $this->testPluginExpectedDefinitions[$id]; diff --git a/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php b/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php index 5bb185c880c..d69767410be 100644 --- a/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php @@ -93,7 +93,7 @@ class QueueSerializationTest extends KernelTestBase implements FormInterface { /** * Tests queue injection serialization. */ - public function testQueueSerialization() { + public function testQueueSerialization(): void { $form_state = new FormState(); $form_state->setRequestMethod('POST'); $form_state->setCached(); diff --git a/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php b/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php index 9561f0804ed..9b91a911174 100644 --- a/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php +++ b/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php @@ -19,7 +19,7 @@ class QueueTest extends KernelTestBase { /** * Tests the System queue. */ - public function testSystemQueue() { + public function testSystemQueue(): void { // Create two queues. $queue1 = new DatabaseQueue($this->randomMachineName(), Database::getConnection()); $queue1->createQueue(); @@ -32,7 +32,7 @@ class QueueTest extends KernelTestBase { /** * Tests the Memory queue. */ - public function testMemoryQueue() { + public function testMemoryQueue(): void { // Create two queues. $queue1 = new Memory($this->randomMachineName()); $queue1->createQueue(); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php index a67f3e7167c..d263f1a4bc3 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php @@ -63,7 +63,7 @@ class ActionsTest extends KernelTestBase implements FormInterface { public function submitForm(array &$form, FormStateInterface $form_state) { } - public function testDropbuttonWithBubbleableMetadata() { + public function testDropbuttonWithBubbleableMetadata(): void { $result = \Drupal::formBuilder()->getForm($this); \Drupal::service('renderer')->renderRoot($result); $this->assertEquals(['system/base', 'core/drupal.dropbutton'], $result['#attached']['library']); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php index 815e999b09f..09931b10f3a 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php @@ -22,7 +22,7 @@ class DeprecatedElementTest extends KernelTestBase { /** * Tests that render elements can trigger deprecations in their constructor. */ - public function testBuildInfo() { + public function testBuildInfo(): void { $info_manager = $this->container->get('plugin.manager.element_info'); $element_names = [ 'deprecated', diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php index 98962932b30..95d6d633f11 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php @@ -66,7 +66,7 @@ class MachineNameTest extends KernelTestBase implements FormInterface { /** * Tests the order of the machine name field and the source. */ - public function testMachineNameOrderException() { + public function testMachineNameOrderException(): void { $this->expectException(\LogicException::class); $this->expectExceptionMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.'); $form = \Drupal::formBuilder()->getForm($this); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php index 36bfeec7106..7ad8afa75be 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php @@ -19,7 +19,7 @@ class PluginAlterTest extends KernelTestBase { /** * Tests hook_element_plugin_alter(). */ - public function testPluginAlter() { + public function testPluginAlter(): void { $info_manager = $this->container->get('plugin.manager.element_info'); $this->assertArrayHasKey('weight', $info_manager->getDefinitions()); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php index aa5022359af..e03e9d4f3ef 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php @@ -50,7 +50,7 @@ class RenderElementTypesTest extends KernelTestBase { /** * Tests system #type 'container'. */ - public function testContainer() { + public function testContainer(): void { // Basic container with no attributes. $this->assertElements([ '#type' => 'container', @@ -78,7 +78,7 @@ class RenderElementTypesTest extends KernelTestBase { /** * Tests system #type 'html_tag'. */ - public function testHtmlTag() { + public function testHtmlTag(): void { // Test void element. $this->assertElements([ '#type' => 'html_tag', @@ -116,7 +116,7 @@ class RenderElementTypesTest extends KernelTestBase { /** * Tests system #type 'more_link'. */ - public function testMoreLink() { + public function testMoreLink(): void { $elements = [ [ 'name' => "#type 'more_link' anchor tag generation without extra classes", @@ -196,7 +196,7 @@ class RenderElementTypesTest extends KernelTestBase { /** * Tests system #type 'system_compact_link'. */ - public function testSystemCompactLink() { + public function testSystemCompactLink(): void { $elements = [ [ 'name' => "#type 'system_compact_link' when admin compact mode is off", diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php index 0bb07c99357..3596aafe707 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php @@ -20,7 +20,7 @@ class TableSortExtenderTest extends KernelTestBase { /** * Tests \Drupal\Core\Utility\TableSort::getContextFromRequest(). */ - public function testTableSortInit() { + public function testTableSortInit(): void { // Test simple table headers. diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php index 04741d5114b..0d72f964a5f 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php @@ -23,7 +23,7 @@ class TableTest extends KernelTestBase { /** * If $sticky is TRUE, `sticky-header` class should be included. */ - public function testThemeTableStickyHeaders() { + public function testThemeTableStickyHeaders(): void { $header = ['one', 'two', 'three']; $rows = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $table = [ @@ -39,7 +39,7 @@ class TableTest extends KernelTestBase { /** * If $sticky is FALSE, `sticky-header` class should not be included. */ - public function testThemeTableNoStickyHeaders() { + public function testThemeTableNoStickyHeaders(): void { $header = ['one', 'two', 'three']; $rows = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $attributes = []; @@ -64,7 +64,7 @@ class TableTest extends KernelTestBase { * Tests are performed when the there are no rows and that the empty text is * displayed correctly. */ - public function testThemeTableWithEmptyMessage() { + public function testThemeTableWithEmptyMessage(): void { $header = [ 'Header 1', [ @@ -92,7 +92,7 @@ class TableTest extends KernelTestBase { /** * Tests that the 'no_striping' option works correctly. */ - public function testThemeTableWithNoStriping() { + public function testThemeTableWithNoStriping(): void { $rows = [ [ 'data' => [1], @@ -111,7 +111,7 @@ class TableTest extends KernelTestBase { /** * Tests that the 'footer' option works correctly. */ - public function testThemeTableFooter() { + public function testThemeTableFooter(): void { $footer = [ [ 'data' => [1], @@ -133,7 +133,7 @@ class TableTest extends KernelTestBase { /** * Tests that the 'header' option in cells works correctly. */ - public function testThemeTableHeaderCellOption() { + public function testThemeTableHeaderCellOption(): void { $rows = [ [ ['data' => 1, 'header' => TRUE], @@ -153,7 +153,7 @@ class TableTest extends KernelTestBase { /** * Tests that the 'responsive-table' class is applied correctly. */ - public function testThemeTableResponsive() { + public function testThemeTableResponsive(): void { $header = ['one', 'two', 'three']; $rows = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $table = [ @@ -169,7 +169,7 @@ class TableTest extends KernelTestBase { /** * Tests that the 'responsive-table' class is not applied without headers. */ - public function testThemeTableNotResponsiveHeaders() { + public function testThemeTableNotResponsiveHeaders(): void { $rows = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $table = [ '#type' => 'table', @@ -183,7 +183,7 @@ class TableTest extends KernelTestBase { /** * Tests that 'responsive-table' class only applied when responsive is TRUE. */ - public function testThemeTableNotResponsiveProperty() { + public function testThemeTableNotResponsiveProperty(): void { $header = ['one', 'two', 'three']; $rows = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $table = [ @@ -199,7 +199,7 @@ class TableTest extends KernelTestBase { /** * Tests 'priority-medium' and 'priority-low' classes. */ - public function testThemeTableResponsivePriority() { + public function testThemeTableResponsivePriority(): void { $header = [ // Test associative header indices. 'associative_key' => ['data' => 1, 'class' => [RESPONSIVE_PRIORITY_MEDIUM]], @@ -227,7 +227,7 @@ class TableTest extends KernelTestBase { /** * Tests header elements with a mix of string and render array values. */ - public function testThemeTableHeaderRenderArray() { + public function testThemeTableHeaderRenderArray(): void { $header = [ [ 'data' => [ @@ -258,7 +258,7 @@ class TableTest extends KernelTestBase { /** * Tests row elements with a mix of string and render array values. */ - public function testThemeTableRowRenderArray() { + public function testThemeTableRowRenderArray(): void { $header = ['one', 'two', 'three']; $rows = [ [ @@ -299,7 +299,7 @@ class TableTest extends KernelTestBase { /** * Tests that the select/checkbox label is being generated and escaped. */ - public function testThemeTableTitle() { + public function testThemeTableTitle(): void { $form = \Drupal::formBuilder()->getForm('\Drupal\form_test\Form\FormTestTableForm'); $this->render($form); $this->assertEscaped('Update <em>kitten</em>'); diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php index d14f9511d4a..00b7948f2a8 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php @@ -35,7 +35,7 @@ class WeightTest extends KernelTestBase { * * @covers ::processWeight */ - public function testProcessWeight() { + public function testProcessWeight(): void { $element = []; $form_state = new FormState(); $complete_form = []; @@ -61,7 +61,7 @@ class WeightTest extends KernelTestBase { * * @covers ::processWeight */ - public function testProcessWeightSelectMax() { + public function testProcessWeightSelectMax(): void { $form_state = new FormState(); $definition = [ '#type' => 'weight', diff --git a/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php index 46fa63a0908..defad383bea 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php @@ -25,7 +25,7 @@ class ElementInfoIntegrationTest extends KernelTestBase { /** * Ensures that the element info can be altered by themes. */ - public function testElementInfoByTheme() { + public function testElementInfoByTheme(): void { /** @var \Drupal\Core\Theme\ThemeInitializationInterface $theme_initializer */ $theme_initializer = $this->container->get('theme.initialization'); diff --git a/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php b/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php index f29477a48a5..2f49ac29e50 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php @@ -45,14 +45,14 @@ class RenderCacheTest extends KernelTestBase { /** * Tests that user 1 has a different permission context with the same roles. */ - public function testUser1PermissionContext() { + public function testUser1PermissionContext(): void { $this->doTestUser1WithContexts(['user.permissions']); } /** * Tests that user 1 has a different roles context with the same roles. */ - public function testUser1RolesContext() { + public function testUser1RolesContext(): void { $this->doTestUser1WithContexts(['user.roles']); } diff --git a/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php b/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php index d2948015e7c..8a517f5a491 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php @@ -23,7 +23,7 @@ class RenderTest extends KernelTestBase { /** * Tests theme preprocess functions being able to attach assets. */ - public function testDrupalRenderThemePreprocessAttached() { + public function testDrupalRenderThemePreprocessAttached(): void { \Drupal::state()->set('theme_preprocess_attached_test', TRUE); $test_element = [ @@ -48,7 +48,7 @@ class RenderTest extends KernelTestBase { /** * Ensures that render array children are processed correctly. */ - public function testRenderChildren() { + public function testRenderChildren(): void { // Ensure that #prefix and #suffix is only being printed once since that is // the behavior the caller code expects. $build = [ @@ -65,7 +65,7 @@ class RenderTest extends KernelTestBase { /** * Tests that we get an exception when we try to attach an illegal type. */ - public function testProcessAttached() { + public function testProcessAttached(): void { // Specify invalid attachments in a render array. $build['#attached']['library'][] = 'core/drupal.states'; $build['#attached']['drupal_process_states'][] = []; @@ -79,7 +79,7 @@ class RenderTest extends KernelTestBase { * * @group legacy */ - public function testDeprecateRenderPlain() { + public function testDeprecateRenderPlain(): void { $message = ['#markup' => 'Test']; \Drupal::service('renderer')->renderPlain($message); $this->expectDeprecation('Renderer::renderPlain() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Instead, you should use ::renderInIsolation(). See https://www.drupal.org/node/3407994'); diff --git a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php index 2f18af508b3..9758937cd99 100644 --- a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php +++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php @@ -47,7 +47,7 @@ class RouteNoneTest extends KernelTestBase { /** * Tests the output process. */ - public function testProcessOutbound() { + public function testProcessOutbound(): void { $expected_cacheability = (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT); $request_stack = \Drupal::requestStack(); diff --git a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php index 32a6024215c..942fd5b2751 100644 --- a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php @@ -46,7 +46,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { /** * Tests the output process. */ - public function testProcessOutbound() { + public function testProcessOutbound(): void { $expected_cacheability = (new BubbleableMetadata()) ->addCacheContexts(['route']) ->setCacheMaxAge(Cache::PERMANENT); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php index 9254ccc2568..76e9b232ec6 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php @@ -35,7 +35,7 @@ class ContentNegotiationRoutingTest extends KernelTestBase { /** * Tests the content negotiation aspect of routing. */ - public function testContentRouting() { + public function testContentRouting(): void { // Alias with extension pointing to no extension/constant content-type. $this->createPathAlias('/content_negotiation/html', '/alias.html'); @@ -99,7 +99,7 @@ class ContentNegotiationRoutingTest extends KernelTestBase { /** * Full negotiation by header only. */ - public function testFullNegotiation() { + public function testFullNegotiation(): void { $this->enableModules(['accept_header_routing_test']); $tests = [ // ['path', 'accept', 'content-type'], diff --git a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php index c5b9e26d6dd..f9eed1d6eaf 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php @@ -34,7 +34,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests on a route with a non-supported HTTP method. */ - public function test405() { + public function test405(): void { $request = Request::create('/router_test/test15', 'PATCH'); /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */ @@ -47,7 +47,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests a route with a non-supported _format parameter. */ - public function test406() { + public function test406(): void { $request = Request::create('/router_test/test2?_format=non_existent_format'); /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */ @@ -60,7 +60,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests the exception handling for json and 403 status code. */ - public function testJson403() { + public function testJson403(): void { $request = Request::create('/router_test/test15'); $request->query->set('_format', 'json'); $request->setRequestFormat('json'); @@ -78,7 +78,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests the exception handling for json and 404 status code. */ - public function testJson404() { + public function testJson404(): void { $request = Request::create('/not-found'); $request->query->set('_format', 'json'); $request->setRequestFormat('json'); @@ -95,7 +95,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests the exception handling for HTML and 403 status code. */ - public function testHtml403() { + public function testHtml403(): void { $request = Request::create('/router_test/test15'); $request->setFormat('html', ['text/html']); @@ -110,7 +110,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests the exception handling for HTML and 404 status code. */ - public function testHtml404() { + public function testHtml404(): void { $request = Request::create('/not-found'); $request->setFormat('html', ['text/html']); @@ -125,7 +125,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests that the exception response is executed in the original context. */ - public function testExceptionResponseGeneratedForOriginalRequest() { + public function testExceptionResponseGeneratedForOriginalRequest(): void { // Test with 404 path pointing to a route that uses '_controller'. $response = $this->doTest404Route('/router_test/test25'); $this->assertStringContainsString('/not-found', $response->getContent()); @@ -163,7 +163,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests if exception backtraces are properly escaped when output to HTML. */ - public function testBacktraceEscaping() { + public function testBacktraceEscaping(): void { // Enable verbose error logging. $this->config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); @@ -185,7 +185,7 @@ class ExceptionHandlingTest extends KernelTestBase { /** * Tests exception message escaping. */ - public function testExceptionEscaping() { + public function testExceptionEscaping(): void { // Enable verbose error logging. $this->config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php b/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php index 677968b3ec8..481caab2ca4 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php @@ -59,7 +59,7 @@ class MatcherDumperTest extends KernelTestBase { /** * Confirms that the dumper can be instantiated successfully. */ - public function testCreate() { + public function testCreate(): void { $connection = Database::getConnection(); $dumper = new MatcherDumper($connection, $this->state, $this->logger); @@ -70,7 +70,7 @@ class MatcherDumperTest extends KernelTestBase { /** * Confirms that we can add routes to the dumper. */ - public function testAddRoutes() { + public function testAddRoutes(): void { $connection = Database::getConnection(); $dumper = new MatcherDumper($connection, $this->state, $this->logger); @@ -91,7 +91,7 @@ class MatcherDumperTest extends KernelTestBase { /** * Confirms that we can add routes to the dumper when it already has some. */ - public function testAddAdditionalRoutes() { + public function testAddAdditionalRoutes(): void { $connection = Database::getConnection(); $dumper = new MatcherDumper($connection, $this->state, $this->logger); @@ -119,7 +119,7 @@ class MatcherDumperTest extends KernelTestBase { /** * Confirm that we can dump a route collection to the database. */ - public function testDump() { + public function testDump(): void { $connection = Database::getConnection(); $dumper = new MatcherDumper($connection, $this->state, $this->logger, 'test_routes'); @@ -154,7 +154,7 @@ class MatcherDumperTest extends KernelTestBase { /** * Tests the determination of the masks generation. */ - public function testMenuMasksGeneration() { + public function testMenuMasksGeneration(): void { $connection = Database::getConnection(); $dumper = new MatcherDumper($connection, $this->state, $this->logger, 'test_routes'); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/PathChangedHelperTest.php b/core/tests/Drupal/KernelTests/Core/Routing/PathChangedHelperTest.php index 99ab50ce000..82ab86cdf11 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/PathChangedHelperTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/PathChangedHelperTest.php @@ -34,7 +34,7 @@ class PathChangedHelperTest extends KernelTestBase { * @covers ::newPath * @covers ::redirect */ - public function testPathChangedHelper() { + public function testPathChangedHelper(): void { $route = \Drupal::service('router.route_provider')->getRouteByName('path.changed.bc'); $raw_parameters = [ 'block_type' => 'test_block_type', diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php index fd9008f73c1..4bb9c5efa29 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php @@ -122,7 +122,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that the correct candidate outlines are generated. */ - public function testCandidateOutlines() { + public function testCandidateOutlines(): void { $connection = Database::getConnection(); $provider = new TestRouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -146,7 +146,7 @@ class RouteProviderTest extends KernelTestBase { /** * Don't fail when given an empty path. */ - public function testEmptyPathCandidatesOutlines() { + public function testEmptyPathCandidatesOutlines(): void { $provider = new TestRouteProvider(Database::getConnection(), $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); $candidates = $provider->getCandidateOutlines([]); $this->assertCount(0, $candidates, 'Empty parts should return no candidates.'); @@ -155,7 +155,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find routes with the exact incoming path. */ - public function testExactPathMatch() { + public function testExactPathMatch(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -179,7 +179,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find routes whose pattern would match the request. */ - public function testOutlinePathMatch() { + public function testOutlinePathMatch(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -232,7 +232,7 @@ class RouteProviderTest extends KernelTestBase { * * @dataProvider providerMixedCaseRoutePaths */ - public function testMixedCasePaths($path, $expected_route_name, $method = 'GET') { + public function testMixedCasePaths($path, $expected_route_name, $method = 'GET'): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -276,7 +276,7 @@ class RouteProviderTest extends KernelTestBase { * * @dataProvider providerDuplicateRoutePaths */ - public function testDuplicateRoutePaths($path, $number, $expected_route_name = NULL) { + public function testDuplicateRoutePaths($path, $number, $expected_route_name = NULL): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -298,7 +298,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms RouteProvider::getAllRoutes() extracts information correctly from the database. */ - public function testGetAllRoutes() { + public function testGetAllRoutes(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -324,7 +324,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that a trailing slash on the request does not result in a 404. */ - public function testOutlinePathMatchTrailingSlash() { + public function testOutlinePathMatchTrailingSlash(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -353,7 +353,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find routes whose pattern would match the request. */ - public function testOutlinePathMatchDefaults() { + public function testOutlinePathMatchDefaults(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -391,7 +391,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find routes whose pattern would match the request. */ - public function testOutlinePathMatchDefaultsCollision() { + public function testOutlinePathMatchDefaultsCollision(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -430,7 +430,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find routes whose pattern would match the request. */ - public function testOutlinePathMatchDefaultsCollision2() { + public function testOutlinePathMatchDefaultsCollision2(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -469,7 +469,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that we can find multiple routes that match the request equally. */ - public function testOutlinePathMatchDefaultsCollision3() { + public function testOutlinePathMatchDefaultsCollision3(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -508,7 +508,7 @@ class RouteProviderTest extends KernelTestBase { /** * Tests a route with a 0 as value. */ - public function testOutlinePathMatchZero() { + public function testOutlinePathMatchZero(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -543,7 +543,7 @@ class RouteProviderTest extends KernelTestBase { /** * Confirms that an exception is thrown when no matching path is found. */ - public function testOutlinePathNoMatch() { + public function testOutlinePathNoMatch(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -567,7 +567,7 @@ class RouteProviderTest extends KernelTestBase { /** * Tests that route caching works. */ - public function testRouteCaching() { + public function testRouteCaching(): void { $connection = Database::getConnection(); $language_manager = \Drupal::languageManager(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes', $language_manager); @@ -659,7 +659,7 @@ class RouteProviderTest extends KernelTestBase { /** * Tests RouteProvider::getRouteByName() & RouteProvider::getRoutesByNames(). */ - public function testRouteByName() { + public function testRouteByName(): void { $connection = Database::getConnection(); $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); @@ -694,7 +694,7 @@ class RouteProviderTest extends KernelTestBase { /** * Ensures that the routing system is capable of extreme long patterns. */ - public function testGetRoutesByPatternWithLongPatterns() { + public function testGetRoutesByPatternWithLongPatterns(): void { $connection = Database::getConnection(); $provider = new TestRouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes'); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php index 1b337b92b92..b71725dec07 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php @@ -26,7 +26,7 @@ class UrlIntegrationTest extends KernelTestBase { /** * Ensures that the access() method on \Drupal\Core\Url objects works. */ - public function testAccess() { + public function testAccess(): void { /** @var \Drupal\user\RoleInterface $role_with_access */ $role_with_access = Role::create(['id' => 'role_with_access', 'label' => 'With access']); $role_with_access->grantPermission('administer users'); diff --git a/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php index 19ad485c3b5..b0807f5d41e 100644 --- a/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php @@ -42,7 +42,7 @@ class ServiceProviderTest extends KernelTestBase { /** * Tests that services provided by module service providers get registered to the DIC. */ - public function testServiceProviderRegistration() { + public function testServiceProviderRegistration(): void { $definition = $this->container->getDefinition('file.usage'); $this->assertSame('Drupal\\service_provider_test\\TestFileUsage', $definition->getClass(), 'Class has been changed'); $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC'); @@ -51,7 +51,7 @@ class ServiceProviderTest extends KernelTestBase { /** * Tests that the DIC keeps up with module enable/disable in the same request. */ - public function testServiceProviderRegistrationDynamic() { + public function testServiceProviderRegistrationDynamic(): void { // Uninstall the module and ensure the service provider's service is not registered. \Drupal::service('module_installer')->uninstall(['service_provider_test']); $this->assertFalse(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service does not exist in the DIC.'); diff --git a/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php b/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php index e10da57516b..ca78d1997ac 100644 --- a/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php +++ b/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php @@ -14,7 +14,7 @@ use Drupal\KernelTests\KernelTestBase; */ class AccountSwitcherTest extends KernelTestBase { - public function testAccountSwitching() { + public function testAccountSwitching(): void { $session_handler = $this->container->get('session_handler.write_safe'); $user = $this->container->get('current_user'); $switcher = $this->container->get('account_switcher'); diff --git a/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php b/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php index 398c3d2dd07..8fc563f9d2e 100644 --- a/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php +++ b/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php @@ -16,7 +16,7 @@ class SessionManagerDestroyNoCliCheckTest extends KernelTestBase { /** * Tests starting and destroying a session from the CLI. */ - public function testCallSessionManagerStartAndDestroy() { + public function testCallSessionManagerStartAndDestroy(): void { $this->assertFalse(\Drupal::service('session_manager')->start()); $this->assertNull(\Drupal::service('session_manager')->destroy()); } diff --git a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php index 61121ef7c3e..7d8b28ef37e 100644 --- a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php +++ b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php @@ -18,7 +18,7 @@ class SettingsRewriteTest extends KernelTestBase { /** * @covers \Drupal\Core\Site\SettingsEditor::rewrite */ - public function testDrupalRewriteSettings() { + public function testDrupalRewriteSettings(): void { include_once $this->root . '/core/includes/install.inc'; $site_path = $this->container->getParameter('site.path'); $tests = [ diff --git a/core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php b/core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php index 8df1ccb9d96..5d2fe9e6b9d 100644 --- a/core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php +++ b/core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php @@ -38,7 +38,7 @@ class StreamWrapperManagerTest extends KernelTestBase { * * @dataProvider providerTestUriScheme */ - public function testUriScheme($uri, $expected) { + public function testUriScheme($uri, $expected): void { $this->assertSame($expected, StreamWrapperManager::getScheme($uri)); } diff --git a/core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php b/core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php index cc2cf7045ec..e5c3663d477 100644 --- a/core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php +++ b/core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php @@ -35,7 +35,7 @@ class TranslationStringTest extends KernelTestBase { /** * Tests that TranslatableMarkup objects can be compared. */ - public function testComparison() { + public function testComparison(): void { $this->rebootAndPrepareSettings(); $a = \Drupal::service('string_translation')->translate('Example @number', ['@number' => 42], ['langcode' => 'de']); diff --git a/core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php b/core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php index 6c7e2b99dce..85aedbd1305 100644 --- a/core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php +++ b/core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php @@ -38,7 +38,7 @@ class AnonymousPrivateTempStoreTest extends KernelTestBase { /** * Tests anonymous can get without a previous set. */ - public function testAnonymousCanUsePrivateTempStoreGet() { + public function testAnonymousCanUsePrivateTempStoreGet(): void { $actual = $this->tempStore->get('foo'); $this->assertNull($actual); } @@ -46,7 +46,7 @@ class AnonymousPrivateTempStoreTest extends KernelTestBase { /** * Tests anonymous can use the PrivateTempStore. */ - public function testAnonymousCanUsePrivateTempStoreSet() { + public function testAnonymousCanUsePrivateTempStoreSet(): void { $this->tempStore->set('foo', 'bar'); $metadata1 = $this->tempStore->getMetadata('foo'); diff --git a/core/tests/Drupal/KernelTests/Core/TempStore/TempStoreDatabaseTest.php b/core/tests/Drupal/KernelTests/Core/TempStore/TempStoreDatabaseTest.php index 8d58db8806a..e78bed73227 100644 --- a/core/tests/Drupal/KernelTests/Core/TempStore/TempStoreDatabaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/TempStore/TempStoreDatabaseTest.php @@ -22,7 +22,7 @@ class TempStoreDatabaseTest extends KernelTestBase { /** * Tests the SharedTempStore API. */ - public function testSharedTempStore() { + public function testSharedTempStore(): void { // Create testing objects. $objects = []; for ($i = 0; $i <= 3; $i++) { diff --git a/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php b/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php index ea8369c1673..859f1fe3bad 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php @@ -20,7 +20,7 @@ class AssertMailTraitTest extends KernelTestBase { /** * Tests that the maintenance theme initializes the theme and its base themes. */ - public function testAssertMailTrait() { + public function testAssertMailTrait(): void { /** @var \Drupal\Core\Mail\MailManagerInterface $mail_service */ $mail_service = \Drupal::service('plugin.manager.mail'); diff --git a/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php b/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php index 218b3418d70..12fc563de17 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php @@ -20,7 +20,7 @@ class EnvironmentCleanerTest extends KernelTestBase { /** * @covers ::doCleanTemporaryDirectories */ - public function testDoCleanTemporaryDirectories() { + public function testDoCleanTemporaryDirectories(): void { vfsStream::setup('cleanup_test', NULL, [ 'sites' => [ 'simpletest' => [ diff --git a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php index 006b20cee69..5480197f406 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php @@ -17,13 +17,13 @@ class PhpUnitBridgeTest extends KernelTestBase { protected static $modules = ['deprecation_test']; - public function testDeprecatedClass() { + public function testDeprecatedClass(): void { $this->expectDeprecation('Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass is deprecated.'); $deprecated = new FixtureDeprecatedClass(); $this->assertEquals('test', $deprecated->testFunction()); } - public function testDeprecatedFunction() { + public function testDeprecatedFunction(): void { $this->expectDeprecation('This is the deprecation message for deprecation_test_function().'); $this->assertEquals('known_return_value', \deprecation_test_function()); } diff --git a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php index 12deaf10683..c59f43156f8 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeMissingTest.php @@ -46,7 +46,7 @@ class BaseThemeMissingTest extends KernelTestBase { /** * Tests exception is thrown. */ - public function testMissingBaseThemeException() { + public function testMissingBaseThemeException(): void { $this->expectException(InfoParserException::class); $this->expectExceptionMessage('Missing required key ("base theme") in core/tests/fixtures/test_missing_base_theme/test_missing_base_theme.info.yml, see https://www.drupal.org/node/3066038'); $this->themeInstaller->install(['test_missing_base_theme']); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php index 80aab70730b..3f7c18953d3 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php @@ -45,7 +45,7 @@ class BaseThemeRequiredTest extends KernelTestBase { /** * Tests opting out of Stable 9 by setting the base theme to false. */ - public function testWildWest() { + public function testWildWest(): void { $this->themeInstaller->install(['test_wild_west']); $this->config('system.theme')->set('default', 'test_wild_west')->save(); $theme = $this->themeManager->getActiveTheme(); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php index 841432ad607..15ccdcb2490 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php @@ -22,7 +22,7 @@ class ClaroVerticalTabsTest extends KernelTestBase { /** * Confirms that Claro can render vertical tabs correctly. */ - public function testVerticalTabs() { + public function testVerticalTabs(): void { // Enable the Claro theme. \Drupal::service('theme_installer')->install(['claro']); $this->config('system.theme')->set('default', 'claro')->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ConfigImportThemeInstallTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ConfigImportThemeInstallTest.php index a7ecad01929..6f0ed1a344e 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ConfigImportThemeInstallTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ConfigImportThemeInstallTest.php @@ -32,7 +32,7 @@ class ConfigImportThemeInstallTest extends KernelTestBase { /** * Tests config imports that install and uninstall a theme with dependencies. */ - public function testConfigImportWithThemeWithModuleDependencies() { + public function testConfigImportWithThemeWithModuleDependencies(): void { $this->container->get('module_installer')->install(['test_module_required_by_theme', 'test_another_module_required_by_theme']); $this->container->get('theme_installer')->install(['test_theme_depending_on_modules']); $this->assertTrue($this->container->get('theme_handler')->themeExists('test_theme_depending_on_modules'), 'test_theme_depending_on_modules theme installed'); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php b/core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php index 895afc92fe3..888db8a0cd7 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php @@ -72,7 +72,7 @@ class FrontMatterTest extends KernelTestBase { * @covers \Drupal\Core\Template\TwigEnvironment::getTemplateMetadata * @covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException */ - public function testFrontMatterBroken() { + public function testFrontMatterBroken(): void { $source = "---\ncollection:\n- key: foo\n foo: bar\n---\n" . ComponentFrontMatterTest::SOURCE; $file = $this->createTwigTemplate($source); $this->expectException(SyntaxError::class); @@ -95,7 +95,7 @@ class FrontMatterTest extends KernelTestBase { * * @dataProvider \Drupal\Tests\Component\FrontMatter\FrontMatterTest::providerFrontMatterData */ - public function testFrontMatter($yaml, $line, $content = ComponentFrontMatterTest::SOURCE) { + public function testFrontMatter($yaml, $line, $content = ComponentFrontMatterTest::SOURCE): void { // Create a temporary Twig template. $source = ComponentFrontMatterTest::createFrontMatterSource($yaml, $content); $file = $this->createTwigTemplate($source); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php index 78890315c6e..297c1111a17 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php @@ -62,7 +62,7 @@ class ImageTest extends KernelTestBase { /** * Tests that an image with the sizes attribute is output correctly. */ - public function testThemeImageWithSizes() { + public function testThemeImageWithSizes(): void { // Test with multipliers. $sizes = '(max-width: ' . rand(10, 30) . 'em) 100vw, (max-width: ' . rand(30, 50) . 'em) 50vw, 30vw'; $image = [ @@ -83,7 +83,7 @@ class ImageTest extends KernelTestBase { /** * Tests that an image with the src attribute is output correctly. */ - public function testThemeImageWithSrc() { + public function testThemeImageWithSrc(): void { $image = [ '#theme' => 'image', @@ -102,7 +102,7 @@ class ImageTest extends KernelTestBase { /** * Tests that an image with the srcset and multipliers is output correctly. */ - public function testThemeImageWithSrcsetMultiplier() { + public function testThemeImageWithSrcsetMultiplier(): void { // Test with multipliers. $image = [ '#theme' => 'image', @@ -130,7 +130,7 @@ class ImageTest extends KernelTestBase { /** * Tests that an image with the srcset and widths is output correctly. */ - public function testThemeImageWithSrcsetWidth() { + public function testThemeImageWithSrcsetWidth(): void { // Test with multipliers. $widths = [ rand(0, 500) . 'w', diff --git a/core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php b/core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php index 4e350ee689f..2a7f8412d34 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/MaintenanceThemeTest.php @@ -16,7 +16,7 @@ class MaintenanceThemeTest extends KernelTestBase { /** * Tests that the maintenance theme initializes the theme and its base themes. */ - public function testMaintenanceTheme() { + public function testMaintenanceTheme(): void { $this->setSetting('maintenance_theme', 'test_subtheme'); // Get the maintenance theme loaded. drupal_maintenance_theme(); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php b/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php index aaea0758dd5..8898598e4d0 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php @@ -21,7 +21,7 @@ class MessageTest extends KernelTestBase { /** * Tests setting messages output. */ - public function testMessages() { + public function testMessages(): void { // Enable the Starterkit theme. \Drupal::service('theme_installer')->install(['starterkit_theme']); $this->config('system.theme')->set('default', 'starterkit_theme')->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php index 0a672d6e321..7e5ef5f4cfd 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php @@ -31,7 +31,7 @@ class RegistryTest extends KernelTestBase { /** * Tests the behavior of the theme registry class. */ - public function testRaceCondition() { + public function testRaceCondition(): void { // The theme registry is not marked as persistable in case we don't have a // proper request. \Drupal::request()->setMethod('GET'); @@ -69,7 +69,7 @@ class RegistryTest extends KernelTestBase { /** * Tests the theme registry with multiple subthemes. */ - public function testMultipleSubThemes() { + public function testMultipleSubThemes(): void { $theme_handler = \Drupal::service('theme_handler'); \Drupal::service('theme_installer')->install(['test_basetheme', 'test_subtheme', 'test_subsubtheme']); @@ -108,7 +108,7 @@ class RegistryTest extends KernelTestBase { /** * Tests the theme registry with suggestions. */ - public function testSuggestionPreprocessFunctions() { + public function testSuggestionPreprocessFunctions(): void { $theme_handler = \Drupal::service('theme_handler'); \Drupal::service('theme_installer')->install(['test_theme']); @@ -147,7 +147,7 @@ class RegistryTest extends KernelTestBase { /** * Tests that the theme registry can be altered by themes. */ - public function testThemeRegistryAlterByTheme() { + public function testThemeRegistryAlterByTheme(): void { /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */ $theme_handler = \Drupal::service('theme_handler'); @@ -164,7 +164,7 @@ class RegistryTest extends KernelTestBase { /** * Tests front node theme suggestion generation. */ - public function testThemeSuggestions() { + public function testThemeSuggestions(): void { // Mock the current page as the front page. /** @var \Drupal\Core\Path\PathMatcherInterface $path_matcher */ $path_matcher = $this->prophesize(PathMatcherInterface::class); @@ -197,7 +197,7 @@ class RegistryTest extends KernelTestBase { /** * Tests page theme suggestions for 200 responses. */ - public function test200ThemeSuggestions() { + public function test200ThemeSuggestions(): void { $path_matcher = $this->prophesize(PathMatcherInterface::class); $path_matcher->isFrontPage()->willReturn(FALSE); \Drupal::getContainer()->set('path.matcher', $path_matcher->reveal()); @@ -259,7 +259,7 @@ class RegistryTest extends KernelTestBase { /** * Tests theme-provided templates that are registered by modules. */ - public function testThemeTemplatesRegisteredByModules() { + public function testThemeTemplatesRegisteredByModules(): void { $theme_handler = \Drupal::service('theme_handler'); \Drupal::service('theme_installer')->install(['test_theme']); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php index 2e3fa0799ba..be6b1fc5342 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php @@ -58,7 +58,7 @@ class Stable9LibraryOverrideTest extends StableLibraryOverrideTestBase { /** * Ensures that Stable 9 overrides all relevant core library assets. */ - public function testStable9LibraryOverrides() { + public function testStable9LibraryOverrides(): void { // First get the clean library definitions with no active theme. $libraries_before = $this->getAllLibraries(); $libraries_before = $this->removeVendorAssets($libraries_before); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php index 7f2598e2fa3..2e50db7e9b7 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php @@ -91,7 +91,7 @@ class Stable9TemplateOverrideTest extends KernelTestBase { /** * Ensures that Stable 9 overrides all relevant core templates. */ - public function testStable9TemplateOverrides() { + public function testStable9TemplateOverrides(): void { $registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $this->themeHandler, \Drupal::service('theme.initialization'), \Drupal::service('cache.bootstrap'), \Drupal::service('extension.list.module'), \Drupal::service('kernel'), 'stable9'); $registry->setThemeManager(\Drupal::theme()); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php index 2ed0fd4650c..69ef57c8cdb 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php @@ -50,7 +50,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Verifies that no themes are installed by default. */ - public function testEmpty() { + public function testEmpty(): void { $this->assertEmpty($this->extensionConfig()->get('theme')); $this->assertEmpty(array_keys($this->themeHandler()->listInfo())); @@ -66,7 +66,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a theme. */ - public function testInstall() { + public function testInstall(): void { $name = 'test_basetheme'; $themes = $this->themeHandler()->listInfo(); @@ -89,7 +89,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a sub-theme. */ - public function testInstallSubTheme() { + public function testInstallSubTheme(): void { $name = 'test_subtheme'; $base_name = 'test_basetheme'; @@ -112,7 +112,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a non-existing theme. */ - public function testInstallNonExisting() { + public function testInstallNonExisting(): void { $name = 'non_existing_theme'; $themes = $this->themeHandler()->listInfo(); @@ -134,7 +134,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a theme with a too long name. */ - public function testInstallNameTooLong() { + public function testInstallNameTooLong(): void { $name = 'test_theme_having_veery_long_name_which_is_too_long'; try { @@ -150,7 +150,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a theme with the same name as an enabled module. */ - public function testInstallThemeSameNameAsModule() { + public function testInstallThemeSameNameAsModule(): void { $name = 'name_collision_test'; // Install and uninstall the theme. @@ -170,7 +170,7 @@ class ThemeInstallerTest extends KernelTestBase { * * @dataProvider providerTestInstallThemeWithUnmetModuleDependencies */ - public function testInstallThemeWithUnmetModuleDependencies($theme_name, $installed_modules, $message) { + public function testInstallThemeWithUnmetModuleDependencies($theme_name, $installed_modules, $message): void { $this->moduleInstaller()->install($installed_modules); $themes = $this->themeHandler()->listInfo(); $this->assertEmpty($themes); @@ -186,7 +186,7 @@ class ThemeInstallerTest extends KernelTestBase { * * @group legacy */ - public function testInstallDeprecated() { + public function testInstallDeprecated(): void { $this->expectDeprecation("The theme 'deprecated_theme_test' is deprecated. See https://example.com/deprecated"); $this->themeInstaller()->install(['deprecated_theme_test']); $this->assertTrue(\Drupal::service('theme_handler')->themeExists('deprecated_theme_test')); @@ -238,7 +238,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests installing a theme with module dependencies that are met. */ - public function testInstallThemeWithMetModuleDependencies() { + public function testInstallThemeWithMetModuleDependencies(): void { $name = 'test_theme_depending_on_modules'; $themes = $this->themeHandler()->listInfo(); $this->assertArrayNotHasKey($name, $themes); @@ -254,7 +254,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling the default theme. */ - public function testUninstallDefault() { + public function testUninstallDefault(): void { $name = 'stark'; $other_name = 'olivero'; $this->themeInstaller()->install([$name, $other_name]); @@ -281,7 +281,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling the admin theme. */ - public function testUninstallAdmin() { + public function testUninstallAdmin(): void { $name = 'stark'; $other_name = 'olivero'; $this->themeInstaller()->install([$name, $other_name]); @@ -308,7 +308,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling a sub-theme. */ - public function testUninstallSubTheme() { + public function testUninstallSubTheme(): void { $name = 'test_subtheme'; $base_name = 'test_basetheme'; @@ -323,7 +323,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling a base theme before its sub-theme. */ - public function testUninstallBaseBeforeSubTheme() { + public function testUninstallBaseBeforeSubTheme(): void { $name = 'test_basetheme'; $sub_name = 'test_subtheme'; @@ -353,7 +353,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling a non-existing theme. */ - public function testUninstallNonExisting() { + public function testUninstallNonExisting(): void { $name = 'non_existing_theme'; $themes = $this->themeHandler()->listInfo(); @@ -366,7 +366,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling a theme. */ - public function testUninstall() { + public function testUninstall(): void { $name = 'test_basetheme'; $this->themeInstaller()->install([$name]); @@ -389,7 +389,7 @@ class ThemeInstallerTest extends KernelTestBase { /** * Tests uninstalling a theme that is not installed. */ - public function testUninstallNotInstalled() { + public function testUninstallNotInstalled(): void { $name = 'test_basetheme'; $themes = $this->themeHandler()->listInfo(); @@ -403,7 +403,7 @@ class ThemeInstallerTest extends KernelTestBase { * * @see module_test_system_info_alter() */ - public function testThemeInfoAlter() { + public function testThemeInfoAlter(): void { $name = 'stark'; $this->container->get('state')->set('module_test.hook_system_info_alter', TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php index 00c2220fd2d..1e7613e33a9 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php @@ -46,7 +46,7 @@ class ThemeSettingsTest extends KernelTestBase { /** * Tests that $theme.settings are imported and used as default theme settings. */ - public function testDefaultConfig() { + public function testDefaultConfig(): void { $name = 'test_basetheme'; $path = $this->availableThemes[$name]->getPath(); $this->assertFileExists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"); @@ -57,7 +57,7 @@ class ThemeSettingsTest extends KernelTestBase { /** * Tests that the $theme.settings default config file is optional. */ - public function testNoDefaultConfig() { + public function testNoDefaultConfig(): void { $name = 'stark'; $path = $this->availableThemes[$name]->getPath(); $this->assertFileDoesNotExist("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"); @@ -68,7 +68,7 @@ class ThemeSettingsTest extends KernelTestBase { /** * Tests that the default logo config can be overridden. */ - public function testLogoConfig() { + public function testLogoConfig(): void { /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ $theme_installer = $this->container->get('theme_installer'); $theme_installer->install(['stark']); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php index fe5bf4eaba3..1552dc39a01 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php @@ -33,7 +33,7 @@ class TwigEnvironmentTest extends KernelTestBase { /** * Tests inline templates. */ - public function testInlineTemplate() { + public function testInlineTemplate(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); /** @var \Drupal\Core\Template\TwigEnvironment $environment */ @@ -103,7 +103,7 @@ class TwigEnvironmentTest extends KernelTestBase { /** * Tests that exceptions are thrown when a template is not found. */ - public function testTemplateNotFoundException() { + public function testTemplateNotFoundException(): void { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); @@ -119,7 +119,7 @@ class TwigEnvironmentTest extends KernelTestBase { /** * Ensures that templates resolve to the same class name and cache file. */ - public function testTemplateClassname() { + public function testTemplateClassname(): void { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); @@ -148,7 +148,7 @@ class TwigEnvironmentTest extends KernelTestBase { /** * Ensures that cacheFilename() varies by extensions + deployment identifier. */ - public function testCacheFilename() { + public function testCacheFilename(): void { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ // Note: Later we refetch the twig service in order to bypass its internal // static cache. @@ -198,7 +198,7 @@ class TwigEnvironmentTest extends KernelTestBase { /** * Tests template invalidation. */ - public function testTemplateInvalidation() { + public function testTemplateInvalidation(): void { $template_before = <<<TWIG <div>Hello before</div> TWIG; @@ -234,7 +234,7 @@ TWIG; /** * Test twig file prefix change. */ - public function testTwigFilePrefixChange() { + public function testTwigFilePrefixChange(): void { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); $cache_prefixes = []; diff --git a/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php index b7fb86ff9cf..dbdc813d133 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php @@ -33,7 +33,7 @@ class TwigMarkupInterfaceTest extends KernelTestBase { /** * @dataProvider providerTestMarkupInterfaceEmpty */ - public function testMarkupInterfaceEmpty($expected, $variable) { + public function testMarkupInterfaceEmpty($expected, $variable): void { $this->assertSame($expected, (string) $this->renderObjectWithTwig($variable)); } @@ -61,7 +61,7 @@ class TwigMarkupInterfaceTest extends KernelTestBase { /** * Tests behavior if a string is translated to become an empty string. */ - public function testEmptyTranslation() { + public function testEmptyTranslation(): void { $settings = Settings::getAll(); $settings['locale_custom_strings_en'] = ['' => ['test' => '']]; // Recreate the settings static. diff --git a/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php index c78854623d2..a34dc73edea 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php @@ -121,7 +121,7 @@ class TwigWhiteListTest extends KernelTestBase { /** * Tests white-listing of methods doesn't interfere with chaining. */ - public function testWhiteListChaining() { + public function testWhiteListChaining(): void { /** @var \Drupal\Core\Template\TwigEnvironment $environment */ $environment = \Drupal::service('twig'); $node = Node::create([ diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php index b6a7c0a6ded..acefd78cd72 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php @@ -35,7 +35,7 @@ class AllowedValuesConstraintValidatorTest extends KernelTestBase { * * For testing we define an integer with a set of allowed values. */ - public function testValidation() { + public function testValidation(): void { // Create a definition that specifies some AllowedValues. $definition = DataDefinition::create('integer') ->addConstraint('AllowedValues', [1, 2, 3]); @@ -65,7 +65,7 @@ class AllowedValuesConstraintValidatorTest extends KernelTestBase { /** * Tests the AllowedValuesConstraintValidator with callbacks. */ - public function testValidationCallback() { + public function testValidationCallback(): void { // Create a definition that specifies some AllowedValues and a callback. // This tests that callbacks have a higher priority than a supplied list of // values and can be used to coerce the value to the correct type. @@ -105,7 +105,7 @@ class AllowedValuesConstraintValidatorTest extends KernelTestBase { /** * Tests the AllowedValuesConstraintValidator with an invalid callback. */ - public function testValidationCallbackException() { + public function testValidationCallbackException(): void { // Create a definition that specifies some AllowedValues and a callback. // This tests that callbacks have a higher priority than a supplied list of // values and can be used to coerce the value to the correct type. diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php index aade322cddf..17934095205 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php @@ -35,7 +35,7 @@ class ComplexDataConstraintValidatorTest extends KernelTestBase { * * For testing a map including a constraint on one of its keys is defined. */ - public function testValidation() { + public function testValidation(): void { // Create a definition that specifies some ComplexData constraint. $definition = MapDataDefinition::create() ->setPropertyDefinition('key', DataDefinition::create('integer')) diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php index 6646fb2cc5f..cdc9a3da703 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php @@ -35,7 +35,7 @@ class RecursiveContextualValidatorTest extends KernelTestBase { /** * Tests recursive validation against given constraints against an entity. */ - public function testRecursiveValidate() { + public function testRecursiveValidate(): void { $entity = EntityTest::create(); $adapter = EntityAdapter::createFromEntity($entity); // This would trigger the ValidReferenceConstraint due to EntityTest @@ -47,7 +47,7 @@ class RecursiveContextualValidatorTest extends KernelTestBase { /** * Tests recursive propagation of violations. */ - public function testRecursiveViolationPropagation() { + public function testRecursiveViolationPropagation(): void { // We create an entity reference field with a constraint which will // trigger the validation of the referenced entities. Then we add a // required field and populate it only on the parent entity, so that diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php index 045ac297379..7c0580ff064 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php @@ -40,7 +40,7 @@ class TypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata about list items. */ - public function testLists() { + public function testLists(): void { $list_definition = ListDataDefinition::create('string'); $this->assertInstanceOf(ListDataDefinitionInterface::class, $list_definition); $item_definition = $list_definition->getItemDefinition(); @@ -63,7 +63,7 @@ class TypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata about maps. */ - public function testMaps() { + public function testMaps(): void { $map_definition = MapDataDefinition::create() ->setPropertyDefinition('one', DataDefinition::create('string')) ->setPropertyDefinition('two', DataDefinition::create('string')) @@ -89,7 +89,7 @@ class TypedDataDefinitionTest extends KernelTestBase { /** * Tests deriving metadata from data references. */ - public function testDataReferences() { + public function testDataReferences(): void { $language_reference_definition = DataReferenceDefinition::create('language'); $this->assertInstanceOf(DataReferenceDefinitionInterface::class, $language_reference_definition); @@ -105,7 +105,7 @@ class TypedDataDefinitionTest extends KernelTestBase { /** * Tests getString() throws exception when getType() is not implemented. */ - public function testNotImplementedGetType() { + public function testNotImplementedGetType(): void { $language_reference_definition = DataReferenceDefinition::create('language'); $language_reference = $this->typedDataManager->create($language_reference_definition); $this->assertInstanceOf(DataReferenceInterface::class, $language_reference); diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index bc69a340134..a7048f38eef 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -72,7 +72,7 @@ class TypedDataTest extends KernelTestBase { /** * Tests the basics around constructing and working with typed data objects. */ - public function testGetAndSet() { + public function testGetAndSet(): void { // Boolean type. $typed_data = $this->createTypedData(['type' => 'boolean'], TRUE); $this->assertInstanceOf(BooleanInterface::class, $typed_data); @@ -386,7 +386,7 @@ class TypedDataTest extends KernelTestBase { /** * Tests using typed data lists. */ - public function testTypedDataLists() { + public function testTypedDataLists(): void { // Test working with an existing list of strings. $value = ['one', 'two', 'three']; $typed_data = $this->createTypedData(ListDataDefinition::create('string'), $value); @@ -465,7 +465,7 @@ class TypedDataTest extends KernelTestBase { /** * Tests the filter() method on typed data lists. */ - public function testTypedDataListsFilter() { + public function testTypedDataListsFilter(): void { // Check that an all-pass filter leaves the list untouched. $value = ['zero', 'one']; $typed_data = $this->createTypedData(ListDataDefinition::create('string'), $value); @@ -502,7 +502,7 @@ class TypedDataTest extends KernelTestBase { /** * Tests using a typed data map. */ - public function testTypedDataMaps() { + public function testTypedDataMaps(): void { // Test working with a simple map. $value = [ 'one' => 'eins', @@ -599,7 +599,7 @@ class TypedDataTest extends KernelTestBase { /** * Tests typed data validation. */ - public function testTypedDataValidation() { + public function testTypedDataValidation(): void { $definition = DataDefinition::create('integer') ->setConstraints([ 'Range' => ['min' => 5], diff --git a/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php index 36d0c858f59..c63b10f8540 100644 --- a/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php @@ -23,7 +23,7 @@ class UpdaterTest extends KernelTestBase { * * @see https://drupal.org/node/2409515 */ - public function testGetProjectTitleWithChild() { + public function testGetProjectTitleWithChild(): void { // Get the project title from its directory. If it can't find the title // it will choose the first project title in the directory. $directory = $this->root . '/core/modules/system/tests/modules/module_handler_test_multiple'; diff --git a/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php b/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php index fb81a8018a0..395bf9055e8 100644 --- a/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php @@ -21,7 +21,7 @@ class LinkGenerationTest extends KernelTestBase { /** * Tests how hook_link_alter() can affect escaping of the link text. */ - public function testHookLinkAlter() { + public function testHookLinkAlter(): void { $url = Url::fromUri('http://example.com'); $renderer = \Drupal::service('renderer'); diff --git a/core/tests/Drupal/KernelTests/Core/Validation/ConstraintFactoryTest.php b/core/tests/Drupal/KernelTests/Core/Validation/ConstraintFactoryTest.php index 3b9326814a4..626f304f7b2 100644 --- a/core/tests/Drupal/KernelTests/Core/Validation/ConstraintFactoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Validation/ConstraintFactoryTest.php @@ -24,7 +24,7 @@ class ConstraintFactoryTest extends KernelTestBase { /** * @covers ::createInstance */ - public function testCreateInstance() { + public function testCreateInstance(): void { $constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager(); // If the plugin is a \Symfony\Component\Validator\Constraint, they will be diff --git a/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php b/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php index 7caeadd50a4..7eec6908d60 100644 --- a/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php @@ -30,7 +30,7 @@ class ConstraintsTest extends KernelTestBase { /** * @see \Drupal\Core\Validation\Plugin\Validation\Constraint\UuidConstraint */ - public function testUuid() { + public function testUuid(): void { $typed_config_manager = \Drupal::service('config.typed'); /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_config */ $typed_config = $typed_config_manager->get('config_test.validation'); diff --git a/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php b/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php index 22adbfbe19e..1bf767970b2 100644 --- a/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php +++ b/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php @@ -33,7 +33,7 @@ class UniqueFieldConstraintTest extends KernelTestBase { * * @covers ::validate */ - public function testEntityWithStringId() { + public function testEntityWithStringId(): void { $this->installEntitySchema('entity_test_string_id'); EntityTestStringId::create([ @@ -69,7 +69,7 @@ class UniqueFieldConstraintTest extends KernelTestBase { * * @dataProvider providerTestEntityWithStringIdWithViolation */ - public function testEntityWithStringIdWithViolation($id) { + public function testEntityWithStringIdWithViolation($id): void { $this->installEntitySchema('entity_test_string_id'); $value = $this->randomString(); @@ -124,7 +124,7 @@ class UniqueFieldConstraintTest extends KernelTestBase { * * @covers ::validate */ - public function testViolationDespiteNoAccess() { + public function testViolationDespiteNoAccess(): void { $this->installEntitySchema('entity_test'); // Create and save an entity with a given field value in the field that has diff --git a/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php index 304fa191cdb..78cfaea2fc3 100644 --- a/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php @@ -47,7 +47,7 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { * * @covers ::validate */ - public function testValidation() { + public function testValidation(): void { // Create entity with two values for the testing field. $definition = [ 'id' => (int) rand(0, getrandmax()), @@ -114,7 +114,7 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { * * @covers ::validate */ - public function testValidationReference() { + public function testValidationReference(): void { $users = []; for ($i = 0; $i <= 5; $i++) { @@ -190,7 +190,7 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { * * @covers ::validate */ - public function testValidationOwn() { + public function testValidationOwn(): void { // Create new entity with two identical values for the testing field. $definition = [ 'user_id' => 0, @@ -238,7 +238,7 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { * * @covers ::validate */ - public function testValidationMultiple() { + public function testValidationMultiple(): void { // Create entity with two different values for the testing field. $definition = [ 'user_id' => 0, diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseShutdownTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseShutdownTest.php index 570d3f8c4cc..4b99b24b1aa 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseShutdownTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseShutdownTest.php @@ -39,7 +39,7 @@ class KernelTestBaseShutdownTest extends KernelTestBase { /** * @covers ::assertPostConditions */ - public function testShutdownFunction() { + public function testShutdownFunction(): void { $this->expectedShutdownCalled = ['shutdownFunction', 'shutdownFunction2']; drupal_register_shutdown_function([$this, 'shutdownFunction']); } @@ -47,7 +47,7 @@ class KernelTestBaseShutdownTest extends KernelTestBase { /** * @covers ::assertPostConditions */ - public function testNoShutdownFunction() { + public function testNoShutdownFunction(): void { $this->expectedShutdownCalled = []; } diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index 55c27fa4c0c..add76e05fbc 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -25,7 +25,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::setUpBeforeClass */ - public function testSetUpBeforeClass() { + public function testSetUpBeforeClass(): void { // Note: PHPUnit automatically restores the original working directory. $this->assertSame(realpath(__DIR__ . '/../../../../'), getcwd()); } @@ -33,7 +33,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::bootEnvironment */ - public function testBootEnvironment() { + public function testBootEnvironment(): void { $this->assertMatchesRegularExpression('/^test\d{8}$/', $this->databasePrefix); $this->assertStringStartsWith('vfs://root/sites/simpletest/', $this->siteDirectory); $this->assertEquals([ @@ -56,7 +56,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::getDatabaseConnectionInfo */ - public function testGetDatabaseConnectionInfoWithOutManualSetDbUrl() { + public function testGetDatabaseConnectionInfoWithOutManualSetDbUrl(): void { $options = $this->container->get('database')->getConnectionOptions(); $this->assertSame($this->databasePrefix, $options['prefix']); } @@ -64,7 +64,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::setUp */ - public function testSetUp() { + public function testSetUp(): void { $this->assertTrue($this->container->has('request_stack')); $this->assertTrue($this->container->initialized('request_stack')); $request = $this->container->get('request_stack')->getCurrentRequest(); @@ -94,7 +94,7 @@ class KernelTestBaseTest extends KernelTestBase { * @covers ::setUp * @depends testSetUp */ - public function testSetUpDoesNotLeak() { + public function testSetUpDoesNotLeak(): void { // Ensure that we have a different database prefix. $schema = $this->container->get('database')->schema(); $this->assertFalse($schema->tableExists('foo')); @@ -103,7 +103,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::register */ - public function testRegister() { + public function testRegister(): void { // Verify that this container is identical to the actual container. $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $this->container); $this->assertSame($this->container, \Drupal::getContainer()); @@ -142,7 +142,7 @@ class KernelTestBaseTest extends KernelTestBase { * * @see ::testSubsequentContainerIsolation() */ - public function testContainerIsolation() { + public function testContainerIsolation(): void { $this->enableModules(['system', 'user']); $this->assertNull($this->installConfig('user')); } @@ -152,7 +152,7 @@ class KernelTestBaseTest extends KernelTestBase { * * @depends testContainerIsolation */ - public function testSubsequentContainerIsolation() { + public function testSubsequentContainerIsolation(): void { $this->enableModules(['system', 'user']); $this->assertNull($this->installConfig('user')); } @@ -160,7 +160,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * Tests that an outbound HTTP request can be performed inside of a test. */ - public function testOutboundHttpRequest() { + public function testOutboundHttpRequest(): void { // The middleware test.http_client.middleware calls drupal_generate_test_ua // which checks the DRUPAL_TEST_IN_CHILD_SITE constant, that is not defined // in Kernel tests. @@ -178,7 +178,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::render */ - public function testRender() { + public function testRender(): void { $type = 'processed_text'; $element_info = $this->container->get('element_info'); $this->assertSame(['#defaults_loaded' => TRUE], $element_info->getInfo($type)); @@ -206,7 +206,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::render */ - public function testRenderWithTheme() { + public function testRenderWithTheme(): void { $this->enableModules(['system']); $build = [ @@ -226,7 +226,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::bootKernel */ - public function testBootKernel() { + public function testBootKernel(): void { $this->assertNull($this->container->get('request_stack')->getParentRequest(), 'There should only be one request on the stack'); $this->assertEquals('public', \Drupal::config('system.file')->get('default_scheme')); } @@ -250,7 +250,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * Tests the assumption that local time is in 'Australia/Sydney'. */ - public function testLocalTimeZone() { + public function testLocalTimeZone(): void { // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php $this->assertEquals('Australia/Sydney', date_default_timezone_get()); } @@ -284,7 +284,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * Ensures KernelTestBase tests can access modules in profiles. */ - public function testProfileModules() { + public function testProfileModules(): void { $this->assertFileExists('core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.info.yml'); $this->assertSame( 'core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.info.yml', @@ -295,7 +295,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * Tests the dump() function provided by the var-dumper Symfony component. */ - public function testVarDump() { + public function testVarDump(): void { // Append the stream capturer to the STDERR stream, so that we can test the // dump() output and also prevent it from actually outputting in this // particular test. @@ -315,7 +315,7 @@ class KernelTestBaseTest extends KernelTestBase { /** * @covers ::bootEnvironment */ - public function testDatabaseDriverModuleEnabled() { + public function testDatabaseDriverModuleEnabled(): void { $module = Database::getConnection()->getProvider(); // Test that the module that is providing the database driver is enabled. diff --git a/core/tests/Drupal/KernelTests/RequestProcessing/RedirectOnExceptionTest.php b/core/tests/Drupal/KernelTests/RequestProcessing/RedirectOnExceptionTest.php index c9caef6ea7e..6eb25fc0ad2 100644 --- a/core/tests/Drupal/KernelTests/RequestProcessing/RedirectOnExceptionTest.php +++ b/core/tests/Drupal/KernelTests/RequestProcessing/RedirectOnExceptionTest.php @@ -20,7 +20,7 @@ class RedirectOnExceptionTest extends KernelTestBase { */ protected static $modules = ['system', 'test_page_test']; - public function testRedirectOn404() { + public function testRedirectOn404(): void { \Drupal::configFactory()->getEditable('system.site') ->set('page.404', '/test-http-response-exception/' . Response::HTTP_PERMANENTLY_REDIRECT) ->save(); diff --git a/core/tests/Drupal/Tests/CSpell/SortTest.php b/core/tests/Drupal/Tests/CSpell/SortTest.php index 1b55eb542ce..be073955fbb 100644 --- a/core/tests/Drupal/Tests/CSpell/SortTest.php +++ b/core/tests/Drupal/Tests/CSpell/SortTest.php @@ -28,14 +28,14 @@ class SortTest extends TestCase { /** * Tests that the file exists. */ - public function testFileExists() { + public function testFileExists(): void { $this->assertFileExists($this->filePath); } /** * Tests that the file is properly sorted. */ - public function testSorted() { + public function testSorted(): void { $content = file_get_contents($this->filePath); $this->assertIsString($content); $current_dictionary = explode("\n", rtrim($content)); diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php index 944f479a7cd..07a9fab674f 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php @@ -32,7 +32,7 @@ class AnnotatedClassDiscoveryCachedTest extends TestCase { * * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { // Path to the classes which we'll discover and parse annotation. $discovery_path = __DIR__ . '/Fixtures'; // File path that should be discovered within that directory. diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php index 97e1a6bec50..a83d030b2af 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php @@ -31,7 +31,7 @@ class AnnotatedClassDiscoveryTest extends TestCase { * @covers ::__construct * @covers ::getPluginNamespaces */ - public function testGetPluginNamespaces() { + public function testGetPluginNamespaces(): void { $discovery = new AnnotatedClassDiscovery(['com/example' => [__DIR__]]); $reflection = new \ReflectionMethod($discovery, 'getPluginNamespaces'); @@ -44,7 +44,7 @@ class AnnotatedClassDiscoveryTest extends TestCase { * @covers ::prepareAnnotationDefinition * @covers ::getAnnotationReader */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $discovery = new AnnotatedClassDiscovery(['com\example' => [__DIR__ . '/Fixtures']]); $this->assertEquals([ 'discovery_test_1' => [ diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php index 28824ecb5d9..80f3b31f82b 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php @@ -17,7 +17,7 @@ class AnnotationBaseTest extends TestCase { * @covers ::getProvider * @covers ::setProvider */ - public function testSetProvider() { + public function testSetProvider(): void { $plugin = new AnnotationBaseStub(); $plugin->setProvider('example'); $this->assertEquals('example', $plugin->getProvider()); @@ -26,7 +26,7 @@ class AnnotationBaseTest extends TestCase { /** * @covers ::getId */ - public function testGetId() { + public function testGetId(): void { $plugin = new AnnotationBaseStub(); // Doctrine sets the public prop directly. $plugin->id = 'example'; @@ -37,7 +37,7 @@ class AnnotationBaseTest extends TestCase { * @covers ::getClass * @covers ::setClass */ - public function testSetClass() { + public function testSetClass(): void { $plugin = new AnnotationBaseStub(); $plugin->setClass('example'); $this->assertEquals('example', $plugin->getClass()); diff --git a/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php b/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php index 7ef3f2638a6..c211193d1fd 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php @@ -20,7 +20,7 @@ class DocParserIgnoredClassesTest extends TestCase { * Drupal's DocParser should never use class_exists() on an ignored * annotation, including cases where namespaces are set. */ - public function testIgnoredAnnotationSkippedBeforeReflection() { + public function testIgnoredAnnotationSkippedBeforeReflection(): void { $annotation = 'neverReflectThis'; $parser = new DocParser(); $parser->setIgnoredAnnotationNames([$annotation => TRUE]); diff --git a/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php b/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php index be571a20584..6511a2c980c 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php @@ -17,7 +17,7 @@ class MockFileFinderTest extends TestCase { * @covers ::create * @covers ::findFile */ - public function testFindFile() { + public function testFindFile(): void { $tmp = MockFileFinder::create('test_filename.txt'); $this->assertEquals('test_filename.txt', $tmp->findFile('n/a')); $this->assertEquals('test_filename.txt', $tmp->findFile('SomeClass')); diff --git a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php index d4fbd465c76..ab59964f339 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php @@ -22,7 +22,7 @@ class AnnotationBridgeDecoratorTest extends TestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $definitions = []; $definitions['object'] = new ObjectDefinition(['id' => 'foo']); $definitions['array'] = ['id' => 'bar']; diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php index b0795460543..17fb399a726 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php @@ -16,7 +16,7 @@ class PluginIdTest extends TestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { // Assert plugin starts empty. $plugin = new PluginID(); $this->assertEquals([ @@ -39,7 +39,7 @@ class PluginIdTest extends TestCase { /** * @covers ::getId */ - public function testGetId() { + public function testGetId(): void { $plugin = new PluginID(); $plugin->value = 'example'; $this->assertEquals('example', $plugin->getId()); diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php index 5c106d70a5b..a2b6ce7086d 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php @@ -18,7 +18,7 @@ class PluginTest extends TestCase { * @covers ::parse * @covers ::get */ - public function testGet() { + public function testGet(): void { // Assert all values are accepted through constructor and default value is // used for non existent but defined property. $plugin = new PluginStub([ @@ -53,7 +53,7 @@ class PluginTest extends TestCase { /** * @covers ::getProvider */ - public function testGetProvider() { + public function testGetProvider(): void { $plugin = new Plugin(['provider' => 'example']); $this->assertEquals('example', $plugin->getProvider()); } @@ -61,7 +61,7 @@ class PluginTest extends TestCase { /** * @covers ::setProvider */ - public function testSetProvider() { + public function testSetProvider(): void { $plugin = new Plugin([]); $plugin->setProvider('example'); $this->assertEquals('example', $plugin->getProvider()); @@ -70,7 +70,7 @@ class PluginTest extends TestCase { /** * @covers ::getId */ - public function testGetId() { + public function testGetId(): void { $plugin = new Plugin(['id' => 'example']); $this->assertEquals('example', $plugin->getId()); } @@ -78,7 +78,7 @@ class PluginTest extends TestCase { /** * @covers ::getClass */ - public function testGetClass() { + public function testGetClass(): void { $plugin = new Plugin(['class' => 'example']); $this->assertEquals('example', $plugin->getClass()); } @@ -86,7 +86,7 @@ class PluginTest extends TestCase { /** * @covers ::setClass */ - public function testSetClass() { + public function testSetClass(): void { $plugin = new Plugin([]); $plugin->setClass('example'); $this->assertEquals('example', $plugin->getClass()); diff --git a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php index a5e1c570516..0d3f5d221a3 100644 --- a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php +++ b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php @@ -22,7 +22,7 @@ class InspectorTest extends TestCase { * @covers ::assertAllStrings * @dataProvider providerTestAssertAllStrings */ - public function testAssertAllStrings($input, $expected) { + public function testAssertAllStrings($input, $expected): void { $this->assertSame($expected, Inspector::assertAllStrings($input)); } @@ -57,7 +57,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllStringable */ - public function testAssertAllStringable() { + public function testAssertAllStringable(): void { $this->assertTrue(Inspector::assertAllStringable([])); $this->assertTrue(Inspector::assertAllStringable(['foo', 'bar'])); $this->assertFalse(Inspector::assertAllStringable('foo')); @@ -69,7 +69,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllArrays */ - public function testAssertAllArrays() { + public function testAssertAllArrays(): void { $this->assertTrue(Inspector::assertAllArrays([])); $this->assertTrue(Inspector::assertAllArrays([[], []])); $this->assertFalse(Inspector::assertAllArrays([[], 'foo'])); @@ -80,7 +80,7 @@ class InspectorTest extends TestCase { * * @covers ::assertStrictArray */ - public function testAssertStrictArray() { + public function testAssertStrictArray(): void { $this->assertTrue(Inspector::assertStrictArray([])); $this->assertTrue(Inspector::assertStrictArray(['bar', 'foo'])); $this->assertFalse(Inspector::assertStrictArray(['foo' => 'bar', 'bar' => 'foo'])); @@ -91,7 +91,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllStrictArrays */ - public function testAssertAllStrictArrays() { + public function testAssertAllStrictArrays(): void { $this->assertTrue(Inspector::assertAllStrictArrays([])); $this->assertTrue(Inspector::assertAllStrictArrays([[], []])); $this->assertFalse(Inspector::assertAllStrictArrays([['foo' => 'bar', 'bar' => 'foo']])); @@ -102,7 +102,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllHaveKey */ - public function testAssertAllHaveKey() { + public function testAssertAllHaveKey(): void { $this->assertTrue(Inspector::assertAllHaveKey([])); $this->assertTrue(Inspector::assertAllHaveKey([['foo' => 'bar', 'bar' => 'foo']])); $this->assertTrue(Inspector::assertAllHaveKey([['foo' => 'bar', 'bar' => 'foo']], 'foo')); @@ -115,7 +115,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllIntegers */ - public function testAssertAllIntegers() { + public function testAssertAllIntegers(): void { $this->assertTrue(Inspector::assertAllIntegers([])); $this->assertTrue(Inspector::assertAllIntegers([1, 2, 3])); $this->assertFalse(Inspector::assertAllIntegers([1, 2, 3.14])); @@ -127,7 +127,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllFloat */ - public function testAssertAllFloat() { + public function testAssertAllFloat(): void { $this->assertTrue(Inspector::assertAllFloat([])); $this->assertTrue(Inspector::assertAllFloat([1.0, 2.1, 3.14])); $this->assertFalse(Inspector::assertAllFloat([1, 2.1, 3.14])); @@ -140,7 +140,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllCallable */ - public function testAllCallable() { + public function testAllCallable(): void { $this->assertTrue(Inspector::assertAllCallable([ 'strchr', [$this, 'callMe'], @@ -166,7 +166,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllNotEmpty */ - public function testAllNotEmpty() { + public function testAllNotEmpty(): void { $this->assertTrue(Inspector::assertAllNotEmpty([1, 'two'])); $this->assertFalse(Inspector::assertAllNotEmpty([''])); } @@ -176,7 +176,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllNumeric */ - public function testAssertAllNumeric() { + public function testAssertAllNumeric(): void { $this->assertTrue(Inspector::assertAllNumeric([1, '2', 3.14])); $this->assertFalse(Inspector::assertAllNumeric([1, 'two', 3.14])); } @@ -186,7 +186,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllMatch */ - public function testAssertAllMatch() { + public function testAssertAllMatch(): void { $this->assertTrue(Inspector::assertAllMatch('f', ['fee', 'fi', 'fo'])); $this->assertTrue(Inspector::assertAllMatch('F', ['fee', 'fi', 'fo'])); $this->assertTrue(Inspector::assertAllMatch('f', ['fee', 'fi', 'fo'], TRUE)); @@ -200,7 +200,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllRegularExpressionMatch */ - public function testAssertAllRegularExpressionMatch() { + public function testAssertAllRegularExpressionMatch(): void { $this->assertTrue(Inspector::assertAllRegularExpressionMatch('/f/i', ['fee', 'fi', 'fo'])); $this->assertTrue(Inspector::assertAllRegularExpressionMatch('/F/i', ['fee', 'fi', 'fo'])); $this->assertTrue(Inspector::assertAllRegularExpressionMatch('/f/', ['fee', 'fi', 'fo'])); @@ -214,7 +214,7 @@ class InspectorTest extends TestCase { * * @covers ::assertAllObjects */ - public function testAssertAllObjects() { + public function testAssertAllObjects(): void { $this->assertTrue(Inspector::assertAllObjects([new \ArrayObject(), new \ArrayObject()])); $this->assertFalse(Inspector::assertAllObjects([new \ArrayObject(), new \ArrayObject(), 'foo'])); $this->assertTrue(Inspector::assertAllObjects([new \ArrayObject(), new \ArrayObject()], '\\Traversable')); diff --git a/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php index c7742e4cd7e..9653180cfa2 100644 --- a/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php +++ b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php @@ -17,7 +17,7 @@ class ClassFinderTest extends TestCase { /** * @covers ::findFile */ - public function testFindFile() { + public function testFindFile(): void { $finder = new ClassFinder(); // The full path is returned therefore only tests with diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php index 99d0b79bdb4..2ae7a736a5c 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php @@ -25,7 +25,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDates */ - public function testDates($input, $timezone, $expected) { + public function testDates($input, $timezone, $expected): void { $date = new DateTimePlus($input, $timezone); $value = $date->format('c'); @@ -47,7 +47,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDateArrays */ - public function testDateArrays($input, $timezone, $expected) { + public function testDateArrays($input, $timezone, $expected): void { $date = DateTimePlus::createFromArray($input, $timezone); $value = $date->format('c'); @@ -71,7 +71,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDateDiff */ - public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected) { + public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected): void { $interval = $input1->diff($input2, $absolute); $this->assertEquals($interval, $expected); } @@ -88,7 +88,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestInvalidDateDiff */ - public function testInvalidDateDiff($input1, $input2, $absolute) { + public function testInvalidDateDiff($input1, $input2, $absolute): void { $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Method Drupal\Component\Datetime\DateTimePlus::diff expects parameter 1 to be a \DateTime or \Drupal\Component\Datetime\DateTimePlus object'); $interval = $input1->diff($input2, $absolute); @@ -106,7 +106,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestInvalidDateArrays */ - public function testInvalidDateArrays($input, $timezone, $class) { + public function testInvalidDateArrays($input, $timezone, $class): void { $this->expectException($class); $this->assertInstanceOf( '\Drupal\Component\DateTimePlus', @@ -124,7 +124,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestCheckArray */ - public function testCheckArray(array $array, $expected) { + public function testCheckArray(array $array, $expected): void { $this->assertSame( $expected, DateTimePlus::checkArray($array) @@ -159,7 +159,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestTimestamp */ - public function testTimestamp($input, array $initial, array $transform) { + public function testTimestamp($input, array $initial, array $transform): void { // Initialize a new date object. $date = DateTimePlus::createFromTimestamp($input, $initial['timezone']); $this->assertDateTimestamp($date, $input, $initial, $transform); @@ -177,7 +177,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDateTimestamp */ - public function testDateTimestamp($input, array $initial, array $transform) { + public function testDateTimestamp($input, array $initial, array $transform): void { // Initialize a new date object. $date = new DateTimePlus($input, $initial['timezone']); $this->assertDateTimestamp($date, $input, $initial, $transform); @@ -242,7 +242,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDateFormat */ - public function testDateFormat($input, $timezone, $format, $format_date, $expected) { + public function testDateFormat($input, $timezone, $format, $format_date, $expected): void { $date = DateTimePlus::createFromFormat($format, $input, $timezone); $value = $date->format($format_date); $this->assertEquals($expected, $value, sprintf("Test new DateTimePlus(%s, %s, %s): should be %s, found %s.", $input, $timezone, $format, $expected, $value)); @@ -264,7 +264,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestInvalidDates */ - public function testInvalidDates($input, $timezone, $format, $message, $class) { + public function testInvalidDates($input, $timezone, $format, $message, $class): void { $this->expectException($class); DateTimePlus::createFromFormat($format, $input, $timezone); } @@ -285,7 +285,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestDateTimezone */ - public function testDateTimezone($input, $timezone, $expected_timezone, $message) { + public function testDateTimezone($input, $timezone, $expected_timezone, $message): void { $date = new DateTimePlus($input, $timezone); $timezone = $date->getTimezone()->getName(); $this->assertEquals($timezone, $expected_timezone, $message); @@ -296,7 +296,7 @@ class DateTimePlusTest extends TestCase { * * But only when the DrupalDateTime is constructed from a datetime object. */ - public function testDateTimezoneWithDateTimeObject() { + public function testDateTimezoneWithDateTimeObject(): void { // Create a date object with another date object. $input = new \DateTime('now', new \DateTimeZone('Pacific/Midway')); $timezone = NULL; @@ -757,7 +757,7 @@ class DateTimePlusTest extends TestCase { * * @dataProvider providerTestInvalidConstructor */ - public function testInvalidConstructor($time, array $errors) { + public function testInvalidConstructor($time, array $errors): void { $date = new DateTimePlus($time); $this->assertEquals(TRUE, $date->hasErrors()); @@ -837,7 +837,7 @@ class DateTimePlusTest extends TestCase { /** * Tests the $settings['validate_format'] parameter in ::createFromFormat(). */ - public function testValidateFormat() { + public function testValidateFormat(): void { // Check that an input that does not strictly follow the input format will // produce the desired date. In this case the year string '11' doesn't // precisely match the 'Y' formatter parameter, but PHP will parse it @@ -856,7 +856,7 @@ class DateTimePlusTest extends TestCase { /** * Tests setting the default time for date-only objects. */ - public function testDefaultDateTime() { + public function testDefaultDateTime(): void { $utc = new \DateTimeZone('UTC'); $date = DateTimePlus::createFromFormat('Y-m-d H:i:s', '2017-05-23 22:58:00', $utc); @@ -870,7 +870,7 @@ class DateTimePlusTest extends TestCase { * * @covers ::__call */ - public function testChainable() { + public function testChainable(): void { $date = new DateTimePlus('now', 'Australia/Sydney'); $date->setTimestamp(12345678); @@ -894,7 +894,7 @@ class DateTimePlusTest extends TestCase { * * @covers ::__call */ - public function testChainableNonChainable() { + public function testChainableNonChainable(): void { $datetime1 = new DateTimePlus('2009-10-11 12:00:00'); $datetime2 = new DateTimePlus('2009-10-13 12:00:00'); $interval = $datetime1->diff($datetime2); @@ -907,7 +907,7 @@ class DateTimePlusTest extends TestCase { * * @covers ::__call */ - public function testChainableNonCallable() { + public function testChainableNonCallable(): void { $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Call to undefined method Drupal\Component\Datetime\DateTimePlus::nonexistent()'); $date = new DateTimePlus('now', 'Australia/Sydney'); @@ -917,7 +917,7 @@ class DateTimePlusTest extends TestCase { /** * @covers ::getPhpDateTime */ - public function testGetPhpDateTime() { + public function testGetPhpDateTime(): void { $new_york = new \DateTimeZone('America/New_York'); $berlin = new \DateTimeZone('Europe/Berlin'); diff --git a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php index 9291d73f406..f793e3a9460 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php @@ -49,7 +49,7 @@ class TimeTest extends TestCase { * * @covers ::getRequestTime */ - public function testGetRequestTime() { + public function testGetRequestTime(): void { $expected = 12345678; $request = Request::createFromGlobals(); @@ -68,7 +68,7 @@ class TimeTest extends TestCase { * * @covers ::getRequestMicroTime */ - public function testGetRequestMicroTime() { + public function testGetRequestMicroTime(): void { $expected = 1234567.89; $request = Request::createFromGlobals(); @@ -85,7 +85,7 @@ class TimeTest extends TestCase { /** * @covers ::getRequestTime */ - public function testGetRequestTimeNoRequest() { + public function testGetRequestTimeNoRequest(): void { // With no request, and no global variable, we expect to get the int part // of the microtime. $expected = 1234567; @@ -98,7 +98,7 @@ class TimeTest extends TestCase { /** * @covers ::getRequestMicroTime */ - public function testGetRequestMicroTimeNoRequest() { + public function testGetRequestMicroTimeNoRequest(): void { $expected = 1234567.89; unset($_SERVER['REQUEST_TIME_FLOAT']); $this->assertEquals($expected, $this->time->getRequestMicroTime()); @@ -111,7 +111,7 @@ class TimeTest extends TestCase { * * @covers ::getCurrentTime */ - public function testGetCurrentTime() { + public function testGetCurrentTime(): void { $expected = 12345678; $this->assertEquals($expected, $this->time->getCurrentTime()); } @@ -121,7 +121,7 @@ class TimeTest extends TestCase { * * @covers ::getCurrentMicroTime */ - public function testGetCurrentMicroTime() { + public function testGetCurrentMicroTime(): void { $expected = 1234567.89; $this->assertEquals($expected, $this->time->getCurrentMicroTime()); } diff --git a/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php b/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php index 7eaf6e6130f..69bac3cb028 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php @@ -52,7 +52,7 @@ class TimeWithNoRequestTest extends TestCase { * * @covers ::getRequestMicroTime */ - public function testGetRequestMicroTimeImmutable() { + public function testGetRequestMicroTimeImmutable(): void { $requestTime = $this->time->getRequestMicroTime(); usleep(20000); $this->assertSame($requestTime, $this->time->getRequestMicroTime()); diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index 0e42a0b4e8e..79fcaad7d74 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -68,7 +68,7 @@ class ContainerTest extends TestCase { * * @covers ::__construct */ - public function testConstruct() { + public function testConstruct(): void { $container_definition = $this->getMockContainerDefinition(); $container_definition['machine_format'] = !$this->machineFormat; $this->expectException(InvalidArgumentException::class); @@ -80,7 +80,7 @@ class ContainerTest extends TestCase { * * @covers ::getParameter */ - public function testGetParameter() { + public function testGetParameter(): void { $this->assertEquals($this->containerDefinition['parameters']['some_config'], $this->container->getParameter('some_config'), 'Container parameter matches for %some_config%.'); $this->assertEquals($this->containerDefinition['parameters']['some_other_config'], $this->container->getParameter('some_other_config'), 'Container parameter matches for %some_other_config%.'); } @@ -92,7 +92,7 @@ class ContainerTest extends TestCase { * @covers ::getParameterAlternatives * @covers ::getAlternatives */ - public function testGetParameterIfNotFound() { + public function testGetParameterIfNotFound(): void { $this->expectException(ParameterNotFoundException::class); $this->container->getParameter('parameter_that_does_not_exist'); } @@ -102,7 +102,7 @@ class ContainerTest extends TestCase { * * @covers ::getParameter */ - public function testGetParameterIfNotFoundBecauseNull() { + public function testGetParameterIfNotFoundBecauseNull(): void { $this->expectException(ParameterNotFoundException::class); $this->container->getParameter(NULL); } @@ -112,7 +112,7 @@ class ContainerTest extends TestCase { * * @covers ::hasParameter */ - public function testHasParameter() { + public function testHasParameter(): void { $this->assertTrue($this->container->hasParameter('some_config'), 'Container parameters include %some_config%.'); $this->assertFalse($this->container->hasParameter('some_config_not_exists'), 'Container parameters do not include %some_config_not_exists%.'); } @@ -122,7 +122,7 @@ class ContainerTest extends TestCase { * * @covers ::setParameter */ - public function testSetParameterWithUnfrozenContainer() { + public function testSetParameterWithUnfrozenContainer(): void { $container_definition = $this->containerDefinition; $container_definition['frozen'] = FALSE; $this->container = new $this->containerClass($container_definition); @@ -135,7 +135,7 @@ class ContainerTest extends TestCase { * * @covers ::setParameter */ - public function testSetParameterWithFrozenContainer() { + public function testSetParameterWithFrozenContainer(): void { $this->container = new $this->containerClass($this->containerDefinition); $this->expectException(LogicException::class); $this->container->setParameter('some_config', 'new_value'); @@ -147,7 +147,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGet() { + public function testGet(): void { $container = $this->container->get('service_container'); $this->assertSame($this->container, $container, 'Container can be retrieved from itself.'); @@ -174,7 +174,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForNonSharedService() { + public function testGetForNonSharedService(): void { $service = $this->container->get('non_shared_service'); $service2 = $this->container->get('non_shared_service'); @@ -187,7 +187,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForClassFromParameter() { + public function testGetForClassFromParameter(): void { $container_definition = $this->containerDefinition; $container_definition['frozen'] = FALSE; $container = new $this->containerClass($container_definition); @@ -202,7 +202,7 @@ class ContainerTest extends TestCase { * * @covers ::set */ - public function testSet() { + public function testSet(): void { $this->assertNull($this->container->get('new_id', ContainerInterface::NULL_ON_INVALID_REFERENCE)); $mock_service = new MockService(); $this->container->set('new_id', $mock_service); @@ -215,7 +215,7 @@ class ContainerTest extends TestCase { * * @covers ::has */ - public function testHas() { + public function testHas(): void { $this->assertTrue($this->container->has('other.service')); $this->assertFalse($this->container->has('another.service')); @@ -230,7 +230,7 @@ class ContainerTest extends TestCase { * * @covers ::has */ - public function testHasForAliasedService() { + public function testHasForAliasedService(): void { $service = $this->container->has('service.provider'); $aliased_service = $this->container->has('service.provider_alias'); $this->assertSame($service, $aliased_service); @@ -241,7 +241,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForCircularServices() { + public function testGetForCircularServices(): void { $this->expectException(ServiceCircularReferenceException::class); $this->container->get('circular_dependency'); } @@ -254,7 +254,7 @@ class ContainerTest extends TestCase { * @covers ::getAlternatives * @covers ::getServiceAlternatives */ - public function testGetForNonExistentService() { + public function testGetForNonExistentService(): void { $this->expectException(ServiceNotFoundException::class); $this->container->get('service_not_exists'); } @@ -265,7 +265,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForSerializedServiceDefinition() { + public function testGetForSerializedServiceDefinition(): void { $container_definition = $this->containerDefinition; $container_definition['services']['other.service'] = serialize($container_definition['services']['other.service']); $container = new $this->containerClass($container_definition); @@ -286,7 +286,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testGetForNonExistentParameterDependency() { + public function testGetForNonExistentParameterDependency(): void { $service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE); $this->assertNull($service, 'Service is NULL.'); } @@ -298,7 +298,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testGetForParameterDependencyWithExceptionOnSecondCall() { + public function testGetForParameterDependencyWithExceptionOnSecondCall(): void { $service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE); $this->assertNull($service, 'Service is NULL.'); @@ -315,7 +315,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testGetForNonExistentParameterDependencyWithException() { + public function testGetForNonExistentParameterDependencyWithException(): void { $this->expectException(InvalidArgumentException::class); $this->container->get('service_parameter_not_exists'); } @@ -327,7 +327,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testGetForNonExistentServiceDependency() { + public function testGetForNonExistentServiceDependency(): void { $service = $this->container->get('service_dependency_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE); $this->assertNull($service, 'Service is NULL.'); } @@ -340,7 +340,7 @@ class ContainerTest extends TestCase { * @covers ::resolveServicesAndParameters * @covers ::getAlternatives */ - public function testGetForNonExistentServiceDependencyWithException() { + public function testGetForNonExistentServiceDependencyWithException(): void { $this->expectException(ServiceNotFoundException::class); $this->container->get('service_dependency_not_exists'); } @@ -351,7 +351,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForNonExistentServiceWhenUsingNull() { + public function testGetForNonExistentServiceWhenUsingNull(): void { $this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does not throw exception.'); } @@ -360,7 +360,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForNonExistentNULLService() { + public function testGetForNonExistentNULLService(): void { $this->expectException(ServiceNotFoundException::class); $this->container->get(NULL); } @@ -371,7 +371,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForNonExistentServiceMultipleTimes() { + public function testGetForNonExistentServiceMultipleTimes(): void { $container = new $this->containerClass(); $this->assertNull($container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does not throw exception.'); @@ -385,7 +385,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::getAlternatives */ - public function testGetForNonExistentServiceWithExceptionOnSecondCall() { + public function testGetForNonExistentServiceWithExceptionOnSecondCall(): void { $this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does nto throw exception.'); $this->expectException(ServiceNotFoundException::class); $this->container->get('service_not_exists'); @@ -397,7 +397,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForAliasedService() { + public function testGetForAliasedService(): void { $service = $this->container->get('service.provider'); $aliased_service = $this->container->get('service.provider_alias'); $this->assertSame($service, $aliased_service); @@ -409,7 +409,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForSyntheticService() { + public function testGetForSyntheticService(): void { $synthetic_service = new \stdClass(); $this->container->set('synthetic', $synthetic_service); $test_service = $this->container->get('synthetic'); @@ -422,7 +422,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForSyntheticServiceWithException() { + public function testGetForSyntheticServiceWithException(): void { $this->expectException(RuntimeException::class); $this->container->get('synthetic'); } @@ -433,7 +433,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetWithFileInclude() { + public function testGetWithFileInclude(): void { $this->container->get('container_test_file_service_test'); $this->assertTrue(function_exists('container_test_file_service_test_service_function')); $this->assertEquals('Hello Container', container_test_file_service_test_service_function()); @@ -446,7 +446,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testGetForInstantiationWithVariousArgumentLengths() { + public function testGetForInstantiationWithVariousArgumentLengths(): void { $args = []; for ($i = 0; $i < 12; $i++) { $instantiation_service = $this->container->get('service_test_instantiation_' . $i); @@ -461,7 +461,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForWrongFactory() { + public function testGetForWrongFactory(): void { $this->expectException(RuntimeException::class); $this->container->get('wrong_factory'); } @@ -472,7 +472,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForFactoryService() { + public function testGetForFactoryService(): void { $factory_service = $this->container->get('factory_service'); $factory_service_class = $this->container->getParameter('factory_service_class'); $this->assertInstanceOf($factory_service_class, $factory_service); @@ -484,7 +484,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForFactoryClass() { + public function testGetForFactoryClass(): void { $service = $this->container->get('service.provider'); $factory_service = $this->container->get('factory_class'); @@ -499,7 +499,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForConfiguratorWithException() { + public function testGetForConfiguratorWithException(): void { $this->expectException(InvalidArgumentException::class); $this->container->get('configurable_service_exception'); } @@ -510,7 +510,7 @@ class ContainerTest extends TestCase { * @covers ::get * @covers ::createService */ - public function testGetForConfigurator() { + public function testGetForConfigurator(): void { $container = $this->container; // Setup a configurator. @@ -534,7 +534,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForPrivateService() { + public function testResolveServicesAndParametersForPrivateService(): void { $service = $this->container->get('service_using_private'); $private_service = $service->getSomeOtherService(); $this->assertEquals('really_private_lama', $private_service->getSomeParameter(), 'Private was found successfully.'); @@ -553,7 +553,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForSharedPrivateService() { + public function testResolveServicesAndParametersForSharedPrivateService(): void { $service = $this->container->get('service_using_shared_private'); $private_service = $service->getSomeOtherService(); $this->assertEquals('really_private_lama', $private_service->getSomeParameter(), 'Private was found successfully.'); @@ -572,7 +572,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForArgumentsUsingDeepArray() { + public function testResolveServicesAndParametersForArgumentsUsingDeepArray(): void { $service = $this->container->get('service_using_array'); $other_service = $this->container->get('other.service'); $this->assertEquals($other_service, $service->getSomeOtherService(), '@other.service was injected via constructor.'); @@ -585,7 +585,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForOptionalServiceDependencies() { + public function testResolveServicesAndParametersForOptionalServiceDependencies(): void { $service = $this->container->get('service_with_optional_dependency'); $this->assertNull($service->getSomeOtherService(), 'other service was NULL was expected.'); } @@ -597,7 +597,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForServiceReferencedViaServiceClosure() { + public function testResolveServicesAndParametersForServiceReferencedViaServiceClosure(): void { $service = $this->container->get('service_within_service_closure'); $other_service = $this->container->get('other.service'); $factory_function = $service->getSomeOtherService(); @@ -612,7 +612,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForInvalidArgument() { + public function testResolveServicesAndParametersForInvalidArgument(): void { $this->expectException(InvalidArgumentException::class); $this->container->get('invalid_argument_service'); } @@ -624,7 +624,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForInvalidArguments() { + public function testResolveServicesAndParametersForInvalidArguments(): void { // In case the machine-optimized format is not used, we need to simulate the // test failure. $this->expectException(InvalidArgumentException::class); @@ -641,7 +641,7 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForServiceInstantiatedFromParameter() { + public function testResolveServicesAndParametersForServiceInstantiatedFromParameter(): void { $service = $this->container->get('service.provider'); $test_service = $this->container->get('service_with_parameter_service'); $this->assertSame($service, $test_service->getSomeOtherService(), 'Service was passed via parameter.'); @@ -652,7 +652,7 @@ class ContainerTest extends TestCase { * * @covers ::initialized */ - public function testInitialized() { + public function testInitialized(): void { $this->assertFalse($this->container->initialized('late.service'), 'Late service is not initialized.'); $this->container->get('late.service'); $this->assertTrue($this->container->initialized('late.service'), 'Late service is initialized after it was retrieved once.'); @@ -663,7 +663,7 @@ class ContainerTest extends TestCase { * * @covers ::initialized */ - public function testInitializedForAliases() { + public function testInitializedForAliases(): void { $this->assertFalse($this->container->initialized('late.service_alias'), 'Late service is not initialized.'); $this->container->get('late.service'); $this->assertTrue($this->container->initialized('late.service_alias'), 'Late service is initialized after it was retrieved once.'); @@ -674,7 +674,7 @@ class ContainerTest extends TestCase { * * @covers ::getServiceIds */ - public function testGetServiceIds() { + public function testGetServiceIds(): void { $service_definition_keys = array_merge(['service_container'], array_keys($this->containerDefinition['services'])); $this->assertEquals($service_definition_keys, $this->container->getServiceIds(), 'Retrieved service IDs match definition.'); @@ -693,14 +693,14 @@ class ContainerTest extends TestCase { * @covers ::createService * @covers ::resolveServicesAndParameters */ - public function testResolveServicesAndParametersForRawArgument() { + public function testResolveServicesAndParametersForRawArgument(): void { $this->assertEquals(['ccc'], $this->container->get('service_with_raw_argument')->getArguments()); } /** * Tests that service iterators are lazily instantiated. */ - public function testIterator() { + public function testIterator(): void { $iterator = $this->container->get('service_iterator')->getArguments()[0]; $this->assertIsIterable($iterator); $this->assertFalse($this->container->initialized('other.service')); @@ -715,7 +715,7 @@ class ContainerTest extends TestCase { * * @covers ::reset */ - public function testReset() { + public function testReset(): void { $this->assertFalse($this->container->initialized('late.service'), 'Late service is not initialized.'); $this->container->get('late.service'); $this->assertTrue($this->container->initialized('late.service'), 'Late service is initialized after it was retrieved once.'); diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php index 1143f59e0b6..5a6f3140afc 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php @@ -95,7 +95,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * @covers ::getArray * @covers ::supportsMachineFormat */ - public function testDumpForEmptyContainer() { + public function testDumpForEmptyContainer(): void { $serialized_definition = $this->dumper->dump(); $this->assertEquals(serialize($this->containerDefinition), $serialized_definition); } @@ -107,7 +107,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @dataProvider getAliasesDataProvider */ - public function testGetAliases($aliases, $definition_aliases) { + public function testGetAliases($aliases, $definition_aliases): void { $this->containerDefinition['aliases'] = $definition_aliases; $this->containerBuilder->getAliases()->willReturn($aliases); $this->assertEquals($this->containerDefinition, $this->dumper->getArray(), 'Expected definition matches dump.'); @@ -146,7 +146,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @dataProvider getParametersDataProvider */ - public function testGetParameters($parameters, $definition_parameters, $is_frozen) { + public function testGetParameters($parameters, $definition_parameters, $is_frozen): void { $this->containerDefinition['parameters'] = $definition_parameters; $this->containerDefinition['frozen'] = $is_frozen; @@ -209,7 +209,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @dataProvider getDefinitionsDataProvider */ - public function testGetServiceDefinitions($services, $definition_services) { + public function testGetServiceDefinitions($services, $definition_services): void { $this->containerDefinition['services'] = $definition_services; $this->containerBuilder->getDefinitions()->willReturn($services); @@ -502,7 +502,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @dataProvider publicPrivateDataProvider */ - public function testGetServiceDefinitionWithReferenceToAlias($public) { + public function testGetServiceDefinitionWithReferenceToAlias($public): void { $bar_definition = new Definition('\stdClass'); $bar_definition_php_array = [ 'class' => '\stdClass', @@ -561,7 +561,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @covers ::getServiceDefinition */ - public function testGetServiceDefinitionForDecoratedService() { + public function testGetServiceDefinitionForDecoratedService(): void { $bar_definition = new Definition('\stdClass'); $bar_definition->setPublic(TRUE); $bar_definition->setDecoratedService((string) new Reference('foo')); @@ -577,7 +577,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @covers ::dumpValue */ - public function testGetServiceDefinitionForExpression() { + public function testGetServiceDefinitionForExpression(): void { $expression = new Expression(''); $bar_definition = new Definition('\stdClass'); @@ -595,7 +595,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @covers ::dumpValue */ - public function testGetServiceDefinitionForObject() { + public function testGetServiceDefinitionForObject(): void { $service = new \stdClass(); $bar_definition = new Definition('\stdClass'); @@ -613,7 +613,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @covers ::dumpValue */ - public function testGetServiceDefinitionForResource() { + public function testGetServiceDefinitionForResource(): void { $resource = fopen('php://memory', 'r'); $bar_definition = new Definition('\stdClass'); @@ -631,7 +631,7 @@ class OptimizedPhpArrayDumperTest extends TestCase { * * @dataProvider percentsEscapeProvider */ - public function testPercentsEscape($expected, $argument) { + public function testPercentsEscape($expected, $argument): void { $definition = new Definition('\stdClass', [$argument]); $definition->setPublic(TRUE); $this->containerBuilder->getDefinitions()->willReturn([ diff --git a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php index 9016dd483f4..696dcb85203 100644 --- a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php @@ -50,7 +50,7 @@ class DiffFormatterTest extends TestCase { * @covers ::format * @dataProvider provideTestDiff */ - public function testDiff($expected, $from, $to) { + public function testDiff($expected, $from, $to): void { $diff = new Diff($from, $to); $formatter = new DiffFormatter(); $output = $formatter->format($diff); diff --git a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php index bcaf935eabd..fecf7d1ed07 100644 --- a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php @@ -25,7 +25,7 @@ class HWLDFWordAccumulatorTest extends TestCase { * * @see Drupal\Component\Diff\Engine\HWLDFWordAccumulator::NBSP */ - public function testGetLinesEmpty() { + public function testGetLinesEmpty(): void { $acc = new HWLDFWordAccumulator(); $this->assertEquals([' '], $acc->getLines()); } @@ -48,7 +48,7 @@ class HWLDFWordAccumulatorTest extends TestCase { * @covers ::addWords * @dataProvider provideAddWords */ - public function testAddWords($expected, $words, $tag) { + public function testAddWords($expected, $words, $tag): void { $acc = new HWLDFWordAccumulator(); $acc->addWords($words, $tag); $this->assertEquals($expected, $acc->getLines()); diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php index ce8744744c4..c0241d053c1 100644 --- a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php @@ -32,7 +32,7 @@ class YamlDirectoryDiscoveryTest extends TestCase { * * @covers ::findAll */ - public function testDiscovery() { + public function testDiscovery(): void { vfsStream::setup('modules', NULL, [ 'test_1' => [ 'subdir1' => [ @@ -103,7 +103,7 @@ class YamlDirectoryDiscoveryTest extends TestCase { * * @covers ::findAll */ - public function testDiscoveryAlternateId() { + public function testDiscoveryAlternateId(): void { vfsStream::setup('modules', NULL, [ 'test_1' => [ 'item_1.test.yml' => "alt_id: item1\nid: ignored", @@ -126,7 +126,7 @@ class YamlDirectoryDiscoveryTest extends TestCase { * @covers ::findAll * @covers ::getIdentifier */ - public function testDiscoveryNoIdException() { + public function testDiscoveryNoIdException(): void { $this->expectException(DiscoveryException::class); $this->expectExceptionMessage('The vfs://modules/test_1' . DIRECTORY_SEPARATOR . 'item_1.test.yml contains no data in the identifier key \'id\''); vfsStream::setup('modules', NULL, [ @@ -147,7 +147,7 @@ class YamlDirectoryDiscoveryTest extends TestCase { * * @covers ::findAll */ - public function testDiscoveryInvalidYamlException() { + public function testDiscoveryInvalidYamlException(): void { $this->expectException(DiscoveryException::class); $this->expectExceptionMessage('The vfs://modules/test_1' . DIRECTORY_SEPARATOR . 'item_1.test.yml contains invalid YAML'); vfsStream::setup('modules', NULL, [ diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php index 2f0cf2af14d..a592b1cea48 100644 --- a/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php @@ -30,7 +30,7 @@ class YamlDiscoveryTest extends TestCase { /** * Tests the YAML file discovery. */ - public function testDiscovery() { + public function testDiscovery(): void { vfsStreamWrapper::register(); $root = new vfsStreamDirectory('modules'); vfsStreamWrapper::setRoot($root); @@ -73,7 +73,7 @@ class YamlDiscoveryTest extends TestCase { /** * Tests if filename is output for a broken YAML file. */ - public function testForBrokenYml() { + public function testForBrokenYml(): void { vfsStreamWrapper::register(); $root = new vfsStreamDirectory('modules'); vfsStreamWrapper::setRoot($root); diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php index b2566ed752b..3f42a89a80a 100644 --- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php +++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php @@ -18,7 +18,7 @@ class DrupalComponentTest extends TestCase { /** * Tests that classes in Component do not use any Core class. */ - public function testNoCoreInComponent() { + public function testNoCoreInComponent(): void { $component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/lib/Drupal/Component'; foreach ($this->findPhpClasses($component_path) as $class) { $this->assertNoCoreUsage($class); @@ -28,7 +28,7 @@ class DrupalComponentTest extends TestCase { /** * Tests that classes in Component Tests do not use any Core class. */ - public function testNoCoreInComponentTests() { + public function testNoCoreInComponentTests(): void { $component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/tests/Drupal/Tests/Component'; foreach ($this->findPhpClasses($component_path) as $class) { $this->assertNoCoreUsage($class); @@ -140,7 +140,7 @@ class DrupalComponentTest extends TestCase { * @covers \Drupal\Tests\Component\DrupalComponentTest::assertNoCoreUsage * @dataProvider providerAssertNoCoreUsage */ - public function testAssertNoCoreUsage($expected_pass, $file_data) { + public function testAssertNoCoreUsage($expected_pass, $file_data): void { // Set up a virtual file to read. $vfs_root = vfsStream::setup('root'); vfsStream::newFile('Test.php')->at($vfs_root)->setContent($file_data); diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php index 5d87abef971..392c206e488 100644 --- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php @@ -38,7 +38,7 @@ class FileCacheFactoryTest extends TestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $file_cache = FileCacheFactory::get('test_foo_settings', []); // Ensure the right backend and configuration is used. @@ -59,7 +59,7 @@ class FileCacheFactoryTest extends TestCase { /** * @covers ::get */ - public function testGetNoPrefix() { + public function testGetNoPrefix(): void { FileCacheFactory::setPrefix(NULL); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Required prefix configuration is missing'); @@ -69,7 +69,7 @@ class FileCacheFactoryTest extends TestCase { /** * @covers ::get */ - public function testGetDisabledFileCache() { + public function testGetDisabledFileCache(): void { // Ensure the returned FileCache is an instance of FileCache::class. $file_cache = FileCacheFactory::get('test_foo_settings', []); $this->assertInstanceOf(FileCache::class, $file_cache); @@ -88,7 +88,7 @@ class FileCacheFactoryTest extends TestCase { * * @dataProvider configurationDataProvider */ - public function testGetConfigurationOverrides($configuration, $arguments, $class) { + public function testGetConfigurationOverrides($configuration, $arguments, $class): void { FileCacheFactory::setConfiguration($configuration); $file_cache = FileCacheFactory::get('test_foo_settings', $arguments); @@ -157,7 +157,7 @@ class FileCacheFactoryTest extends TestCase { * @covers ::getConfiguration * @covers ::setConfiguration */ - public function testGetSetConfiguration() { + public function testGetSetConfiguration(): void { $configuration = FileCacheFactory::getConfiguration(); $configuration['test_foo_bar'] = ['bar' => 'llama']; FileCacheFactory::setConfiguration($configuration); @@ -169,7 +169,7 @@ class FileCacheFactoryTest extends TestCase { * @covers ::getPrefix * @covers ::setPrefix */ - public function testGetSetPrefix() { + public function testGetSetPrefix(): void { // Random generator. $random = new Random(); diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php index 610a90905c5..88aa8e2f34c 100644 --- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php +++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php @@ -41,7 +41,7 @@ class FileCacheTest extends TestCase { * @covers ::get * @covers ::__construct */ - public function testGet() { + public function testGet(): void { // Test a cache miss. $result = $this->fileCache->get(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'no-llama-42.yml'); $this->assertNull($result); @@ -68,7 +68,7 @@ class FileCacheTest extends TestCase { /** * @covers ::getMultiple */ - public function testGetMultiple() { + public function testGetMultiple(): void { // Test a cache miss. $result = $this->fileCache->getMultiple([__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'no-llama-42.yml']); $this->assertEmpty($result); @@ -103,7 +103,7 @@ class FileCacheTest extends TestCase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'llama-23.txt'; $realpath = realpath($filename); $cid = 'prefix:test:' . $realpath; @@ -124,7 +124,7 @@ class FileCacheTest extends TestCase { /** * @covers ::delete */ - public function testDelete() { + public function testDelete(): void { $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'llama-23.txt'; $realpath = realpath($filename); $cid = 'prefix:test:' . $realpath; diff --git a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php index add09e6613c..60cedeb245c 100644 --- a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php +++ b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php @@ -19,7 +19,7 @@ class FileSecurityTest extends TestCase { /** * @covers ::writeHtaccess */ - public function testWriteHtaccessPrivate() { + public function testWriteHtaccessPrivate(): void { vfsStream::setup('root'); FileSecurity::writeHtaccess(vfsStream::url('root')); $htaccess_file = vfsStream::url('root') . '/.htaccess'; @@ -32,7 +32,7 @@ class FileSecurityTest extends TestCase { /** * @covers ::writeHtaccess */ - public function testWriteHtaccessPublic() { + public function testWriteHtaccessPublic(): void { vfsStream::setup('root'); $this->assertTrue(FileSecurity::writeHtaccess(vfsStream::url('root'), FALSE)); $htaccess_file = vfsStream::url('root') . '/.htaccess'; @@ -45,7 +45,7 @@ class FileSecurityTest extends TestCase { /** * @covers ::writeHtaccess */ - public function testWriteHtaccessForceOverwrite() { + public function testWriteHtaccessForceOverwrite(): void { vfsStream::setup('root'); $htaccess_file = vfsStream::url('root') . '/.htaccess'; file_put_contents($htaccess_file, "foo"); @@ -58,7 +58,7 @@ class FileSecurityTest extends TestCase { /** * @covers ::writeHtaccess */ - public function testWriteHtaccessFailure() { + public function testWriteHtaccessFailure(): void { vfsStream::setup('root'); $this->assertFalse(FileSecurity::writeHtaccess(vfsStream::url('root') . '/foo')); } diff --git a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php index 39a5095525b..36749ade6dd 100644 --- a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php +++ b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php @@ -18,7 +18,7 @@ class RegexDirectoryIteratorTest extends TestCase { * @covers ::accept * @dataProvider providerTestRegexDirectoryIterator */ - public function testRegexDirectoryIterator(array $directory, $regex, array $expected) { + public function testRegexDirectoryIterator(array $directory, $regex, array $expected): void { vfsStream::setup('root', NULL, $directory); $iterator = new RegexDirectoryIterator(vfsStream::url('root'), $regex); diff --git a/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php b/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php index a371dc3a70c..90977d85fb6 100644 --- a/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php +++ b/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php @@ -50,7 +50,7 @@ class FrontMatterTest extends TestCase { * @covers ::__construct * @covers ::create */ - public function testFrontMatterSerializerException() { + public function testFrontMatterSerializerException(): void { $this->expectException(\AssertionError::class); $this->expectExceptionMessage('The $serializer parameter must reference a class that implements Drupal\Component\Serialization\SerializationInterface.'); FrontMatter::create('', ''); @@ -64,7 +64,7 @@ class FrontMatterTest extends TestCase { * @covers ::parse * @covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException */ - public function testFrontMatterBroken() { + public function testFrontMatterBroken(): void { $this->expectException(FrontMatterParseException::class); $this->expectExceptionMessage('An error occurred when attempting to parse front matter data on line 4'); $source = "---\ncollection:\n- key: foo\n foo: bar\n---\n"; @@ -90,7 +90,7 @@ class FrontMatterTest extends TestCase { * * @dataProvider providerFrontMatterData */ - public function testFrontMatterData($yaml, $line, $content = self::SOURCE) { + public function testFrontMatterData($yaml, $line, $content = self::SOURCE): void { $source = static::createFrontMatterSource($yaml, $content); $frontMatter = FrontMatter::create($source); $this->assertEquals($content, $frontMatter->getContent()); diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php index 54d7914475a..17c26a0b36e 100644 --- a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php +++ b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php @@ -29,7 +29,7 @@ class PoHeaderTest extends TestCase { * * @dataProvider providerTestPluralsFormula */ - public function testPluralsFormula($plural, $expected) { + public function testPluralsFormula($plural, $expected): void { $p = new PoHeader(); $parsed = $p->parsePluralForms($plural); [$nplurals, $new_plural] = $parsed; diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php index d18888eecdd..667c2129770 100644 --- a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php +++ b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php @@ -53,7 +53,7 @@ class PoStreamWriterTest extends TestCase { /** * @covers ::getURI */ - public function testGetUriException() { + public function testGetUriException(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('No URI set.'); @@ -64,7 +64,7 @@ class PoStreamWriterTest extends TestCase { * @covers ::writeItem * @dataProvider providerWriteData */ - public function testWriteItem($poContent, $expected, $long) { + public function testWriteItem($poContent, $expected, $long): void { if ($long) { $this->expectException(\Exception::class); $this->expectExceptionMessage('Unable to write data:'); @@ -107,7 +107,7 @@ class PoStreamWriterTest extends TestCase { /** * @covers ::close */ - public function testCloseException() { + public function testCloseException(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Cannot close stream that is not open.'); diff --git a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php index 3fa25a7f1fa..ccfd520b127 100644 --- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php +++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php @@ -16,7 +16,7 @@ class GraphTest extends TestCase { /** * Tests depth-first-search features. */ - public function testDepthFirstSearch() { + public function testDepthFirstSearch(): void { // The sample graph used is: // @code // 1 --> 2 --> 3 5 ---> 6 diff --git a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php index b2a2cabea78..c6a19a35b99 100644 --- a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php +++ b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php @@ -23,7 +23,7 @@ class SecuredRedirectResponseTest extends TestCase { * @covers ::createFromRedirectResponse * @covers ::fromResponse */ - public function testRedirectCopy() { + public function testRedirectCopy(): void { $redirect = new RedirectResponse('/magic_redirect_url', 301, ['x-cache-foobar' => 123]); $redirect->setProtocolVersion('2.0'); $redirect->setCharset('ibm-943_P14A-2000'); diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php index 438814702c6..4d4c56ef1eb 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php @@ -53,7 +53,7 @@ class FileStorageReadOnlyTest extends PhpStorageTestBase { /** * Tests writing with one class and reading with another. */ - public function testReadOnly() { + public function testReadOnly(): void { // Random generator. $random = new Random(); @@ -85,7 +85,7 @@ class FileStorageReadOnlyTest extends PhpStorageTestBase { /** * @covers ::deleteAll */ - public function testDeleteAll() { + public function testDeleteAll(): void { // Random generator. $random = new Random(); diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php index db63b5498b6..bc0d8e5e908 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php @@ -45,7 +45,7 @@ class FileStorageTest extends PhpStorageTestBase { * @covers ::exists * @covers ::delete */ - public function testCRUD() { + public function testCRUD(): void { $php = new FileStorage($this->standardSettings); $this->assertCRUD($php); } @@ -53,7 +53,7 @@ class FileStorageTest extends PhpStorageTestBase { /** * @covers ::deleteAll */ - public function testDeleteAll() { + public function testDeleteAll(): void { // Random generator. $random_generator = new Random(); @@ -88,7 +88,7 @@ class FileStorageTest extends PhpStorageTestBase { /** * @covers ::createDirectory */ - public function testCreateDirectoryFailWarning() { + public function testCreateDirectoryFailWarning(): void { $directory = new vfsStreamDirectory('permissionDenied', 0200); $storage = new FileStorage([ 'directory' => $directory->url(), diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php index 0056c4477cf..5d769d0b194 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php @@ -62,7 +62,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase { /** * Tests basic load/save/delete operations. */ - public function testCRUD() { + public function testCRUD(): void { $php = new $this->storageClass($this->settings); $this->assertCRUD($php); } @@ -76,7 +76,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase { * We need to delay over 1 second for mtime test. * @medium */ - public function testSecurity() { + public function testSecurity(): void { $php = new $this->storageClass($this->settings); $name = 'test.php'; $php->save($name, '<?php'); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php index 877a0fae2e5..1dfa467e599 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php @@ -17,7 +17,7 @@ class AttributeBaseTest extends TestCase { * @covers ::getProvider * @covers ::setProvider */ - public function testSetProvider() { + public function testSetProvider(): void { $plugin = new AttributeBaseStub(id: '1'); $plugin->setProvider('example'); $this->assertEquals('example', $plugin->getProvider()); @@ -26,7 +26,7 @@ class AttributeBaseTest extends TestCase { /** * @covers ::getId */ - public function testGetId() { + public function testGetId(): void { $plugin = new AttributeBaseStub(id: 'example'); $this->assertEquals('example', $plugin->getId()); } @@ -35,7 +35,7 @@ class AttributeBaseTest extends TestCase { * @covers ::getClass * @covers ::setClass */ - public function testSetClass() { + public function testSetClass(): void { $plugin = new AttributeBaseStub(id: '1'); $plugin->setClass('example'); $this->assertEquals('example', $plugin->getClass()); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php index 4798504927b..566058d7c88 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php @@ -36,7 +36,7 @@ class AttributeClassDiscoveryCachedTest extends TestCase { * * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { // Path to the classes which we'll discover and parse annotation. $discovery_path = __DIR__ . '/Fixtures/Plugins'; // File path that should be discovered within that directory. diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php index 92b8fede1c4..f6c6370e7e1 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php @@ -36,7 +36,7 @@ class AttributeClassDiscoveryTest extends TestCase { * @covers ::__construct * @covers ::getPluginNamespaces */ - public function testGetPluginNamespaces() { + public function testGetPluginNamespaces(): void { // Path to the classes which we'll discover and parse annotation. $discovery = new AttributeClassDiscovery(['com/example' => [__DIR__]]); @@ -51,7 +51,7 @@ class AttributeClassDiscoveryTest extends TestCase { * @covers ::getDefinitions * @covers ::prepareAttributeDefinition */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $discovery = new AttributeClassDiscovery(['com\example' => [__DIR__ . '/Fixtures/Plugins']]); $this->assertEquals([ 'discovery_test_1' => [ diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php index 72ba747627a..2791af3d3f7 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php @@ -16,7 +16,7 @@ class PluginIdTest extends TestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { // Assert plugin starts with only an ID. $plugin = new PluginID(id: 'test'); // Plugin's always have a class set by discovery. diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php index 0399b7c59b7..5cad2a94067 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php @@ -17,7 +17,7 @@ class PluginTest extends TestCase { * @covers ::__construct * @covers ::get */ - public function testGet() { + public function testGet(): void { $plugin = new PluginStub(id: 'example', deriver: 'test'); $plugin->setClass('foo'); $this->assertEquals([ @@ -31,7 +31,7 @@ class PluginTest extends TestCase { * @covers ::setProvider * @covers ::getProvider */ - public function testSetProvider() { + public function testSetProvider(): void { $plugin = new Plugin(id: 'example'); $plugin->setProvider('example'); $this->assertEquals('example', $plugin->getProvider()); @@ -40,7 +40,7 @@ class PluginTest extends TestCase { /** * @covers ::getId */ - public function testGetId() { + public function testGetId(): void { $plugin = new Plugin(id: 'example'); $this->assertEquals('example', $plugin->getId()); } @@ -49,7 +49,7 @@ class PluginTest extends TestCase { * @covers ::setClass * @covers ::getClass */ - public function testSetClass() { + public function testSetClass(): void { $plugin = new Plugin(id: 'test'); $plugin->setClass('example'); $this->assertEquals('example', $plugin->getClass()); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php index faa0dd47f0d..6004e705acf 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php @@ -28,7 +28,7 @@ class ContextTest extends TestCase { * @covers ::getContextValue * @dataProvider providerGetContextValue */ - public function testGetContextValue($expected, $context_value, $is_required, $data_type) { + public function testGetContextValue($expected, $context_value, $is_required, $data_type): void { // Mock a Context object. $mock_context = $this->getMockBuilder('Drupal\Component\Plugin\Context\Context') ->disableOriginalConstructor() @@ -116,7 +116,7 @@ class ContextTest extends TestCase { /** * @covers ::getContextValue */ - public function testDefaultValue() { + public function testDefaultValue(): void { $mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface'); $mock_definition->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php index 0413216eeb1..f92d274cd85 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php @@ -23,7 +23,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithValidArrayPluginDefinition() { + public function testGetPluginClassWithValidArrayPluginDefinition(): void { $plugin_class = Corn::class; $class = DefaultFactory::getPluginClass('corn', ['class' => $plugin_class]); @@ -35,7 +35,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithValidObjectPluginDefinition() { + public function testGetPluginClassWithValidObjectPluginDefinition(): void { $plugin_class = Corn::class; $plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class)->getMock(); $plugin_definition->expects($this->atLeastOnce()) @@ -51,7 +51,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithMissingClassWithArrayPluginDefinition() { + public function testGetPluginClassWithMissingClassWithArrayPluginDefinition(): void { $this->expectException(PluginException::class); $this->expectExceptionMessage('The plugin (corn) did not specify an instance class.'); DefaultFactory::getPluginClass('corn', []); @@ -62,7 +62,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithMissingClassWithObjectPluginDefinition() { + public function testGetPluginClassWithMissingClassWithObjectPluginDefinition(): void { $plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class) ->getMock(); $this->expectException(PluginException::class); @@ -75,7 +75,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithNotExistingClassWithArrayPluginDefinition() { + public function testGetPluginClassWithNotExistingClassWithArrayPluginDefinition(): void { $this->expectException(PluginException::class); $this->expectExceptionMessage('Plugin (carrot) instance class "Drupal\Tests\Component\Plugin\Fixtures\vegetable\Carrot" does not exist.'); DefaultFactory::getPluginClass('carrot', ['class' => 'Drupal\Tests\Component\Plugin\Fixtures\vegetable\Carrot']); @@ -86,7 +86,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithNotExistingClassWithObjectPluginDefinition() { + public function testGetPluginClassWithNotExistingClassWithObjectPluginDefinition(): void { $plugin_class = 'Drupal\Tests\Component\Plugin\Fixtures\vegetable\Carrot'; $plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class)->getMock(); $plugin_definition->expects($this->atLeastOnce()) @@ -101,7 +101,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithInterfaceWithArrayPluginDefinition() { + public function testGetPluginClassWithInterfaceWithArrayPluginDefinition(): void { $plugin_class = Corn::class; $class = DefaultFactory::getPluginClass('corn', ['class' => $plugin_class], VegetableInterface::class); @@ -113,7 +113,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithInterfaceWithObjectPluginDefinition() { + public function testGetPluginClassWithInterfaceWithObjectPluginDefinition(): void { $plugin_class = Corn::class; $plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class)->getMock(); $plugin_definition->expects($this->atLeastOnce()) @@ -129,7 +129,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithInterfaceAndInvalidClassWithArrayPluginDefinition() { + public function testGetPluginClassWithInterfaceAndInvalidClassWithArrayPluginDefinition(): void { $this->expectException(PluginException::class); $this->expectExceptionMessage('Plugin "corn" (Drupal\Tests\Component\Plugin\Fixtures\vegetable\Broccoli) must implement interface Drupal\Tests\Component\Plugin\Fixtures\vegetable\VegetableInterface.'); DefaultFactory::getPluginClass('corn', ['class' => Broccoli::class], VegetableInterface::class); @@ -140,7 +140,7 @@ class DefaultFactoryTest extends TestCase { * * @covers ::getPluginClass */ - public function testGetPluginClassWithInterfaceAndInvalidClassWithObjectPluginDefinition() { + public function testGetPluginClassWithInterfaceAndInvalidClassWithObjectPluginDefinition(): void { $plugin_class = Broccoli::class; $plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class)->getMock(); $plugin_definition->expects($this->atLeastOnce()) diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php index 6b7c905c28f..483764b3c0e 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php @@ -58,7 +58,7 @@ class AnnotatedClassDiscoveryTest extends TestCase { * * @coversNothing */ - public function testAutoloadBadAnnotations($annotation) { + public function testAutoloadBadAnnotations($annotation): void { // Set up a class file in vfsStream. vfsStreamWrapper::register(); $root = new vfsStreamDirectory('root'); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php index 8d7be68c166..d2deaa5ffb2 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php @@ -19,7 +19,7 @@ class AttributeBridgeDecoratorTest extends TestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { // Normally the attribute classes would be autoloaded. include_once __DIR__ . '/../Attribute/Fixtures/CustomPlugin.php'; include_once __DIR__ . '/../Attribute/Fixtures/Plugins/PluginNamespace/AttributeDiscoveryTest1.php'; diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php index cd2bbcea11b..9db89444c17 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php @@ -35,7 +35,7 @@ class DiscoveryCachedTraitTest extends TestCase { * @covers ::getDefinition * @dataProvider providerGetDefinition */ - public function testGetDefinition($expected, $cached_definitions, $get_definitions, $plugin_id) { + public function testGetDefinition($expected, $cached_definitions, $get_definitions, $plugin_id): void { $trait = $this->getMockBuilder(DiscoveryCachedTraitMockableClass::class) ->onlyMethods(['getDefinitions']) ->getMock(); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php index 16858ae5d13..d26a538aad6 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php @@ -33,7 +33,7 @@ class DiscoveryTraitTest extends TestCase { * @covers ::doGetDefinition * @dataProvider providerDoGetDefinition */ - public function testDoGetDefinition($expected, $definitions, $plugin_id) { + public function testDoGetDefinition($expected, $definitions, $plugin_id): void { $trait = new DiscoveryTraitMockableClass(); // Un-protect the method using reflection. $method_ref = new \ReflectionMethod($trait, 'doGetDefinition'); @@ -63,7 +63,7 @@ class DiscoveryTraitTest extends TestCase { * @dataProvider providerDoGetDefinitionException * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException */ - public function testDoGetDefinitionException($expected, $definitions, $plugin_id) { + public function testDoGetDefinitionException($expected, $definitions, $plugin_id): void { $trait = new DiscoveryTraitMockableClass(); // Un-protect the method using reflection. $method_ref = new \ReflectionMethod($trait, 'doGetDefinition'); @@ -76,7 +76,7 @@ class DiscoveryTraitTest extends TestCase { * @covers ::getDefinition * @dataProvider providerDoGetDefinition */ - public function testGetDefinition($expected, $definitions, $plugin_id) { + public function testGetDefinition($expected, $definitions, $plugin_id): void { // Since getDefinition is a wrapper around doGetDefinition(), we can re-use // its data provider. We just have to tell abstract method getDefinitions() // to use the $definitions array. @@ -98,7 +98,7 @@ class DiscoveryTraitTest extends TestCase { * @dataProvider providerDoGetDefinitionException * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException */ - public function testGetDefinitionException($expected, $definitions, $plugin_id) { + public function testGetDefinitionException($expected, $definitions, $plugin_id): void { // Since getDefinition is a wrapper around doGetDefinition(), we can re-use // its data provider. We just have to tell abstract method getDefinitions() // to use the $definitions array. @@ -131,7 +131,7 @@ class DiscoveryTraitTest extends TestCase { * @covers ::hasDefinition * @dataProvider providerHasDefinition */ - public function testHasDefinition($expected, $plugin_id) { + public function testHasDefinition($expected, $plugin_id): void { $trait = $this->getMockBuilder(DiscoveryTraitMockableClass::class) ->onlyMethods(['getDefinition']) ->getMock(); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php index 94fbe6ad9d7..b2f430416a7 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php @@ -61,7 +61,7 @@ class StaticDiscoveryDecoratorTest extends TestCase { * @covers ::getDefinition * @dataProvider providerGetDefinition */ - public function testGetDefinition($expected, $has_register_definitions, $exception_on_invalid, $definitions, $base_plugin_id) { + public function testGetDefinition($expected, $has_register_definitions, $exception_on_invalid, $definitions, $base_plugin_id): void { // Mock our StaticDiscoveryDecorator. $mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class) ->disableOriginalConstructor() @@ -126,7 +126,7 @@ class StaticDiscoveryDecoratorTest extends TestCase { * @covers ::getDefinitions * @dataProvider providerGetDefinitions */ - public function testGetDefinitions($has_register_definitions, $definitions) { + public function testGetDefinitions($has_register_definitions, $definitions): void { // Mock our StaticDiscoveryDecorator. $mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class) ->disableOriginalConstructor() @@ -189,7 +189,7 @@ class StaticDiscoveryDecoratorTest extends TestCase { * @covers ::__call * @dataProvider providerCall */ - public function testCall($method, $args) { + public function testCall($method, $args): void { // Mock a decorated object. $mock_decorated = $this->getMockBuilder(StaticDiscoveryTestDecoratedClass::class) ->onlyMethods([$method]) diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php index ccacab19e64..860c96c6e22 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php @@ -80,7 +80,7 @@ class ReflectionFactoryTest extends TestCase { * @covers ::createInstance * @dataProvider providerGetInstanceArguments */ - public function testCreateInstance($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration) { + public function testCreateInstance($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration): void { // Create a mock DiscoveryInterface which can return our plugin definition. $mock_discovery = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface') ->onlyMethods(['getDefinition', 'getDefinitions', 'hasDefinition']) @@ -105,7 +105,7 @@ class ReflectionFactoryTest extends TestCase { * @covers ::getInstanceArguments * @dataProvider providerGetInstanceArguments */ - public function testGetInstanceArguments($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration) { + public function testGetInstanceArguments($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration): void { $reflection_factory = $this->getMockBuilder('Drupal\Component\Plugin\Factory\ReflectionFactory') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php index e33cf214a75..488361d6de9 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php @@ -16,7 +16,7 @@ class PluginBaseTest extends TestCase { * @dataProvider providerTestGetPluginId * @covers ::getPluginId */ - public function testGetPluginId($plugin_id, $expected) { + public function testGetPluginId($plugin_id, $expected): void { $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [ [], $plugin_id, @@ -42,7 +42,7 @@ class PluginBaseTest extends TestCase { * @dataProvider providerTestGetBaseId * @coves ::getBaseId */ - public function testGetBaseId($plugin_id, $expected) { + public function testGetBaseId($plugin_id, $expected): void { /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit\Framework\MockObject\MockObject $plugin_base */ $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [ [], @@ -69,7 +69,7 @@ class PluginBaseTest extends TestCase { * @dataProvider providerTestGetDerivativeId * @covers ::getDerivativeId */ - public function testGetDerivativeId($plugin_id = NULL, $expected = NULL) { + public function testGetDerivativeId($plugin_id = NULL, $expected = NULL): void { /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit\Framework\MockObject\MockObject $plugin_base */ $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [ [], @@ -95,7 +95,7 @@ class PluginBaseTest extends TestCase { /** * @covers ::getPluginDefinition */ - public function testGetPluginDefinition() { + public function testGetPluginDefinition(): void { $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [ [], 'plugin_id', diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php index ad9ba1ac969..39fdeddc08d 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php @@ -50,7 +50,7 @@ class PluginManagerBaseTest extends TestCase { * * @covers ::createInstance */ - public function testCreateInstance() { + public function testCreateInstance(): void { $manager = $this->getMockBuilder('Drupal\Component\Plugin\PluginManagerBase') ->getMockForAbstractClass(); // PluginManagerBase::createInstance() looks for a factory object and then @@ -70,7 +70,7 @@ class PluginManagerBaseTest extends TestCase { * * @covers ::createInstance */ - public function testCreateInstanceFallback() { + public function testCreateInstanceFallback(): void { // We use our special stub class which extends PluginManagerBase and also // implements FallbackPluginManagerInterface. $manager = new StubFallbackPluginManager(); @@ -96,7 +96,7 @@ class PluginManagerBaseTest extends TestCase { /** * @covers ::getInstance */ - public function testGetInstance() { + public function testGetInstance(): void { $options = [ 'foo' => 'F00', 'bar' => 'bAr', @@ -113,7 +113,7 @@ class PluginManagerBaseTest extends TestCase { /** * @covers ::getInstance */ - public function testGetInstanceWithoutMapperShouldThrowException() { + public function testGetInstanceWithoutMapperShouldThrowException(): void { $options = [ 'foo' => 'F00', 'bar' => 'bAr', diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php index 271bef19ca0..05eac87208e 100644 --- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php @@ -32,7 +32,7 @@ class ProxyBuilderTest extends TestCase { /** * @covers ::buildProxyClassName */ - public function testBuildProxyClassName() { + public function testBuildProxyClassName(): void { $class_name = $this->proxyBuilder->buildProxyClassName('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod'); $this->assertEquals('Drupal\Tests\ProxyClass\Component\ProxyBuilder\TestServiceNoMethod', $class_name); } @@ -40,7 +40,7 @@ class ProxyBuilderTest extends TestCase { /** * @covers ::buildProxyClassName */ - public function testBuildProxyClassNameForModule() { + public function testBuildProxyClassNameForModule(): void { $class_name = $this->proxyBuilder->buildProxyClassName('Drupal\views_ui\ParamConverter\ViewUIConverter'); $this->assertEquals('Drupal\views_ui\ProxyClass\ParamConverter\ViewUIConverter', $class_name); } @@ -48,7 +48,7 @@ class ProxyBuilderTest extends TestCase { /** * @covers ::buildProxyNamespace */ - public function testBuildProxyNamespace() { + public function testBuildProxyNamespace(): void { $class_name = $this->proxyBuilder->buildProxyNamespace('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod'); $this->assertEquals('Drupal\Tests\ProxyClass\Component\ProxyBuilder', $class_name); } @@ -60,7 +60,7 @@ class ProxyBuilderTest extends TestCase { * @covers ::buildConstructorMethod * @covers ::buildLazyLoadItselfMethod */ - public function testBuildNoMethod() { + public function testBuildNoMethod(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod'; $result = $this->proxyBuilder->build($class); @@ -71,7 +71,7 @@ class ProxyBuilderTest extends TestCase { * @covers ::buildMethod * @covers ::buildMethodBody */ - public function testBuildSimpleMethod() { + public function testBuildSimpleMethod(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceSimpleMethod'; $result = $this->proxyBuilder->build($class); @@ -95,7 +95,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildMethodWithParameter() { + public function testBuildMethodWithParameter(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceMethodWithParameter'; $result = $this->proxyBuilder->build($class); @@ -119,7 +119,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildComplexMethod() { + public function testBuildComplexMethod(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceComplexMethod'; $result = $this->proxyBuilder->build($class); @@ -144,7 +144,7 @@ EOS; /** * @covers ::buildMethodBody */ - public function testBuildServiceMethodReturnsVoid() { + public function testBuildServiceMethodReturnsVoid(): void { $class = TestServiceMethodReturnsVoid::class; $result = $this->proxyBuilder->build($class); @@ -169,7 +169,7 @@ EOS; * @covers ::buildMethod * @covers ::buildMethodBody */ - public function testBuildReturnReference() { + public function testBuildReturnReference(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceReturnReference'; $result = $this->proxyBuilder->build($class); @@ -195,7 +195,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildWithInterface() { + public function testBuildWithInterface(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithInterface'; $result = $this->proxyBuilder->build($class); @@ -219,7 +219,7 @@ EOS; /** * @covers ::build */ - public function testBuildWithNestedInterface() { + public function testBuildWithNestedInterface(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithChildInterfaces'; $result = $this->proxyBuilder->build($class); @@ -234,7 +234,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildWithProtectedAndPrivateMethod() { + public function testBuildWithProtectedAndPrivateMethod(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithProtectedMethods'; $result = $this->proxyBuilder->build($class); @@ -259,7 +259,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildWithPublicStaticMethod() { + public function testBuildWithPublicStaticMethod(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod'; $result = $this->proxyBuilder->build($class); @@ -285,7 +285,7 @@ EOS; * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildWithNullableSelfTypeHint() { + public function testBuildWithNullableSelfTypeHint(): void { $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNullableTypeHintSelf'; $result = $this->proxyBuilder->build($class); diff --git a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php index 9bd02126d78..d3451194895 100644 --- a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php @@ -36,7 +36,7 @@ class FormattableMarkupTest extends TestCase { * @covers ::__toString * @covers ::jsonSerialize */ - public function testToString() { + public function testToString(): void { $string = 'Can I have a @replacement'; $formattable_string = new FormattableMarkup($string, ['@replacement' => 'kitten']); $text = (string) $formattable_string; @@ -48,7 +48,7 @@ class FormattableMarkupTest extends TestCase { /** * @covers ::count */ - public function testCount() { + public function testCount(): void { $string = 'Can I have a @replacement'; $formattable_string = new FormattableMarkup($string, ['@replacement' => 'kitten']); $this->assertEquals(strlen($string), $formattable_string->count()); @@ -75,7 +75,7 @@ class FormattableMarkupTest extends TestCase { * @covers ::__toString * @dataProvider providerTestUnexpectedPlaceholder */ - public function testUnexpectedPlaceholder($string, $arguments, $error_number, $error_message) { + public function testUnexpectedPlaceholder($string, $arguments, $error_number, $error_message): void { // We set a custom error handler because of https://github.com/sebastianbergmann/phpunit/issues/487 set_error_handler([$this, 'errorHandler']); // We want this to trigger an error. diff --git a/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php b/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php index 2f09bf1821f..2b10bbfbd79 100644 --- a/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php +++ b/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php @@ -23,7 +23,7 @@ class HtmlEscapedTextTest extends TestCase { * * @dataProvider providerToString */ - public function testToString($text, $expected, $message) { + public function testToString($text, $expected, $message): void { $escapable_string = new HtmlEscapedText($text); $this->assertEquals($expected, (string) $escapable_string, $message); $this->assertEquals($expected, $escapable_string->jsonSerialize()); @@ -60,7 +60,7 @@ class HtmlEscapedTextTest extends TestCase { /** * @covers ::count */ - public function testCount() { + public function testCount(): void { $string = 'Can I have a <em>kitten</em>'; $escapable_string = new HtmlEscapedText($string); $this->assertEquals(strlen($string), $escapable_string->count()); diff --git a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php index afae2d777fe..23ddfea0119 100644 --- a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php +++ b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php @@ -30,7 +30,7 @@ class PlainTextOutputTest extends TestCase { * @covers ::renderFromHtml * @dataProvider providerRenderFromHtml */ - public function testRenderFromHtml($expected, $string, $args = []) { + public function testRenderFromHtml($expected, $string, $args = []): void { $markup = new FormattableMarkup($string, $args); $output = PlainTextOutput::renderFromHtml($markup); $this->assertSame($expected, $output); diff --git a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php index d940543136b..9f24283f962 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php +++ b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php @@ -57,7 +57,7 @@ class JsonTest extends TestCase { /** * Tests encoding for every ASCII character. */ - public function testEncodingAscii() { + public function testEncodingAscii(): void { // Verify there aren't character encoding problems with the source string. $this->assertSame(127, strlen($this->string), 'A string with the full ASCII table has the correct length.'); foreach ($this->htmlUnsafe as $char) { @@ -68,7 +68,7 @@ class JsonTest extends TestCase { /** * Tests encoding length. */ - public function testEncodingLength() { + public function testEncodingLength(): void { // Verify that JSON encoding produces a string with all of the characters. $json = Json::encode($this->string); // Verify that a JSON-encoded string is larger than the source string. @@ -78,7 +78,7 @@ class JsonTest extends TestCase { /** * Tests end and start of the encoded string. */ - public function testEncodingStartEnd() { + public function testEncodingStartEnd(): void { $json = Json::encode($this->string); // The first and last characters should be ", and no others. $this->assertStringStartsWith('"', $json, 'A JSON encoded string begins with ".'); @@ -89,7 +89,7 @@ class JsonTest extends TestCase { /** * Tests converting PHP variables to JSON strings and back. */ - public function testReversibility() { + public function testReversibility(): void { $json = Json::encode($this->string); // Verify that encoding/decoding is reversible. $json_decoded = Json::decode($json); @@ -99,7 +99,7 @@ class JsonTest extends TestCase { /** * Tests the reversibility of structured data. */ - public function testStructuredReversibility() { + public function testStructuredReversibility(): void { // Verify reversibility for structured data. Also verify that necessary // characters are escaped. $source = [TRUE, FALSE, 0, 1, '0', '1', $this->string, ['key1' => $this->string, 'key2' => ['nested' => TRUE]]]; diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php index 174ea786b2a..8f124a85ba9 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php +++ b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php @@ -31,7 +31,7 @@ class YamlPeclTest extends YamlTestBase { /** * Ensures that php object support is disabled. */ - public function testObjectSupportDisabled() { + public function testObjectSupportDisabled(): void { $object = new \stdClass(); $object->foo = 'bar'; $this->assertEquals(['O:8:"stdClass":1:{s:3:"foo";s:3:"bar";}'], YamlPecl::decode(YamlPecl::encode([$object]))); @@ -44,7 +44,7 @@ class YamlPeclTest extends YamlTestBase { * @covers ::decode * @dataProvider providerDecodeTests */ - public function testDecode($string, $data) { + public function testDecode($string, $data): void { $this->assertEquals($data, YamlPecl::decode($string)); } @@ -53,7 +53,7 @@ class YamlPeclTest extends YamlTestBase { * * @covers ::encode */ - public function testEncode() { + public function testEncode(): void { // cSpell:disable $this->assertEquals('--- foo: @@ -74,14 +74,14 @@ foo: * @covers ::applyBooleanCallbacks * @dataProvider providerBoolTest */ - public function testApplyBooleanCallbacks($string, $expected) { + public function testApplyBooleanCallbacks($string, $expected): void { $this->assertEquals($expected, YamlPecl::applyBooleanCallbacks($string, 'bool', NULL)); } /** * @covers ::getFileExtension */ - public function testGetFileExtension() { + public function testGetFileExtension(): void { $this->assertEquals('yml', YamlPecl::getFileExtension()); } @@ -90,7 +90,7 @@ foo: * * @covers ::errorHandler */ - public function testError() { + public function testError(): void { $this->expectException(InvalidDataTypeException::class); YamlPecl::decode('foo: [ads'); } diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php index 7c08d60d701..7980f584535 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php +++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php @@ -33,7 +33,7 @@ class YamlTest extends YamlTestBase { * @covers ::decode * @dataProvider providerDecodeTests */ - public function testDecode($string, $data) { + public function testDecode($string, $data): void { $this->assertSame($data, Yaml::decode($string)); } @@ -42,7 +42,7 @@ class YamlTest extends YamlTestBase { * * @covers ::encode */ - public function testEncode() { + public function testEncode(): void { // cSpell:disable $this->assertSame('foo: bar: \'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sapien ex, venenatis vitae nisi eu, posuere luctus dolor. Nullam convallis\' @@ -53,7 +53,7 @@ class YamlTest extends YamlTestBase { /** * @covers ::getFileExtension */ - public function testGetFileExtension() { + public function testGetFileExtension(): void { $this->assertSame('yml', Yaml::getFileExtension()); } @@ -62,7 +62,7 @@ class YamlTest extends YamlTestBase { * * @covers ::decode */ - public function testError() { + public function testError(): void { $this->expectException(InvalidDataTypeException::class); Yaml::decode('foo: [ads'); } @@ -72,7 +72,7 @@ class YamlTest extends YamlTestBase { * * @covers ::encode */ - public function testEncodeObjectSupportDisabled() { + public function testEncodeObjectSupportDisabled(): void { $this->expectException(InvalidDataTypeException::class); $this->expectExceptionMessage('Object support when dumping a YAML file has been disabled.'); $object = new \stdClass(); @@ -85,7 +85,7 @@ class YamlTest extends YamlTestBase { * * @covers ::decode */ - public function testDecodeObjectSupportDisabled() { + public function testDecodeObjectSupportDisabled(): void { $this->expectException(InvalidDataTypeException::class); $this->expectExceptionMessageMatches('/^Object support when parsing a YAML file has been disabled/'); $yaml = <<<YAML diff --git a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php index ce176d26299..3badd32fab8 100644 --- a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php +++ b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php @@ -28,7 +28,7 @@ class PhpTransliterationTest extends TestCase { * * @dataProvider providerTestPhpTransliterationRemoveDiacritics */ - public function testRemoveDiacritics($original, $expected) { + public function testRemoveDiacritics($original, $expected): void { $transliterator_class = new PhpTransliteration(); $result = $transliterator_class->removeDiacritics($original); $this->assertEquals($expected, $result); @@ -225,7 +225,7 @@ class PhpTransliterationTest extends TestCase { * * @covers ::readLanguageOverrides */ - public function testSafeInclude() { + public function testSafeInclude(): void { // The overrides in the transliteration data directory transliterates 0x82 // into "safe" but the overrides one directory higher transliterates the // same character into "security hole". So by using "../index" as the diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php index 9f7004e4d27..d9d8563de20 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php @@ -25,7 +25,7 @@ class ArgumentsResolverTest extends TestCase { * * @dataProvider providerTestGetArgument */ - public function testGetArgument($callable, $scalars, $objects, $wildcards, $expected) { + public function testGetArgument($callable, $scalars, $objects, $wildcards, $expected): void { $arguments = (new ArgumentsResolver($scalars, $objects, $wildcards))->getArguments($callable); $this->assertSame($expected, $arguments); } @@ -79,7 +79,7 @@ class ArgumentsResolverTest extends TestCase { /** * Tests getArgument() with an object. */ - public function testGetArgumentObject() { + public function testGetArgumentObject(): void { $callable = function (\stdClass $object) {}; $object = new \stdClass(); @@ -90,7 +90,7 @@ class ArgumentsResolverTest extends TestCase { /** * Tests getArgument() with a wildcard object for a parameter with a custom name. */ - public function testGetWildcardArgument() { + public function testGetWildcardArgument(): void { $callable = function (\stdClass $custom_name) {}; $object = new \stdClass(); @@ -101,7 +101,7 @@ class ArgumentsResolverTest extends TestCase { /** * Tests getArgument() with a Route, Request, and Account object. */ - public function testGetArgumentOrder() { + public function testGetArgumentOrder(): void { $a1 = $this->getMockBuilder('\Drupal\Tests\Component\Utility\Test1Interface')->getMock(); $a2 = $this->getMockBuilder('\Drupal\Tests\Component\Utility\TestClass')->getMock(); $a3 = $this->getMockBuilder('\Drupal\Tests\Component\Utility\Test2Interface')->getMock(); @@ -128,7 +128,7 @@ class ArgumentsResolverTest extends TestCase { * * Without the type hint, the wildcard object will not be passed to the callable. */ - public function testGetWildcardArgumentNoTypeHint() { + public function testGetWildcardArgumentNoTypeHint(): void { $a = $this->getMockBuilder('\Drupal\Tests\Component\Utility\Test1Interface')->getMock(); $wildcards = [$a]; $resolver = new ArgumentsResolver([], [], $wildcards); @@ -145,7 +145,7 @@ class ArgumentsResolverTest extends TestCase { * Without the type hint, passing a value to a named parameter will still * receive the provided value. */ - public function testGetArgumentRouteNoTypeHintAndValue() { + public function testGetArgumentRouteNoTypeHintAndValue(): void { $scalars = ['route' => 'foo']; $resolver = new ArgumentsResolver($scalars, [], []); @@ -157,7 +157,7 @@ class ArgumentsResolverTest extends TestCase { /** * Tests handleUnresolvedArgument() for a scalar argument. */ - public function testHandleNotUpcastedArgument() { + public function testHandleNotUpcastedArgument(): void { $objects = ['foo' => 'bar']; $scalars = ['foo' => 'baz']; $resolver = new ArgumentsResolver($scalars, $objects, []); @@ -173,7 +173,7 @@ class ArgumentsResolverTest extends TestCase { * * @dataProvider providerTestHandleUnresolvedArgument */ - public function testHandleUnresolvedArgument($callable) { + public function testHandleUnresolvedArgument($callable): void { $resolver = new ArgumentsResolver([], [], []); $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('requires a value for the "$foo" argument.'); diff --git a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php index f2a6a202f82..d79aabb136d 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php @@ -24,7 +24,7 @@ class ColorTest extends TestCase { * * @dataProvider providerTestValidateHex */ - public function testValidateHex($expected, $value) { + public function testValidateHex($expected, $value): void { $this->assertSame($expected, Color::validateHex($value)); } @@ -80,7 +80,7 @@ class ColorTest extends TestCase { * * @dataProvider providerTestHexToRgb */ - public function testHexToRgb($value, $expected, $invalid = FALSE) { + public function testHexToRgb($value, $expected, $invalid = FALSE): void { if ($invalid) { $this->expectException('InvalidArgumentException'); } @@ -141,7 +141,7 @@ class ColorTest extends TestCase { * * @dataProvider providerTestRbgToHex */ - public function testRgbToHex($value, $expected) { + public function testRgbToHex($value, $expected): void { $this->assertSame($expected, Color::rgbToHex($value)); } @@ -208,7 +208,7 @@ class ColorTest extends TestCase { * * @dataProvider providerTestNormalizeHexLength */ - public function testNormalizeHexLength($value, $expected) { + public function testNormalizeHexLength($value, $expected): void { $this->assertSame($expected, Color::normalizeHexLength($value)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php index 22c5081efb7..c29ded1e244 100644 --- a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php @@ -27,7 +27,7 @@ class CryptTest extends TestCase { * @param string $expected_hash * Expected result from hashing $data. */ - public function testHashBase64($data, $expected_hash) { + public function testHashBase64($data, $expected_hash): void { $hash = Crypt::hashBase64($data); $this->assertEquals($expected_hash, $hash, 'The correct hash was not calculated.'); } @@ -45,7 +45,7 @@ class CryptTest extends TestCase { * @param string $expected_hmac * Expected result from hashing $data using $key. */ - public function testHmacBase64($data, $key, $expected_hmac) { + public function testHmacBase64($data, $key, $expected_hmac): void { $hmac = Crypt::hmacBase64($data, $key); $this->assertEquals($expected_hmac, $hmac, 'The correct hmac was not calculated.'); } @@ -61,7 +61,7 @@ class CryptTest extends TestCase { * @param string $key * Key to use in hashing process. */ - public function testHmacBase64Invalid($data, $key) { + public function testHmacBase64Invalid($data, $key): void { $this->expectException('InvalidArgumentException'); Crypt::hmacBase64($data, $key); } diff --git a/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php index a44fe30c5ca..2383752bffd 100644 --- a/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php @@ -21,7 +21,7 @@ class DeprecationHelperTest extends TestCase { * * @dataProvider deprecatedHelperTestCases */ - public function testDeprecationHelper(string $currentVersion, array $tests) { + public function testDeprecationHelper(string $currentVersion, array $tests): void { foreach ($tests as $deprecatedVersion => $expectedCallable) { $result = DeprecationHelper::backwardsCompatibleCall( $currentVersion, diff --git a/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php b/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php index d5d4577baf5..b57f51c8b6a 100644 --- a/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php @@ -19,7 +19,7 @@ class EmailValidatorTest extends TestCase { /** * @covers ::isValid */ - public function testIsValid() { + public function testIsValid(): void { // Note that \Drupal\Component\Utility\EmailValidator wraps // \Egulias\EmailValidator\EmailValidator so we don't do anything more than // test that the wrapping works since the dependency has its own test @@ -33,7 +33,7 @@ class EmailValidatorTest extends TestCase { /** * @covers ::isValid */ - public function testIsValidException() { + public function testIsValidException(): void { $validator = new EmailValidator(); $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Calling \Drupal\Component\Utility\EmailValidator::isValid() with the second argument is not supported. See https://www.drupal.org/node/2997196'); diff --git a/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php b/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php index 7f0ef7f0c96..228d8bc50a9 100644 --- a/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php @@ -32,7 +32,7 @@ class EnvironmentTest extends TestCase { * The expected return value from * \Drupal\Component\Utility\Environment::checkMemoryLimit(). */ - public function testCheckMemoryLimit($required, $custom_memory_limit, $expected) { + public function testCheckMemoryLimit($required, $custom_memory_limit, $expected): void { $actual = Environment::checkMemoryLimit($required, $custom_memory_limit); $this->assertEquals($expected, $actual); } diff --git a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php index 17fcabc59b0..a3f30dac659 100644 --- a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php @@ -46,7 +46,7 @@ class HtmlTest extends TestCase { * * @covers ::cleanCssIdentifier */ - public function testCleanCssIdentifier($expected, $source, $filter = NULL) { + public function testCleanCssIdentifier($expected, $source, $filter = NULL): void { if ($filter !== NULL) { $this->assertSame($expected, Html::cleanCssIdentifier($source, $filter)); } @@ -92,7 +92,7 @@ class HtmlTest extends TestCase { * * @covers ::getClass */ - public function testHtmlClass() { + public function testHtmlClass(): void { // Verify Drupal coding standards are enforced. $this->assertSame('class-name--ü', Html::getClass('CLASS NAME_[Ü]'), 'Enforce Drupal coding standards.'); @@ -116,7 +116,7 @@ class HtmlTest extends TestCase { * * @covers ::getUniqueId */ - public function testHtmlGetUniqueId($expected, $source, $reset = FALSE) { + public function testHtmlGetUniqueId($expected, $source, $reset = FALSE): void { if ($reset) { Html::resetSeenIds(); } @@ -159,7 +159,7 @@ class HtmlTest extends TestCase { * * @covers ::getUniqueId */ - public function testHtmlGetUniqueIdWithAjaxIds($expected, $source) { + public function testHtmlGetUniqueIdWithAjaxIds($expected, $source): void { Html::setIsAjax(TRUE); $id = Html::getUniqueId($source); @@ -203,7 +203,7 @@ class HtmlTest extends TestCase { * * @covers ::getId */ - public function testHtmlGetId($expected, $source) { + public function testHtmlGetId($expected, $source): void { Html::setIsAjax(FALSE); $this->assertSame($expected, Html::getId($source)); } @@ -237,7 +237,7 @@ class HtmlTest extends TestCase { * @dataProvider providerDecodeEntities * @covers ::decodeEntities */ - public function testDecodeEntities($text, $expected) { + public function testDecodeEntities($text, $expected): void { $this->assertEquals($expected, Html::decodeEntities($text)); } @@ -278,7 +278,7 @@ class HtmlTest extends TestCase { * @dataProvider providerEscape * @covers ::escape */ - public function testEscape($expected, $text) { + public function testEscape($expected, $text): void { $this->assertEquals($expected, Html::escape($text)); } @@ -312,7 +312,7 @@ class HtmlTest extends TestCase { * @covers ::decodeEntities * @covers ::escape */ - public function testDecodeEntitiesAndEscape() { + public function testDecodeEntitiesAndEscape(): void { $string = "<em>répété</em>"; $escaped = Html::escape($string); $this->assertSame('<em>répét&eacute;</em>', $escaped); @@ -332,7 +332,7 @@ class HtmlTest extends TestCase { * * @covers ::serialize */ - public function testSerialize() { + public function testSerialize(): void { $document = new \DOMDocument(); $result = Html::serialize($document); $this->assertSame('', $result); @@ -342,7 +342,7 @@ class HtmlTest extends TestCase { * @covers ::transformRootRelativeUrlsToAbsolute * @dataProvider providerTestTransformRootRelativeUrlsToAbsolute */ - public function testTransformRootRelativeUrlsToAbsolute($html, $scheme_and_host, $expected_html) { + public function testTransformRootRelativeUrlsToAbsolute($html, $scheme_and_host, $expected_html): void { $this->assertSame($expected_html ?: $html, Html::transformRootRelativeUrlsToAbsolute($html, $scheme_and_host)); } @@ -350,7 +350,7 @@ class HtmlTest extends TestCase { * @covers ::transformRootRelativeUrlsToAbsolute * @dataProvider providerTestTransformRootRelativeUrlsToAbsoluteAssertion */ - public function testTransformRootRelativeUrlsToAbsoluteAssertion($scheme_and_host) { + public function testTransformRootRelativeUrlsToAbsoluteAssertion($scheme_and_host): void { $this->expectException(\AssertionError::class); Html::transformRootRelativeUrlsToAbsolute('', $scheme_and_host); } diff --git a/core/tests/Drupal/Tests/Component/Utility/ImageTest.php b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php index c41af317910..7d179e3145b 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ImageTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php @@ -18,7 +18,7 @@ class ImageTest extends TestCase { * * @dataProvider providerTestScaleDimensions */ - public function testScaleDimensions($input, $output) { + public function testScaleDimensions($input, $output): void { // Process the test dataset. $return_value = Image::scaleDimensions($input['dimensions'], $input['width'], $input['height'], $input['upscale']); diff --git a/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php index a48d5bab73f..7a43bda8882 100644 --- a/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php @@ -47,7 +47,7 @@ class NestedArrayTest extends TestCase { * * @covers ::getValue */ - public function testGetValue() { + public function testGetValue(): void { // Verify getting a value of a nested element. $value = NestedArray::getValue($this->form, $this->parents); $this->assertSame('Nested element', $value['#value'], 'Nested element value found.'); @@ -77,7 +77,7 @@ class NestedArrayTest extends TestCase { * * @covers ::setValue */ - public function testSetValue() { + public function testSetValue(): void { $new_value = [ '#value' => 'New value', '#required' => TRUE, @@ -98,7 +98,7 @@ class NestedArrayTest extends TestCase { * * @covers ::setValue */ - public function testSetValueForce() { + public function testSetValueForce(): void { $new_value = [ 'one', ]; @@ -113,7 +113,7 @@ class NestedArrayTest extends TestCase { * * @covers ::unsetValue */ - public function testUnsetValue() { + public function testUnsetValue(): void { // Verify unsetting a non-existing nested element throws no errors and the // non-existing key is properly reported. $key_existed = NULL; @@ -133,7 +133,7 @@ class NestedArrayTest extends TestCase { /** * Tests existence of array key. */ - public function testKeyExists() { + public function testKeyExists(): void { // Verify that existing key is found. $this->assertTrue(NestedArray::keyExists($this->form, $this->parents), 'Nested key found.'); @@ -149,7 +149,7 @@ class NestedArrayTest extends TestCase { * @covers ::mergeDeep * @covers ::mergeDeepArray */ - public function testMergeDeepArray() { + public function testMergeDeepArray(): void { $link_options_1 = [ 'fragment' => 'x', 'attributes' => ['title' => 'X', 'class' => ['a', 'b']], @@ -176,7 +176,7 @@ class NestedArrayTest extends TestCase { * * @covers ::mergeDeepArray */ - public function testMergeImplicitKeys() { + public function testMergeImplicitKeys(): void { $a = [ 'subkey' => ['X', 'Y'], ]; @@ -197,7 +197,7 @@ class NestedArrayTest extends TestCase { * * @covers ::mergeDeepArray */ - public function testMergeExplicitKeys() { + public function testMergeExplicitKeys(): void { $a = [ 'subkey' => [ 0 => 'A', @@ -233,7 +233,7 @@ class NestedArrayTest extends TestCase { * * @covers ::mergeDeepArray */ - public function testMergeOutOfSequenceKeys() { + public function testMergeOutOfSequenceKeys(): void { $a = [ 'subkey' => [ 10 => 'A', @@ -264,7 +264,7 @@ class NestedArrayTest extends TestCase { * @covers ::filter * @dataProvider providerTestFilter */ - public function testFilter($array, $callable, $expected) { + public function testFilter($array, $callable, $expected): void { $this->assertEquals($expected, NestedArray::filter($array, $callable)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php index 3e06711db90..17482990004 100644 --- a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php @@ -31,7 +31,7 @@ class NumberTest extends TestCase { * @param bool $expected * Expected return value from Number::validStep(). */ - public function testValidStep($value, $step, $expected) { + public function testValidStep($value, $step, $expected): void { $return = Number::validStep($value, $step); $this->assertEquals($expected, $return); } @@ -51,7 +51,7 @@ class NumberTest extends TestCase { * @param bool $expected * Expected return value from Number::validStep(). */ - public function testValidStepOffset($value, $step, $offset, $expected) { + public function testValidStepOffset($value, $step, $offset, $expected): void { $return = Number::validStep($value, $step, $offset); $this->assertEquals($expected, $return); } @@ -130,7 +130,7 @@ class NumberTest extends TestCase { * @param string $expected * The expected alphadecimal value. */ - public function testConversions($value, $expected) { + public function testConversions($value, $expected): void { $this->assertSame(Number::intToAlphadecimal($value), $expected); $this->assertSame($value, Number::alphadecimalToInt($expected)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php index fde2dbbb824..0f34c21d17b 100644 --- a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php @@ -30,7 +30,7 @@ class RandomTest extends TestCase { * * @covers ::string */ - public function testRandomStringUniqueness() { + public function testRandomStringUniqueness(): void { $strings = []; $random = new Random(); for ($i = 0; $i <= 50; $i++) { @@ -45,7 +45,7 @@ class RandomTest extends TestCase { * * @covers ::name */ - public function testRandomNamesUniqueness() { + public function testRandomNamesUniqueness(): void { $names = []; $random = new Random(); for ($i = 0; $i <= 10; $i++) { @@ -60,7 +60,7 @@ class RandomTest extends TestCase { * * @covers ::name */ - public function testRandomNameException() { + public function testRandomNameException(): void { // There are fewer than 100 possibilities so an exception should occur to // prevent infinite loops. $random = new Random(); @@ -76,7 +76,7 @@ class RandomTest extends TestCase { * * @covers ::string */ - public function testRandomStringException() { + public function testRandomStringException(): void { // There are fewer than 100 possibilities so an exception should occur to // prevent infinite loops. $random = new Random(); @@ -92,7 +92,7 @@ class RandomTest extends TestCase { * * @covers ::name */ - public function testRandomNameNonUnique() { + public function testRandomNameNonUnique(): void { // There are fewer than 100 possibilities if we were forcing uniqueness so // exception would occur. $random = new Random(); @@ -107,7 +107,7 @@ class RandomTest extends TestCase { * * @covers ::string */ - public function testRandomStringNonUnique() { + public function testRandomStringNonUnique(): void { // There are fewer than 100 possibilities if we were forcing uniqueness so // exception would occur. $random = new Random(); @@ -167,7 +167,7 @@ class RandomTest extends TestCase { * * @covers ::object */ - public function testRandomObject() { + public function testRandomObject(): void { // For values of 0 and 1 \Drupal\Component\Utility\Random::object() will // have different execution paths. $random = new Random(); @@ -182,7 +182,7 @@ class RandomTest extends TestCase { * * @covers ::string */ - public function testRandomStringValidator() { + public function testRandomStringValidator(): void { $random = new Random(); $this->firstStringGenerated = ''; $str = $random->string(1, TRUE, [$this, '_RandomStringValidate']); @@ -194,7 +194,7 @@ class RandomTest extends TestCase { * * @covers ::word */ - public function testRandomWordValidator() { + public function testRandomWordValidator(): void { $random = new Random(); $this->assertNotEquals($random->word(20), $random->word(20)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php index 79d42ff079d..f7a77f6e7db 100644 --- a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php @@ -18,7 +18,7 @@ class RectangleTest extends TestCase { * * @covers ::rotate */ - public function testWrongWidth() { + public function testWrongWidth(): void { $this->expectException(\InvalidArgumentException::class); $rect = new Rectangle(-40, 20); } @@ -28,7 +28,7 @@ class RectangleTest extends TestCase { * * @covers ::rotate */ - public function testWrongHeight() { + public function testWrongHeight(): void { $this->expectException(\InvalidArgumentException::class); $rect = new Rectangle(40, 0); } @@ -53,7 +53,7 @@ class RectangleTest extends TestCase { * * @dataProvider providerPhp55RotateDimensions */ - public function testRotateDimensions($width, $height, $angle, $exp_width, $exp_height) { + public function testRotateDimensions($width, $height, $angle, $exp_width, $exp_height): void { $rect = new Rectangle($width, $height); $rect->rotate($angle); $this->assertEquals($exp_width, $rect->getBoundingWidth()); diff --git a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php index 1b15c34f331..c1ea6045939 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php @@ -22,7 +22,7 @@ class ReflectionTest extends TestCase { * @covers ::getParameterClassName * @dataProvider providerGetParameterClassName */ - public function testGetParameterClassName(?string $expected, \ReflectionParameter $parameter) { + public function testGetParameterClassName(?string $expected, \ReflectionParameter $parameter): void { $this->assertEquals($expected, Reflection::getParameterClassName($parameter)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php index f23aaf4bd87..ceeefe20fe9 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php @@ -30,7 +30,7 @@ class SortArrayTest extends TestCase { * @param int $expected * The expected output from calling the method. */ - public function testSortByWeightElement($a, $b, $expected) { + public function testSortByWeightElement($a, $b, $expected): void { $result = SortArray::sortByWeightElement($a, $b); $this->assertBothNegativePositiveOrZero($expected, $result); } @@ -106,7 +106,7 @@ class SortArrayTest extends TestCase { * @param int $expected * The expected output from calling the method. */ - public function testSortByWeightProperty($a, $b, $expected) { + public function testSortByWeightProperty($a, $b, $expected): void { $result = SortArray::sortByWeightProperty($a, $b); $this->assertBothNegativePositiveOrZero($expected, $result); } @@ -182,7 +182,7 @@ class SortArrayTest extends TestCase { * @param int $expected * The expected output from calling the method. */ - public function testSortByTitleElement($a, $b, $expected) { + public function testSortByTitleElement($a, $b, $expected): void { $result = SortArray::sortByTitleElement($a, $b); $this->assertBothNegativePositiveOrZero($expected, $result); } @@ -251,7 +251,7 @@ class SortArrayTest extends TestCase { * @param int $expected * The expected output from calling the method. */ - public function testSortByTitleProperty($a, $b, $expected) { + public function testSortByTitleProperty($a, $b, $expected): void { $result = SortArray::sortByTitleProperty($a, $b); $this->assertBothNegativePositiveOrZero($expected, $result); } diff --git a/core/tests/Drupal/Tests/Component/Utility/TimerTest.php b/core/tests/Drupal/Tests/Component/Utility/TimerTest.php index 3c12f9a19df..470ff1de13f 100644 --- a/core/tests/Drupal/Tests/Component/Utility/TimerTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/TimerTest.php @@ -23,7 +23,7 @@ class TimerTest extends TestCase { * @covers ::stop * @covers ::read */ - public function testTimer() { + public function testTimer(): void { Timer::start('test'); usleep(5000); $value = Timer::read('test'); diff --git a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php index 29130453278..99ee8ff7e52 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php @@ -24,7 +24,7 @@ class UnicodeTest extends TestCase { * @dataProvider providerUcfirst * @covers ::ucfirst */ - public function testUcfirst($text, $expected) { + public function testUcfirst($text, $expected): void { $this->assertEquals($expected, Unicode::ucfirst($text)); } @@ -55,7 +55,7 @@ class UnicodeTest extends TestCase { * @dataProvider providerLcfirst * @covers ::lcfirst */ - public function testLcfirst($text, $expected) { + public function testLcfirst($text, $expected): void { $this->assertEquals($expected, Unicode::lcfirst($text)); } @@ -86,7 +86,7 @@ class UnicodeTest extends TestCase { * @dataProvider providerUcwords * @covers ::ucwords */ - public function testUcwords($text, $expected) { + public function testUcwords($text, $expected): void { $this->assertEquals($expected, Unicode::ucwords($text)); } @@ -119,7 +119,7 @@ class UnicodeTest extends TestCase { * @dataProvider providerTruncate * @covers ::truncate */ - public function testTruncate($text, $max_length, $expected, $wordsafe = FALSE, $add_ellipsis = FALSE) { + public function testTruncate($text, $max_length, $expected, $wordsafe = FALSE, $add_ellipsis = FALSE): void { $this->assertEquals($expected, Unicode::truncate($text, $max_length, $wordsafe, $add_ellipsis)); } @@ -218,7 +218,7 @@ EOF; * @param string $expected * The expected return from Unicode::truncateBytes(). */ - public function testTruncateBytes($text, $max_length, $expected) { + public function testTruncateBytes($text, $max_length, $expected): void { $this->assertEquals($expected, Unicode::truncateBytes($text, $max_length), 'The string was not correctly truncated.'); } @@ -253,7 +253,7 @@ EOF; * @param string $message * The message to display on failure. */ - public function testValidateUtf8($text, $expected, $message) { + public function testValidateUtf8($text, $expected, $message): void { $this->assertEquals($expected, Unicode::validateUtf8($text), $message); } @@ -292,7 +292,7 @@ EOF; * @param string|bool $expected * The expected result. */ - public function testConvertToUtf8($data, $encoding, $expected) { + public function testConvertToUtf8($data, $encoding, $expected): void { $this->assertEquals($expected, Unicode::convertToUtf8($data, $encoding)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php index d7431155f80..4e3e6a84f56 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php @@ -42,7 +42,7 @@ class UrlHelperTest extends TestCase { * @param string $message * The assertion message. */ - public function testBuildQuery($query, $expected, $message) { + public function testBuildQuery($query, $expected, $message): void { $this->assertEquals(UrlHelper::buildQuery($query), $expected, $message); } @@ -112,7 +112,7 @@ class UrlHelperTest extends TestCase { /** * Tests that we get the same thing out that we put in. */ - public function testCompressUncompress() { + public function testCompressUncompress(): void { $data = []; while (count($data) < 30) { $data[] = 'drupal/drupal' . count($data); @@ -127,7 +127,7 @@ class UrlHelperTest extends TestCase { /** * Tests passing an invalid string as a compressed query parameter. */ - public function testUncompressInvalidString() { + public function testUncompressInvalidString(): void { // Pass an invalid string to ::uncompressQueryParameter() and ensure it // returns the passed string without resulting in a PHP warning. $this->assertSame('llama', UrlHelper::uncompressQueryParameter('llama')); @@ -230,7 +230,7 @@ class UrlHelperTest extends TestCase { * @param array $expected * An array containing query parameters. */ - public function testFilterQueryParameters($query, $exclude, $expected) { + public function testFilterQueryParameters($query, $exclude, $expected): void { $filtered = UrlHelper::filterQueryParameters($query, $exclude); $this->assertEquals($expected, $filtered, 'The query was not properly filtered.'); } @@ -268,7 +268,7 @@ class UrlHelperTest extends TestCase { * @param array $expected * Associative array with expected parameters. */ - public function testParse($url, $expected) { + public function testParse($url, $expected): void { $parsed = UrlHelper::parse($url); $this->assertEquals($expected, $parsed, 'The URL was not properly parsed.'); } @@ -390,7 +390,7 @@ class UrlHelperTest extends TestCase { * @param string $expected * The expected encoded path. */ - public function testEncodePath($path, $expected) { + public function testEncodePath($path, $expected): void { $encoded = UrlHelper::encodePath($path); $this->assertEquals($expected, $encoded); } @@ -418,7 +418,7 @@ class UrlHelperTest extends TestCase { * @param bool $expected * Expected result. */ - public function testIsExternal($path, $expected) { + public function testIsExternal($path, $expected): void { $isExternal = UrlHelper::isExternal($path); $this->assertEquals($expected, $isExternal); } @@ -480,7 +480,7 @@ class UrlHelperTest extends TestCase { * * @runInSeparateProcess */ - public function testFilterBadProtocol($uri, $expected, $protocols) { + public function testFilterBadProtocol($uri, $expected, $protocols): void { UrlHelper::setAllowedProtocols($protocols); $this->assertEquals($expected, UrlHelper::filterBadProtocol($uri)); // Multiple calls to UrlHelper::filterBadProtocol() do not cause double @@ -521,7 +521,7 @@ class UrlHelperTest extends TestCase { * * @runInSeparateProcess */ - public function testStripDangerousProtocols($uri, $expected, $protocols) { + public function testStripDangerousProtocols($uri, $expected, $protocols): void { UrlHelper::setAllowedProtocols($protocols); $stripped = UrlHelper::stripDangerousProtocols($uri); $this->assertEquals($expected, $stripped); @@ -598,7 +598,7 @@ class UrlHelperTest extends TestCase { * @covers ::externalIsLocal * @dataProvider providerTestExternalIsLocal */ - public function testExternalIsLocal($url, $base_url, $expected) { + public function testExternalIsLocal($url, $base_url, $expected): void { $this->assertSame($expected, UrlHelper::externalIsLocal($url, $base_url)); } @@ -650,7 +650,7 @@ class UrlHelperTest extends TestCase { * @covers ::externalIsLocal * @dataProvider providerTestExternalIsLocalInvalid */ - public function testExternalIsLocalInvalid($url, $base_url) { + public function testExternalIsLocalInvalid($url, $base_url): void { $this->expectException(\InvalidArgumentException::class); UrlHelper::externalIsLocal($url, $base_url); } diff --git a/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php b/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php index f0ee35429a6..b14d4327379 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php @@ -74,7 +74,7 @@ class UserAgentTest extends TestCase { * @dataProvider providerTestGetBestMatchingLangcode * @covers ::getBestMatchingLangcode */ - public function testGetBestMatchingLangcode($accept_language, $expected) { + public function testGetBestMatchingLangcode($accept_language, $expected): void { $result = UserAgent::getBestMatchingLangcode($accept_language, $this->getLanguages(), $this->getMappings()); $this->assertSame($expected, $result); } diff --git a/core/tests/Drupal/Tests/Component/Utility/VariableTest.php b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php index 0df91d37e95..16756235cfe 100644 --- a/core/tests/Drupal/Tests/Component/Utility/VariableTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php @@ -174,7 +174,7 @@ class VariableTest extends TestCase { * @param mixed $variable * The variable to be exported. */ - public function testExport($expected, $variable) { + public function testExport($expected, $variable): void { $this->assertEquals($expected, Variable::export($variable)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php index e25dd3e5dfc..15b1f038434 100644 --- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php @@ -68,7 +68,7 @@ class XssTest extends TestCase { * * @dataProvider providerTestFilterXssNormalized */ - public function testFilterXssNormalized($value, $expected, $message, ?array $allowed_tags = NULL) { + public function testFilterXssNormalized($value, $expected, $message, ?array $allowed_tags = NULL): void { if ($allowed_tags === NULL) { $value = Xss::filter($value); } @@ -135,7 +135,7 @@ class XssTest extends TestCase { * * @dataProvider providerTestFilterXssNotNormalized */ - public function testFilterXssNotNormalized($value, $expected, $message, ?array $allowed_tags = NULL) { + public function testFilterXssNotNormalized($value, $expected, $message, ?array $allowed_tags = NULL): void { if ($allowed_tags === NULL) { $value = Xss::filter($value); } @@ -448,7 +448,7 @@ class XssTest extends TestCase { * * @dataProvider providerTestInvalidMultiByte */ - public function testInvalidMultiByte($value, $expected, $message) { + public function testInvalidMultiByte($value, $expected, $message): void { $this->assertEquals(Xss::filter($value), $expected, $message); } @@ -474,7 +474,7 @@ class XssTest extends TestCase { /** * Checks that strings starting with a question sign are correctly processed. */ - public function testQuestionSign() { + public function testQuestionSign(): void { $value = Xss::filter('<?xml:namespace ns="urn:schemas-microsoft-com:time">'); $this->assertStringNotContainsStringIgnoringCase('<?xml', $value, 'HTML tag stripping evasion -- starting with a question sign (processing instructions).'); } @@ -485,7 +485,7 @@ class XssTest extends TestCase { * @covers ::attributes * @dataProvider providerTestAttributes */ - public function testAttribute($value, $expected, $message, $allowed_tags = NULL) { + public function testAttribute($value, $expected, $message, $allowed_tags = NULL): void { $value = Xss::filter($value, $allowed_tags); $this->assertEquals($expected, $value, $message); } @@ -567,7 +567,7 @@ class XssTest extends TestCase { /** * Checks that \Drupal\Component\Utility\Xss::filterAdmin() correctly strips disallowed tags. */ - public function testFilterXSSAdmin() { + public function testFilterXSSAdmin(): void { $value = Xss::filterAdmin('<style /><iframe /><frame /><frameset /><meta /><link /><embed /><applet /><param /><layer />'); $this->assertEquals('', $value, 'Admin HTML filter -- should never allow some tags.'); } @@ -584,7 +584,7 @@ class XssTest extends TestCase { * * @dataProvider providerTestFilterXssAdminNotNormalized */ - public function testFilterXssAdminNotNormalized($value, $expected, $message) { + public function testFilterXssAdminNotNormalized($value, $expected, $message): void { $this->assertNotNormalized(Xss::filterAdmin($value), $expected, $message); } @@ -612,7 +612,7 @@ class XssTest extends TestCase { * * @see \Drupal\Component\Utility\HtmlSerializerRules */ - public function testFilterNormalizedHtml5() { + public function testFilterNormalizedHtml5(): void { $input = '<span data-caption="foo <em>bar</em>"></span>'; $this->assertEquals($input, Xss::filter(Html::normalize($input), ['span'])); } diff --git a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php index 77a5ed1fb96..a0c2dd8b9cd 100644 --- a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php +++ b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php @@ -23,7 +23,7 @@ class UuidTest extends TestCase { * * @dataProvider providerUuidInstances */ - public function testGenerateUuid(UuidInterface $instance) { + public function testGenerateUuid(UuidInterface $instance): void { $this->assertTrue(Uuid::isValid($instance->generate()), sprintf('UUID generation for %s works.', get_class($instance))); } @@ -32,7 +32,7 @@ class UuidTest extends TestCase { * * @dataProvider providerUuidInstances */ - public function testUuidIsUnique(UuidInterface $instance) { + public function testUuidIsUnique(UuidInterface $instance): void { $this->assertNotEquals($instance->generate(), $instance->generate(), sprintf('Same UUID was not generated twice with %s.', get_class($instance))); } @@ -71,7 +71,7 @@ class UuidTest extends TestCase { * * @dataProvider providerTestValidation */ - public function testValidation($uuid, $is_valid, $message) { + public function testValidation($uuid, $is_valid, $message): void { $this->assertSame($is_valid, Uuid::isValid($uuid), $message); } diff --git a/core/tests/Drupal/Tests/Composer/ComposerTest.php b/core/tests/Drupal/Tests/Composer/ComposerTest.php index 552f25c2166..47084472880 100644 --- a/core/tests/Drupal/Tests/Composer/ComposerTest.php +++ b/core/tests/Drupal/Tests/Composer/ComposerTest.php @@ -18,7 +18,7 @@ class ComposerTest extends UnitTestCase { * * @covers ::ensureComposerVersion */ - public function testEnsureComposerVersion() { + public function testEnsureComposerVersion(): void { try { $this->assertNull(Composer::ensureComposerVersion()); } @@ -33,7 +33,7 @@ class ComposerTest extends UnitTestCase { * Also ensure that the minimum php version in the root-level composer.json * file exactly matches \Drupal::MINIMUM_PHP. */ - public function testEnsurePhpConfiguredVersion() { + public function testEnsurePhpConfiguredVersion(): void { $composer_json = json_decode(file_get_contents($this->root . '/composer.json'), TRUE); $composer_core_json = json_decode(file_get_contents($this->root . '/core/composer.json'), TRUE); $this->assertEquals(\Drupal::MINIMUM_PHP, $composer_json['config']['platform']['php'], 'The \Drupal::MINIMUM_PHP constant should always be exactly the same as the config.platform.php in the root composer.json.'); diff --git a/core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php b/core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php index a41153b4ee8..4c85ec8f114 100644 --- a/core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php +++ b/core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php @@ -88,7 +88,7 @@ class BuilderTest extends TestCase { * * @dataProvider builderTestData */ - public function testBuilder($builderClass, $expected) { + public function testBuilder($builderClass, $expected): void { $fixtures = new Fixtures(); $drupalCoreInfo = $fixtures->drupalCoreComposerFixture(); diff --git a/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php b/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php index dcadfe9989c..5a9df6df8f7 100644 --- a/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php +++ b/core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php @@ -55,7 +55,7 @@ class MetapackageUpdateTest extends TestCase { * * @dataProvider updatedTestData */ - public function testUpdated($builderClass, $path) { + public function testUpdated($builderClass, $path): void { // Create a DrupalCoreComposer for the System Under Test (current repo) $repositoryRoot = dirname(__DIR__, 6); $drupalCoreInfo = DrupalCoreComposer::createFromPath($repositoryRoot); diff --git a/core/tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php b/core/tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php index 2b0305f9850..503a78b1fc3 100644 --- a/core/tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php +++ b/core/tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php @@ -35,7 +35,7 @@ class OverlapWithTopLevelDependenciesTest extends TestCase { * @param string $template_project_path * The path of the project template to test. */ - public function testOverlapWithTemplateProject($template_project_path) { + public function testOverlapWithTemplateProject($template_project_path): void { $root = dirname(__DIR__, 6); // Read template project composer.json. $top_level_composer_json = json_decode(file_get_contents("$root/$template_project_path/composer.json"), TRUE); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php b/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php index 8949cf51cd7..4c52c5600fb 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php @@ -59,7 +59,7 @@ class ConfigTest extends TestCase { * @dataProvider provideGetMessageText * @covers ::getText */ - public function testGetMessageText($expected, $config) { + public function testGetMessageText($expected, $config): void { // Root package has our config. $root = $this->createMock(RootPackageInterface::class); $root->expects($this->once()) @@ -74,7 +74,7 @@ class ConfigTest extends TestCase { /** * @covers ::getText */ - public function testDefaultFile() { + public function testDefaultFile(): void { // Root package has no extra field. $root = $this->createMock(RootPackageInterface::class); $root->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php index dda93939b66..7c7a10909c1 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php @@ -77,7 +77,7 @@ class ComposerHookTest extends BuildTestBase { /** * Tests to see if scaffold operation runs at the correct times. */ - public function testComposerHooks() { + public function testComposerHooks(): void { $topLevelProjectDir = 'composer-hooks-fixture'; $sut = $this->fixturesDir . '/' . $topLevelProjectDir; // First test: run composer install. This is the same as composer update @@ -126,7 +126,7 @@ class ComposerHookTest extends BuildTestBase { /** * Tests to see if scaffold messages are omitted when running scaffold twice. */ - public function testScaffoldMessagesDoNotPrintTwice() { + public function testScaffoldMessagesDoNotPrintTwice(): void { $topLevelProjectDir = 'drupal-drupal'; $sut = $this->fixturesDir . '/' . $topLevelProjectDir; // First test: run composer install. This is the same as composer update diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php index e61a716ff8b..634b4018c59 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php @@ -102,7 +102,7 @@ class ManageGitIgnoreTest extends TestCase { /** * Tests scaffold command correctly manages the .gitignore file. */ - public function testManageGitIgnore() { + public function testManageGitIgnore(): void { // Note that the drupal-composer-drupal-project fixture does not // have any configuration settings related to .gitignore management. $sut = $this->createSutWithGit('drupal-composer-drupal-project'); @@ -146,7 +146,7 @@ EOT; /** * Tests scaffold command does not manage the .gitignore file when disabled. */ - public function testUnmanagedGitIgnoreWhenDisabled() { + public function testUnmanagedGitIgnoreWhenDisabled(): void { // Note that the drupal-drupal fixture has a configuration setting // `"gitignore": false,` which disables .gitignore file handling. $sut = $this->createSutWithGit('drupal-drupal'); @@ -167,7 +167,7 @@ EOT; * .gitignore files, then we expect that the unmanaged file should not be * added to the .gitignore file, because unmanaged files should be committed. */ - public function testAppendToEmptySettingsIsUnmanaged() { + public function testAppendToEmptySettingsIsUnmanaged(): void { $sut = $this->createSutWithGit('drupal-drupal-append-settings'); $this->assertFileDoesNotExist($sut . '/autoload.php'); $this->assertFileDoesNotExist($sut . '/index.php'); @@ -187,7 +187,7 @@ EOT; * The scaffold operation should still succeed if there is no 'git' * executable. */ - public function testUnmanagedGitIgnoreWhenGitNotAvailable() { + public function testUnmanagedGitIgnoreWhenGitNotAvailable(): void { // Note that the drupal-composer-drupal-project fixture does not have any // configuration settings related to .gitignore management. $sut = $this->createSutWithGit('drupal-composer-drupal-project'); 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 012cc4590c4..951bca66264 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php @@ -170,7 +170,7 @@ class ScaffoldTest extends TestCase { * * @dataProvider scaffoldExpectedExceptionTestValues */ - public function testScaffoldWithExpectedException($fixture_name, $expected_exception_message, $is_link) { + public function testScaffoldWithExpectedException($fixture_name, $expected_exception_message, $is_link): void { // Test scaffold. Expect an error. $this->expectException(\Exception::class); $this->expectExceptionMessage($expected_exception_message); @@ -180,7 +180,7 @@ class ScaffoldTest extends TestCase { /** * Try to scaffold a project that does not scaffold anything. */ - public function testEmptyProject() { + public function testEmptyProject(): void { $fixture_name = 'empty-fixture'; $result = $this->scaffoldSut($fixture_name, FALSE, FALSE); @@ -190,7 +190,7 @@ class ScaffoldTest extends TestCase { /** * Try to scaffold a project that allows a project with no scaffold files. */ - public function testProjectThatScaffoldsEmptyProject() { + public function testProjectThatScaffoldsEmptyProject(): void { $fixture_name = 'project-allowing-empty-fixture'; $result = $this->scaffoldSut($fixture_name, FALSE, FALSE); $this->assertStringContainsString('The allowed package fixtures/empty-fixture does not provide a file mapping for Composer Scaffold', $result->scaffoldOutput()); @@ -227,7 +227,7 @@ class ScaffoldTest extends TestCase { * * @dataProvider scaffoldOverridingSettingsExcludingHtaccessValues */ - public function testScaffoldOverridingSettingsExcludingHtaccess($fixture_name, $is_link, $relocated_docroot) { + public function testScaffoldOverridingSettingsExcludingHtaccess($fixture_name, $is_link, $relocated_docroot): void { $result = $this->scaffoldSut($fixture_name, $is_link, $relocated_docroot); $this->assertCommonDrupalAssetsWereScaffolded($result->docroot(), $is_link); @@ -243,7 +243,7 @@ class ScaffoldTest extends TestCase { * replaced, and that files that were not supposed to be replaced remain * unchanged. */ - public function testDrupalDrupalFileWasReplaced() { + public function testDrupalDrupalFileWasReplaced(): void { $fixture_name = 'drupal-drupal-test-overwrite'; $result = $this->scaffoldSut($fixture_name, FALSE, FALSE); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php index c9f34d95516..f0c687bc439 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php @@ -53,7 +53,7 @@ class ScaffoldUpgradeTest extends TestCase { /** * Tests upgrading the Composer Scaffold plugin. */ - public function testScaffoldUpgrade() { + public function testScaffoldUpgrade(): void { $composerVersionLine = exec('composer --version'); if (str_contains($composerVersionLine, 'Composer version 2')) { $this->markTestSkipped('We cannot run the scaffold upgrade test with Composer 2 until we have a stable version of drupal/core-composer-scaffold to start from that we can install with Composer 2.x.'); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php index 3cce05475a4..1363cb351b1 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php @@ -19,7 +19,7 @@ class AppendOpTest extends TestCase { /** * @covers ::process */ - public function testProcess() { + public function testProcess(): void { $fixtures = new Fixtures(); $destination = $fixtures->destinationPath('[web-root]/robots.txt'); $options = ScaffoldOptions::create([]); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php index a781d5b9c66..27053fe0eed 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php @@ -19,7 +19,7 @@ class ReplaceOpTest extends TestCase { /** * @covers ::process */ - public function testProcess() { + public function testProcess(): void { $fixtures = new Fixtures(); $destination = $fixtures->destinationPath('[web-root]/robots.txt'); $source = $fixtures->sourcePath('drupal-assets-fixture', 'robots.txt'); @@ -42,7 +42,7 @@ class ReplaceOpTest extends TestCase { /** * @covers ::process */ - public function testEmptyFile() { + public function testEmptyFile(): void { $fixtures = new Fixtures(); $destination = $fixtures->destinationPath('[web-root]/empty_file.txt'); $source = $fixtures->sourcePath('empty-file', 'empty_file.txt'); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ScaffoldFileCollectionTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ScaffoldFileCollectionTest.php index 2741a77d338..05e89463c02 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ScaffoldFileCollectionTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ScaffoldFileCollectionTest.php @@ -20,7 +20,7 @@ class ScaffoldFileCollectionTest extends TestCase { /** * @covers ::__construct */ - public function testCreate() { + public function testCreate(): void { $fixtures = new Fixtures(); $locationReplacements = $fixtures->getLocationReplacements(); $scaffold_file_fixtures = [ diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php index 5a13e34918a..ee5d3a566a1 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php @@ -19,7 +19,7 @@ class SkipOpTest extends TestCase { /** * @covers ::process */ - public function testProcess() { + public function testProcess(): void { $fixtures = new Fixtures(); $destination = $fixtures->destinationPath('[web-root]/robots.txt'); $options = ScaffoldOptions::create([]); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php index 66f28d2ed5e..77ceffae7ef 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php @@ -17,7 +17,7 @@ class ConfigTest extends TestCase { /** * @covers ::getPathsForPackage */ - public function testGetPathsForPackageMixedCase() { + public function testGetPathsForPackageMixedCase(): void { $config = $this->getMockBuilder(Config::class) ->onlyMethods(['getAllCleanupPaths']) ->disableOriginalConstructor() @@ -33,7 +33,7 @@ class ConfigTest extends TestCase { /** * @covers ::getAllCleanupPaths */ - public function testNoRootMergeConfig() { + public function testNoRootMergeConfig(): void { // Root package has no extra field. $root = $this->createMock(RootPackageInterface::class); $root->expects($this->once()) @@ -54,7 +54,7 @@ class ConfigTest extends TestCase { /** * @covers ::getAllCleanupPaths */ - public function testRootMergeConfig() { + public function testRootMergeConfig(): void { // Root package has configuration in extra. $root = $this->createMock(RootPackageInterface::class); $root->expects($this->once()) @@ -81,7 +81,7 @@ class ConfigTest extends TestCase { * * @runInSeparateProcess */ - public function testMixedCaseConfigCleanupPackages() { + public function testMixedCaseConfigCleanupPackages(): void { // Root package has configuration in extra. $root = $this->createMock(RootPackageInterface::class); $root->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php index 29c935fe144..7df0fc60129 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php @@ -42,7 +42,7 @@ class VendorHardeningPluginTest extends TestCase { /** * @covers ::cleanPackage */ - public function testCleanPackage() { + public function testCleanPackage(): void { $config = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() @@ -78,7 +78,7 @@ class VendorHardeningPluginTest extends TestCase { /** * @covers ::cleanPathsForPackage */ - public function testCleanPathsForPackage() { + public function testCleanPathsForPackage(): void { $plugin = $this->getMockBuilder(VendorHardeningPlugin::class) ->onlyMethods(['getInstallPathForPackage']) ->getMock(); @@ -106,7 +106,7 @@ class VendorHardeningPluginTest extends TestCase { /** * @covers ::cleanAllPackages */ - public function testCleanAllPackages() { + public function testCleanAllPackages(): void { $config = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock(); @@ -146,7 +146,7 @@ class VendorHardeningPluginTest extends TestCase { /** * @covers ::writeAccessRestrictionFiles */ - public function testWriteAccessRestrictionFiles() { + public function testWriteAccessRestrictionFiles(): void { $dir = vfsStream::url('vendor'); // Set up mocks so that writeAccessRestrictionFiles() can eventually use @@ -219,7 +219,7 @@ class VendorHardeningPluginTest extends TestCase { * @covers ::findBinOverlap * @dataProvider providerFindBinOverlap */ - public function testFindBinOverlap($expected, $binaries, $clean_paths) { + public function testFindBinOverlap($expected, $binaries, $clean_paths): void { $plugin = $this->getMockBuilder(VendorHardeningPlugin::class) ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php index 3ea8d0ba8e6..f2dfe4bf73c 100644 --- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php +++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php @@ -25,7 +25,7 @@ class ComposerIntegrationTest extends UnitTestCase { * * @see https://www.drupal.org/about/core/policies/core-dependencies-policies/managing-composer-updates-for-drupal-core */ - public function testComposerLockHash() { + public function testComposerLockHash(): void { $content_hash = self::getContentHash(file_get_contents($this->root . '/composer.json')); $lock = json_decode(file_get_contents($this->root . '/composer.lock'), TRUE); $this->assertSame($content_hash, $lock['content-hash']); @@ -185,7 +185,7 @@ class ComposerIntegrationTest extends UnitTestCase { * * @dataProvider providerTestExpectedScaffoldFiles */ - public function testExpectedScaffoldFiles($destRelPath, $sourceRelPath, $expectedDestination = '[web-root]') { + public function testExpectedScaffoldFiles($destRelPath, $sourceRelPath, $expectedDestination = '[web-root]'): void { // Grab the 'file-mapping' section of the core composer.json file. $json = json_decode(file_get_contents($this->root . '/core/composer.json')); $scaffold_file_mapping = (array) $json->extra->{'drupal-scaffold'}->{'file-mapping'}; diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php index 248cbeac54f..20862c77e43 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php @@ -132,7 +132,7 @@ class AccessManagerTest extends UnitTestCase { /** * Tests \Drupal\Core\Access\AccessManager::setChecks(). */ - public function testSetChecks() { + public function testSetChecks(): void { // Check setChecks without any access checker defined yet. $this->checkProvider->setChecks($this->routeCollection); @@ -152,7 +152,7 @@ class AccessManagerTest extends UnitTestCase { /** * Tests setChecks with a dynamic access checker. */ - public function testSetChecksWithDynamicAccessChecker() { + public function testSetChecksWithDynamicAccessChecker(): void { // Setup the dynamic access checker. $access_check = $this->createMock('Drupal\Tests\Core\Access\TestAccessCheckInterface'); $this->container->set('test_access', $access_check); @@ -183,7 +183,7 @@ class AccessManagerTest extends UnitTestCase { /** * Tests \Drupal\Core\Access\AccessManager::check(). */ - public function testCheck() { + public function testCheck(): void { $route_matches = []; // Construct route match objects. @@ -225,7 +225,7 @@ class AccessManagerTest extends UnitTestCase { * * @covers ::check */ - public function testCheckWithNullAccount() { + public function testCheckWithNullAccount(): void { $this->setupAccessChecker(); $this->checkProvider->setChecks($this->routeCollection); @@ -299,7 +299,7 @@ class AccessManagerTest extends UnitTestCase { * * @dataProvider providerTestCheckConjunctions */ - public function testCheckConjunctions($name, $condition_one, $condition_two, $expected_access) { + public function testCheckConjunctions($name, $condition_one, $condition_two, $expected_access): void { $this->setupAccessChecker(); $this->container->register('test_access_defined', DefinedTestAccessCheck::class); $this->checkProvider->addCheckService('test_access_defined', 'access', ['_test_access']); @@ -326,7 +326,7 @@ class AccessManagerTest extends UnitTestCase { * * @see \Drupal\Core\Access\AccessManager::checkNamedRoute() */ - public function testCheckNamedRoute() { + public function testCheckNamedRoute(): void { $this->setupAccessChecker(); $this->checkProvider->setChecks($this->routeCollection); $this->setupAccessArgumentsResolverFactory(); @@ -350,7 +350,7 @@ class AccessManagerTest extends UnitTestCase { * * @see \Drupal\Core\Access\AccessManager::checkNamedRoute() */ - public function testCheckNamedRouteWithUpcastedValues() { + public function testCheckNamedRouteWithUpcastedValues(): void { $this->routeCollection = new RouteCollection(); $route = new Route('/test-route-1/{value}', [], ['_test_access' => 'TRUE']); $this->routeCollection->add('test_route_1', $route); @@ -398,7 +398,7 @@ class AccessManagerTest extends UnitTestCase { * * @covers ::checkNamedRoute */ - public function testCheckNamedRouteWithDefaultValue() { + public function testCheckNamedRouteWithDefaultValue(): void { $this->routeCollection = new RouteCollection(); $route = new Route('/test-route-1/{value}', ['value' => 'example'], ['_test_access' => 'TRUE']); $this->routeCollection->add('test_route_1', $route); @@ -444,7 +444,7 @@ class AccessManagerTest extends UnitTestCase { /** * Tests checkNamedRoute given an invalid/non existing route name. */ - public function testCheckNamedRouteWithNonExistingRoute() { + public function testCheckNamedRouteWithNonExistingRoute(): void { $this->routeProvider->expects($this->any()) ->method('getRouteByName') ->will($this->throwException(new RouteNotFoundException())); @@ -460,7 +460,7 @@ class AccessManagerTest extends UnitTestCase { * * @dataProvider providerCheckException */ - public function testCheckException($return_value) { + public function testCheckException($return_value): void { $route_provider = $this->createMock('Drupal\Core\Routing\RouteProviderInterface'); // Setup a test route for each access configuration. diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php index cdf7a8c99f6..1bedba8f7f2 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultForbiddenTest.php @@ -19,7 +19,7 @@ class AccessResultForbiddenTest extends UnitTestCase { * @covers ::__construct * @covers ::getReason */ - public function testConstruction() { + public function testConstruction(): void { $a = new AccessResultForbidden(); $this->assertEquals(NULL, $a->getReason()); @@ -34,7 +34,7 @@ class AccessResultForbiddenTest extends UnitTestCase { * * @covers ::setReason */ - public function testSetReason() { + public function testSetReason(): void { $a = new AccessResultForbidden(); $reason = $this->getRandomGenerator()->string(); diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php index 2a0c4f3bc2e..94fd5a73b24 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php @@ -19,7 +19,7 @@ class AccessResultNeutralTest extends UnitTestCase { * @covers ::__construct * @covers ::getReason */ - public function testConstruction() { + public function testConstruction(): void { $a = new AccessResultNeutral(); $this->assertEquals('', $a->getReason()); @@ -33,7 +33,7 @@ class AccessResultNeutralTest extends UnitTestCase { * * @covers ::setReason */ - public function testSetReason() { + public function testSetReason(): void { $a = new AccessResultNeutral(); $reason = $this->getRandomGenerator()->string(); diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index f61abb0f3f7..fad36f270dc 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -56,7 +56,7 @@ class AccessResultTest extends UnitTestCase { * * @covers ::neutral */ - public function testConstruction() { + public function testConstruction(): void { $verify = function (AccessResult $access) { $this->assertFalse($access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -81,7 +81,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::isForbidden * @covers ::isNeutral */ - public function testAccessAllowed() { + public function testAccessAllowed(): void { $verify = function (AccessResult $access) { $this->assertTrue($access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -100,7 +100,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::isForbidden * @covers ::isNeutral */ - public function testAccessForbidden() { + public function testAccessForbidden(): void { $verify = function (AccessResult $access) { $this->assertFalse($access->isAllowed()); $this->assertTrue($access->isForbidden()); @@ -116,7 +116,7 @@ class AccessResultTest extends UnitTestCase { /** * @covers ::forbidden */ - public function testAccessForbiddenReason() { + public function testAccessForbiddenReason(): void { $verify = function (AccessResult $access, $reason) { $this->assertInstanceOf(AccessResultReasonInterface::class, $access); $this->assertSame($reason, $access->getReason()); @@ -139,7 +139,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::isForbidden * @covers ::isNeutral */ - public function testAccessConditionallyAllowed() { + public function testAccessConditionallyAllowed(): void { $verify = function (AccessResult $access, $allowed) { $this->assertSame($allowed, $access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -159,7 +159,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::isForbidden * @covers ::isNeutral */ - public function testAccessConditionallyForbidden() { + public function testAccessConditionallyForbidden(): void { $verify = function (AccessResult $access, $forbidden) { $this->assertFalse($access->isAllowed()); $this->assertSame($forbidden, $access->isForbidden()); @@ -176,7 +176,7 @@ class AccessResultTest extends UnitTestCase { /** * @covers ::andIf */ - public function testAndIf() { + public function testAndIf(): void { $neutral = AccessResult::neutral('neutral message'); $allowed = AccessResult::allowed(); $forbidden = AccessResult::forbidden('forbidden message'); @@ -267,7 +267,7 @@ class AccessResultTest extends UnitTestCase { /** * @covers ::orIf */ - public function testOrIf() { + public function testOrIf(): void { $neutral = AccessResult::neutral('neutral message'); $neutral_other = AccessResult::neutral('other neutral message'); $neutral_reasonless = AccessResult::neutral(); @@ -385,7 +385,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::setCacheMaxAge * @covers ::getCacheMaxAge */ - public function testCacheMaxAge() { + public function testCacheMaxAge(): void { $this->assertSame(Cache::PERMANENT, AccessResult::neutral()->getCacheMaxAge()); $this->assertSame(1337, AccessResult::neutral()->setCacheMaxAge(1337)->getCacheMaxAge()); } @@ -398,7 +398,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::cachePerUser * @covers ::allowedIfHasPermission */ - public function testCacheContexts() { + public function testCacheContexts(): void { $verify = function (AccessResult $access, array $contexts) { $this->assertFalse($access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -474,7 +474,7 @@ class AccessResultTest extends UnitTestCase { * @covers ::getCacheTags * @covers ::resetCacheTags */ - public function testCacheTags() { + public function testCacheTags(): void { $verify = function (AccessResult $access, array $tags, array $contexts = [], $max_age = Cache::PERMANENT) { $this->assertFalse($access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -532,7 +532,7 @@ class AccessResultTest extends UnitTestCase { /** * @covers ::inheritCacheability */ - public function testInheritCacheability() { + public function testInheritCacheability(): void { // andIf(); 1st has defaults, 2nd has custom tags, contexts and max-age. $access = AccessResult::allowed(); $other = AccessResult::allowed()->setCacheMaxAge(1500)->cachePerPermissions()->addCacheTags(['node:20011988']); @@ -852,7 +852,7 @@ class AccessResultTest extends UnitTestCase { * * @dataProvider andOrCacheabilityPropagationProvider */ - public function testAndOrCacheabilityPropagation(AccessResultInterface $first, $op, AccessResultInterface $second, $implements_cacheable_dependency_interface, $is_cacheable) { + public function testAndOrCacheabilityPropagation(AccessResultInterface $first, $op, AccessResultInterface $second, $implements_cacheable_dependency_interface, $is_cacheable): void { if ($op === 'OR') { $result = $first->orIf($second); } @@ -884,7 +884,7 @@ class AccessResultTest extends UnitTestCase { * * @covers ::orIf */ - public function testOrIfCacheabilityMerging() { + public function testOrIfCacheabilityMerging(): void { $merge_both_directions = function (AccessResult $a, AccessResult $b) { // A globally cacheable access result. $a->setCacheMaxAge(3600); @@ -920,7 +920,7 @@ class AccessResultTest extends UnitTestCase { * @param \Drupal\Core\Access\AccessResult $expected_access * The expected access check result. */ - public function testAllowedIfHasPermissions($permissions, $conjunction, AccessResult $expected_access) { + public function testAllowedIfHasPermissions($permissions, $conjunction, AccessResult $expected_access): void { $account = $this->createMock('\Drupal\Core\Session\AccountInterface'); $account->expects($this->any()) ->method('hasPermission') diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php index b6678722ecc..34bb870ef48 100644 --- a/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Access/CsrfAccessCheckTest.php @@ -55,7 +55,7 @@ class CsrfAccessCheckTest extends UnitTestCase { /** * Tests the access() method with a valid token. */ - public function testAccessTokenPass() { + public function testAccessTokenPass(): void { $this->csrfToken->expects($this->once()) ->method('validate') ->with('test_query', 'test-path/42') @@ -74,7 +74,7 @@ class CsrfAccessCheckTest extends UnitTestCase { /** * @covers ::access */ - public function testCsrfTokenInvalid() { + public function testCsrfTokenInvalid(): void { $this->csrfToken->expects($this->once()) ->method('validate') ->with('test_query', 'test-path') @@ -93,7 +93,7 @@ class CsrfAccessCheckTest extends UnitTestCase { /** * @covers ::access */ - public function testCsrfTokenMissing() { + public function testCsrfTokenMissing(): void { $this->csrfToken->expects($this->once()) ->method('validate') ->with('', 'test-path') diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php index 011a8f2eba8..9282dc94d48 100644 --- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php @@ -82,7 +82,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * * @covers ::get */ - public function testGet() { + public function testGet(): void { $this->setupDefaultExpectations(); $this->assertIsString($this->generator->get()); @@ -95,7 +95,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * * @covers ::get */ - public function testGenerateSeedOnGet() { + public function testGenerateSeedOnGet(): void { $key = Crypt::randomBytesBase64(); $this->privateKey->expects($this->any()) ->method('get') @@ -117,7 +117,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * * @covers ::validate */ - public function testValidate() { + public function testValidate(): void { $this->setupDefaultExpectations(); $token = $this->generator->get(); @@ -139,7 +139,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * @covers ::validate * @dataProvider providerTestValidateParameterTypes */ - public function testValidateParameterTypes($token, $value) { + public function testValidateParameterTypes($token, $value): void { $this->setupDefaultExpectations(); // The following check might throw PHP fatal errors and notices, so we @@ -176,7 +176,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * @covers ::validate * @dataProvider providerTestInvalidParameterTypes */ - public function testInvalidParameterTypes($token, $value = '') { + public function testInvalidParameterTypes($token, $value = ''): void { $this->setupDefaultExpectations(); $this->expectException(\InvalidArgumentException::class); @@ -203,7 +203,7 @@ class CsrfTokenGeneratorTest extends UnitTestCase { * * @covers ::get */ - public function testGetWithNoHashSalt() { + public function testGetWithNoHashSalt(): void { // Update settings with no hash salt. new Settings([]); $generator = new CsrfTokenGenerator($this->privateKey, $this->sessionMetadata); diff --git a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php index c487ded7c97..f4de1af1046 100644 --- a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php @@ -54,7 +54,7 @@ class CustomAccessCheckTest extends UnitTestCase { /** * Tests the access method. */ - public function testAccess() { + public function testAccess(): void { $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $this->callableResolver @@ -111,7 +111,7 @@ class CustomAccessCheckTest extends UnitTestCase { /** * Tests the access method exception for invalid access callbacks. */ - public function testAccessException() { + public function testAccessException(): void { // Create callableResolver mock to return InvalidArgumentException. $this->callableResolver = $this->getMockBuilder(CallableResolver::class) ->disableOriginalConstructor() diff --git a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php index 372b3515984..58a90449265 100644 --- a/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php @@ -43,7 +43,7 @@ class DefaultAccessCheckTest extends UnitTestCase { /** * Tests the access method. */ - public function testAccess() { + public function testAccess(): void { $request = new Request([]); $route = new Route('/test-route', [], ['_access' => 'NULL']); diff --git a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php index 6e356b7f244..621d79557c0 100644 --- a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php +++ b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php @@ -46,7 +46,7 @@ class RouteProcessorCsrfTest extends UnitTestCase { /** * Tests the processOutbound() method with no _csrf_token route requirement. */ - public function testProcessOutboundNoRequirement() { + public function testProcessOutboundNoRequirement(): void { $this->csrfToken->expects($this->never()) ->method('get'); @@ -65,7 +65,7 @@ class RouteProcessorCsrfTest extends UnitTestCase { /** * Tests the processOutbound() method with a _csrf_token route requirement. */ - public function testProcessOutbound() { + public function testProcessOutbound(): void { $route = new Route('/test-path', [], ['_csrf_token' => 'TRUE']); $parameters = []; @@ -87,7 +87,7 @@ class RouteProcessorCsrfTest extends UnitTestCase { /** * Tests the processOutbound() method with a dynamic path and one replacement. */ - public function testProcessOutboundDynamicOne() { + public function testProcessOutboundDynamicOne(): void { $route = new Route('/test-path/{slug}', [], ['_csrf_token' => 'TRUE']); $parameters = ['slug' => 100]; @@ -106,7 +106,7 @@ class RouteProcessorCsrfTest extends UnitTestCase { /** * Tests the processOutbound() method with two parameter replacements. */ - public function testProcessOutboundDynamicTwo() { + public function testProcessOutboundDynamicTwo(): void { $route = new Route('{slug_1}/test-path/{slug_2}', [], ['_csrf_token' => 'TRUE']); $parameters = ['slug_1' => 100, 'slug_2' => 'test']; diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php index 276ce7955d7..58c37667be4 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php @@ -120,7 +120,7 @@ class AjaxCommandsTest extends UnitTestCase { * @covers \Drupal\Core\Ajax\AddCssCommand * @dataProvider providerCss */ - public function testAddCssCommand($css, $expected) { + public function testAddCssCommand($css, $expected): void { $command = new AddCssCommand($css); $this->assertEquals($expected, $command->render()); @@ -129,7 +129,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\AfterCommand */ - public function testAfterCommand() { + public function testAfterCommand(): void { $command = new AfterCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -146,7 +146,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\AlertCommand */ - public function testAlertCommand() { + public function testAlertCommand(): void { $command = new AlertCommand('Set condition 1 throughout the ship!'); $expected = [ 'command' => 'alert', @@ -161,7 +161,7 @@ class AjaxCommandsTest extends UnitTestCase { * * @dataProvider announceCommandProvider */ - public function testAnnounceCommand($message, $priority, array $expected) { + public function testAnnounceCommand($message, $priority, array $expected): void { if ($priority === NULL) { $command = new AnnounceCommand($message); } @@ -214,7 +214,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\AppendCommand */ - public function testAppendCommand() { + public function testAppendCommand(): void { $command = new AppendCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -231,7 +231,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\BeforeCommand */ - public function testBeforeCommand() { + public function testBeforeCommand(): void { $command = new BeforeCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -248,7 +248,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\ChangedCommand */ - public function testChangedCommand() { + public function testChangedCommand(): void { $command = new ChangedCommand('#page-title', '#page-title-changed'); $expected = [ @@ -263,7 +263,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\CssCommand */ - public function testCssCommand() { + public function testCssCommand(): void { $command = new CssCommand('#page-title', ['text-decoration' => 'blink']); $command->setProperty('font-size', '40px')->setProperty('font-weight', 'bold'); @@ -283,7 +283,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\DataCommand */ - public function testDataCommand() { + public function testDataCommand(): void { $command = new DataCommand('#page-title', 'my-data', ['key' => 'value']); $expected = [ @@ -299,7 +299,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\HtmlCommand */ - public function testHtmlCommand() { + public function testHtmlCommand(): void { $command = new HtmlCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -316,7 +316,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\InsertCommand */ - public function testInsertCommand() { + public function testInsertCommand(): void { $command = new InsertCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -333,7 +333,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\InvokeCommand */ - public function testInvokeCommand() { + public function testInvokeCommand(): void { $command = new InvokeCommand('#page-title', 'myMethod', ['var1', 'var2']); $expected = [ @@ -349,7 +349,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\PrependCommand */ - public function testPrependCommand() { + public function testPrependCommand(): void { $command = new PrependCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -366,7 +366,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\RemoveCommand */ - public function testRemoveCommand() { + public function testRemoveCommand(): void { $command = new RemoveCommand('#page-title'); $expected = [ @@ -380,7 +380,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\ReplaceCommand */ - public function testReplaceCommand() { + public function testReplaceCommand(): void { $command = new ReplaceCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']); $expected = [ @@ -397,7 +397,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\RestripeCommand */ - public function testRestripeCommand() { + public function testRestripeCommand(): void { $command = new RestripeCommand('#page-title'); $expected = [ @@ -411,7 +411,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\SettingsCommand */ - public function testSettingsCommand() { + public function testSettingsCommand(): void { $command = new SettingsCommand(['key' => 'value'], TRUE); $expected = [ @@ -426,7 +426,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\OpenDialogCommand */ - public function testOpenDialogCommand() { + public function testOpenDialogCommand(): void { $command = new OpenDialogCommand('#some-dialog', 'Title', '<p>Text!</p>', [ 'url' => FALSE, 'width' => 500, @@ -454,7 +454,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\OpenModalDialogCommand */ - public function testOpenModalDialogCommand() { + public function testOpenModalDialogCommand(): void { $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenModalDialogCommand') ->setConstructorArgs([ 'Title', '<p>Text!</p>', [ @@ -489,7 +489,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\CloseModalDialogCommand */ - public function testCloseModalDialogCommand() { + public function testCloseModalDialogCommand(): void { $command = new CloseModalDialogCommand(); $expected = [ 'command' => 'closeDialog', @@ -503,7 +503,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\CloseDialogCommand */ - public function testCloseDialogCommand() { + public function testCloseDialogCommand(): void { $command = new CloseDialogCommand('#some-dialog', TRUE); $expected = [ 'command' => 'closeDialog', @@ -517,7 +517,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\SetDialogOptionCommand */ - public function testSetDialogOptionCommand() { + public function testSetDialogOptionCommand(): void { $command = new SetDialogOptionCommand('#some-dialog', 'width', '500'); $expected = [ 'command' => 'setDialogOption', @@ -532,7 +532,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\SetDialogTitleCommand */ - public function testSetDialogTitleCommand() { + public function testSetDialogTitleCommand(): void { $command = new SetDialogTitleCommand('#some-dialog', 'Example'); $expected = [ 'command' => 'setDialogOption', @@ -547,7 +547,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\RedirectCommand */ - public function testRedirectCommand() { + public function testRedirectCommand(): void { $command = new RedirectCommand('http://example.com'); $expected = [ 'command' => 'redirect', @@ -560,7 +560,7 @@ class AjaxCommandsTest extends UnitTestCase { /** * @covers \Drupal\Core\Ajax\UpdateBuildIdCommand */ - public function testUpdateBuildIdCommand() { + public function testUpdateBuildIdCommand(): void { $old = 'ThisStringIsOld'; $new = 'ThisStringIsNew'; $command = new UpdateBuildIdCommand($old, $new); diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php index ac17d076509..ab5fce6d191 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php @@ -39,7 +39,7 @@ class AjaxResponseTest extends UnitTestCase { * @see \Drupal\Core\Ajax\AjaxResponse::addCommand() * @see \Drupal\Core\Ajax\AjaxResponse::getCommands() */ - public function testCommands() { + public function testCommands(): void { $command_one = $this->createMock('Drupal\Core\Ajax\CommandInterface'); $command_one->expects($this->once()) ->method('render') @@ -79,7 +79,7 @@ class AjaxResponseTest extends UnitTestCase { * * @cover ::prepareResponse */ - public function testPrepareResponseForIeFormRequestsWithFileUpload() { + public function testPrepareResponseForIeFormRequestsWithFileUpload(): void { $request = Request::create('/example', 'POST'); $request->headers->set('Accept', 'text/html'); $response = new AjaxResponse([]); diff --git a/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php b/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php index 1ad22f8905f..5065b543e9f 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php @@ -18,7 +18,7 @@ class OpenOffCanvasDialogCommandTest extends UnitTestCase { * * @dataProvider dialogPosition */ - public function testRender($position) { + public function testRender($position): void { $command = new OpenOffCanvasDialogCommand('Title', '<p>Text!</p>', ['url' => 'example'], NULL, $position); $expected = [ diff --git a/core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php b/core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php index 48ef5569271..9e8d98240bd 100644 --- a/core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php +++ b/core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php @@ -19,7 +19,7 @@ class PluralTranslationTest extends UnitTestCase { * * @dataProvider providerTestGet */ - public function testGet(array $values) { + public function testGet(array $values): void { $annotation = new PluralTranslation($values); $default_values = [ @@ -53,7 +53,7 @@ class PluralTranslationTest extends UnitTestCase { /** * @dataProvider providerTestMissingData */ - public function testMissingData($data) { + public function testMissingData($data): void { $this->expectException(\InvalidArgumentException::class); new PluralTranslation($data); } diff --git a/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php b/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php index 2a6e79aa48a..c8b355d72b8 100644 --- a/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php +++ b/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php @@ -36,7 +36,7 @@ class TranslationTest extends UnitTestCase { * * @dataProvider providerTestGet */ - public function testGet(array $values, $expected) { + public function testGet(array $values, $expected): void { $container = new ContainerBuilder(); $container->set('string_translation', $this->translationManager); \Drupal::setContainer($container); diff --git a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php index 9a23e5d7cac..d5e2190439a 100644 --- a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php @@ -168,7 +168,7 @@ class AssetResolverTest extends UnitTestCase { * @covers ::getCssAssets * @dataProvider providerAttachedCssAssets */ - public function testGetCssAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_css_cache_item_count) { + public function testGetCssAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_css_cache_item_count): void { $this->libraryDiscovery->expects($this->any()) ->method('getLibraryByName') ->willReturnOnConsecutiveCalls( @@ -203,7 +203,7 @@ class AssetResolverTest extends UnitTestCase { * @covers ::getJsAssets * @dataProvider providerAttachedJsAssets */ - public function testGetJsAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_js_cache_item_count, $expected_multilingual_js_cache_item_count) { + public function testGetJsAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_js_cache_item_count, $expected_multilingual_js_cache_item_count): void { $this->libraryDiscovery->expects($this->any()) ->method('getLibraryByName') ->willReturnOnConsecutiveCalls( diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php index 34adf3fe497..adc8da35669 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php @@ -33,7 +33,7 @@ class CssCollectionGrouperUnitTest extends UnitTestCase { /** * Tests \Drupal\Core\Asset\CssCollectionGrouper. */ - public function testGrouper() { + public function testGrouper(): void { $css_assets = [ 'system.base.css' => [ 'group' => -100, diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php index 18fb5b7f712..3c38cfbac80 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php @@ -280,14 +280,14 @@ class CssCollectionRendererUnitTest extends UnitTestCase { * * @dataProvider providerTestRender */ - public function testRender(array $css_assets, array $render_elements) { + public function testRender(array $css_assets, array $render_elements): void { $this->assertSame($render_elements, $this->renderer->render($css_assets)); } /** * Tests a CSS asset group with the invalid 'type' => 'internal'. */ - public function testRenderInvalidType() { + public function testRenderInvalidType(): void { $this->expectException('Exception'); $this->expectExceptionMessage('Invalid CSS asset type.'); diff --git a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php index 985cc785f59..b61bd1e4b65 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php @@ -239,7 +239,7 @@ class CssOptimizerUnitTest extends UnitTestCase { * * @dataProvider providerTestOptimize */ - public function testOptimize($css_asset, $expected) { + public function testOptimize($css_asset, $expected): void { global $base_path; $original_base_path = $base_path; $base_path = '/'; @@ -252,7 +252,7 @@ class CssOptimizerUnitTest extends UnitTestCase { /** * Tests a file CSS asset with preprocessing disabled. */ - public function testTypeFilePreprocessingDisabled() { + public function testTypeFilePreprocessingDisabled(): void { $this->expectException('Exception'); $this->expectExceptionMessage('Only file CSS assets with preprocessing enabled can be optimized.'); @@ -272,7 +272,7 @@ class CssOptimizerUnitTest extends UnitTestCase { /** * Tests a CSS asset with 'type' => 'external'. */ - public function testTypeExternal() { + public function testTypeExternal(): void { $this->expectException('Exception'); $this->expectExceptionMessage('Only file CSS assets can be optimized.'); diff --git a/core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php index e1da45e626a..6a6b3f80e8a 100644 --- a/core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php @@ -73,7 +73,7 @@ class JsOptimizerUnitTest extends UnitTestCase { * * @dataProvider providerTestClean */ - public function testClean($js_asset, $expected) { + public function testClean($js_asset, $expected): void { $this->assertEquals($expected, $this->optimizer->clean($js_asset)); } @@ -139,7 +139,7 @@ class JsOptimizerUnitTest extends UnitTestCase { * * @dataProvider providerTestOptimize */ - public function testOptimize($js_asset, $expected) { + public function testOptimize($js_asset, $expected): void { $this->assertEquals($expected, $this->optimizer->optimize($js_asset)); } diff --git a/core/tests/Drupal/Tests/Core/Asset/LibrariesDirectoryFileFinderTest.php b/core/tests/Drupal/Tests/Core/Asset/LibrariesDirectoryFileFinderTest.php index bf3a7f02d83..ad175404a96 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibrariesDirectoryFileFinderTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibrariesDirectoryFileFinderTest.php @@ -18,7 +18,7 @@ class LibrariesDirectoryFileFinderTest extends UnitTestCase { /** * @covers ::find */ - public function testFind() { + public function testFind(): void { // Place a library file in all the possible locations. $structure = [ 'sites' => [ diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php index 705461e915e..fa65a72ff51 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDependencyResolverTest.php @@ -118,7 +118,7 @@ class LibraryDependencyResolverTest extends UnitTestCase { * * @dataProvider providerTestGetLibrariesWithDependencies */ - public function testGetLibrariesWithDependencies(array $libraries, array $expected) { + public function testGetLibrariesWithDependencies(array $libraries, array $expected): void { $this->assertEquals($expected, $this->libraryDependencyResolver->getLibrariesWithDependencies($libraries)); } @@ -172,14 +172,14 @@ class LibraryDependencyResolverTest extends UnitTestCase { * * @dataProvider providerTestGetMinimalRepresentativeSubset */ - public function testGetMinimalRepresentativeSubset(array $libraries, array $expected) { + public function testGetMinimalRepresentativeSubset(array $libraries, array $expected): void { $this->assertEquals($expected, $this->libraryDependencyResolver->getMinimalRepresentativeSubset($libraries)); } /** * @covers ::getMinimalRepresentativeSubset */ - public function testGetMinimalRepresentativeSubsetInvalidInput() { + public function testGetMinimalRepresentativeSubsetInvalidInput(): void { $this->expectException(\AssertionError::class); $this->expectExceptionMessage('$libraries can\'t contain duplicate items.'); $this->libraryDependencyResolver->getMinimalRepresentativeSubset(['test/no_deps_a', 'test/no_deps_a']); diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php index 5528ca294fb..cecf44fc3b4 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php @@ -106,7 +106,7 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { * * @covers ::resolveCacheMiss */ - public function testResolveCacheMiss() { + public function testResolveCacheMiss(): void { $this->activeTheme = $this->getMockBuilder(ActiveTheme::class) ->disableOriginalConstructor() ->getMock(); @@ -132,7 +132,7 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { * * @covers ::destruct */ - public function testDestruct() { + public function testDestruct(): void { $this->activeTheme = $this->getMockBuilder(ActiveTheme::class) ->disableOriginalConstructor() ->getMock(); @@ -176,7 +176,7 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { * * @covers ::applyLibrariesExtend */ - public function testLibrariesExtend() { + public function testLibrariesExtend(): void { $this->activeTheme = $this->getMockBuilder(ActiveTheme::class) ->disableOriginalConstructor() ->getMock(); @@ -221,7 +221,7 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { * * @group legacy */ - public function testLibrariesExtendDeprecated() { + public function testLibrariesExtendDeprecated(): void { $this->expectDeprecation('Theme "test" is extending a deprecated library. The "test/test_4" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use the test_3 library instead. See https://www.example.com'); $this->activeTheme = $this->getMockBuilder(ActiveTheme::class) ->disableOriginalConstructor() diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index 67b440fb2f9..13ba2d41ad3 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -124,7 +124,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @runInSeparateProcess */ - public function testBuildByExtensionSimple() { + public function testBuildByExtensionSimple(): void { FileCacheFactory::setPrefix('testing'); // Use the default file cache configuration. FileCacheFactory::setConfiguration([ @@ -164,7 +164,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testBuildByExtensionWithTheme() { + public function testBuildByExtensionWithTheme(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_theme') @@ -191,7 +191,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testBuildByExtensionWithMissingLibraryFile() { + public function testBuildByExtensionWithMissingLibraryFile(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_module') @@ -212,7 +212,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testInvalidLibrariesFile() { + public function testInvalidLibrariesFile(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('invalid_file') @@ -234,7 +234,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testBuildByExtensionWithOnlyDependencies() { + public function testBuildByExtensionWithOnlyDependencies(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_module_only_dependencies') @@ -256,7 +256,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testBuildByExtensionWithMissingInformation() { + public function testBuildByExtensionWithMissingInformation(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_module_missing_information') @@ -279,7 +279,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testVersion() { + public function testVersion(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('versions') @@ -312,7 +312,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testExternalLibraries() { + public function testExternalLibraries(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('external') @@ -338,7 +338,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testDefaultCssWeights() { + public function testDefaultCssWeights(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('css_weights') @@ -379,7 +379,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testJsWithPositiveWeight() { + public function testJsWithPositiveWeight(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('js_positive_weight') @@ -401,7 +401,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryWithCssJsSetting() { + public function testLibraryWithCssJsSetting(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('css_js_settings') @@ -434,7 +434,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryWithDependencies() { + public function testLibraryWithDependencies(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('dependencies') @@ -460,7 +460,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryWithDataTypes() { + public function testLibraryWithDataTypes(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('data_types') @@ -498,7 +498,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryWithJavaScript() { + public function testLibraryWithJavaScript(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('js') @@ -524,7 +524,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryThirdPartyWithMissingLicense() { + public function testLibraryThirdPartyWithMissingLicense(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('licenses_missing_information') @@ -547,7 +547,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::buildByExtension */ - public function testLibraryWithLicenses() { + public function testLibraryWithLicenses(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('licenses') @@ -634,7 +634,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @covers ::applyLibrariesOverride */ - public function testLibraryOverride() { + public function testLibraryOverride(): void { $mock_theme_path = 'mocked_themes/kittens'; $this->themeManager = $this->createMock(ThemeManagerInterface::class); $this->activeTheme = $this->getMockBuilder(ActiveTheme::class) @@ -689,7 +689,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @group legacy */ - public function testLibraryOverrideDeprecated() { + public function testLibraryOverrideDeprecated(): void { $this->expectDeprecation('Theme "deprecated" is overriding a deprecated library. The "deprecated/deprecated" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use another library instead. See https://www.example.com'); $mock_theme_path = 'mocked_themes/kittens'; $this->themeManager = $this->createMock(ThemeManagerInterface::class); @@ -746,7 +746,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { * * @dataProvider providerTestCssAssert */ - public function testCssAssert($extension, $exception_message) { + public function testCssAssert($extension, $exception_message): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with($extension) @@ -778,7 +778,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { /** * @covers ::buildByExtension */ - public function testNonCoreLibrariesFound() { + public function testNonCoreLibrariesFound(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_contrib_module') @@ -809,7 +809,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { /** * @covers ::buildByExtension */ - public function testNonCoreLibrariesNotFound() { + public function testNonCoreLibrariesNotFound(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('example_contrib_module') @@ -844,7 +844,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase { /** * @covers ::parseLibraryInfo */ - public function testEmptyLibraryFile() { + public function testEmptyLibraryFile(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('empty') diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php index 72bc4add577..a10dac0d043 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php @@ -81,7 +81,7 @@ class LibraryDiscoveryTest extends UnitTestCase { /** * @covers ::getLibrariesByExtension */ - public function testGetLibrariesByExtension() { + public function testGetLibrariesByExtension(): void { $this->libraryDiscovery->getLibrariesByExtension('test'); // Verify that subsequent calls don't trigger hook_library_info_alter() // and hook_js_settings_alter() invocations, nor do they talk to the @@ -97,14 +97,14 @@ class LibraryDiscoveryTest extends UnitTestCase { * * @covers ::getLibraryByName */ - public function testGetLibraryByName() { + public function testGetLibraryByName(): void { $this->assertSame($this->libraryData['test_1'], $this->libraryDiscovery->getLibraryByName('test', 'test_1')); } /** * Tests getting a deprecated library. */ - public function testAssetLibraryDeprecation() { + public function testAssetLibraryDeprecation(): void { $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) { // Convert deprecation error into a catchable exception. if ($severity === E_USER_DEPRECATED) { diff --git a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php index 9f19efe1113..0a6d68a3aad 100644 --- a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php @@ -23,7 +23,7 @@ class AuthenticationCollectorTest extends UnitTestCase { * @covers ::getProvider * @covers ::isGlobal */ - public function testAuthenticationCollector() { + public function testAuthenticationCollector(): void { $providers = []; $global = []; $authentication_collector = new AuthenticationCollector(); diff --git a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php index c988388f73d..0bfc70450d0 100644 --- a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php @@ -25,7 +25,7 @@ class AuthenticationManagerTest extends UnitTestCase { * * @dataProvider providerTestDefaultFilter */ - public function testDefaultFilter($applies, $has_route, $auth_option, $provider_id, $global) { + public function testDefaultFilter($applies, $has_route, $auth_option, $provider_id, $global): void { $auth_provider = $this->createMock('Drupal\Core\Authentication\AuthenticationProviderInterface'); $auth_collector = new AuthenticationCollector(); $auth_collector->addProvider($auth_provider, $provider_id, 0, $global); @@ -46,7 +46,7 @@ class AuthenticationManagerTest extends UnitTestCase { /** * @covers ::applyFilter */ - public function testApplyFilterWithFilterProvider() { + public function testApplyFilterWithFilterProvider(): void { $auth_provider = $this->createMock('Drupal\Tests\Core\Authentication\TestAuthenticationProviderInterface'); $auth_provider->expects($this->once()) ->method('appliesToRoutedRequest') diff --git a/core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php b/core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php index 5971692a116..757a5c50660 100644 --- a/core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php @@ -22,7 +22,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::toArray */ - public function testDefaultValues() { + public function testDefaultValues(): void { $batch = (new BatchBuilder())->toArray(); $this->assertIsArray($batch); @@ -51,7 +51,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setTitle */ - public function testSetTitle() { + public function testSetTitle(): void { $batch = (new BatchBuilder()) ->setTitle(new TranslatableMarkup('New Title')) ->toArray(); @@ -64,7 +64,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setFinishCallback */ - public function testSetFinishCallback() { + public function testSetFinishCallback(): void { $batch = (new BatchBuilder()) ->setFinishCallback('\Drupal\Tests\Core\Batch\BatchBuilderTest::finishedCallback') ->toArray(); @@ -77,7 +77,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setInitMessage */ - public function testSetInitMessage() { + public function testSetInitMessage(): void { $batch = (new BatchBuilder()) ->setInitMessage(new TranslatableMarkup('New initialization message.')) ->toArray(); @@ -90,7 +90,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setProgressMessage */ - public function testSetProgressMessage() { + public function testSetProgressMessage(): void { $batch = (new BatchBuilder()) ->setProgressMessage(new TranslatableMarkup('Batch in progress...')) ->toArray(); @@ -101,7 +101,7 @@ class BatchBuilderTest extends UnitTestCase { /** * Tests setErrorMessage(). */ - public function testSetErrorMessage() { + public function testSetErrorMessage(): void { $batch = (new BatchBuilder()) ->setErrorMessage(new TranslatableMarkup('Oops. An error has occurred :(')) ->toArray(); @@ -114,7 +114,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setFile */ - public function testSetFile() { + public function testSetFile(): void { $filename = dirname(__DIR__, 6) . '/core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc'; $this->assertIsNotCallable('_batch_test_callback_1'); $this->assertIsNotCallable('_batch_test_finished_1'); @@ -136,7 +136,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setLibraries */ - public function testAddingLibraries() { + public function testAddingLibraries(): void { $batch = (new BatchBuilder()) ->setLibraries(['only/library']) ->toArray(); @@ -149,7 +149,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setProgressive */ - public function testSetProgressive() { + public function testSetProgressive(): void { $batch_builder = new BatchBuilder(); $batch = $batch_builder ->setProgressive(FALSE) @@ -169,7 +169,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setQueue */ - public function testSetQueue() { + public function testSetQueue(): void { $batch = (new BatchBuilder()) ->setQueue('BatchName', '\Drupal\Core\Queue\Batch') ->toArray(); @@ -185,7 +185,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setQueue */ - public function testQueueExists() { + public function testQueueExists(): void { $batch_builder = (new BatchBuilder()); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Class \ThisIsNotAClass does not exist.'); @@ -197,7 +197,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setQueue */ - public function testQueueImplements() { + public function testQueueImplements(): void { $batch_builder = (new BatchBuilder()); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Class Exception does not implement \Drupal\Core\Queue\QueueInterface.'); @@ -209,7 +209,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::setUrlOptions */ - public function testSetUrlOptions() { + public function testSetUrlOptions(): void { $options = [ 'absolute' => TRUE, 'language' => 'de', @@ -226,7 +226,7 @@ class BatchBuilderTest extends UnitTestCase { * * @covers ::addOperation */ - public function testAddOperation() { + public function testAddOperation(): void { $batch_builder = new BatchBuilder(); $batch = $batch_builder ->addOperation('\Drupal\Tests\Core\Batch\BatchBuilderTest::operationCallback') diff --git a/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php b/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php index 2cfa8264442..afd9b1f1dbe 100644 --- a/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php +++ b/core/tests/Drupal/Tests/Core/Batch/PercentagesTest.php @@ -22,7 +22,7 @@ class PercentagesTest extends UnitTestCase { * @dataProvider providerTestPercentages * @covers ::format */ - public function testPercentages($total, $current, $expected_result) { + public function testPercentages($total, $current, $expected_result): void { $actual_result = Percentage::format($total, $current); $this->assertEquals($actual_result, $expected_result, sprintf('The expected the batch api percentage at the state %s/%s is %s%% and got %s%%.', $current, $total, $expected_result, $actual_result)); } diff --git a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php index 5d4d2cbf4e1..4775100e59c 100644 --- a/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php @@ -27,7 +27,7 @@ class BlockBaseTest extends UnitTestCase { * * @dataProvider providerTestGetMachineNameSuggestion */ - public function testGetMachineNameSuggestion($label, $expected) { + public function testGetMachineNameSuggestion($label, $expected): void { $module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'); $transliteration = $this->getMockBuilder('Drupal\Core\Transliteration\PhpTransliteration') ->setConstructorArgs([NULL, $module_handler]) diff --git a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php index dc993a5faad..d11b3b8a001 100644 --- a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php @@ -87,7 +87,7 @@ class BlockManagerTest extends UnitTestCase { /** * @covers ::getDefinitions */ - public function testDefinitions() { + public function testDefinitions(): void { $definitions = $this->blockManager->getDefinitions(); $this->assertSame(['broken', 'block1', 'block2', 'block3'], array_keys($definitions)); } @@ -95,7 +95,7 @@ class BlockManagerTest extends UnitTestCase { /** * @covers ::getSortedDefinitions */ - public function testSortedDefinitions() { + public function testSortedDefinitions(): void { $definitions = $this->blockManager->getSortedDefinitions(); $this->assertSame(['block2', 'block3', 'block1'], array_keys($definitions)); } @@ -103,7 +103,7 @@ class BlockManagerTest extends UnitTestCase { /** * @covers ::getGroupedDefinitions */ - public function testGroupedDefinitions() { + public function testGroupedDefinitions(): void { $definitions = $this->blockManager->getGroupedDefinitions(); $this->assertSame(['Group 1', 'Group 2'], array_keys($definitions)); $this->assertSame(['block2'], array_keys($definitions['Group 1'])); @@ -113,7 +113,7 @@ class BlockManagerTest extends UnitTestCase { /** * @covers ::handlePluginNotFound */ - public function testHandlePluginNotFound() { + public function testHandlePluginNotFound(): void { $this->logger->warning('The "%plugin_id" was not found', ['%plugin_id' => 'invalid'])->shouldBeCalled(); $plugin = $this->blockManager->createInstance('invalid'); $this->assertSame('broken', $plugin->getPluginId()); diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php index 579a7168636..92054fedc72 100644 --- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php @@ -66,7 +66,7 @@ class BreadcrumbManagerTest extends UnitTestCase { /** * Tests the breadcrumb manager without any set breadcrumb. */ - public function testBuildWithoutBuilder() { + public function testBuildWithoutBuilder(): void { $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $this->moduleHandler->expects($this->once()) ->method('alter') @@ -82,7 +82,7 @@ class BreadcrumbManagerTest extends UnitTestCase { /** * Tests the build method with a single breadcrumb builder. */ - public function testBuildWithSingleBuilder() { + public function testBuildWithSingleBuilder(): void { $builder = $this->createMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface'); $links = ['<a href="/example">Test</a>']; $this->breadcrumb->setLinks($links); @@ -113,7 +113,7 @@ class BreadcrumbManagerTest extends UnitTestCase { /** * Tests multiple breadcrumb builder with different priority. */ - public function testBuildWithMultipleApplyingBuilders() { + public function testBuildWithMultipleApplyingBuilders(): void { $builder1 = $this->createMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface'); $builder1->expects($this->never()) ->method('applies'); @@ -150,7 +150,7 @@ class BreadcrumbManagerTest extends UnitTestCase { /** * Tests multiple breadcrumb builders of which one returns NULL. */ - public function testBuildWithOneNotApplyingBuilders() { + public function testBuildWithOneNotApplyingBuilders(): void { $builder1 = $this->createMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface'); $builder1->expects($this->once()) ->method('applies') @@ -188,7 +188,7 @@ class BreadcrumbManagerTest extends UnitTestCase { /** * Tests a breadcrumb builder with a bad return value. */ - public function testBuildWithInvalidBreadcrumbResult() { + public function testBuildWithInvalidBreadcrumbResult(): void { $builder = $this->createMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface'); $builder->expects($this->once()) ->method('applies') diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php index c0f91db54a6..4932f17e9c9 100644 --- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php +++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php @@ -18,7 +18,7 @@ class BreadcrumbTest extends UnitTestCase { /** * @covers ::setLinks */ - public function testSetLinks() { + public function testSetLinks(): void { $breadcrumb = new Breadcrumb(); $breadcrumb->setLinks([new Link('Home', Url::fromRoute('<front>'))]); $this->expectException(\LogicException::class); diff --git a/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php b/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php index 43e94f18d93..dd46ae78eb2 100644 --- a/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php @@ -90,7 +90,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests the get feature. */ - public function testGet() { + public function testGet(): void { $cached = $this->chain->get('t123'); $this->assertNotFalse($cached, 'Got key that is on all backends'); $this->assertSame(1231, $cached->data, 'Got the key from the backend 1'); @@ -107,7 +107,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests the get multiple feature. */ - public function testGetMultiple() { + public function testGetMultiple(): void { $cids = ['t123', 't23', 't3', 't4']; $ret = $this->chain->getMultiple($cids); @@ -125,7 +125,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests that set will propagate. */ - public function testSet() { + public function testSet(): void { $this->chain->set('test', 123); $cached = $this->firstBackend->get('test'); @@ -144,7 +144,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests that delete will propagate. */ - public function testDelete() { + public function testDelete(): void { $this->chain->set('test', 5); $cached = $this->firstBackend->get('test'); @@ -167,7 +167,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Ensure get values propagation to previous backends. */ - public function testGetHasPropagated() { + public function testGetHasPropagated(): void { $this->chain->get('t23'); $cached = $this->firstBackend->get('t23'); $this->assertNotFalse($cached, 'Test 2 has been propagated to the first backend'); @@ -182,7 +182,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Ensure get multiple values propagation to previous backends. */ - public function testGetMultipleHasPropagated() { + public function testGetMultipleHasPropagated(): void { $cids = ['t3', 't23']; $this->chain->getMultiple($cids); @@ -201,7 +201,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests that the delete all operation is propagated to all chained backends. */ - public function testDeleteAllPropagation() { + public function testDeleteAllPropagation(): void { // Set both expiring and permanent keys. $this->chain->set('test1', 1, Cache::PERMANENT); $this->chain->set('test2', 3, time() + 1000); @@ -218,7 +218,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests that the delete tags operation is propagated to all chained backends. */ - public function testDeleteTagsPropagation() { + public function testDeleteTagsPropagation(): void { // Create two cache entries with the same tag and tag value. $this->chain->set('test_cid_clear1', 'foo', Cache::PERMANENT, ['test_tag:2']); $this->chain->set('test_cid_clear2', 'foo', Cache::PERMANENT, ['test_tag:2']); @@ -294,7 +294,7 @@ class BackendChainImplementationUnitTest extends UnitTestCase { /** * Tests that removing bin propagates to all backends. */ - public function testRemoveBin() { + public function testRemoveBin(): void { $chain = new BackendChain(); for ($i = 0; $i < 3; $i++) { $backend = $this->createMock('Drupal\Core\Cache\CacheBackendInterface'); diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php index fd7f0682391..a070a22f3d0 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php @@ -66,7 +66,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests the resolve cache miss function. */ - public function testResolveCacheMiss() { + public function testResolveCacheMiss(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); $this->collector->setCacheMissData($key, $value); @@ -77,7 +77,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests setting and getting values when the cache is empty. */ - public function testSetAndGet() { + public function testSetAndGet(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -91,7 +91,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Makes sure that NULL is a valid value and is collected. */ - public function testSetAndGetNull() { + public function testSetAndGetNull(): void { $key = $this->randomMachineName(); $value = NULL; @@ -112,7 +112,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests returning value from the collected cache. */ - public function testGetFromCache() { + public function testGetFromCache(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -132,7 +132,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests setting and deleting values. */ - public function testDelete() { + public function testDelete(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -153,7 +153,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests updating the cache when no changes were made. */ - public function testUpdateCacheNoChanges() { + public function testUpdateCacheNoChanges(): void { $this->lock->expects($this->never()) ->method('acquire'); $this->cacheBackend->expects($this->never()) @@ -166,7 +166,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests updating the cache after a set. */ - public function testUpdateCache() { + public function testUpdateCache(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -197,7 +197,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests updating the cache when the lock acquire fails. */ - public function testUpdateCacheLockFail() { + public function testUpdateCacheLockFail(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -219,7 +219,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests updating the cache when there is a conflict after cache invalidation. */ - public function testUpdateCacheInvalidatedConflict() { + public function testUpdateCacheInvalidatedConflict(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -263,7 +263,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests a cache hit, then item updated by a different request. */ - public function testUpdateCacheMerge() { + public function testUpdateCacheMerge(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -300,7 +300,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests a cache miss, then item created by another request. */ - public function testUpdateCacheRace() { + public function testUpdateCacheRace(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -330,7 +330,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests updating the cache after a delete. */ - public function testUpdateCacheDelete() { + public function testUpdateCacheDelete(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -370,7 +370,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests a reset of the cache collector. */ - public function testUpdateCacheReset() { + public function testUpdateCacheReset(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -391,7 +391,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests a clear of the cache collector. */ - public function testUpdateCacheClear() { + public function testUpdateCacheClear(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -417,7 +417,7 @@ class CacheCollectorTest extends UnitTestCase { /** * Tests a clear of the cache collector using tags. */ - public function testUpdateCacheClearTags() { + public function testUpdateCacheClearTags(): void { $key = $this->randomMachineName(); $value = $this->randomMachineName(); $tags = [$this->randomMachineName()]; diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php index 8c555465c75..618c51fa38f 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php @@ -21,7 +21,7 @@ class CacheFactoryTest extends UnitTestCase { * @covers ::__construct * @covers ::get */ - public function testCacheFactoryWithDefaultSettings() { + public function testCacheFactoryWithDefaultSettings(): void { $settings = new Settings([]); $cache_factory = new CacheFactory($settings); @@ -47,7 +47,7 @@ class CacheFactoryTest extends UnitTestCase { * @covers ::__construct * @covers ::get */ - public function testCacheFactoryWithCustomizedDefaultBackend() { + public function testCacheFactoryWithCustomizedDefaultBackend(): void { $settings = new Settings([ 'cache' => [ 'default' => 'cache.backend.custom', @@ -77,7 +77,7 @@ class CacheFactoryTest extends UnitTestCase { * @covers ::__construct * @covers ::get */ - public function testCacheFactoryWithDefaultBinBackend() { + public function testCacheFactoryWithDefaultBinBackend(): void { // Ensure the default bin backends are used before the configured default. $settings = new Settings([ 'cache' => [ @@ -113,7 +113,7 @@ class CacheFactoryTest extends UnitTestCase { * @covers ::__construct * @covers ::get */ - public function testCacheFactoryWithSpecifiedPerBinBackend() { + public function testCacheFactoryWithSpecifiedPerBinBackend(): void { // Ensure the per-bin configuration is used before the configured default // and per-bin defaults. $settings = new Settings([ diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php index 61527df595e..2a118b36867 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php @@ -18,7 +18,7 @@ class CacheTagsInvalidatorTest extends UnitTestCase { /** * @covers ::invalidateTags */ - public function testInvalidateTagsWithInvalidTags() { + public function testInvalidateTagsWithInvalidTags(): void { $cache_tags_invalidator = new CacheTagsInvalidator(); $this->expectException(\AssertionError::class); $cache_tags_invalidator->invalidateTags(['node' => [2, 3, 5, 8, 13]]); @@ -29,7 +29,7 @@ class CacheTagsInvalidatorTest extends UnitTestCase { * @covers ::addInvalidator * @covers ::addBin */ - public function testInvalidateTags() { + public function testInvalidateTags(): void { $cache_tags_invalidator = new CacheTagsInvalidator(); $invalidator_cache_bin = $this->createMock(InvalidatingCacheBackendInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php index a3712c0d356..dc005bc3f09 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php @@ -68,7 +68,7 @@ class CacheTest extends UnitTestCase { * * @dataProvider mergeTagsProvider */ - public function testMergeTags(array $expected, ...$cache_tags) { + public function testMergeTags(array $expected, ...$cache_tags): void { $this->assertEqualsCanonicalizing($expected, Cache::mergeTags(...$cache_tags)); } @@ -107,7 +107,7 @@ class CacheTest extends UnitTestCase { * * @dataProvider mergeMaxAgesProvider */ - public function testMergeMaxAges($expected, ...$max_ages) { + public function testMergeMaxAges($expected, ...$max_ages): void { $this->assertSame($expected, Cache::mergeMaxAges(...$max_ages)); } @@ -141,7 +141,7 @@ class CacheTest extends UnitTestCase { * * @dataProvider mergeCacheContextsProvide */ - public function testMergeCacheContexts(array $expected, ...$contexts) { + public function testMergeCacheContexts(array $expected, ...$contexts): void { $cache_contexts_manager = $this->prophesize(CacheContextsManager::class); $cache_contexts_manager->assertValidTokens(Argument::any())->willReturn(TRUE); $container = $this->prophesize(Container::class); @@ -182,7 +182,7 @@ class CacheTest extends UnitTestCase { * * @dataProvider buildTagsProvider */ - public function testBuildTags($prefix, array $suffixes, array $expected, $glue = ':') { + public function testBuildTags($prefix, array $suffixes, array $expected, $glue = ':'): void { $this->assertEquals($expected, Cache::buildTags($prefix, $suffixes, $glue)); } diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php index ef813ef4b36..9162ecf21cd 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php @@ -29,7 +29,7 @@ class CacheableMetadataTest extends UnitTestCase { * @covers ::merge * @dataProvider providerTestMerge */ - public function testMerge(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) { + public function testMerge(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected): void { $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); @@ -55,7 +55,7 @@ class CacheableMetadataTest extends UnitTestCase { * @covers ::addCacheableDependency * @dataProvider providerTestMerge */ - public function testAddCacheableDependency(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) { + public function testAddCacheableDependency(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected): void { $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); @@ -90,7 +90,7 @@ class CacheableMetadataTest extends UnitTestCase { * * @covers ::addCacheTags */ - public function testAddCacheTags() { + public function testAddCacheTags(): void { $metadata = new CacheableMetadata(); $add_expected = [ [[], []], @@ -114,7 +114,7 @@ class CacheableMetadataTest extends UnitTestCase { * @covers ::setCacheMaxAge * @dataProvider providerSetCacheMaxAge */ - public function testSetCacheMaxAge($data, $expect_exception) { + public function testSetCacheMaxAge($data, $expect_exception): void { $metadata = new CacheableMetadata(); if ($expect_exception) { $this->expectException('\InvalidArgumentException'); @@ -142,7 +142,7 @@ class CacheableMetadataTest extends UnitTestCase { * @covers ::createFromRenderArray * @dataProvider providerTestCreateFromRenderArray */ - public function testCreateFromRenderArray(array $render_array, CacheableMetadata $expected) { + public function testCreateFromRenderArray(array $render_array, CacheableMetadata $expected): void { $this->assertEquals($expected, CacheableMetadata::createFromRenderArray($render_array)); } @@ -178,7 +178,7 @@ class CacheableMetadataTest extends UnitTestCase { * @covers ::createFromObject * @dataProvider providerTestCreateFromObject */ - public function testCreateFromObject($object, CacheableMetadata $expected) { + public function testCreateFromObject($object, CacheableMetadata $expected): void { $this->assertEquals($expected, CacheableMetadata::createFromObject($object)); } diff --git a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php index 436db6dc00c..012a0ce5237 100644 --- a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php @@ -20,7 +20,7 @@ class ChainedFastBackendFactoryTest extends UnitTestCase { /** * Test if the same name is provided for consistent and fast services. */ - public function testIdenticalService() { + public function testIdenticalService(): void { $container = $this->createMock(ContainerInterface::class); $testCacheFactory = $this->createMock(CacheFactoryInterface::class); $testCacheBackend = $this->createMock(CacheBackendInterface::class); @@ -47,7 +47,7 @@ class ChainedFastBackendFactoryTest extends UnitTestCase { /** * Test if different names are provided for consistent and fast services. */ - public function testDifferentServices() { + public function testDifferentServices(): void { $container = $this->createMock(ContainerInterface::class); $testConsistentCacheFactory = $this->createMock(CacheFactoryInterface::class); $testFastCacheFactory = $this->createMock(CacheFactoryInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php index 47a495e9d99..653f5d7b552 100644 --- a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php @@ -39,7 +39,7 @@ class ChainedFastBackendTest extends UnitTestCase { /** * Tests a get() on the fast backend, with no hit on the consistent backend. */ - public function testGetDoesNotHitConsistentBackend() { + public function testGetDoesNotHitConsistentBackend(): void { $consistent_cache = $this->createMock('Drupal\Core\Cache\CacheBackendInterface'); $timestamp_cid = ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_foo'; // Use the request time because that is what we will be comparing against. @@ -64,7 +64,7 @@ class ChainedFastBackendTest extends UnitTestCase { /** * Tests a fast cache miss gets data from the consistent cache backend. */ - public function testFallThroughToConsistentCache() { + public function testFallThroughToConsistentCache(): void { $timestamp_item = (object) [ 'cid' => ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_foo', // Time travel is easy. diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php index 51afa3a9d42..afc6999420d 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php @@ -25,7 +25,7 @@ class CacheContextsManagerTest extends UnitTestCase { * * @dataProvider providerTestOptimizeTokens */ - public function testOptimizeTokens(array $context_tokens, array $optimized_context_tokens) { + public function testOptimizeTokens(array $context_tokens, array $optimized_context_tokens): void { $container = $this->getMockBuilder('Drupal\Core\DependencyInjection\Container') ->disableOriginalConstructor() ->getMock(); @@ -104,7 +104,7 @@ class CacheContextsManagerTest extends UnitTestCase { /** * @covers ::convertTokensToKeys */ - public function testConvertTokensToKeys() { + public function testConvertTokensToKeys(): void { $container = $this->getMockContainer(); $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture()); @@ -125,7 +125,7 @@ class CacheContextsManagerTest extends UnitTestCase { /** * @covers ::convertTokensToKeys */ - public function testInvalidContext() { + public function testInvalidContext(): void { $container = $this->getMockContainer(); $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture()); @@ -138,7 +138,7 @@ class CacheContextsManagerTest extends UnitTestCase { * * @dataProvider providerTestInvalidCalculatedContext */ - public function testInvalidCalculatedContext($context_token) { + public function testInvalidCalculatedContext($context_token): void { $container = $this->getMockContainer(); $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture()); @@ -156,13 +156,13 @@ class CacheContextsManagerTest extends UnitTestCase { ]; } - public function testAvailableContextStrings() { + public function testAvailableContextStrings(): void { $cache_contexts_manager = new CacheContextsManager($this->getMockContainer(), $this->getContextsFixture()); $contexts = $cache_contexts_manager->getAll(); $this->assertEquals(["foo", "baz"], $contexts); } - public function testAvailableContextLabels() { + public function testAvailableContextLabels(): void { $container = $this->getMockContainer(); $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture()); $labels = $cache_contexts_manager->getLabels(); @@ -232,7 +232,7 @@ class CacheContextsManagerTest extends UnitTestCase { * * @dataProvider validateTokensProvider */ - public function testValidateContexts(array $contexts, $expected_exception_message) { + public function testValidateContexts(array $contexts, $expected_exception_message): void { $container = new ContainerBuilder(); $cache_contexts_manager = new CacheContextsManager($container, ['foo', 'foo.bar', 'baz']); if ($expected_exception_message !== FALSE) { diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php index 8eef5a40506..5a7c0835e1b 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php @@ -20,7 +20,7 @@ class CookieCacheContextTest extends UnitTestCase { * * @dataProvider providerTestGetContext */ - public function testGetContext($cookies, $cookie_name, $context) { + public function testGetContext($cookies, $cookie_name, $context): void { $request_stack = new RequestStack(); $request = Request::create('/', 'GET'); foreach ($cookies as $cookie => $value) { diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/HeadersCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/HeadersCacheContextTest.php index f691ffe9da5..7197a6283ed 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/HeadersCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/HeadersCacheContextTest.php @@ -20,7 +20,7 @@ class HeadersCacheContextTest extends UnitTestCase { * * @dataProvider providerTestGetContext */ - public function testGetContext($headers, $header_name, $context) { + public function testGetContext($headers, $header_name, $context): void { $request_stack = new RequestStack(); $request = Request::create('/', 'GET'); // Request defaults could change, so compare with default values instead of diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php index ef732eb9cec..b54554dae0f 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php @@ -17,7 +17,7 @@ class IsFrontPathCacheContextTest extends UnitTestCase { /** * @covers ::getContext */ - public function testGetContextFront() { + public function testGetContextFront(): void { $cache_context = new IsFrontPathCacheContext($this->createPathMatcher(TRUE)->reveal()); $this->assertSame('is_front.1', $cache_context->getContext()); } @@ -25,7 +25,7 @@ class IsFrontPathCacheContextTest extends UnitTestCase { /** * @covers ::getContext */ - public function testGetContextNotFront() { + public function testGetContextNotFront(): void { $cache_context = new IsFrontPathCacheContext($this->createPathMatcher(FALSE)->reveal()); $this->assertSame('is_front.0', $cache_context->getContext()); } diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php index 1d5b652ddbc..3eed80e3db3 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/PathParentCacheContextTest.php @@ -20,7 +20,7 @@ class PathParentCacheContextTest extends UnitTestCase { * * @dataProvider providerTestGetContext */ - public function testGetContext($original_path, $context) { + public function testGetContext($original_path, $context): void { $request_stack = new RequestStack(); $request = Request::create($original_path); $request_stack->push($request); diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/ProtocolVersionCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/ProtocolVersionCacheContextTest.php index 673cd4cc387..12f3c641a65 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/ProtocolVersionCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/ProtocolVersionCacheContextTest.php @@ -20,7 +20,7 @@ class ProtocolVersionCacheContextTest extends UnitTestCase { * * @dataProvider providerTestGetContext */ - public function testGetContext($protocol, $context) { + public function testGetContext($protocol, $context): void { $request_stack = new RequestStack(); $request = Request::create('/'); $request->server->set('SERVER_PROTOCOL', $protocol); diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php index 4ed09f3ae4d..0556773defe 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php @@ -20,7 +20,7 @@ class QueryArgsCacheContextTest extends UnitTestCase { * * @dataProvider providerTestGetContext */ - public function testGetContext(array $query_args, $cache_context_parameter, $context) { + public function testGetContext(array $query_args, $cache_context_parameter, $context): void { $request_stack = new RequestStack(); $request = Request::create('/', 'GET', $query_args); $request_stack->push($request); diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php index 5d2dce80a73..b085377be46 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php @@ -54,7 +54,7 @@ class SessionCacheContextTest extends UnitTestCase { /** * @covers ::getContext */ - public function testSameContextForSameSession() { + public function testSameContextForSameSession(): void { $this->request->setSession($this->session); $cache_context = new SessionCacheContext($this->requestStack); @@ -73,7 +73,7 @@ class SessionCacheContextTest extends UnitTestCase { /** * @covers ::getContext */ - public function testDifferentContextForDifferentSession() { + public function testDifferentContextForDifferentSession(): void { $this->request->setSession($this->session); $cache_context = new SessionCacheContext($this->requestStack); diff --git a/core/tests/Drupal/Tests/Core/Cache/DatabaseBackendFactoryTest.php b/core/tests/Drupal/Tests/Core/Cache/DatabaseBackendFactoryTest.php index 93666f28daf..60438d2063a 100644 --- a/core/tests/Drupal/Tests/Core/Cache/DatabaseBackendFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/DatabaseBackendFactoryTest.php @@ -24,7 +24,7 @@ class DatabaseBackendFactoryTest extends UnitTestCase { * @covers ::get * @dataProvider getProvider */ - public function testGet(array $settings, $expected_max_rows_foo, $expected_max_rows_bar) { + public function testGet(array $settings, $expected_max_rows_foo, $expected_max_rows_bar): void { $database_backend_factory = new DatabaseBackendFactory( $this->prophesize(Connection::class)->reveal(), $this->prophesize(CacheTagsChecksumInterface::class)->reveal(), diff --git a/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php b/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php index e5067a697d8..51a6699585c 100644 --- a/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php @@ -17,7 +17,7 @@ class NullBackendTest extends UnitTestCase { /** * Tests that the NullBackend does not actually store variables. */ - public function testNullBackend() { + public function testNullBackend(): void { $null_cache = new NullBackend('test'); $key = $this->randomMachineName(); diff --git a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php index 64a11e90de4..61b058b7e2f 100644 --- a/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php @@ -184,7 +184,7 @@ class VariationCacheTest extends UnitTestCase { * @covers ::get * @covers ::set */ - public function testNoVariations() { + public function testNoVariations(): void { $data = 'You have a nice house!'; $cacheability = (new CacheableMetadata())->setCacheTags(['bar', 'foo']); $initial_cacheability = (new CacheableMetadata())->setCacheTags(['foo']); @@ -198,7 +198,7 @@ class VariationCacheTest extends UnitTestCase { * @covers ::get * @covers ::set */ - public function testSingleVariation() { + public function testSingleVariation(): void { $cacheability = $this->housingTypeCacheability; $house_data = [ @@ -221,7 +221,7 @@ class VariationCacheTest extends UnitTestCase { * @covers ::get * @covers ::set */ - public function testNestedVariations() { + public function testNestedVariations(): void { // We are running this scenario in the best possible outcome: The redirects // are stored in expanding order, meaning the simplest one is stored first // and the nested ones are stored in subsequent ::set() calls. This means no @@ -273,7 +273,7 @@ class VariationCacheTest extends UnitTestCase { * * @depends testNestedVariations */ - public function testNestedVariationsSelfHealing() { + public function testNestedVariationsSelfHealing(): void { // This is the worst possible scenario: A very specific item was stored // first, followed by a less specific one. This means an overly specific // cache redirect was stored that needs to be dumbed down. After this @@ -330,7 +330,7 @@ class VariationCacheTest extends UnitTestCase { * @covers ::get * @covers ::set */ - public function testSplitVariationsSelfHealing() { + public function testSplitVariationsSelfHealing(): void { // This is an edge case. Something varies by AB where some values of B // trigger the whole to vary by either C, D or nothing extra. But due to an // unfortunate series of requests, only ABC and ABD variations were cached. @@ -402,7 +402,7 @@ class VariationCacheTest extends UnitTestCase { * @covers ::get * @covers ::set */ - public function testIncompatibleVariationsException() { + public function testIncompatibleVariationsException(): void { // This should never happen. When someone first stores something in the // cache using context A and then tries to store something using context B, // something is wrong. There should always be at least one shared context at diff --git a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php index 688b54b753f..74139e1b9ba 100644 --- a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php +++ b/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php @@ -86,7 +86,7 @@ class QuickStartTest extends TestCase { /** * Tests the quick-start command. */ - public function testQuickStartCommand() { + public function testQuickStartCommand(): void { $sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0]; if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) { $this->markTestSkipped(); @@ -142,7 +142,7 @@ class QuickStartTest extends TestCase { /** * Tests the quick-start commands. */ - public function testQuickStartInstallAndServerCommands() { + public function testQuickStartInstallAndServerCommands(): void { $sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0]; if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) { $this->markTestSkipped(); @@ -224,7 +224,7 @@ class QuickStartTest extends TestCase { /** * Tests the install command with an invalid profile. */ - public function testQuickStartCommandProfileValidation() { + public function testQuickStartCommandProfileValidation(): void { // Install a site using the standard profile to ensure the one time login // link generation works. $install_command = [ @@ -242,7 +242,7 @@ class QuickStartTest extends TestCase { /** * Tests the server command when there is no installation. */ - public function testServerWithNoInstall() { + public function testServerWithNoInstall(): void { $server_command = [ $this->php, 'core/scripts/drupal', diff --git a/core/tests/Drupal/Tests/Core/Common/AttributesTest.php b/core/tests/Drupal/Tests/Core/Common/AttributesTest.php index 49321a4fa2a..e051a1338bb 100644 --- a/core/tests/Drupal/Tests/Core/Common/AttributesTest.php +++ b/core/tests/Drupal/Tests/Core/Common/AttributesTest.php @@ -54,14 +54,14 @@ class AttributesTest extends UnitTestCase { * * @dataProvider providerTestAttributeData */ - public function testDrupalAttributes($attributes, $expected, $message) { + public function testDrupalAttributes($attributes, $expected, $message): void { $this->assertSame($expected, (string) new Attribute($attributes), $message); } /** * Tests attribute iteration. */ - public function testAttributeIteration() { + public function testAttributeIteration(): void { $attribute = new Attribute(['key1' => 'value1']); foreach ($attribute as $value) { $this->assertSame((string) $value, 'value1', 'Iterate over attribute.'); @@ -71,7 +71,7 @@ class AttributesTest extends UnitTestCase { /** * Tests AttributeValueBase copy. */ - public function testAttributeValueBaseCopy() { + public function testAttributeValueBaseCopy(): void { $original_attributes = new Attribute([ 'checked' => TRUE, 'class' => ['who', 'is', 'on'], diff --git a/core/tests/Drupal/Tests/Core/Common/DiffArrayTest.php b/core/tests/Drupal/Tests/Core/Common/DiffArrayTest.php index 3394fca907f..77d1776f35a 100644 --- a/core/tests/Drupal/Tests/Core/Common/DiffArrayTest.php +++ b/core/tests/Drupal/Tests/Core/Common/DiffArrayTest.php @@ -60,7 +60,7 @@ class DiffArrayTest extends UnitTestCase { /** * Tests DiffArray::diffAssocRecursive(). */ - public function testDiffAssocRecursive() { + public function testDiffAssocRecursive(): void { $expected = [ 'different' => 'no', 'int_diff' => 1, diff --git a/core/tests/Drupal/Tests/Core/Common/TagsTest.php b/core/tests/Drupal/Tests/Core/Common/TagsTest.php index 9c97fa5e28c..d4fc3a936e2 100644 --- a/core/tests/Drupal/Tests/Core/Common/TagsTest.php +++ b/core/tests/Drupal/Tests/Core/Common/TagsTest.php @@ -26,7 +26,7 @@ class TagsTest extends UnitTestCase { /** * Explodes a series of tags. */ - public function testExplodeTags() { + public function testExplodeTags(): void { $string = implode(', ', array_keys($this->validTags)); $tags = Tags::explode($string); $this->assertEquals(array_values($this->validTags), $tags); @@ -35,7 +35,7 @@ class TagsTest extends UnitTestCase { /** * Implodes a series of tags. */ - public function testImplodeTags() { + public function testImplodeTags(): void { $tags = array_values($this->validTags); // Let's explode and implode to our heart's content. for ($i = 0; $i < 10; $i++) { diff --git a/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php b/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php index e90931e54b3..0fb4073b424 100644 --- a/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php @@ -20,7 +20,7 @@ class ConditionAccessResolverTraitTest extends UnitTestCase { * * @dataProvider providerTestResolveConditions */ - public function testResolveConditions($conditions, $logic, $expected) { + public function testResolveConditions($conditions, $logic, $expected): void { $mocks['true'] = $this->createMock('Drupal\Core\Condition\ConditionInterface'); $mocks['true']->expects($this->any()) ->method('execute') diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php index 32bb2b0fde0..fd440f70734 100644 --- a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php @@ -23,7 +23,7 @@ class CachedStorageTest extends UnitTestCase { /** * Tests listAll static cache. */ - public function testListAllStaticCache() { + public function testListAllStaticCache(): void { $prefix = __FUNCTION__; $storage = $this->createMock('Drupal\Core\Config\StorageInterface'); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigDependencyManagerTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigDependencyManagerTest.php index a84b4f22bc5..557360b0c6f 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigDependencyManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigDependencyManagerTest.php @@ -19,7 +19,7 @@ class ConfigDependencyManagerTest extends UnitTestCase { /** * @dataProvider providerTestSortAll */ - public function testSortAll(array $data, array $expected_order) { + public function testSortAll(array $data, array $expected_order): void { $dependency_manager = new ConfigDependencyManager(); $dependency_manager->setData($data); $this->assertEquals($expected_order, $dependency_manager->sortAll()); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php index 8a01635b81f..744e668f842 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php @@ -19,7 +19,7 @@ class ConfigFactoryOverrideBaseTest extends UnitTestCase { /** * @dataProvider providerTestFilterNestedArray */ - public function testFilterNestedArray(array $original_data, array $override_data_before, array $override_data_after, $changed) { + public function testFilterNestedArray(array $original_data, array $override_data_before, array $override_data_after, $changed): void { $config_factory = new TestConfigFactoryOverrideBase(); $result = $config_factory->doFilterNestedArray($original_data, $override_data_before); $this->assertEquals($changed, $result); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php index ae0944489eb..d893f970d49 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryTest.php @@ -71,7 +71,7 @@ class ConfigFactoryTest extends UnitTestCase { /** * @covers ::rename */ - public function testRename() { + public function testRename(): void { $old = new Config($this->randomMachineName(), $this->storage, $this->eventDispatcher, $this->typedConfig); $new = new Config($this->randomMachineName(), $this->storage, $this->eventDispatcher, $this->typedConfig); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php index 4ba8a31f727..e313731c9eb 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php @@ -77,7 +77,7 @@ class ConfigTest extends UnitTestCase { * @covers ::setName * @dataProvider setNameProvider */ - public function testSetName($name) { + public function testSetName($name): void { // Set the name. $this->config->setName($name); @@ -110,7 +110,7 @@ class ConfigTest extends UnitTestCase { /** * @covers ::isNew */ - public function testIsNew() { + public function testIsNew(): void { // Config should be new by default. $this->assertTrue($this->config->isNew()); @@ -123,7 +123,7 @@ class ConfigTest extends UnitTestCase { * @covers ::setData * @dataProvider nestedDataProvider */ - public function testSetData($data) { + public function testSetData($data): void { $this->config->setData($data); $this->assertEquals($data, $this->config->getRawData()); $this->assertConfigDataEquals($data); @@ -133,7 +133,7 @@ class ConfigTest extends UnitTestCase { * @covers ::save * @dataProvider nestedDataProvider */ - public function testSaveNew($data) { + public function testSaveNew($data): void { $this->cacheTagsInvalidator->expects($this->never()) ->method('invalidateTags'); @@ -159,7 +159,7 @@ class ConfigTest extends UnitTestCase { * @covers ::save * @dataProvider nestedDataProvider */ - public function testSaveExisting($data) { + public function testSaveExisting($data): void { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['config:config.test']); @@ -183,7 +183,7 @@ class ConfigTest extends UnitTestCase { * @covers ::hasOverrides * @dataProvider overrideDataProvider */ - public function testOverrideData($data, $module_data, $setting_data) { + public function testOverrideData($data, $module_data, $setting_data): void { // Set initial data. $this->config->setData($data); @@ -253,7 +253,7 @@ class ConfigTest extends UnitTestCase { * @covers ::set * @dataProvider nestedDataProvider */ - public function testSetValue($data) { + public function testSetValue($data): void { foreach ($data as $key => $value) { $this->config->set($key, $value); } @@ -263,7 +263,7 @@ class ConfigTest extends UnitTestCase { /** * @covers ::set */ - public function testSetValidation() { + public function testSetValidation(): void { $this->expectException(ConfigValueException::class); $this->config->set('testData', ['dot.key' => 1]); } @@ -271,7 +271,7 @@ class ConfigTest extends UnitTestCase { /** * @covers ::set */ - public function testSetIllegalOffsetValue() { + public function testSetIllegalOffsetValue(): void { // Set a single value. $this->config->set('testData', 1); @@ -285,7 +285,7 @@ class ConfigTest extends UnitTestCase { * @covers ::initWithData * @dataProvider nestedDataProvider */ - public function testInitWithData($data) { + public function testInitWithData($data): void { $config = $this->config->initWithData($data); // Should return the Config object. @@ -308,7 +308,7 @@ class ConfigTest extends UnitTestCase { * @covers ::clear * @dataProvider simpleDataProvider */ - public function testClear($data) { + public function testClear($data): void { foreach ($data as $key => $value) { // Check that values are cleared. $this->config->set($key, $value); @@ -322,7 +322,7 @@ class ConfigTest extends UnitTestCase { * @covers ::clear * @dataProvider nestedDataProvider */ - public function testNestedClear($data) { + public function testNestedClear($data): void { foreach ($data as $key => $value) { // Check that values are cleared. $this->config->set($key, $value); @@ -340,7 +340,7 @@ class ConfigTest extends UnitTestCase { * @covers ::delete * @dataProvider overrideDataProvider */ - public function testDelete($data, $module_data) { + public function testDelete($data, $module_data): void { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['config:config.test']); @@ -385,7 +385,7 @@ class ConfigTest extends UnitTestCase { * @covers ::merge * @dataProvider mergeDataProvider */ - public function testMerge($data, $data_to_merge, $merged_data) { + public function testMerge($data, $data_to_merge, $merged_data): void { // Set initial data. $this->config->setData($data); @@ -418,7 +418,7 @@ class ConfigTest extends UnitTestCase { * @covers ::validateName * @dataProvider validateNameProvider */ - public function testValidateNameException($name, $exception_message) { + public function testValidateNameException($name, $exception_message): void { $this->expectException('\Drupal\Core\Config\ConfigNameException'); $this->expectExceptionMessage($exception_message); $this->config->validateName($name); @@ -427,7 +427,7 @@ class ConfigTest extends UnitTestCase { /** * @covers ::getCacheTags */ - public function testGetCacheTags() { + public function testGetCacheTags(): void { $this->assertSame(['config:' . $this->config->getName()], $this->config->getCacheTags()); } @@ -615,7 +615,7 @@ class ConfigTest extends UnitTestCase { * @covers ::set * @covers ::initWithData */ - public function testSafeStringHandling() { + public function testSafeStringHandling(): void { // Safe strings are cast when using ::set(). $safe_string = Markup::create('bar'); $this->config->set('foo', $safe_string); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigDependencyManagerTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigDependencyManagerTest.php index 1bf92c0ec49..587ccbcf48a 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigDependencyManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigDependencyManagerTest.php @@ -14,12 +14,12 @@ use Drupal\Core\Config\Entity\ConfigDependencyManager; */ class ConfigDependencyManagerTest extends UnitTestCase { - public function testNoConfiguration() { + public function testNoConfiguration(): void { $dep_manger = new ConfigDependencyManager(); $this->assertEmpty($dep_manger->getDependentEntities('config', 'config_test.dynamic.entity_id:745b0ce0-aece-42dd-a800-ade5b8455e84')); } - public function testNoConfigEntities() { + public function testNoConfigEntities(): void { $dep_manger = new ConfigDependencyManager(); $dep_manger->setData([ 'simple.config' => [ diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php index 35316ac0dcf..63e02c778f4 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php @@ -170,7 +170,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::calculateDependencies * @covers ::getDependencies */ - public function testCalculateDependencies() { + public function testCalculateDependencies(): void { // Calculating dependencies will reset the dependencies array. $this->entity->set('dependencies', ['module' => ['node']]); $this->assertEmpty($this->entity->calculateDependencies()->getDependencies()); @@ -186,7 +186,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::preSave */ - public function testPreSaveDuringSync() { + public function testPreSaveDuringSync(): void { $this->moduleHandler->moduleExists('node')->willReturn(TRUE); $query = $this->createMock('\Drupal\Core\Entity\Query\QueryInterface'); @@ -221,7 +221,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::addDependency */ - public function testAddDependency() { + public function testAddDependency(): void { $method = new \ReflectionMethod('\Drupal\Core\Config\Entity\ConfigEntityBase', 'addDependency'); $method->invoke($this->entity, 'module', static::PROVIDER); $method->invoke($this->entity, 'module', 'core'); @@ -334,7 +334,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::getDependencies * @covers ::onDependencyRemoval */ - public function testCalculateDependenciesWithThirdPartySettings() { + public function testCalculateDependenciesWithThirdPartySettings(): void { $this->entity = $this->getMockBuilder(ConfigEntityBaseMockableClass::class) ->setConstructorArgs([[], $this->entityTypeId]) ->onlyMethods([]) @@ -354,7 +354,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::__sleep */ - public function testSleepWithPluginCollections() { + public function testSleepWithPluginCollections(): void { $instance_id = 'the_instance_id'; $instance = new TestConfigurablePlugin([], $instance_id, []); @@ -393,7 +393,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::setOriginalId * @covers ::getOriginalId */ - public function testGetOriginalId() { + public function testGetOriginalId(): void { $new_id = $this->randomMachineName(); $this->entity->set('id', $new_id); $this->assertSame($this->id, $this->entity->getOriginalId()); @@ -413,7 +413,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::isNew */ - public function testIsNew() { + public function testIsNew(): void { $this->assertFalse($this->entity->isNew()); $this->assertSame($this->entity, $this->entity->enforceIsNew()); $this->assertTrue($this->entity->isNew()); @@ -425,7 +425,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::set * @covers ::get */ - public function testGet() { + public function testGet(): void { $name = 'id'; $value = $this->randomMachineName(); $this->assertSame($this->id, $this->entity->get($name)); @@ -437,7 +437,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::setStatus * @covers ::status */ - public function testSetStatus() { + public function testSetStatus(): void { $this->assertTrue($this->entity->status()); $this->assertSame($this->entity, $this->entity->setStatus(FALSE)); $this->assertFalse($this->entity->status()); @@ -449,7 +449,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::enable * @depends testSetStatus */ - public function testEnable() { + public function testEnable(): void { $this->entity->setStatus(FALSE); $this->assertSame($this->entity, $this->entity->enable()); $this->assertTrue($this->entity->status()); @@ -459,7 +459,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::disable * @depends testSetStatus */ - public function testDisable() { + public function testDisable(): void { $this->entity->setStatus(TRUE); $this->assertSame($this->entity, $this->entity->disable()); $this->assertFalse($this->entity->status()); @@ -469,7 +469,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::setSyncing * @covers ::isSyncing */ - public function testIsSyncing() { + public function testIsSyncing(): void { $this->assertFalse($this->entity->isSyncing()); $this->assertSame($this->entity, $this->entity->setSyncing(TRUE)); $this->assertTrue($this->entity->isSyncing()); @@ -480,7 +480,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::createDuplicate */ - public function testCreateDuplicate() { + public function testCreateDuplicate(): void { $this->entityType->expects($this->exactly(2)) ->method('getKey') ->willReturnMap([ @@ -512,7 +512,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::sort */ - public function testSort() { + public function testSort(): void { $this->entityTypeManager->expects($this->any()) ->method('getDefinition') ->with($this->entityTypeId) @@ -555,7 +555,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::toArray */ - public function testToArray() { + public function testToArray(): void { $this->typedConfigManager->expects($this->never()) ->method('getDefinition'); $this->entityType->expects($this->any()) @@ -569,7 +569,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::toArray */ - public function testToArrayIdKey() { + public function testToArrayIdKey(): void { $entity = $this->getMockBuilder(ConfigEntityBaseMockableClass::class) ->setConstructorArgs([[], $this->entityTypeId]) ->onlyMethods(['id', 'get']) @@ -602,7 +602,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { * @covers ::unsetThirdPartySetting * @covers ::getThirdPartyProviders */ - public function testThirdPartySettings() { + public function testThirdPartySettings(): void { $key = 'test'; $third_party = 'test_provider'; $value = $this->getRandomGenerator()->string(); @@ -632,7 +632,7 @@ class ConfigEntityBaseUnitTest extends UnitTestCase { /** * @covers ::toArray */ - public function testToArraySchemaException() { + public function testToArraySchemaException(): void { $this->entityType->expects($this->any()) ->method('getPropertiesToExport') ->willReturn(NULL); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityDependencyTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityDependencyTest.php index d41ac6d92c3..c367978ccb2 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityDependencyTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityDependencyTest.php @@ -14,7 +14,7 @@ use Drupal\Core\Config\Entity\ConfigEntityDependency; */ class ConfigEntityDependencyTest extends UnitTestCase { - public function testEmptyDependencies() { + public function testEmptyDependencies(): void { $dep = new ConfigEntityDependency('config_test.dynamic.entity_id', []); $this->assertEquals('config_test.dynamic.entity_id', $dep->getConfigDependencyName()); @@ -25,7 +25,7 @@ class ConfigEntityDependencyTest extends UnitTestCase { $this->assertFalse($dep->hasDependency('module', 'views')); } - public function testWithDependencies() { + public function testWithDependencies(): void { $values = [ 'uuid' => '60db47f4-54fb-4c86-a439-5769fbda4bd1', 'dependencies' => [ diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index 85b7461b6fb..ca7f7f05d27 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -170,7 +170,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::create * @covers ::doCreate */ - public function testCreateWithPredefinedUuid() { + public function testCreateWithPredefinedUuid(): void { $this->cacheTagsInvalidator->invalidateTags(Argument::cetera())->shouldNotBeCalled(); $entity = $this->getMockEntity(); @@ -227,7 +227,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::create * @covers ::doCreate */ - public function testCreateWithCurrentLanguage() { + public function testCreateWithCurrentLanguage(): void { $this->languageManager->getLanguage('hu')->willReturn(new Language(['id' => 'hu'])); $entity = $this->entityStorage->create(['id' => 'foo']); @@ -238,7 +238,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::create * @covers ::doCreate */ - public function testCreateWithExplicitLanguage() { + public function testCreateWithExplicitLanguage(): void { $this->languageManager->getLanguage('en')->willReturn(new Language(['id' => 'en'])); $entity = $this->entityStorage->create(['id' => 'foo', 'langcode' => 'en']); @@ -364,7 +364,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * * @depends testSaveInsert */ - public function testSaveRename(ConfigEntityInterface $entity) { + public function testSaveRename(ConfigEntityInterface $entity): void { $immutable_config_object = $this->prophesize(ImmutableConfig::class); $immutable_config_object->isNew()->willReturn(FALSE); @@ -410,7 +410,7 @@ class ConfigEntityStorageTest extends UnitTestCase { /** * @covers ::save */ - public function testSaveInvalid() { + public function testSaveInvalid(): void { $this->cacheTagsInvalidator->invalidateTags(Argument::cetera()) ->shouldNotBeCalled(); @@ -424,7 +424,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveDuplicate() { + public function testSaveDuplicate(): void { $config_object = $this->prophesize(ImmutableConfig::class); $config_object->isNew()->willReturn(FALSE); @@ -445,7 +445,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveMismatch() { + public function testSaveMismatch(): void { $config_object = $this->prophesize(ImmutableConfig::class); $config_object->isNew()->willReturn(TRUE); @@ -468,7 +468,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveNoMismatch() { + public function testSaveNoMismatch(): void { $immutable_config_object = $this->prophesize(ImmutableConfig::class); $immutable_config_object->isNew()->willReturn(TRUE); @@ -510,7 +510,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveChangedUuid() { + public function testSaveChangedUuid(): void { $config_object = $this->prophesize(ImmutableConfig::class); $config_object->get()->willReturn(['id' => 'foo']); $config_object->get('id')->willReturn('foo'); @@ -546,7 +546,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::mapFromStorageRecords * @covers ::doLoadMultiple */ - public function testLoad() { + public function testLoad(): void { $config_object = $this->prophesize(ImmutableConfig::class); $config_object->get()->willReturn(['id' => 'foo']); $config_object->get('id')->willReturn('foo'); @@ -573,7 +573,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::mapFromStorageRecords * @covers ::doLoadMultiple */ - public function testLoadMultipleAll() { + public function testLoadMultipleAll(): void { $foo_config_object = $this->prophesize(ImmutableConfig::class); $foo_config_object->get()->willReturn(['id' => 'foo']); $foo_config_object->get('id')->willReturn('foo'); @@ -611,7 +611,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::mapFromStorageRecords * @covers ::doLoadMultiple */ - public function testLoadMultipleIds() { + public function testLoadMultipleIds(): void { $config_object = $this->prophesize(ImmutableConfig::class); $config_object->get()->willReturn(['id' => 'foo']); $config_object->get('id')->willReturn('foo'); @@ -634,7 +634,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::delete * @covers ::doDelete */ - public function testDelete() { + public function testDelete(): void { // Dependencies are tested in // \Drupal\Tests\config\Kernel\ConfigDependencyTest. $this->configManager @@ -676,7 +676,7 @@ class ConfigEntityStorageTest extends UnitTestCase { * @covers ::delete * @covers ::doDelete */ - public function testDeleteNothing() { + public function testDeleteNothing(): void { $this->moduleHandler->invokeAll(Argument::cetera())->shouldNotBeCalled(); $this->configFactory->get(Argument::cetera())->shouldNotBeCalled(); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php index 9b22d95d0b6..b3b29d0d517 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php @@ -60,7 +60,7 @@ class ConfigEntityTypeTest extends UnitTestCase { * * @covers ::getConfigPrefix */ - public function testConfigPrefixLengthExceeds() { + public function testConfigPrefixLengthExceeds(): void { // A provider length of 24 and config_prefix length of 59 (+1 for the .) // results in a config length of 84, which is too long. $definition = [ @@ -81,7 +81,7 @@ class ConfigEntityTypeTest extends UnitTestCase { * * @covers ::getConfigPrefix */ - public function testConfigPrefixLengthValid() { + public function testConfigPrefixLengthValid(): void { // A provider length of 24 and config_prefix length of 58 (+1 for the .) // results in a config length of 83, which is right at the limit. $definition = [ @@ -96,7 +96,7 @@ class ConfigEntityTypeTest extends UnitTestCase { /** * @covers ::__construct */ - public function testConstruct() { + public function testConstruct(): void { $config_entity = new ConfigEntityType([ 'id' => 'example_config_entity_type', ]); @@ -106,7 +106,7 @@ class ConfigEntityTypeTest extends UnitTestCase { /** * @covers ::__construct */ - public function testConstructBadStorage() { + public function testConstructBadStorage(): void { $this->expectException(ConfigEntityStorageClassException::class); $this->expectExceptionMessage('\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it'); new ConfigEntityType([ @@ -118,7 +118,7 @@ class ConfigEntityTypeTest extends UnitTestCase { /** * @covers ::setStorageClass */ - public function testSetStorageClass() { + public function testSetStorageClass(): void { $config_entity = $this->setUpConfigEntityType([]); $this->expectException(ConfigEntityStorageClassException::class); $this->expectExceptionMessage('\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it'); @@ -132,7 +132,7 @@ class ConfigEntityTypeTest extends UnitTestCase { * * @covers ::getConfigPrefix */ - public function testGetConfigPrefix($definition, $expected) { + public function testGetConfigPrefix($definition, $expected): void { $entity_type = $this->setUpConfigEntityType($definition); $this->assertSame($expected, $entity_type->getConfigPrefix()); } @@ -152,7 +152,7 @@ class ConfigEntityTypeTest extends UnitTestCase { * * @dataProvider providerGetPropertiesToExport */ - public function testGetPropertiesToExport($definition, $expected) { + public function testGetPropertiesToExport($definition, $expected): void { $entity_type = $this->setUpConfigEntityType($definition); $properties_to_export = $entity_type->getPropertiesToExport(); $this->assertSame($expected, $properties_to_export); @@ -202,7 +202,7 @@ class ConfigEntityTypeTest extends UnitTestCase { /** * @covers ::getPropertiesToExport */ - public function testGetPropertiesToExportNoFallback() { + public function testGetPropertiesToExportNoFallback(): void { $config_entity_type = new ConfigEntityType([ 'id' => 'example_config_entity_type', ]); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php index 010bc319174..a45e3d10bd2 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayBaseTest.php @@ -34,7 +34,7 @@ class EntityDisplayBaseTest extends UnitTestCase { /** * @covers ::getTargetEntityTypeId */ - public function testGetTargetEntityTypeId() { + public function testGetTargetEntityTypeId(): void { $reflection = new \ReflectionProperty($this->entityDisplay, 'targetEntityType'); $reflection->setValue($this->entityDisplay, 'test'); $this->assertEquals('test', $this->entityDisplay->getTargetEntityTypeId()); @@ -43,7 +43,7 @@ class EntityDisplayBaseTest extends UnitTestCase { /** * @covers ::getMode */ - public function testGetMode() { + public function testGetMode(): void { $reflection = new \ReflectionProperty($this->entityDisplay, 'mode'); $reflection->setValue($this->entityDisplay, 'test'); $this->assertEquals('test', $this->entityDisplay->getMode()); @@ -52,7 +52,7 @@ class EntityDisplayBaseTest extends UnitTestCase { /** * @covers ::getOriginalMode */ - public function testGetOriginalMode() { + public function testGetOriginalMode(): void { $reflection = new \ReflectionProperty($this->entityDisplay, 'originalMode'); $reflection->setValue($this->entityDisplay, 'test'); $this->assertEquals('test', $this->entityDisplay->getOriginalMode()); @@ -61,7 +61,7 @@ class EntityDisplayBaseTest extends UnitTestCase { /** * @covers ::getTargetBundle */ - public function testGetTargetBundle() { + public function testGetTargetBundle(): void { $reflection = new \ReflectionProperty($this->entityDisplay, 'bundle'); $reflection->setValue($this->entityDisplay, 'test'); $this->assertEquals('test', $this->entityDisplay->getTargetBundle()); @@ -70,7 +70,7 @@ class EntityDisplayBaseTest extends UnitTestCase { /** * @covers ::setTargetBundle */ - public function testSetTargetBundle() { + public function testSetTargetBundle(): void { $reflection = new \ReflectionProperty($this->entityDisplay, 'bundle'); $this->entityDisplay->setTargetBundle('test'); $this->assertEquals('test', $reflection->getValue($this->entityDisplay)); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php index c71a84836c3..8cf5161535a 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php @@ -77,7 +77,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase { /** * @covers ::calculateDependencies */ - public function testCalculateDependencies() { + public function testCalculateDependencies(): void { $target_entity_type_id = $this->randomMachineName(16); $target_entity_type = $this->createMock('\Drupal\Core\Entity\EntityTypeInterface'); @@ -101,7 +101,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase { /** * @covers ::setTargetType */ - public function testSetTargetType() { + public function testSetTargetType(): void { // Generate mock. $mock = $this->getMockBuilder('Drupal\Core\Entity\EntityDisplayModeBase') ->onlyMethods([]) @@ -128,7 +128,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase { /** * @covers ::getTargetType */ - public function testGetTargetType() { + public function testGetTargetType(): void { // Generate mock. $mock = $this->getMockBuilder('Drupal\Core\Entity\EntityDisplayModeBase') ->onlyMethods([]) diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php index f46f41db513..f8a36d4cc20 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php @@ -105,7 +105,7 @@ class QueryFactoryTest extends UnitTestCase { * @covers ::getKeys * @covers ::getValues */ - public function testGetKeysWildCardEnd() { + public function testGetKeysWildCardEnd(): void { $config_factory = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface'); $key_value_factory = $this->createMock('Drupal\Core\KeyValueStore\KeyValueFactoryInterface'); $config_manager = $this->createMock('Drupal\Core\Config\ConfigManagerInterface'); diff --git a/core/tests/Drupal/Tests/Core/Config/ExtensionInstallStorageTest.php b/core/tests/Drupal/Tests/Core/Config/ExtensionInstallStorageTest.php index 4444073b087..94254800e37 100644 --- a/core/tests/Drupal/Tests/Core/Config/ExtensionInstallStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ExtensionInstallStorageTest.php @@ -19,7 +19,7 @@ class ExtensionInstallStorageTest extends UnitTestCase { /** * @covers ::createCollection */ - public function testCreateCollection() { + public function testCreateCollection(): void { $memory = new MemoryStorage(); $include_profile = FALSE; $profile = $this->randomMachineName(); diff --git a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php index 29375c3e525..0b32fdbc718 100644 --- a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php @@ -35,7 +35,7 @@ class ImmutableConfigTest extends UnitTestCase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { $this->expectException(ImmutableConfigException::class); $this->expectExceptionMessage('Can not set values on immutable configuration test:name. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); $this->config->set('name', 'value'); @@ -44,7 +44,7 @@ class ImmutableConfigTest extends UnitTestCase { /** * @covers ::clear */ - public function testClear() { + public function testClear(): void { $this->expectException(ImmutableConfigException::class); $this->expectExceptionMessage('Can not clear name key in immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); $this->config->clear('name'); @@ -53,7 +53,7 @@ class ImmutableConfigTest extends UnitTestCase { /** * @covers ::save */ - public function testSave() { + public function testSave(): void { $this->expectException(ImmutableConfigException::class); $this->expectExceptionMessage('Can not save immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); $this->config->save(); @@ -62,7 +62,7 @@ class ImmutableConfigTest extends UnitTestCase { /** * @covers ::delete */ - public function testDelete() { + public function testDelete(): void { $this->expectException(ImmutableConfigException::class); $this->expectExceptionMessage('Can not delete immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); $this->config->delete(); diff --git a/core/tests/Drupal/Tests/Core/Config/NullStorageTest.php b/core/tests/Drupal/Tests/Core/Config/NullStorageTest.php index 1a8f9228787..b81cf2c24fc 100644 --- a/core/tests/Drupal/Tests/Core/Config/NullStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/NullStorageTest.php @@ -18,7 +18,7 @@ class NullStorageTest extends UnitTestCase { /** * Tests createCollection. */ - public function testCollection() { + public function testCollection(): void { $nullStorage = new NullStorage(); $collection = $nullStorage->createCollection('test'); $this->assertInstanceOf(StorageInterface::class, $collection); diff --git a/core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php b/core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php index 980d5fd4721..7d5dc0eed6b 100644 --- a/core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php @@ -53,7 +53,7 @@ class ReadOnlyStorageTest extends UnitTestCase { * * @dataProvider readMethodsProvider */ - public function testReadOperations($method, $arguments, $fixture) { + public function testReadOperations($method, $arguments, $fixture): void { $this->setRandomFixtureConfig($fixture); $expected = call_user_func_array([$this->memory, $method], $arguments); @@ -93,7 +93,7 @@ class ReadOnlyStorageTest extends UnitTestCase { * * @dataProvider writeMethodsProvider */ - public function testWriteOperations($method, $arguments, $fixture) { + public function testWriteOperations($method, $arguments, $fixture): void { $this->setRandomFixtureConfig($fixture); // Create an independent memory storage as a backup. @@ -143,7 +143,7 @@ class ReadOnlyStorageTest extends UnitTestCase { * @covers ::getCollectionName * @covers ::createCollection */ - public function testCollections() { + public function testCollections(): void { $fixture = [ StorageInterface::DEFAULT_COLLECTION => [$this->randomMachineName()], 'A' => [$this->randomMachineName()], @@ -165,7 +165,7 @@ class ReadOnlyStorageTest extends UnitTestCase { * @covers ::encode * @covers ::decode */ - public function testEncodeDecode() { + public function testEncodeDecode(): void { $array = (array) $this->getRandomGenerator()->object(); $string = $this->getRandomGenerator()->string(); diff --git a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php index a3c7e63fea2..a9f0a881ce1 100644 --- a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php +++ b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php @@ -110,7 +110,7 @@ class StorageComparerTest extends UnitTestCase { /** * @covers ::createChangelist */ - public function testCreateChangelistNoChange() { + public function testCreateChangelistNoChange(): void { $config_data = $this->getConfigData(); $config_files = array_keys($config_data); $this->sourceStorage->expects($this->once()) @@ -141,7 +141,7 @@ class StorageComparerTest extends UnitTestCase { /** * @covers ::createChangelist */ - public function testCreateChangelistCreate() { + public function testCreateChangelistCreate(): void { $target_data = $source_data = $this->getConfigData(); unset($target_data['field.storage.node.body']); unset($target_data['field.field.node.article.body']); @@ -180,7 +180,7 @@ class StorageComparerTest extends UnitTestCase { /** * @covers ::createChangelist */ - public function testCreateChangelistDelete() { + public function testCreateChangelistDelete(): void { $target_data = $source_data = $this->getConfigData(); unset($source_data['field.storage.node.body']); unset($source_data['field.field.node.article.body']); @@ -219,7 +219,7 @@ class StorageComparerTest extends UnitTestCase { /** * @covers ::createChangelist */ - public function testCreateChangelistUpdate() { + public function testCreateChangelistUpdate(): void { $target_data = $source_data = $this->getConfigData(); $source_data['system.site']['title'] = 'Drupal New!'; $source_data['field.field.node.article.body']['new_config_key'] = 'new data'; @@ -258,7 +258,7 @@ class StorageComparerTest extends UnitTestCase { /** * @covers ::createChangelist */ - public function testDifferentCollections() { + public function testDifferentCollections(): void { $source = new MemoryStorage(); $target = new MemoryStorage(); diff --git a/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php b/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php index 2dc0b1fd0ca..ef2e486a54d 100644 --- a/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php @@ -26,7 +26,7 @@ class StorageCopyTraitTest extends UnitTestCase { * * @dataProvider providerTestReplaceStorageContents */ - public function testReplaceStorageContents($source_collections, $target_collections) { + public function testReplaceStorageContents($source_collections, $target_collections): void { $source = new MemoryStorage(); $target = new MemoryStorage(); // Empty the storage should be the same. @@ -121,7 +121,7 @@ class StorageCopyTraitTest extends UnitTestCase { * * @covers ::replaceStorageContents */ - public function testWithInvalidConfiguration() { + public function testWithInvalidConfiguration(): void { $source = new TestStorage(); $this->generateRandomData($source); diff --git a/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php b/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php index a1d4e38e27f..c6e1e92df25 100644 --- a/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php @@ -68,7 +68,7 @@ class AjaxRendererTest extends UnitTestCase { * * @covers ::renderResponse */ - public function testRenderWithFragmentObject() { + public function testRenderWithFragmentObject(): void { $main_content = ['#markup' => 'example content']; $request = new Request(); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php index 0ddb46e121a..6e58e56896a 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerBaseTest.php @@ -32,7 +32,7 @@ class ControllerBaseTest extends UnitTestCase { /** * Tests the config method. */ - public function testGetConfig() { + public function testGetConfig(): void { $config_factory = $this->getConfigFactoryStub([ 'config_name' => [ 'key' => 'value', diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php index bfc368dd08d..4634e966fe9 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -52,7 +52,7 @@ class ControllerResolverTest extends UnitTestCase { * * @dataProvider providerTestCreateController */ - public function testCreateController($controller, $class, $output) { + public function testCreateController($controller, $class, $output): void { $this->container->set('some_service', new MockController()); $result = $this->controllerResolver->getControllerFromDefinition($controller); $this->assertCallableController($result, $class, $output); @@ -75,7 +75,7 @@ class ControllerResolverTest extends UnitTestCase { /** * Tests createController() with a non-existent class. */ - public function testCreateControllerNonExistentClass() { + public function testCreateControllerNonExistentClass(): void { $this->expectException(\InvalidArgumentException::class); $this->controllerResolver->getControllerFromDefinition('Class::method'); } @@ -83,7 +83,7 @@ class ControllerResolverTest extends UnitTestCase { /** * Tests createController() with an invalid name. */ - public function testCreateControllerInvalidName() { + public function testCreateControllerInvalidName(): void { $this->expectException(\LogicException::class); $this->controllerResolver->getControllerFromDefinition('ClassWithoutMethod'); } @@ -93,7 +93,7 @@ class ControllerResolverTest extends UnitTestCase { * * @dataProvider providerTestGetController */ - public function testGetController($attributes, $class, $output = NULL) { + public function testGetController($attributes, $class, $output = NULL): void { $request = new Request([], [], $attributes); $result = $this->controllerResolver->getController($request); if ($class) { @@ -125,7 +125,7 @@ class ControllerResolverTest extends UnitTestCase { * * @dataProvider providerTestGetControllerFromDefinition */ - public function testGetControllerFromDefinition($definition, $output) { + public function testGetControllerFromDefinition($definition, $output): void { $this->container->set('invoke_service', new MockInvokeController()); $controller = $this->controllerResolver->getControllerFromDefinition($definition); $this->assertCallableController($controller, NULL, $output); @@ -152,7 +152,7 @@ class ControllerResolverTest extends UnitTestCase { /** * Tests getControllerFromDefinition() without a callable. */ - public function testGetControllerFromDefinitionNotCallable() { + public function testGetControllerFromDefinitionNotCallable(): void { $this->expectException(\InvalidArgumentException::class); $this->controllerResolver->getControllerFromDefinition('Drupal\Tests\Core\Controller\MockController::bananas'); } diff --git a/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php index 7ce370711b8..f27c647a047 100644 --- a/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php @@ -63,7 +63,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testStaticTitle() { + public function testStaticTitle(): void { $request = new Request(); $route = new Route('/test-route', ['_title' => 'static title']); $this->assertEquals(new TranslatableMarkup('static title', [], [], $this->translationManager), $this->titleResolver->getTitle($request, $route)); @@ -74,7 +74,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testStaticTitleZero() { + public function testStaticTitleZero(): void { $request = new Request(); $route = new Route('/test-route', ['_title' => '0', '_title_context' => '0']); $this->assertEquals(new TranslatableMarkup('0', [], ['context' => '0'], $this->translationManager), $this->titleResolver->getTitle($request, $route)); @@ -85,7 +85,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testStaticTitleWithContext() { + public function testStaticTitleWithContext(): void { $request = new Request(); $route = new Route('/test-route', ['_title' => 'static title', '_title_context' => 'context']); $this->assertEquals(new TranslatableMarkup('static title', [], ['context' => 'context'], $this->translationManager), $this->titleResolver->getTitle($request, $route)); @@ -96,7 +96,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testStaticTitleWithParameter() { + public function testStaticTitleWithParameter(): void { $raw_variables = new InputBag(['test' => 'value', 'test2' => 'value2']); $request = new Request(); $request->attributes->set('_raw_variables', $raw_variables); @@ -113,7 +113,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testStaticTitleWithNullAndArrayValueParameter() { + public function testStaticTitleWithNullAndArrayValueParameter(): void { $raw_variables = new InputBag(['test1' => NULL, 'test2' => ['foo' => 'bar'], 'test3' => 'value']); $request = new Request(); $request->attributes->set('_raw_variables', $raw_variables); @@ -134,7 +134,7 @@ class TitleResolverTest extends UnitTestCase { * * @see \Drupal\Core\Controller\TitleResolver::getTitle() */ - public function testDynamicTitle() { + public function testDynamicTitle(): void { $request = new Request(); $route = new Route('/test-route', ['_title' => 'static title', '_title_callback' => 'Drupal\Tests\Core\Controller\TitleCallback::example']); diff --git a/core/tests/Drupal/Tests/Core/CronTest.php b/core/tests/Drupal/Tests/Core/CronTest.php index d10be2b26f0..6326f4c38d6 100644 --- a/core/tests/Drupal/Tests/Core/CronTest.php +++ b/core/tests/Drupal/Tests/Core/CronTest.php @@ -192,7 +192,7 @@ class CronTest extends UnitTestCase { * @covers ::processQueues * @dataProvider processQueuesTestData */ - public function testProcessQueues($item, $message_logged_assertion, $count_post_run) { + public function testProcessQueues($item, $message_logged_assertion, $count_post_run): void { $this->resetTestingState(); $this->queue->createItem($item); $this->assertFalse($this->state->get('cron_test.message_logged')); @@ -205,7 +205,7 @@ class CronTest extends UnitTestCase { /** * Verify that RequeueException causes an item to be processed multiple times. */ - public function testRequeueException() { + public function testRequeueException(): void { $this->resetTestingState(); $this->queue->createItem('RequeueException'); $this->cron->run(); diff --git a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php index 908b6265028..9cda46bd7b3 100644 --- a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php @@ -39,7 +39,7 @@ class ConditionTest extends UnitTestCase { * @covers ::compile * @dataProvider providerSimpleCondition */ - public function testSimpleCondition($expected, $field_name) { + public function testSimpleCondition($expected, $field_name): void { $connection = $this->prophesize(Connection::class); $connection->escapeField($field_name)->will(function ($args) { return preg_replace('/[^A-Za-z0-9_.]+/', '', $args[0]); @@ -81,7 +81,7 @@ class ConditionTest extends UnitTestCase { * @param mixed $expected_arguments * (optional) The expected set arguments. */ - public function testCompileWithKnownOperators($expected, $field, $value, $operator, $expected_arguments = NULL) { + public function testCompileWithKnownOperators($expected, $field, $value, $operator, $expected_arguments = NULL): void { $connection = $this->prophesize(Connection::class); $connection->escapeField(Argument::any())->will(function ($args) { return preg_replace('/[^A-Za-z0-9_.]+/', '', $args[0]); @@ -150,7 +150,7 @@ class ConditionTest extends UnitTestCase { * * @dataProvider providerTestCompileWithSqlInjectionForOperator */ - public function testCompileWithSqlInjectionForOperator($operator) { + public function testCompileWithSqlInjectionForOperator($operator): void { $connection = $this->prophesize(Connection::class); $connection->escapeField(Argument::any())->will(function ($args) { return preg_replace('/[^A-Za-z0-9_.]+/', '', $args[0]); @@ -188,7 +188,7 @@ class ConditionTest extends UnitTestCase { /** * Tests that the core Condition can be overridden. */ - public function testContribCondition() { + public function testContribCondition(): void { $connection = new StubConnection($this->createMock(StubPDO::class), [ 'namespace' => 'Drupal\mock\Driver\Database\mock', 'prefix' => '', diff --git a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php index fc3a4ddb519..7e9ae828063 100644 --- a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php @@ -50,7 +50,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider providerPrefixRoundTrip */ - public function testPrefixRoundTrip($expected, $prefix_info) { + public function testPrefixRoundTrip($expected, $prefix_info): void { $mock_pdo = $this->createMock('Drupal\Tests\Core\Database\Stub\StubPDO'); $connection = new StubConnection($mock_pdo, []); @@ -110,7 +110,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider providerTestPrefixTables */ - public function testPrefixTables($expected, $prefix_info, $query, array $quote_identifier = ['"', '"']) { + public function testPrefixTables($expected, $prefix_info, $query, array $quote_identifier = ['"', '"']): void { $mock_pdo = $this->createMock('Drupal\Tests\Core\Database\Stub\StubPDO'); $connection = new StubConnection($mock_pdo, ['prefix' => $prefix_info], $quote_identifier); $this->assertEquals($expected, $connection->prefixTables($query)); @@ -319,7 +319,7 @@ class ConnectionTest extends UnitTestCase { * @dataProvider providerGetDriverClass * @group legacy */ - public function testGetDriverClass($expected, $namespace, $class) { + public function testGetDriverClass($expected, $namespace, $class): void { $additional_class_loader = new ClassLoader(); $additional_class_loader->addPsr4("Drupal\\core_fake\\Driver\\Database\\CoreFake\\", __DIR__ . "/../../../../../tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFake"); $additional_class_loader->addPsr4("Drupal\\core_fake\\Driver\\Database\\CoreFakeWithAllCustomClasses\\", __DIR__ . "/../../../../../tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses"); @@ -369,7 +369,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider providerSchema */ - public function testSchema($expected, $driver, $namespace) { + public function testSchema($expected, $driver, $namespace): void { $mock_pdo = $this->createMock('Drupal\Tests\Core\Database\Stub\StubPDO'); $connection = new StubConnection($mock_pdo, ['namespace' => $namespace]); $connection->driver = $driver; @@ -406,7 +406,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider providerMakeComments */ - public function testMakeComments($expected, $comment_array) { + public function testMakeComments($expected, $comment_array): void { $mock_pdo = $this->createMock('Drupal\Tests\Core\Database\Stub\StubPDO'); $connection = new StubConnection($mock_pdo, []); $this->assertEquals($expected, $connection->makeComment($comment_array)); @@ -433,7 +433,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider providerFilterComments */ - public function testFilterComments($expected, $comment) { + public function testFilterComments($expected, $comment): void { $mock_pdo = $this->createMock('Drupal\Tests\Core\Database\Stub\StubPDO'); $connection = new StubConnection($mock_pdo, []); @@ -475,7 +475,7 @@ class ConnectionTest extends UnitTestCase { * @covers ::escapeTable * @dataProvider providerEscapeTables */ - public function testEscapeTable($expected, $name, array $identifier_quote = ['"', '"']) { + public function testEscapeTable($expected, $name, array $identifier_quote = ['"', '"']): void { $mock_pdo = $this->createMock(StubPDO::class); $connection = new StubConnection($mock_pdo, [], $identifier_quote); @@ -506,7 +506,7 @@ class ConnectionTest extends UnitTestCase { * @covers ::escapeAlias * @dataProvider providerEscapeAlias */ - public function testEscapeAlias($expected, $name, array $identifier_quote = ['"', '"']) { + public function testEscapeAlias($expected, $name, array $identifier_quote = ['"', '"']): void { $mock_pdo = $this->createMock(StubPDO::class); $connection = new StubConnection($mock_pdo, [], $identifier_quote); @@ -540,7 +540,7 @@ class ConnectionTest extends UnitTestCase { * @covers ::escapeField * @dataProvider providerEscapeFields */ - public function testEscapeField($expected, $name, array $identifier_quote = ['"', '"']) { + public function testEscapeField($expected, $name, array $identifier_quote = ['"', '"']): void { $mock_pdo = $this->createMock(StubPDO::class); $connection = new StubConnection($mock_pdo, [], $identifier_quote); @@ -569,7 +569,7 @@ class ConnectionTest extends UnitTestCase { * @covers ::escapeDatabase * @dataProvider providerEscapeDatabase */ - public function testEscapeDatabase($expected, $name, array $identifier_quote = ['"', '"']) { + public function testEscapeDatabase($expected, $name, array $identifier_quote = ['"', '"']): void { $mock_pdo = $this->createMock(StubPDO::class); $connection = new StubConnection($mock_pdo, [], $identifier_quote); @@ -579,7 +579,7 @@ class ConnectionTest extends UnitTestCase { /** * @covers ::__construct */ - public function testIdentifierQuotesAssertCount() { + public function testIdentifierQuotesAssertCount(): void { $this->expectException(\AssertionError::class); $this->expectExceptionMessage('\Drupal\Core\Database\Connection::$identifierQuotes must contain 2 string values'); $mock_pdo = $this->createMock(StubPDO::class); @@ -589,7 +589,7 @@ class ConnectionTest extends UnitTestCase { /** * @covers ::__construct */ - public function testIdentifierQuotesAssertString() { + public function testIdentifierQuotesAssertString(): void { $this->expectException(\AssertionError::class); $this->expectExceptionMessage('\Drupal\Core\Database\Connection::$identifierQuotes must contain 2 string values'); $mock_pdo = $this->createMock(StubPDO::class); @@ -599,7 +599,7 @@ class ConnectionTest extends UnitTestCase { /** * @covers ::__construct */ - public function testNamespaceDefault() { + public function testNamespaceDefault(): void { $mock_pdo = $this->createMock(StubPDO::class); $connection = new StubConnection($mock_pdo, []); $this->assertSame('Drupal\Tests\Core\Database\Stub', $connection->getConnectionOptions()['namespace']); @@ -610,7 +610,7 @@ class ConnectionTest extends UnitTestCase { * * @dataProvider provideQueriesToTrim */ - public function testQueryTrim($expected, $query, $options) { + public function testQueryTrim($expected, $query, $options): void { $mock_pdo = $this->getMockBuilder(StubPdo::class)->getMock(); $connection = new StubConnection($mock_pdo, []); @@ -669,7 +669,7 @@ class ConnectionTest extends UnitTestCase { * @covers ::removeDatabaseEntriesFromDebugBacktrace * @covers ::getDebugBacktrace */ - public function testFindCallerFromDebugBacktrace() { + public function testFindCallerFromDebugBacktrace(): void { Database::addConnectionInfo('default', 'default', [ 'driver' => 'test', 'namespace' => 'Drupal\Tests\Core\Database\Stub', diff --git a/core/tests/Drupal/Tests/Core/Database/OrderByTest.php b/core/tests/Drupal/Tests/Core/Database/OrderByTest.php index f6b21a04c24..a031d24d495 100644 --- a/core/tests/Drupal/Tests/Core/Database/OrderByTest.php +++ b/core/tests/Drupal/Tests/Core/Database/OrderByTest.php @@ -37,7 +37,7 @@ class OrderByTest extends UnitTestCase { /** * Checks that invalid sort directions in ORDER BY get converted to ASC. */ - public function testInvalidDirection() { + public function testInvalidDirection(): void { $this->query->orderBy('test', 'invalid direction'); $order_bys = $this->query->getOrderBy(); $this->assertEquals('ASC', $order_bys['test'], 'Invalid order by direction is converted to ASC.'); @@ -46,7 +46,7 @@ class OrderByTest extends UnitTestCase { /** * Tests that fields passed for ordering get escaped properly. */ - public function testFieldEscaping() { + public function testFieldEscaping(): void { $this->query->orderBy('x; DROP table node; --'); $sql = $this->query->__toString(); $this->assertStringEndsWith('ORDER BY xDROPtablenode ASC', $sql, 'Order by field is escaped correctly.'); diff --git a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php index aa978be52e6..411bec228ea 100644 --- a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php @@ -35,7 +35,7 @@ class RowCountExceptionTest extends UnitTestCase { * @covers ::__construct * @dataProvider providerTestExceptionMessage */ - public function testExceptionMessage($expected, $message) { + public function testExceptionMessage($expected, $message): void { $e = new RowCountException($message); $this->assertSame($expected, $e->getMessage()); } @@ -44,7 +44,7 @@ class RowCountExceptionTest extends UnitTestCase { * @covers ::__construct * @group legacy */ - public function testExceptionMessageNull() { + public function testExceptionMessageNull(): void { $e = new RowCountException(NULL); $this->assertSame(static::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage()); } diff --git a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php index c2e8f135233..4548ed42c3d 100644 --- a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php @@ -28,7 +28,7 @@ class UrlConversionTest extends UnitTestCase { * * @dataProvider providerConvertDbUrlToConnectionInfo */ - public function testDbUrlToConnectionConversion($url, $database_array, $include_test_drivers) { + public function testDbUrlToConnectionConversion($url, $database_array, $include_test_drivers): void { $result = Database::convertDbUrlToConnectionInfo($url, $this->root, $include_test_drivers); $this->assertEquals($database_array, $result); } @@ -278,7 +278,7 @@ class UrlConversionTest extends UnitTestCase { * * @dataProvider providerInvalidArgumentsUrlConversion */ - public function testGetInvalidArgumentExceptionInUrlConversion($url, $root, $expected_exception_message) { + public function testGetInvalidArgumentExceptionInUrlConversion($url, $root, $expected_exception_message): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage($expected_exception_message); Database::convertDbUrlToConnectionInfo($url, $root); @@ -310,7 +310,7 @@ class UrlConversionTest extends UnitTestCase { * * @dataProvider providerGetConnectionInfoAsUrl */ - public function testGetConnectionInfoAsUrl(array $info, $expected_url) { + public function testGetConnectionInfoAsUrl(array $info, $expected_url): void { Database::addConnectionInfo('default', 'default', $info); $url = Database::getConnectionInfoAsUrl(); $this->assertEquals($expected_url, $url); @@ -461,7 +461,7 @@ class UrlConversionTest extends UnitTestCase { * * @dataProvider providerInvalidArgumentGetConnectionInfoAsUrl */ - public function testGetInvalidArgumentGetConnectionInfoAsUrl(array $connection_options, $expected_exception_message) { + public function testGetInvalidArgumentGetConnectionInfoAsUrl(array $connection_options, $expected_exception_message): void { Database::addConnectionInfo('default', 'default', $connection_options); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage($expected_exception_message); @@ -493,7 +493,7 @@ class UrlConversionTest extends UnitTestCase { /** * @covers ::convertDbUrlToConnectionInfo */ - public function testDriverModuleDoesNotExist() { + public function testDriverModuleDoesNotExist(): void { $url = 'foo_bar_mysql://test_user:test_pass@test_host:3306/test_database?module=foo_bar'; $this->expectException(UnknownExtensionException::class); $this->expectExceptionMessage("The database_driver Drupal\\foo_bar\\Driver\\Database\\foo_bar_mysql does not exist."); @@ -503,7 +503,7 @@ class UrlConversionTest extends UnitTestCase { /** * @covers ::convertDbUrlToConnectionInfo */ - public function testModuleDriverDoesNotExist() { + public function testModuleDriverDoesNotExist(): void { $url = 'driver_test_mysql://test_user:test_pass@test_host:3306/test_database?module=driver_test'; $this->expectException(UnknownExtensionException::class); $this->expectExceptionMessage("The database_driver Drupal\\driver_test\\Driver\\Database\\driver_test_mysql does not exist."); diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php index 40111e41eec..432b9bc083d 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php @@ -49,7 +49,7 @@ class DateHelperTest extends UnitTestCase { * @covers ::weekDaysOrdered * @dataProvider providerTestWeekDaysOrdered */ - public function testWeekDaysOrdered($first_day, $expected) { + public function testWeekDaysOrdered($first_day, $expected): void { $container = new ContainerBuilder(); $config = ['system.date' => ['first_day' => $first_day]]; $container->set('config.factory', $this->getConfigFactoryStub($config)); @@ -164,7 +164,7 @@ class DateHelperTest extends UnitTestCase { /** * @covers ::daysInMonth */ - public function testDaysInMonth() { + public function testDaysInMonth(): void { // @todo Consider deprecating passing NULL in // https://www.drupal.org/project/drupal/issues/3299788 // Passing NULL, FALSE, or an empty string should default to now. Just @@ -189,7 +189,7 @@ class DateHelperTest extends UnitTestCase { /** * @covers ::daysInYear */ - public function testDaysInYear() { + public function testDaysInYear(): void { // Passing NULL, FALSE, or an empty string should default to now. Just // check these are NOT null to avoid copying the implementation here. $this->assertNotNull(DateHelper::daysInYear()); @@ -213,7 +213,7 @@ class DateHelperTest extends UnitTestCase { /** * @covers ::dayOfWeek */ - public function testDayOfWeek() { + public function testDayOfWeek(): void { // Passing NULL, FALSE, or an empty string should default to now. Just // check these are NOT null to avoid copying the implementation here. $this->assertNotNull(DateHelper::dayOfWeek()); @@ -238,7 +238,7 @@ class DateHelperTest extends UnitTestCase { /** * @covers ::dayOfWeekName */ - public function testDayOfWeekName() { + public function testDayOfWeekName(): void { // Passing NULL, FALSE, or an empty string should default to now. Just // check these are NOT null to avoid copying the implementation here. $this->assertNotNull(DateHelper::dayOfWeekName()); diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php index a31757d9ef8..f049ecf5a4c 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php @@ -102,7 +102,7 @@ class DateTest extends UnitTestCase { * * @covers ::formatInterval */ - public function testFormatInterval($interval, $granularity, $expected, $langcode = NULL) { + public function testFormatInterval($interval, $granularity, $expected, $langcode = NULL): void { // Mocks a simple formatPlural implementation. $this->stringTranslation->expects($this->any()) ->method('translateString') @@ -159,7 +159,7 @@ class DateTest extends UnitTestCase { /** * Tests the formatInterval method for 0 second. */ - public function testFormatIntervalZeroSecond() { + public function testFormatIntervalZeroSecond(): void { $result = $this->dateFormatter->formatInterval(0, 1, 'xxx-lolspeak'); $this->assertEquals(new TranslatableMarkup('0 sec', [], ['langcode' => 'xxx-lolspeak'], $this->stringTranslation), $result); } @@ -169,7 +169,7 @@ class DateTest extends UnitTestCase { * * @covers \Drupal\Core\Datetime\DateFormatter::getSampleDateFormats */ - public function testGetSampleDateFormats() { + public function testGetSampleDateFormats(): void { $timestamp = strtotime('2015-03-22 14:23:00'); $expected = $this->dateFormatter->getSampleDateFormats('en', $timestamp, 'Australia/Sydney'); @@ -189,7 +189,7 @@ class DateTest extends UnitTestCase { * * @covers ::formatTimeDiffUntil */ - public function testFormatTimeDiffUntil() { + public function testFormatTimeDiffUntil(): void { $expected = '1 second'; $request_time = self::createTimestamp('2013-12-11 10:09:08'); $timestamp = self::createTimestamp('2013-12-11 10:09:09'); @@ -222,7 +222,7 @@ class DateTest extends UnitTestCase { * * @covers ::formatTimeDiffSince */ - public function testFormatTimeDiffSince() { + public function testFormatTimeDiffSince(): void { $expected = '1 second'; $timestamp = self::createTimestamp('2013-12-11 10:09:07'); $request_time = self::createTimestamp('2013-12-11 10:09:08'); @@ -404,7 +404,7 @@ class DateTest extends UnitTestCase { * @covers \Drupal\Core\Datetime\FormattedDateDiff::getString * @covers \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge */ - public function testFormattedDateDiff() { + public function testFormattedDateDiff(): void { $string = '10 minutes'; $max_age = 60; $object = new FormattedDateDiff($string, $max_age); diff --git a/core/tests/Drupal/Tests/Core/Datetime/DrupalDateTimeTest.php b/core/tests/Drupal/Tests/Core/Datetime/DrupalDateTimeTest.php index b523f4e0aaf..150c3b2d4ed 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DrupalDateTimeTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DrupalDateTimeTest.php @@ -30,7 +30,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @dataProvider providerTestDateDiff */ - public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected) { + public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected): void { $interval = $input1->diff($input2, $absolute); $this->assertEquals($interval, $expected); } @@ -47,7 +47,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @dataProvider providerTestInvalidDateDiff */ - public function testInvalidDateDiff($input1, $input2, $absolute) { + public function testInvalidDateDiff($input1, $input2, $absolute): void { $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Method Drupal\Component\Datetime\DateTimePlus::diff expects parameter 1 to be a \DateTime or \Drupal\Component\Datetime\DateTimePlus object'); $interval = $input1->diff($input2, $absolute); @@ -165,7 +165,7 @@ class DrupalDateTimeTest extends UnitTestCase { /** * Tests setting the default time for date-only objects. */ - public function testDefaultDateTime() { + public function testDefaultDateTime(): void { $utc = new \DateTimeZone('UTC'); $date = DrupalDateTime::createFromFormat('Y-m-d H:i:s', '2017-05-23 22:58:00', $utc, ['langcode' => 'en']); @@ -179,7 +179,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @covers ::__call */ - public function testChainable() { + public function testChainable(): void { $tz = new \DateTimeZone(date_default_timezone_get()); $date = new DrupalDateTime('now', $tz, ['langcode' => 'en']); @@ -197,7 +197,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @covers ::__call */ - public function testChainableNonChainable() { + public function testChainableNonChainable(): void { $tz = new \DateTimeZone(date_default_timezone_get()); $datetime1 = new DrupalDateTime('2009-10-11 12:00:00', $tz, ['langcode' => 'en']); $datetime2 = new DrupalDateTime('2009-10-13 12:00:00', $tz, ['langcode' => 'en']); @@ -211,7 +211,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @covers ::__call */ - public function testChainableNonCallable() { + public function testChainableNonCallable(): void { $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Call to undefined method Drupal\Core\Datetime\DrupalDateTime::nonexistent()'); $tz = new \DateTimeZone(date_default_timezone_get()); @@ -222,7 +222,7 @@ class DrupalDateTimeTest extends UnitTestCase { /** * @covers ::getPhpDateTime */ - public function testGetPhpDateTime() { + public function testGetPhpDateTime(): void { $new_york = new \DateTimeZone('America/New_York'); $berlin = new \DateTimeZone('Europe/Berlin'); @@ -251,7 +251,7 @@ class DrupalDateTimeTest extends UnitTestCase { * * @covers ::format */ - public function testRfc2822DateFormat() { + public function testRfc2822DateFormat(): void { $language_manager = $this->createMock(LanguageManager::class); $language_manager->expects($this->any()) ->method('getCurrentLanguage') diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php index 7e106cefcc6..5e8ab648e60 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php @@ -19,7 +19,7 @@ class AuthenticationProviderPassTest extends UnitTestCase { /** * @covers ::process */ - public function testEncoders() { + public function testEncoders(): void { $container = new ContainerBuilder(); $definition = new Definition(Serializer::class, [[], []]); $definition->setPublic(TRUE); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php index a906bd949ae..1edc10dbe64 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php @@ -37,7 +37,7 @@ class BackendCompilerPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcess() { + public function testProcess(): void { // Add a container with no set default_backend. $prefix = __NAMESPACE__ . '\\ServiceClass'; $service = (new Definition($prefix . 'Default'))->addTag('backend_overridable'); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php index 8936501d590..63aa1f55d00 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php @@ -35,7 +35,7 @@ class ProxyServicesPassTest extends UnitTestCase { /** * @covers ::process */ - public function testContainerWithoutLazyServices() { + public function testContainerWithoutLazyServices(): void { $container = new ContainerBuilder(); $container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend'); @@ -48,7 +48,7 @@ class ProxyServicesPassTest extends UnitTestCase { /** * @covers ::process */ - public function testContainerWithLazyServices() { + public function testContainerWithLazyServices(): void { $container = new ContainerBuilder(); $container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend') ->setLazy(TRUE); @@ -68,7 +68,7 @@ class ProxyServicesPassTest extends UnitTestCase { /** * @covers ::process */ - public function testContainerWithLazyServicesWithoutProxyClass() { + public function testContainerWithLazyServicesWithoutProxyClass(): void { $container = new ContainerBuilder(); $container->register('path.current', CurrentPathStack::class) ->setLazy(TRUE); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php index ec95f280199..2443817c8d2 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php @@ -46,7 +46,7 @@ class StackedKernelPassTest extends UnitTestCase { /** * @covers ::process */ - public function testProcessWithStackedKernel() { + public function testProcessWithStackedKernel(): void { $stacked_kernel = new Definition(StackedHttpKernel::class); $stacked_kernel->setPublic(TRUE); $this->containerBuilder->setDefinition('http_kernel', $stacked_kernel); @@ -88,7 +88,7 @@ class StackedKernelPassTest extends UnitTestCase { /** * @covers ::process */ - public function testProcessWithHttpKernel() { + public function testProcessWithHttpKernel(): void { $kernel = new Definition('Symfony\Component\HttpKernel\HttpKernelInterface'); $kernel->setPublic(TRUE); $this->containerBuilder->setDefinition('http_kernel', $kernel); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php index ed07b2fb7ce..e61dd318b15 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php @@ -27,7 +27,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessNoConsumers() { + public function testProcessNoConsumers(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer'); @@ -44,7 +44,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessRequiredHandlers() { + public function testProcessRequiredHandlers(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -64,7 +64,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * @covers ::process * @covers ::processServiceIdCollectorPass */ - public function testIdCollectorProcessRequiredHandlers() { + public function testIdCollectorProcessRequiredHandlers(): void { $this->expectException(LogicException::class); $this->expectExceptionMessage("At least one service tagged with 'consumer_id' is required."); $container = $this->buildContainer(); @@ -83,7 +83,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessMissingInterface() { + public function testProcessMissingInterface(): void { $container = $this->buildContainer(); $container ->register('consumer_id0', __NAMESPACE__ . '\ValidConsumer') @@ -103,7 +103,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcess() { + public function testProcess(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -128,7 +128,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testServiceIdProcess() { + public function testServiceIdProcess(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -154,7 +154,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessPriority() { + public function testProcessPriority(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -185,7 +185,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testServiceIdProcessPriority() { + public function testServiceIdProcessPriority(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -218,7 +218,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessNoPriorityParam() { + public function testProcessNoPriorityParam(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -251,7 +251,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessWithIdParameter() { + public function testProcessWithIdParameter(): void { $container = $this->buildContainer(); $container ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer') @@ -286,7 +286,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessInterfaceMismatch() { + public function testProcessInterfaceMismatch(): void { $container = $this->buildContainer(); $container @@ -311,7 +311,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessWithExtraArguments() { + public function testProcessWithExtraArguments(): void { $container = $this->buildContainer(); $container @@ -341,7 +341,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessNoPriorityAndExtraArguments() { + public function testProcessNoPriorityAndExtraArguments(): void { $container = $this->buildContainer(); $container @@ -370,7 +370,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessWithIdAndExtraArguments() { + public function testProcessWithIdAndExtraArguments(): void { $container = $this->buildContainer(); $container @@ -402,7 +402,7 @@ class TaggedHandlersPassTest extends UnitTestCase { * * @covers ::process */ - public function testProcessWithDifferentArgumentsOrderAndDefaultValue() { + public function testProcessWithDifferentArgumentsOrderAndDefaultValue(): void { $container = $this->buildContainer(); $container diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php index 32f4c3cfaf8..dd45b97b6ce 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php @@ -18,7 +18,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $container = new ContainerBuilder(); $container->register('bar', 'Drupal\Tests\Core\DependencyInjection\Fixture\BarClass'); @@ -29,7 +29,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * @covers ::setParameter */ - public function testSetParameterException() { + public function testSetParameterException(): void { $container = new ContainerBuilder(); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Parameter names must be lowercase: Buzz'); @@ -39,7 +39,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * @covers ::register */ - public function testRegister() { + public function testRegister(): void { $container = new ContainerBuilder(); $service = $container->register('bar'); $this->assertTrue($service->isPublic()); @@ -48,7 +48,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * @covers ::setDefinition */ - public function testSetDefinition() { + public function testSetDefinition(): void { // Test a service with public set to true. $container = new ContainerBuilder(); $definition = new Definition(); @@ -66,7 +66,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * @covers ::setAlias */ - public function testSetAlias() { + public function testSetAlias(): void { $container = new ContainerBuilder(); $container->register('bar'); $alias = $container->setAlias('foo', 'bar'); @@ -76,7 +76,7 @@ class ContainerBuilderTest extends UnitTestCase { /** * Tests serialization. */ - public function testSerialize() { + public function testSerialize(): void { $container = new ContainerBuilder(); $this->expectException(\AssertionError::class); serialize($container); @@ -91,7 +91,7 @@ class ContainerBuilderTest extends UnitTestCase { * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testConstructor() { + public function testConstructor(): void { class_alias(TestInterface::class, 'Symfony\Component\Config\Resource\ResourceInterface'); $container = new ContainerBuilder(); $this->assertFalse($container->isTrackingResources()); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php index 426d392bf30..36757451767 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php @@ -16,7 +16,7 @@ class ContainerTest extends UnitTestCase { /** * Tests serialization. */ - public function testSerialize() { + public function testSerialize(): void { $container = new Container(); $this->expectException(\AssertionError::class); serialize($container); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php index 085f8a01846..d41703afe30 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php @@ -20,7 +20,7 @@ class DependencySerializationTest extends UnitTestCase { * @covers ::__sleep * @covers ::__wakeup */ - public function testSerialization() { + public function testSerialization(): void { // Create a pseudo service and dependency injected object. $service = new \stdClass(); $container = TestKernel::setContainerWithKernel(); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php index 0fc5c0203e8..b4ed2ca57c3 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php @@ -28,7 +28,7 @@ class YamlFileLoaderTest extends UnitTestCase { FileCacheFactory::setPrefix('example'); } - public function testParseDefinitionsWithProvider() { + public function testParseDefinitionsWithProvider(): void { $yml = <<<YAML services: example_service_1: @@ -80,7 +80,7 @@ YAML; /** * @dataProvider providerTestExceptions */ - public function testExceptions($yml, $message) { + public function testExceptions($yml, $message): void { vfsStream::setup('drupal', NULL, [ 'modules' => [ 'example' => [ diff --git a/core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php index b5094f06759..78b1840320e 100644 --- a/core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php @@ -30,7 +30,7 @@ class YamlDiscoveryTest extends TestCase { /** * Tests if filename is output for a broken YAML file. */ - public function testFilenameForBrokenYml() { + public function testFilenameForBrokenYml(): void { vfsStreamWrapper::register(); $root = new vfsStreamDirectory('modules'); vfsStreamWrapper::setRoot($root); diff --git a/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php index e8555b9bc3f..56b5ad551da 100644 --- a/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php +++ b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php @@ -36,7 +36,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::label */ - public function testLabel() { + public function testLabel(): void { $display_variant = $this->setUpDisplayVariant(['label' => 'foo']); $this->assertSame('foo', $display_variant->label()); } @@ -46,7 +46,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::label */ - public function testLabelDefault() { + public function testLabelDefault(): void { $display_variant = $this->setUpDisplayVariant(); $this->assertSame('', $display_variant->label()); } @@ -56,7 +56,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::getWeight */ - public function testGetWeight() { + public function testGetWeight(): void { $display_variant = $this->setUpDisplayVariant(['weight' => 5]); $this->assertSame(5, $display_variant->getWeight()); } @@ -66,7 +66,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::getWeight */ - public function testGetWeightDefault() { + public function testGetWeightDefault(): void { $display_variant = $this->setUpDisplayVariant(); $this->assertSame(0, $display_variant->getWeight()); } @@ -78,7 +78,7 @@ class DisplayVariantTest extends UnitTestCase { * * @dataProvider providerTestGetConfiguration */ - public function testGetConfiguration($configuration, $expected) { + public function testGetConfiguration($configuration, $expected): void { $display_variant = $this->setUpDisplayVariant($configuration); $this->assertSame($expected, $display_variant->getConfiguration()); @@ -124,7 +124,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::access */ - public function testAccess() { + public function testAccess(): void { $display_variant = $this->setUpDisplayVariant(); $this->assertTrue($display_variant->access()); } @@ -134,7 +134,7 @@ class DisplayVariantTest extends UnitTestCase { * * @covers ::submitConfigurationForm */ - public function testSubmitConfigurationForm() { + public function testSubmitConfigurationForm(): void { $display_variant = $this->setUpDisplayVariant(); $this->assertSame('', $display_variant->label()); diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php index 2763f40b530..50954cafa43 100644 --- a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php @@ -20,7 +20,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase { * * @covers ::discoverServiceProviders */ - public function testDiscoverServiceCustom() { + public function testDiscoverServiceCustom(): void { new Settings([ 'container_yamls' => [ __DIR__ . '/fixtures/custom.yml', @@ -46,7 +46,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase { /** * Tests the exception when container_yamls is not set. */ - public function testDiscoverServiceNoContainerYamls() { + public function testDiscoverServiceNoContainerYamls(): void { new Settings([]); $kernel = new DrupalKernel('prod', new ClassLoader()); $kernel->discoverServiceProviders(); diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php index ab15a6a71e7..e01add01477 100644 --- a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php @@ -23,7 +23,7 @@ class DrupalKernelTest extends UnitTestCase { * @covers ::setupTrustedHosts * @dataProvider providerTestTrustedHosts */ - public function testTrustedHosts($host, $server_name, $message, $expected = FALSE) { + public function testTrustedHosts($host, $server_name, $message, $expected = FALSE): void { $request = new Request(); $trusted_host_patterns = [ @@ -114,7 +114,7 @@ class DrupalKernelTest extends UnitTestCase { * @covers ::findSitePath * @runInSeparateProcess */ - public function testFindSitePath() { + public function testFindSitePath(): void { $vfs_root = vfsStream::setup('drupal_root'); $sites_php = <<<'EOD' <?php @@ -143,7 +143,7 @@ EOD; * @covers ::terminate * @runInSeparateProcess */ - public function testUnBootedTerminate() { + public function testUnBootedTerminate(): void { $kernel = new DrupalKernel('test', new ClassLoader()); $kernel->terminate(new Request(), new Response()); $this->assertTrue(TRUE, "\Drupal\Core\DrupalKernel::terminate() called without error on kernel which has not booted"); diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php index 4be76598eeb..2c2ad89f4c9 100644 --- a/core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php @@ -18,7 +18,7 @@ class ValidateHostnameTest extends UnitTestCase { * @covers ::validateHostname * @dataProvider providerTestValidateHostname */ - public function testValidateHostname($hostname, $message, $expected = FALSE) { + public function testValidateHostname($hostname, $message, $expected = FALSE): void { $server = ['HTTP_HOST' => $hostname]; $request = new Request([], [], [], [], [], $server); $validated_hostname = DrupalKernel::validateHostname($request); diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php index 49c6226f6ae..a009151df0b 100644 --- a/core/tests/Drupal/Tests/Core/DrupalTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalTest.php @@ -43,7 +43,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::getContainer */ - public function testSetContainer() { + public function testSetContainer(): void { \Drupal::setContainer($this->container); $this->assertSame($this->container, \Drupal::getContainer()); } @@ -51,7 +51,7 @@ class DrupalTest extends UnitTestCase { /** * @covers ::getContainer */ - public function testGetContainerException() { + public function testGetContainerException(): void { $this->expectException(ContainerNotInitializedException::class); $this->expectExceptionMessage('\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.'); \Drupal::getContainer(); @@ -62,7 +62,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::service */ - public function testService() { + public function testService(): void { $this->setMockContainerService('test_service'); $this->assertNotNull(\Drupal::service('test_service')); } @@ -72,7 +72,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::currentUser */ - public function testCurrentUser() { + public function testCurrentUser(): void { $this->setMockContainerService('current_user'); $this->assertNotNull(\Drupal::currentUser()); } @@ -82,7 +82,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::entityTypeManager */ - public function testEntityTypeManager() { + public function testEntityTypeManager(): void { $this->setMockContainerService('entity_type.manager'); $this->assertNotNull(\Drupal::entityTypeManager()); } @@ -92,7 +92,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::database */ - public function testDatabase() { + public function testDatabase(): void { $this->setMockContainerService('database'); $this->assertNotNull(\Drupal::database()); } @@ -102,7 +102,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::cache */ - public function testCache() { + public function testCache(): void { $this->setMockContainerService('cache.test'); $this->assertNotNull(\Drupal::cache('test')); } @@ -112,7 +112,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::classResolver */ - public function testClassResolver() { + public function testClassResolver(): void { $class_resolver = $this->prophesize(ClassResolverInterface::class); $this->setMockContainerService('class_resolver', $class_resolver->reveal()); $this->assertInstanceOf(ClassResolverInterface::class, \Drupal::classResolver()); @@ -123,7 +123,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::classResolver */ - public function testClassResolverWithClass() { + public function testClassResolverWithClass(): void { $class_resolver = $this->prophesize(ClassResolverInterface::class); $class_resolver->getInstanceFromDefinition(static::class)->willReturn($this); $this->setMockContainerService('class_resolver', $class_resolver->reveal()); @@ -135,7 +135,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::keyValueExpirable */ - public function testKeyValueExpirable() { + public function testKeyValueExpirable(): void { $keyvalue = $this->getMockBuilder('Drupal\Core\KeyValueStore\KeyValueExpirableFactory') ->disableOriginalConstructor() ->getMock(); @@ -153,7 +153,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::lock */ - public function testLock() { + public function testLock(): void { $this->setMockContainerService('lock'); $this->assertNotNull(\Drupal::lock()); } @@ -163,7 +163,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::config */ - public function testConfig() { + public function testConfig(): void { $config = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface'); $config->expects($this->once()) ->method('get') @@ -180,7 +180,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::queue */ - public function testQueue() { + public function testQueue(): void { $queue = $this->getMockBuilder('Drupal\Core\Queue\QueueFactory') ->disableOriginalConstructor() ->getMock(); @@ -198,7 +198,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::requestStack */ - public function testRequestStack() { + public function testRequestStack(): void { $request_stack = new RequestStack(); $this->setMockContainerService('request_stack', $request_stack); @@ -210,7 +210,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::keyValue */ - public function testKeyValue() { + public function testKeyValue(): void { $keyvalue = $this->getMockBuilder('Drupal\Core\KeyValueStore\KeyValueFactory') ->disableOriginalConstructor() ->getMock(); @@ -228,7 +228,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::state */ - public function testState() { + public function testState(): void { $this->setMockContainerService('state'); $this->assertNotNull(\Drupal::state()); } @@ -238,7 +238,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::httpClient */ - public function testHttpClient() { + public function testHttpClient(): void { $this->setMockContainerService('http_client'); $this->assertNotNull(\Drupal::httpClient()); } @@ -248,7 +248,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::entityQuery */ - public function testEntityQuery() { + public function testEntityQuery(): void { $query = $this->createMock(QueryInterface::class); $storage = $this->createMock(EntityStorageInterface::class); $storage @@ -274,7 +274,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::entityQueryAggregate */ - public function testEntityQueryAggregate() { + public function testEntityQueryAggregate(): void { $query = $this->createMock(QueryAggregateInterface::class); $storage = $this->createMock(EntityStorageInterface::class); $storage @@ -300,7 +300,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::flood */ - public function testFlood() { + public function testFlood(): void { $this->setMockContainerService('flood'); $this->assertNotNull(\Drupal::flood()); } @@ -310,7 +310,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::moduleHandler */ - public function testModuleHandler() { + public function testModuleHandler(): void { $this->setMockContainerService('module_handler'); $this->assertNotNull(\Drupal::moduleHandler()); } @@ -320,7 +320,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::typedDataManager */ - public function testTypedDataManager() { + public function testTypedDataManager(): void { $this->setMockContainerService('typed_data_manager'); $this->assertNotNull(\Drupal::typedDataManager()); } @@ -330,7 +330,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::token */ - public function testToken() { + public function testToken(): void { $this->setMockContainerService('token'); $this->assertNotNull(\Drupal::token()); } @@ -340,7 +340,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::urlGenerator */ - public function testUrlGenerator() { + public function testUrlGenerator(): void { $this->setMockContainerService('url_generator'); $this->assertNotNull(\Drupal::urlGenerator()); } @@ -350,7 +350,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::linkGenerator */ - public function testLinkGenerator() { + public function testLinkGenerator(): void { $this->setMockContainerService('link_generator'); $this->assertNotNull(\Drupal::linkGenerator()); } @@ -360,7 +360,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::translation */ - public function testTranslation() { + public function testTranslation(): void { $this->setMockContainerService('string_translation'); $this->assertNotNull(\Drupal::translation()); } @@ -370,7 +370,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::languageManager */ - public function testLanguageManager() { + public function testLanguageManager(): void { $this->setMockContainerService('language_manager'); $this->assertNotNull(\Drupal::languageManager()); } @@ -380,7 +380,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::csrfToken */ - public function testCsrfToken() { + public function testCsrfToken(): void { $this->setMockContainerService('csrf_token'); $this->assertNotNull(\Drupal::csrfToken()); } @@ -390,7 +390,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::transliteration */ - public function testTransliteration() { + public function testTransliteration(): void { $this->setMockContainerService('transliteration'); $this->assertNotNull(\Drupal::transliteration()); } @@ -400,7 +400,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::formBuilder */ - public function testFormBuilder() { + public function testFormBuilder(): void { $this->setMockContainerService('form_builder'); $this->assertNotNull(\Drupal::formBuilder()); } @@ -410,7 +410,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::menuTree */ - public function testMenuTree() { + public function testMenuTree(): void { $this->setMockContainerService('menu.link_tree'); $this->assertNotNull(\Drupal::menuTree()); } @@ -420,7 +420,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::pathValidator */ - public function testPathValidator() { + public function testPathValidator(): void { $this->setMockContainerService('path.validator'); $this->assertNotNull(\Drupal::pathValidator()); } @@ -430,7 +430,7 @@ class DrupalTest extends UnitTestCase { * * @covers ::accessManager */ - public function testAccessManager() { + public function testAccessManager(): void { $this->setMockContainerService('access_manager'); $this->assertNotNull(\Drupal::accessManager()); } @@ -438,7 +438,7 @@ class DrupalTest extends UnitTestCase { /** * Tests the PHP constants have consistent values. */ - public function testPhpConstants() { + public function testPhpConstants(): void { // RECOMMENDED_PHP can be just MAJOR.MINOR so normalize it to allow using // version_compare(). $normalizer = function (string $version): string { diff --git a/core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php b/core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php index d5a691dd951..f1a68f6b8ab 100644 --- a/core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php +++ b/core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php @@ -34,7 +34,7 @@ class EntityRevisionRouteEnhancerTest extends UnitTestCase { /** * @covers ::enhance */ - public function testEnhanceWithoutParameter() { + public function testEnhanceWithoutParameter(): void { $route = new Route('/test-path/{entity_test}'); $request = Request::create('/test-path'); @@ -47,7 +47,7 @@ class EntityRevisionRouteEnhancerTest extends UnitTestCase { /** * @covers ::enhance */ - public function testEnhanceWithoutEntityRevision() { + public function testEnhanceWithoutEntityRevision(): void { $route = new Route('/test-path/{entity_test}', [], [], ['parameters' => ['entity_test' => ['type' => 'entity:entity_test']]]); $request = Request::create('/test-path/123'); $entity = $this->prophesize(EntityInterface::class); @@ -61,7 +61,7 @@ class EntityRevisionRouteEnhancerTest extends UnitTestCase { /** * @covers ::enhance */ - public function testEnhanceWithEntityRevision() { + public function testEnhanceWithEntityRevision(): void { $route = new Route('/test-path/{entity_test_revision}', [], [], ['parameters' => ['entity_test_revision' => ['type' => 'entity_revision:entity_test']]]); $request = Request::create('/test-path/123'); $entity = $this->prophesize(EntityInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php b/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php index 261a93590a6..2f6bb549e86 100644 --- a/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php +++ b/core/tests/Drupal/Tests/Core/Enhancer/ParamConversionEnhancerTest.php @@ -40,7 +40,7 @@ class ParamConversionEnhancerTest extends UnitTestCase { /** * @covers ::enhance */ - public function testEnhance() { + public function testEnhance(): void { $route = new Route('/test/{id}/{literal}/{null}'); $raw_variables = [ @@ -75,7 +75,7 @@ class ParamConversionEnhancerTest extends UnitTestCase { /** * @covers ::copyRawVariables */ - public function testCopyRawVariables() { + public function testCopyRawVariables(): void { $route = new Route('/test/{id}'); $route->setDefault('node_type', 'page'); $defaults = [ diff --git a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php index df0e46e0d9d..01216173fce 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php @@ -215,7 +215,7 @@ class EntityFormDisplayAccessControlHandlerTest extends UnitTestCase { * @covers ::access * @covers ::checkAccess */ - public function testAccess() { + public function testAccess(): void { $this->assertAllowOperations([], $this->anon); $this->assertAllowOperations(['view', 'update', 'delete'], $this->member); $this->assertAllowOperations(['view', 'update', 'delete'], $this->parentMember); diff --git a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php index 43c436c475c..a70c9b4c8ce 100644 --- a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php @@ -79,7 +79,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::getName */ - public function testFieldName() { + public function testFieldName(): void { $definition = BaseFieldDefinition::create($this->fieldType); $field_name = $this->randomMachineName(); $definition->setName($field_name); @@ -91,7 +91,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::getLabel */ - public function testFieldLabel() { + public function testFieldLabel(): void { $definition = BaseFieldDefinition::create($this->fieldType); $label = $this->randomMachineName(); $definition->setLabel($label); @@ -103,7 +103,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::getDescription */ - public function testFieldDescription() { + public function testFieldDescription(): void { $definition = BaseFieldDefinition::create($this->fieldType); $description = $this->randomMachineName(); $definition->setDescription($description); @@ -115,7 +115,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::getType */ - public function testFieldType() { + public function testFieldType(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertEquals($this->fieldType, $definition->getType()); } @@ -127,7 +127,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::setSetting * @covers ::getSettings */ - public function testFieldSettings() { + public function testFieldSettings(): void { $definition = BaseFieldDefinition::create($this->fieldType); $setting = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -144,7 +144,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::setSetting * @covers ::getSettings */ - public function testDefaultFieldSettings() { + public function testDefaultFieldSettings(): void { $definition = BaseFieldDefinition::create($this->fieldType); $expected_settings = $this->fieldTypeDefinition['storage_settings'] + $this->fieldTypeDefinition['field_settings']; $this->assertEquals($expected_settings, $definition->getSettings()); @@ -159,7 +159,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::getDefaultValue * @covers ::setDefaultValue */ - public function testFieldDefaultValue() { + public function testFieldDefaultValue(): void { $definition = BaseFieldDefinition::create($this->fieldType); $default_value = [ 'value' => $this->randomMachineName(), @@ -207,7 +207,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::getInitialValue * @covers ::setInitialValue */ - public function testFieldInitialValue() { + public function testFieldInitialValue(): void { $definition = BaseFieldDefinition::create($this->fieldType); $definition->setItemDefinition(DataDefinition::createFromDataType('string')->setClass(FieldItemBase::class)); $default_value = [ @@ -255,7 +255,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::isTranslatable * @covers ::setTranslatable */ - public function testFieldTranslatable() { + public function testFieldTranslatable(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertFalse($definition->isTranslatable()); $definition->setTranslatable(TRUE); @@ -270,7 +270,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::isRevisionable * @covers ::setRevisionable */ - public function testFieldRevisionable() { + public function testFieldRevisionable(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertFalse($definition->isRevisionable()); $definition->setRevisionable(TRUE); @@ -285,7 +285,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::getCardinality * @covers ::setCardinality */ - public function testFieldCardinality() { + public function testFieldCardinality(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertEquals(1, $definition->getCardinality()); $definition->setCardinality(2); @@ -300,7 +300,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::isRequired * @covers ::setRequired */ - public function testFieldRequired() { + public function testFieldRequired(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertFalse($definition->isRequired()); $definition->setRequired(TRUE); @@ -315,7 +315,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::isStorageRequired * @covers ::setStorageRequired */ - public function testFieldStorageRequired() { + public function testFieldStorageRequired(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertFalse($definition->isStorageRequired()); $definition->setStorageRequired(TRUE); @@ -330,7 +330,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::getProvider * @covers ::setProvider */ - public function testFieldProvider() { + public function testFieldProvider(): void { $definition = BaseFieldDefinition::create($this->fieldType); $provider = $this->randomMachineName(); $definition->setProvider($provider); @@ -343,7 +343,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * @covers ::hasCustomStorage * @covers ::setCustomStorage */ - public function testCustomStorage() { + public function testCustomStorage(): void { $definition = BaseFieldDefinition::create($this->fieldType); $this->assertFalse($definition->hasCustomStorage()); $definition->setCustomStorage(TRUE); @@ -357,7 +357,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::setDefaultValueCallback */ - public function testDefaultValueCallback() { + public function testDefaultValueCallback(): void { $definition = BaseFieldDefinition::create($this->fieldType); $callback = static::class . '::mockDefaultValueCallback'; // setDefaultValueCallback returns $this. @@ -369,7 +369,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::setDefaultValueCallback */ - public function testInvalidDefaultValueCallback() { + public function testInvalidDefaultValueCallback(): void { $definition = BaseFieldDefinition::create($this->fieldType); // setDefaultValueCallback returns $this. $this->expectException(\InvalidArgumentException::class); @@ -381,7 +381,7 @@ class BaseFieldDefinitionTest extends UnitTestCase { * * @covers ::setDefaultValueCallback */ - public function testNullDefaultValueCallback() { + public function testNullDefaultValueCallback(): void { $definition = BaseFieldDefinition::create($this->fieldType); // setDefaultValueCallback returns $this. $this->assertSame($definition, $definition->setDefaultValueCallback(NULL)); diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index d5a79f8b8a5..785443b1f65 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -227,7 +227,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::isNewRevision * @covers ::setNewRevision */ - public function testIsNewRevision() { + public function testIsNewRevision(): void { // Set up the entity type so that on the first call there is no revision key // and on the second call there is one. $this->entityType->expects($this->exactly(4)) @@ -262,7 +262,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::setNewRevision */ - public function testSetNewRevisionException() { + public function testSetNewRevisionException(): void { $this->entityType->expects($this->once()) ->method('hasKey') ->with('revision') @@ -275,7 +275,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::isDefaultRevision */ - public function testIsDefaultRevision() { + public function testIsDefaultRevision(): void { // The default value is TRUE. $this->assertTrue($this->entity->isDefaultRevision()); // Change the default revision, verify that the old value is returned. @@ -293,7 +293,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::getRevisionId */ - public function testGetRevisionId() { + public function testGetRevisionId(): void { // The default getRevisionId() implementation returns NULL. $this->assertNull($this->entity->getRevisionId()); } @@ -301,7 +301,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::isTranslatable */ - public function testIsTranslatable() { + public function testIsTranslatable(): void { $this->entityTypeBundleInfo->expects($this->any()) ->method('getBundleInfo') ->with($this->entityTypeId) @@ -325,7 +325,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::isTranslatable */ - public function testIsTranslatableForMonolingual() { + public function testIsTranslatableForMonolingual(): void { $this->languageManager->expects($this->any()) ->method('isMultilingual') ->willReturn(FALSE); @@ -335,7 +335,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::preSaveRevision */ - public function testPreSaveRevision() { + public function testPreSaveRevision(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $record = new \stdClass(); @@ -424,7 +424,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidate() { + public function testValidate(): void { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); @@ -451,7 +451,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::save * @covers ::preSave */ - public function testRequiredValidation() { + public function testRequiredValidation(): void { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); @@ -500,14 +500,14 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::bundle */ - public function testBundle() { + public function testBundle(): void { $this->assertSame($this->bundle, $this->entity->bundle()); } /** * @covers ::access */ - public function testAccess() { + public function testAccess(): void { $access = $this->createMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface'); $operation = $this->randomMachineName(); $access->expects($this->exactly(2)) @@ -550,7 +550,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::get * @dataProvider providerGet */ - public function testGet($expected, $field_name, $active_langcode, $fields) { + public function testGet($expected, $field_name, $active_langcode, $fields): void { // Mock ContentEntityBase. $mock_base = $this->getMockBuilder(ContentEntityBaseMockableClass::class) ->disableOriginalConstructor() @@ -610,7 +610,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::getFields * @dataProvider providerGetFields */ - public function testGetFields($expected, $include_computed, $is_computed, $field_definitions) { + public function testGetFields($expected, $include_computed, $is_computed, $field_definitions): void { // Mock ContentEntityBase. $mock_base = $this->getMockBuilder(ContentEntityBaseMockableClass::class) ->disableOriginalConstructor() @@ -660,7 +660,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { // Exercise set(), check if it returns $this $this->assertSame( $this->entity, diff --git a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php index 5df0b8c7a6e..7f38aecf8da 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php @@ -21,7 +21,7 @@ class EntityRouteEnhancerTest extends UnitTestCase { * * @see \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer::enhancer() */ - public function testEnhancer() { + public function testEnhancer(): void { $route_enhancer = new EntityRouteEnhancer(); // Set a controller to ensure it is not overridden. diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php index c5028fc654c..f3cf79f5118 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php @@ -43,7 +43,7 @@ class EntityAccessCheckTest extends UnitTestCase { /** * Tests the method for checking access to routes. */ - public function testAccess() { + public function testAccess(): void { $route = new Route('/foo/{var_name}', [], ['_entity_access' => 'var_name.update'], ['parameters' => ['var_name' => ['type' => 'entity:node']]]); /** @var \Drupal\Core\Session\AccountInterface $account */ $account = $this->prophesize(AccountInterface::class)->reveal(); @@ -66,7 +66,7 @@ class EntityAccessCheckTest extends UnitTestCase { /** * @covers ::access */ - public function testAccessWithTypePlaceholder() { + public function testAccessWithTypePlaceholder(): void { $route = new Route('/foo/{entity_type}/{var_name}', [], ['_entity_access' => 'var_name.update'], ['parameters' => ['var_name' => ['type' => 'entity:{entity_type}']]]); /** @var \Drupal\Core\Session\AccountInterface $account */ $account = $this->prophesize(AccountInterface::class)->reveal(); @@ -86,7 +86,7 @@ class EntityAccessCheckTest extends UnitTestCase { /** * @covers ::access */ - public function testAccessWithDifferentRouteParameters() { + public function testAccessWithDifferentRouteParameters(): void { $route = new Route( '/foo/{var_name}', [], diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php index 6aeda12d3d5..47de82b7100 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php @@ -20,7 +20,7 @@ class EntityConstraintViolationListTest extends UnitTestCase { /** * @covers ::filterByFields */ - public function testFilterByFields() { + public function testFilterByFields(): void { $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal(); $entity = $this->setupEntity($account); @@ -35,7 +35,7 @@ class EntityConstraintViolationListTest extends UnitTestCase { /** * @covers ::filterByFields */ - public function testFilterByFieldsWithCompositeConstraints() { + public function testFilterByFieldsWithCompositeConstraints(): void { $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal(); $entity = $this->setupEntity($account); @@ -50,7 +50,7 @@ class EntityConstraintViolationListTest extends UnitTestCase { /** * @covers ::filterByFieldAccess */ - public function testFilterByFieldAccess() { + public function testFilterByFieldAccess(): void { $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal(); $entity = $this->setupEntity($account); @@ -65,7 +65,7 @@ class EntityConstraintViolationListTest extends UnitTestCase { /** * @covers ::filterByFieldAccess */ - public function testFilterByFieldAccessWithCompositeConstraint() { + public function testFilterByFieldAccessWithCompositeConstraint(): void { $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal(); $entity = $this->setupEntity($account); @@ -80,7 +80,7 @@ class EntityConstraintViolationListTest extends UnitTestCase { /** * @covers ::findByCodes */ - public function testFindByCodes() { + public function testFindByCodes(): void { $account = $this->prophesize('\Drupal\Core\Session\AccountInterface')->reveal(); $entity = $this->setupEntity($account); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php index 66b4e94d0cd..f2868d22ab7 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php @@ -70,7 +70,7 @@ class EntityCreateAccessCheckTest extends UnitTestCase { * * @dataProvider providerTestAccess */ - public function testAccess($entity_bundle, $requirement, $access, $expected, $expect_permission_context = TRUE) { + public function testAccess($entity_bundle, $requirement, $access, $expected, $expect_permission_context = TRUE): void { // Set up the access result objects for allowing or denying access. $access_result = $access ? AccessResult::allowed()->cachePerPermissions() : AccessResult::neutral()->cachePerPermissions(); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index 08c3823c0bb..8a56ad19a8a 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -223,7 +223,7 @@ class EntityFieldManagerTest extends UnitTestCase { * @covers ::getBaseFieldDefinitions * @covers ::buildBaseFieldDefinitions */ - public function testGetBaseFieldDefinitions() { + public function testGetBaseFieldDefinitions(): void { $field_definition = $this->setUpEntityWithFieldDefinition(); $expected = ['id' => $field_definition]; @@ -236,7 +236,7 @@ class EntityFieldManagerTest extends UnitTestCase { * @covers ::getFieldDefinitions * @covers ::buildBundleFieldDefinitions */ - public function testGetFieldDefinitions() { + public function testGetFieldDefinitions(): void { $field_definition = $this->setUpEntityWithFieldDefinition(); $bundle_field_definition = $this->prophesize() @@ -295,7 +295,7 @@ class EntityFieldManagerTest extends UnitTestCase { * @covers ::getFieldStorageDefinitions * @covers ::buildFieldStorageDefinitions */ - public function testGetFieldStorageDefinitions() { + public function testGetFieldStorageDefinitions(): void { $field_definition = $this->setUpEntityWithFieldDefinition(TRUE); $field_storage_definition = $this->prophesize(FieldStorageDefinitionInterface::class); $field_storage_definition->getName()->willReturn('field_storage'); @@ -339,7 +339,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @dataProvider providerTestGetBaseFieldDefinitionsTranslatableEntityTypeDefaultLangcode */ - public function testGetBaseFieldDefinitionsTranslatableEntityTypeDefaultLangcode($default_langcode_key) { + public function testGetBaseFieldDefinitionsTranslatableEntityTypeDefaultLangcode($default_langcode_key): void { $this->setUpEntityWithFieldDefinition(FALSE, 'id', ['langcode' => 'langcode', 'default_langcode' => $default_langcode_key]); $field_definition = $this->prophesize()->willImplement(FieldDefinitionInterface::class)->willImplement(FieldStorageDefinitionInterface::class); @@ -376,7 +376,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @dataProvider providerTestGetBaseFieldDefinitionsTranslatableEntityTypeLangcode */ - public function testGetBaseFieldDefinitionsTranslatableEntityTypeLangcode($provide_key, $provide_field, $translatable) { + public function testGetBaseFieldDefinitionsTranslatableEntityTypeLangcode($provide_key, $provide_field, $translatable): void { $keys = $provide_key ? ['langcode' => 'langcode'] : []; $this->setUpEntityWithFieldDefinition(FALSE, 'id', $keys); @@ -418,7 +418,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @covers ::getBaseFieldDefinitions */ - public function testGetBaseFieldDefinitionsWithCaching() { + public function testGetBaseFieldDefinitionsWithCaching(): void { $field_definition = $this->setUpEntityWithFieldDefinition(); $expected = ['id' => $field_definition]; @@ -446,7 +446,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @covers ::getFieldDefinitions */ - public function testGetFieldDefinitionsWithCaching() { + public function testGetFieldDefinitionsWithCaching(): void { $field_definition = $this->setUpEntityWithFieldDefinition(FALSE, 'id'); $expected = ['id' => $field_definition]; @@ -477,7 +477,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @covers ::getFieldStorageDefinitions */ - public function testGetFieldStorageDefinitionsWithCaching() { + public function testGetFieldStorageDefinitionsWithCaching(): void { $field_definition = $this->setUpEntityWithFieldDefinition(TRUE, 'id'); $field_storage_definition = $this->prophesize(FieldStorageDefinitionInterface::class); $field_storage_definition->getName()->willReturn('field_storage'); @@ -526,7 +526,7 @@ class EntityFieldManagerTest extends UnitTestCase { * @covers ::getBaseFieldDefinitions * @covers ::buildBaseFieldDefinitions */ - public function testGetBaseFieldDefinitionsInvalidDefinition() { + public function testGetBaseFieldDefinitionsInvalidDefinition(): void { $this->setUpEntityWithFieldDefinition(FALSE, 'langcode', ['langcode' => 'langcode']); $this->entityType->isTranslatable()->willReturn(TRUE); @@ -542,7 +542,7 @@ class EntityFieldManagerTest extends UnitTestCase { * @covers ::getFieldDefinitions * @covers ::buildBundleFieldDefinitions */ - public function testGetFieldDefinitionsProvider() { + public function testGetFieldDefinitionsProvider(): void { $this->setUpEntityWithFieldDefinition(TRUE); $module = 'entity_field_manager_test_module'; @@ -646,7 +646,7 @@ class EntityFieldManagerTest extends UnitTestCase { * * @covers ::clearCachedFieldDefinitions */ - public function testClearCachedFieldDefinitions() { + public function testClearCachedFieldDefinitions(): void { $this->setUpEntityTypeDefinitions(); $this->cacheTagsInvalidator->invalidateTags(['entity_field_info'])->shouldBeCalled(); @@ -660,7 +660,7 @@ class EntityFieldManagerTest extends UnitTestCase { /** * @covers ::getExtraFields */ - public function testGetExtraFields() { + public function testGetExtraFields(): void { $this->setUpEntityTypeDefinitions(); $entity_type_id = $this->randomMachineName(); @@ -701,7 +701,7 @@ class EntityFieldManagerTest extends UnitTestCase { /** * @covers ::getFieldMap */ - public function testGetFieldMap() { + public function testGetFieldMap(): void { $this->entityTypeBundleInfo->getBundleInfo('test_entity_type')->willReturn([])->shouldBeCalled(); // Set up a content entity type. @@ -777,7 +777,7 @@ class EntityFieldManagerTest extends UnitTestCase { /** * @covers ::getFieldMap */ - public function testGetFieldMapFromCache() { + public function testGetFieldMapFromCache(): void { $expected = [ 'test_entity_type' => [ 'id' => [ @@ -801,7 +801,7 @@ class EntityFieldManagerTest extends UnitTestCase { /** * @covers ::getFieldMapByFieldType */ - public function testGetFieldMapByFieldType() { + public function testGetFieldMapByFieldType(): void { // Set up a content entity type. $entity_type = $this->prophesize(ContentEntityTypeInterface::class); $entity_class = EntityTypeManagerTestEntity::class; @@ -871,7 +871,7 @@ class TestEntityFieldManager extends EntityFieldManager { /** * Allows the static caches to be cleared. */ - public function testClearEntityFieldInfo() { + public function testClearEntityFieldInfo(): void { $this->baseFieldDefinitions = []; $this->fieldDefinitions = []; $this->fieldStorageDefinitions = []; diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php index aecf223435e..5709fc3b375 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFormBuilderTest.php @@ -50,7 +50,7 @@ class EntityFormBuilderTest extends UnitTestCase { * * @covers ::getForm */ - public function testGetForm() { + public function testGetForm(): void { $form_controller = $this->createMock('Drupal\Core\Entity\EntityFormInterface'); $form_controller->expects($this->any()) ->method('getFormId') diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php index 8e30610eab4..b16345420dd 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php @@ -51,7 +51,7 @@ class EntityFormTest extends UnitTestCase { * * @dataProvider providerTestFormIds */ - public function testFormId($expected, $definition) { + public function testFormId($expected, $definition): void { $this->entityType->set('entity_keys', ['bundle' => $definition['bundle']]); $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityBase', [[], $definition['entity_type']], '', TRUE, TRUE, TRUE, ['getEntityType', 'bundle']); @@ -120,7 +120,7 @@ class EntityFormTest extends UnitTestCase { /** * @covers ::copyFormValuesToEntity */ - public function testCopyFormValuesToEntity() { + public function testCopyFormValuesToEntity(): void { $entity_id = 'test_config_entity_id'; $values = ['id' => $entity_id]; $entity = $this->getMockBuilder('\Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections') @@ -150,7 +150,7 @@ class EntityFormTest extends UnitTestCase { * * @covers ::getEntityFromRouteMatch */ - public function testGetEntityFromRouteMatchEditDelete() { + public function testGetEntityFromRouteMatchEditDelete(): void { $entity = $this->prophesize(EntityInterface::class)->reveal(); $id = $this->entityType->id(); $route_match = new RouteMatch( @@ -168,7 +168,7 @@ class EntityFormTest extends UnitTestCase { * * @covers ::getEntityFromRouteMatch */ - public function testGetEntityFromRouteMatchAdd() { + public function testGetEntityFromRouteMatchAdd(): void { $entity = $this->prophesize(EntityInterface::class)->reveal(); $this->setUpStorage()->create([])->willReturn($entity); $route_match = new RouteMatch('test_route', new Route('/entity-test/add')); @@ -181,7 +181,7 @@ class EntityFormTest extends UnitTestCase { * * @covers ::getEntityFromRouteMatch */ - public function testGetEntityFromRouteMatchAddStatic() { + public function testGetEntityFromRouteMatchAddStatic(): void { $entity = $this->prophesize(EntityInterface::class)->reveal(); $bundle_key = 'bundle'; $bundle = 'test_bundle'; @@ -211,7 +211,7 @@ class EntityFormTest extends UnitTestCase { * * @covers ::getEntityFromRouteMatch */ - public function testGetEntityFromRouteMatchAddEntity() { + public function testGetEntityFromRouteMatchAddEntity(): void { $entity = $this->prophesize(EntityInterface::class)->reveal(); $bundle_entity_type_id = 'entity_test_bundle'; $bundle = 'test_entity_bundle'; diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php index 745e78cc07e..6e59c427088 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php @@ -62,7 +62,7 @@ class EntityLinkTest extends UnitTestCase { * * @dataProvider providerTestLink */ - public function testToLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []) { + public function testToLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []): void { $language = new Language(['id' => 'es']); $link_options += ['language' => $language]; $this->languageManager->expects($this->any()) diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php index 4ab0e17c0ba..9a7531d5f2c 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php @@ -95,7 +95,7 @@ class EntityListBuilderTest extends UnitTestCase { /** * @covers ::getOperations */ - public function testGetOperations() { + public function testGetOperations(): void { $operation_name = $this->randomMachineName(); $operations = [ $operation_name => [ diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php index 7048f2fbac7..d06cfa7335a 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php @@ -66,7 +66,7 @@ class EntityRepositoryTest extends UnitTestCase { * * @covers ::getTranslationFromContext */ - public function testGetTranslationFromContext() { + public function testGetTranslationFromContext(): void { $language = new Language(['id' => 'en']); $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT) ->willReturn($language) diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php index f148e18af83..1c34d09d194 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php @@ -72,7 +72,7 @@ class EntityResolverManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteOptionsWithStandardRoute */ - public function testSetRouteOptionsWithStandardRoute($controller) { + public function testSetRouteOptionsWithStandardRoute($controller): void { $route = new Route('/example', [ '_controller' => $controller, ]); @@ -101,7 +101,7 @@ class EntityResolverManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteOptionsWithStandardRouteWithArgument */ - public function testSetRouteOptionsWithStandardRouteWithArgument($controller) { + public function testSetRouteOptionsWithStandardRouteWithArgument($controller): void { $route = new Route('/example/{argument}', [ '_controller' => $controller, 'argument' => 'test', @@ -131,7 +131,7 @@ class EntityResolverManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteOptionsWithContentController */ - public function testSetRouteOptionsWithContentController($controller) { + public function testSetRouteOptionsWithContentController($controller): void { $route = new Route('/example/{argument}', [ '_controller' => $controller, 'argument' => 'test', @@ -163,7 +163,7 @@ class EntityResolverManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteOptionsWithEntityTypeNoUpcasting */ - public function testSetRouteOptionsWithEntityTypeNoUpcasting($controller) { + public function testSetRouteOptionsWithEntityTypeNoUpcasting($controller): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ @@ -196,7 +196,7 @@ class EntityResolverManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteOptionsWithEntityTypeUpcasting */ - public function testSetRouteOptionsWithEntityTypeUpcasting($controller) { + public function testSetRouteOptionsWithEntityTypeUpcasting($controller): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ @@ -228,7 +228,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::getEntityTypes * @covers ::setParametersFromReflection */ - public function testSetRouteOptionsWithEntityFormUpcasting() { + public function testSetRouteOptionsWithEntityFormUpcasting(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ @@ -250,7 +250,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::getEntityTypes * @covers ::setParametersFromReflection */ - public function testSetRouteOptionsWithEntityUpcastingNoCreate() { + public function testSetRouteOptionsWithEntityUpcastingNoCreate(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ @@ -272,7 +272,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::getEntityTypes * @covers ::setParametersFromReflection */ - public function testSetRouteOptionsWithEntityFormNoUpcasting() { + public function testSetRouteOptionsWithEntityFormNoUpcasting(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ @@ -294,7 +294,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityViewRouteAndManualParameters() { + public function testSetRouteOptionsWithEntityViewRouteAndManualParameters(): void { $this->setupEntityTypes(); $route = new Route('/example/{foo}', [ @@ -326,7 +326,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityViewRoute() { + public function testSetRouteOptionsWithEntityViewRoute(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ '_entity_view' => 'entity_test.view', @@ -348,7 +348,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityListRoute() { + public function testSetRouteOptionsWithEntityListRoute(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ '_entity_list' => 'entity_test', @@ -370,7 +370,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityFormRoute() { + public function testSetRouteOptionsWithEntityFormRoute(): void { $this->setupEntityTypes(); $route = new Route('/example/{entity_test}', [ '_entity_form' => 'entity_test.edit', @@ -395,7 +395,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityFormRouteAndArgument() { + public function testSetRouteOptionsWithEntityFormRouteAndArgument(): void { $this->setupEntityTypes(); $route = new Route('/example/{argument}/{entity_test}', [ '_entity_form' => 'entity_test.edit', @@ -424,7 +424,7 @@ class EntityResolverManagerTest extends UnitTestCase { * @covers ::setParametersFromReflection * @covers ::setParametersFromEntityInformation */ - public function testSetRouteOptionsWithEntityAddFormRoute() { + public function testSetRouteOptionsWithEntityAddFormRoute(): void { $this->setupEntityTypes(); $route = new Route('/example/add', [ '_entity_form' => 'entity_test.add', diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php index 256a06e9448..55742942e03 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php @@ -145,7 +145,7 @@ class EntityTypeBundleInfoTest extends UnitTestCase { * * @covers ::clearCachedBundles */ - public function testClearCachedBundles() { + public function testClearCachedBundles(): void { $this->setUpEntityTypeDefinitions(); $this->typedDataManager->clearCachedDefinitions()->shouldBeCalled(); @@ -162,7 +162,7 @@ class EntityTypeBundleInfoTest extends UnitTestCase { * * @dataProvider providerTestGetBundleInfo */ - public function testGetBundleInfo($entity_type_id, $expected) { + public function testGetBundleInfo($entity_type_id, $expected): void { $this->moduleHandler->invokeAll('entity_bundle_info')->willReturn([]); $this->moduleHandler->alter('entity_bundle_info', Argument::type('array'))->willReturn(NULL); @@ -212,7 +212,7 @@ class EntityTypeBundleInfoTest extends UnitTestCase { * * @covers ::getAllBundleInfo */ - public function testGetAllBundleInfo() { + public function testGetAllBundleInfo(): void { $this->moduleHandler->invokeAll('entity_bundle_info')->willReturn([]); $this->moduleHandler->alter('entity_bundle_info', Argument::type('array'))->willReturn(NULL); @@ -270,7 +270,7 @@ class EntityTypeBundleInfoTest extends UnitTestCase { /** * @covers ::getAllBundleInfo */ - public function testGetAllBundleInfoWithEntityBundleInfo() { + public function testGetAllBundleInfoWithEntityBundleInfo(): void { // Ensure that EntityTypeBundleInfo::getAllBundleInfo() does not add // additional bundles if hook_entity_bundle_info() defines some and the // entity_type does not define a bundle entity type. diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php index bf2ce4b160d..a3e5953ea58 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php @@ -135,7 +135,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @dataProvider providerTestHasHandler */ - public function testHasHandler($entity_type_id, $expected) { + public function testHasHandler($entity_type_id, $expected): void { $apple = $this->prophesize(EntityTypeInterface::class); $apple->hasHandlerClass('storage')->willReturn(TRUE); @@ -170,7 +170,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getStorage */ - public function testGetStorage() { + public function testGetStorage(): void { $class = $this->getTestHandlerClass(); $entity = $this->prophesize(EntityTypeInterface::class); $entity->getHandlerClass('storage')->willReturn($class); @@ -184,7 +184,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getListBuilder */ - public function testGetListBuilder() { + public function testGetListBuilder(): void { $class = $this->getTestHandlerClass(); $entity = $this->prophesize(EntityTypeInterface::class); $entity->getHandlerClass('list_builder')->willReturn($class); @@ -198,7 +198,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getViewBuilder */ - public function testGetViewBuilder() { + public function testGetViewBuilder(): void { $class = $this->getTestHandlerClass(); $entity = $this->prophesize(EntityTypeInterface::class); $entity->getHandlerClass('view_builder')->willReturn($class); @@ -212,7 +212,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getAccessControlHandler */ - public function testGetAccessControlHandler() { + public function testGetAccessControlHandler(): void { $class = $this->getTestHandlerClass(); $entity = $this->prophesize(EntityTypeInterface::class); $entity->getHandlerClass('access')->willReturn($class); @@ -226,7 +226,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getFormObject */ - public function testGetFormObject() { + public function testGetFormObject(): void { $apple = $this->prophesize(EntityTypeInterface::class); $apple->getFormClass('default')->willReturn(TestEntityForm::class); @@ -301,7 +301,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getHandler */ - public function testGetHandler() { + public function testGetHandler(): void { $class = get_class($this->getMockForAbstractClass(TestEntityHandlerBase::class)); $apple = $this->prophesize(EntityTypeInterface::class); $apple->getHandlerClass('storage')->willReturn($class); @@ -364,7 +364,7 @@ class EntityTypeManagerTest extends UnitTestCase { /** * @covers ::getRouteProviders */ - public function testGetRouteProviders() { + public function testGetRouteProviders(): void { $apple = $this->prophesize(EntityTypeInterface::class); $apple->getRouteProviderClasses()->willReturn(['default' => TestRouteProvider::class]); @@ -383,7 +383,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::processDefinition */ - public function testProcessDefinition() { + public function testProcessDefinition(): void { $apple = $this->prophesize(EntityTypeInterface::class); $this->setUpEntityTypeDefinitions(['apple' => $apple]); @@ -402,7 +402,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @dataProvider providerTestGetDefinition */ - public function testGetDefinition($entity_type_id, $expected) { + public function testGetDefinition($entity_type_id, $expected): void { $entity = $this->prophesize(EntityTypeInterface::class); $this->setUpEntityTypeDefinitions([ @@ -438,7 +438,7 @@ class EntityTypeManagerTest extends UnitTestCase { * * @covers ::getDefinition */ - public function testGetDefinitionInvalidException() { + public function testGetDefinitionInvalidException(): void { $this->setUpEntityTypeDefinitions(); $this->expectException(PluginNotFoundException::class); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php index 5afc6db038f..a5d46ebb761 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php @@ -97,7 +97,7 @@ class EntityTypeRepositoryTest extends UnitTestCase { * * @covers ::getEntityTypeLabels */ - public function testGetEntityTypeLabels() { + public function testGetEntityTypeLabels(): void { $apple = $this->prophesize(EntityTypeInterface::class); $apple->getLabel()->willReturn('Apple'); $apple->getBundleOf()->willReturn(NULL); @@ -121,7 +121,7 @@ class EntityTypeRepositoryTest extends UnitTestCase { /** * @covers ::getEntityTypeFromClass */ - public function testGetEntityTypeFromClass() { + public function testGetEntityTypeFromClass(): void { $apple = $this->prophesize(EntityTypeInterface::class); $banana = $this->prophesize(EntityTypeInterface::class); @@ -147,7 +147,7 @@ class EntityTypeRepositoryTest extends UnitTestCase { /** * @covers ::getEntityTypeFromClass */ - public function testGetEntityTypeFromClassNoMatch() { + public function testGetEntityTypeFromClassNoMatch(): void { $apple = $this->prophesize(EntityTypeInterface::class); $banana = $this->prophesize(EntityTypeInterface::class); @@ -167,7 +167,7 @@ class EntityTypeRepositoryTest extends UnitTestCase { /** * @covers ::getEntityTypeFromClass */ - public function testGetEntityTypeFromClassAmbiguous() { + public function testGetEntityTypeFromClassAmbiguous(): void { $jazz = $this->prophesize(EntityTypeInterface::class); $jazz->getOriginalClass()->willReturn('\Drupal\apple\Entity\Apple'); $jazz->id()->willReturn('jazz'); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index 071b5d41912..c70a98aded4 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -37,7 +37,7 @@ class EntityTypeTest extends UnitTestCase { * * @dataProvider providerTestGet */ - public function testGet(array $definition, $key, $expected) { + public function testGet(array $definition, $key, $expected): void { $entity_type = $this->setUpEntityType($definition); $this->assertSame($expected, $entity_type->get($key)); } @@ -48,7 +48,7 @@ class EntityTypeTest extends UnitTestCase { * * @dataProvider providerTestSet */ - public function testSet($key, $value) { + public function testSet($key, $value): void { $entity_type = $this->setUpEntityType([]); $this->assertInstanceOf('Drupal\Core\Entity\EntityTypeInterface', $entity_type->set($key, $value)); $this->assertSame($value, $entity_type->get($key)); @@ -60,7 +60,7 @@ class EntityTypeTest extends UnitTestCase { * * @dataProvider providerTestGetKeys */ - public function testGetKeys($entity_keys, $expected) { + public function testGetKeys($entity_keys, $expected): void { $entity_type = $this->setUpEntityType(['entity_keys' => $entity_keys]); $expected += [ 'default_langcode' => 'default_langcode', @@ -74,7 +74,7 @@ class EntityTypeTest extends UnitTestCase { * * @dataProvider providerTestGetKeys */ - public function testGetKey($entity_keys, $expected) { + public function testGetKey($entity_keys, $expected): void { $entity_type = $this->setUpEntityType(['entity_keys' => $entity_keys]); $this->assertSame($expected['bundle'], $entity_type->getKey('bundle')); $this->assertFalse($entity_type->getKey('bananas')); @@ -85,7 +85,7 @@ class EntityTypeTest extends UnitTestCase { * * @dataProvider providerTestGetKeys */ - public function testHasKey($entity_keys, $expected) { + public function testHasKey($entity_keys, $expected): void { $entity_type = $this->setUpEntityType(['entity_keys' => $entity_keys]); $this->assertSame(!empty($expected['bundle']), $entity_type->hasKey('bundle')); $this->assertSame(!empty($expected['id']), $entity_type->hasKey('id')); @@ -134,7 +134,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the isInternal() method. */ - public function testIsInternal() { + public function testIsInternal(): void { $entity_type = $this->setUpEntityType(['internal' => TRUE]); $this->assertTrue($entity_type->isInternal()); $entity_type = $this->setUpEntityType(['internal' => FALSE]); @@ -146,7 +146,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the isRevisionable() method. */ - public function testIsRevisionable() { + public function testIsRevisionable(): void { $entity_type = $this->setUpEntityType(['entity_keys' => ['id' => 'id']]); $this->assertFalse($entity_type->isRevisionable()); $entity_type = $this->setUpEntityType(['entity_keys' => ['id' => 'id', 'revision' => FALSE]]); @@ -158,7 +158,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getHandler() method. */ - public function testGetHandler() { + public function testGetHandler(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([ 'handlers' => [ @@ -177,7 +177,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getStorageClass() method. */ - public function testGetStorageClass() { + public function testGetStorageClass(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([ 'handlers' => [ @@ -190,7 +190,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the setStorageClass() method. */ - public function testSetStorageClass() { + public function testSetStorageClass(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([]); $this->assertSame($entity_type, $entity_type->setStorageClass($controller)); @@ -199,7 +199,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getListBuilderClass() method. */ - public function testGetListBuilderClass() { + public function testGetListBuilderClass(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([ 'handlers' => [ @@ -212,7 +212,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getAccessControlClass() method. */ - public function testGetAccessControlClass() { + public function testGetAccessControlClass(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([ 'handlers' => [ @@ -225,7 +225,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getFormClass() method. */ - public function testGetFormClass() { + public function testGetFormClass(): void { $controller = $this->getTestHandlerClass(); $operation = 'default'; $entity_type = $this->setUpEntityType([ @@ -241,7 +241,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the hasFormClasses() method. */ - public function testHasFormClasses() { + public function testHasFormClasses(): void { $controller = $this->getTestHandlerClass(); $operation = 'default'; $entity_type1 = $this->setUpEntityType([ @@ -261,7 +261,7 @@ class EntityTypeTest extends UnitTestCase { /** * Tests the getViewBuilderClass() method. */ - public function testGetViewBuilderClass() { + public function testGetViewBuilderClass(): void { $controller = $this->getTestHandlerClass(); $entity_type = $this->setUpEntityType([ 'handlers' => [ @@ -274,7 +274,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::__construct */ - public function testIdExceedsMaxLength() { + public function testIdExceedsMaxLength(): void { $id = $this->randomMachineName(33); $message = 'Attempt to create an entity type with an ID longer than 32 characters: ' . $id; $this->expectException('Drupal\Core\Entity\Exception\EntityTypeIdLengthException'); @@ -285,7 +285,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getOriginalClass */ - public function testGetOriginalClassUnchanged() { + public function testGetOriginalClassUnchanged(): void { $class = $this->randomMachineName(); $entity_type = $this->setUpEntityType(['class' => $class]); $this->assertEquals($class, $entity_type->getOriginalClass()); @@ -295,7 +295,7 @@ class EntityTypeTest extends UnitTestCase { * @covers ::setClass * @covers ::getOriginalClass */ - public function testGetOriginalClassChanged() { + public function testGetOriginalClassChanged(): void { $class = $this->randomMachineName(); $entity_type = $this->setUpEntityType(['class' => $class]); $entity_type->setClass($this->randomMachineName()); @@ -305,7 +305,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::id */ - public function testId() { + public function testId(): void { $id = $this->randomMachineName(32); $entity_type = $this->setUpEntityType(['id' => $id]); $this->assertEquals($id, $entity_type->id()); @@ -314,7 +314,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getLabel */ - public function testGetLabel() { + public function testGetLabel(): void { $translatable_label = new TranslatableMarkup($this->randomMachineName()); $entity_type = $this->setUpEntityType(['label' => $translatable_label]); $this->assertSame($translatable_label, $entity_type->getLabel()); @@ -327,7 +327,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getGroupLabel */ - public function testGetGroupLabel() { + public function testGetGroupLabel(): void { $translatable_group_label = new TranslatableMarkup($this->randomMachineName()); $entity_type = $this->setUpEntityType(['group_label' => $translatable_group_label]); $this->assertSame($translatable_group_label, $entity_type->getGroupLabel()); @@ -344,7 +344,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getCollectionLabel */ - public function testGetCollectionLabel() { + public function testGetCollectionLabel(): void { $translatable_label = new TranslatableMarkup('Entity test collection', [], [], $this->getStringTranslationStub()); $entity_type = $this->setUpEntityType(['label_collection' => $translatable_label]); $entity_type->setStringTranslation($this->getStringTranslationStub()); @@ -354,7 +354,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getSingularLabel */ - public function testGetSingularLabel() { + public function testGetSingularLabel(): void { $translatable_label = new TranslatableMarkup('entity test singular', [], [], $this->getStringTranslationStub()); $entity_type = $this->setUpEntityType(['label_singular' => $translatable_label]); $entity_type->setStringTranslation($this->getStringTranslationStub()); @@ -364,7 +364,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getSingularLabel */ - public function testGetSingularLabelDefault() { + public function testGetSingularLabelDefault(): void { $entity_type = $this->setUpEntityType(['label' => 'Entity test Singular']); $entity_type->setStringTranslation($this->getStringTranslationStub()); $this->assertEquals('entity test singular', $entity_type->getSingularLabel()); @@ -373,7 +373,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getPluralLabel */ - public function testGetPluralLabel() { + public function testGetPluralLabel(): void { $translatable_label = new TranslatableMarkup('entity test plural', [], [], $this->getStringTranslationStub()); $entity_type = $this->setUpEntityType(['label_plural' => $translatable_label]); $entity_type->setStringTranslation($this->getStringTranslationStub()); @@ -383,7 +383,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getPluralLabel */ - public function testGetPluralLabelDefault() { + public function testGetPluralLabelDefault(): void { $entity_type = $this->setUpEntityType(['label' => 'Entity test Plural']); $entity_type->setStringTranslation($this->getStringTranslationStub()); $this->assertEquals('entity test plural entities', $entity_type->getPluralLabel()); @@ -392,7 +392,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getCountLabel */ - public function testGetCountLabel() { + public function testGetCountLabel(): void { $entity_type = $this->setUpEntityType(['label_count' => ['singular' => 'one entity test', 'plural' => '@count entity test']]); $entity_type->setStringTranslation($this->getStringTranslationStub()); $this->assertEquals('one entity test', $entity_type->getCountLabel(1)); @@ -409,7 +409,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::getCountLabel */ - public function testGetCountLabelDefault() { + public function testGetCountLabelDefault(): void { $entity_type = $this->setUpEntityType(['label' => 'Entity test Plural']); $entity_type->setStringTranslation($this->getStringTranslationStub()); $this->assertEquals('1 entity test plural', $entity_type->getCountLabel(1)); @@ -424,7 +424,7 @@ class EntityTypeTest extends UnitTestCase { * @covers ::getBundleLabel * @dataProvider providerTestGetBundleLabel */ - public function testGetBundleLabel($definition, $expected) { + public function testGetBundleLabel($definition, $expected): void { $entity_type = $this->setUpEntityType($definition); $entity_type->setStringTranslation($this->getStringTranslationStub()); $this->assertEquals($expected, $entity_type->getBundleLabel()); @@ -453,7 +453,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::setLinkTemplate */ - public function testSetLinkTemplateWithInvalidPath() { + public function testSetLinkTemplateWithInvalidPath(): void { $entity_type = $this->setUpEntityType(['id' => $this->randomMachineName()]); $this->expectException(\InvalidArgumentException::class); $entity_type->setLinkTemplate('test', 'invalid-path'); @@ -466,7 +466,7 @@ class EntityTypeTest extends UnitTestCase { * @covers ::setConstraints * @covers ::addConstraint */ - public function testConstraintMethods() { + public function testConstraintMethods(): void { $definition = [ 'constraints' => [ 'EntityChanged' => [], @@ -496,7 +496,7 @@ class EntityTypeTest extends UnitTestCase { /** * @covers ::entityClassImplements */ - public function testEntityClassImplements() { + public function testEntityClassImplements(): void { $entity_type = $this->setUpEntityType(['class' => EntityFormMode::class]); $this->assertTrue($entity_type->entityClassImplements(ConfigEntityInterface::class)); $this->assertFalse($entity_type->entityClassImplements(\DateTimeInterface::class)); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index cfc633fa1d2..43816924d15 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -133,14 +133,14 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::id */ - public function testId() { + public function testId(): void { $this->assertSame($this->values['id'], $this->entity->id()); } /** * @covers ::uuid */ - public function testUuid() { + public function testUuid(): void { $this->assertSame($this->values['uuid'], $this->entity->uuid()); } @@ -148,7 +148,7 @@ class EntityUnitTest extends UnitTestCase { * @covers ::isNew * @covers ::enforceIsNew */ - public function testIsNew() { + public function testIsNew(): void { // We provided an ID, so the entity is not new. $this->assertFalse($this->entity->isNew()); // Force it to be new. @@ -159,21 +159,21 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::getEntityType */ - public function testGetEntityType() { + public function testGetEntityType(): void { $this->assertSame($this->entityType, $this->entity->getEntityType()); } /** * @covers ::bundle */ - public function testBundle() { + public function testBundle(): void { $this->assertSame($this->entityTypeId, $this->entity->bundle()); } /** * @covers ::label */ - public function testLabel() { + public function testLabel(): void { $property_label = $this->randomMachineName(); $this->entityType->expects($this->atLeastOnce()) ->method('getKey') @@ -198,7 +198,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::access */ - public function testAccess() { + public function testAccess(): void { $access = $this->createMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface'); $operation = $this->randomMachineName(); $access->expects($this->once()) @@ -219,7 +219,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::language */ - public function testLanguage() { + public function testLanguage(): void { $this->entityType->expects($this->any()) ->method('getKey') ->willReturnMap([ @@ -253,7 +253,7 @@ class EntityUnitTest extends UnitTestCase { * * @covers ::load */ - public function testLoad() { + public function testLoad(): void { $this->setupTestLoad(); $class_name = get_class($this->entity); @@ -288,7 +288,7 @@ class EntityUnitTest extends UnitTestCase { * * @covers ::loadMultiple */ - public function testLoadMultiple() { + public function testLoadMultiple(): void { $this->setupTestLoad(); $class_name = get_class($this->entity); @@ -320,7 +320,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::create */ - public function testCreate() { + public function testCreate(): void { $this->setupTestLoad(); $class_name = get_class($this->entity); @@ -352,7 +352,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::save */ - public function testSave() { + public function testSave(): void { $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage->expects($this->once()) ->method('save') @@ -369,7 +369,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::delete */ - public function testDelete() { + public function testDelete(): void { $this->entity->id = $this->randomMachineName(); $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); // Testing the argument of the delete() method consumes too much memory. @@ -387,14 +387,14 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::getEntityTypeId */ - public function testGetEntityTypeId() { + public function testGetEntityTypeId(): void { $this->assertSame($this->entityTypeId, $this->entity->getEntityTypeId()); } /** * @covers ::preSave */ - public function testPreSave() { + public function testPreSave(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); // Our mocked entity->preSave() returns NULL, so assert that. @@ -404,7 +404,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postSave */ - public function testPostSave() { + public function testPostSave(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); @@ -426,7 +426,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postSave */ - public function testPostSaveBundle() { + public function testPostSaveBundle(): void { $this->entityType->expects($this->atLeastOnce()) ->method('hasKey') ->with('bundle') @@ -456,7 +456,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::preCreate */ - public function testPreCreate() { + public function testPreCreate(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $values = []; @@ -467,7 +467,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postCreate */ - public function testPostCreate() { + public function testPostCreate(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); // Our mocked entity->postCreate() returns NULL, so assert that. @@ -477,7 +477,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::preDelete */ - public function testPreDelete() { + public function testPreDelete(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); // Our mocked entity->preDelete() returns NULL, so assert that. @@ -487,7 +487,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postDelete */ - public function testPostDelete() { + public function testPostDelete(): void { $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage->expects($this->once()) ->method('getEntityType') @@ -505,7 +505,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postDelete */ - public function testPostDeleteBundle() { + public function testPostDeleteBundle(): void { $this->entityType->expects($this->atLeastOnce()) ->method('hasKey') ->with('bundle') @@ -530,7 +530,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::postLoad */ - public function testPostLoad() { + public function testPostLoad(): void { // This method is internal, so check for errors on calling it only. $storage = $this->createMock('\Drupal\Core\Entity\EntityStorageInterface'); $entities = [$this->entity]; @@ -541,7 +541,7 @@ class EntityUnitTest extends UnitTestCase { /** * @covers ::referencedEntities */ - public function testReferencedEntities() { + public function testReferencedEntities(): void { $this->assertSame([], $this->entity->referencedEntities()); } @@ -550,7 +550,7 @@ class EntityUnitTest extends UnitTestCase { * @covers ::getCacheTagsToInvalidate * @covers ::addCacheTags */ - public function testCacheTags() { + public function testCacheTags(): void { // Ensure that both methods return the same by default. $this->assertEqualsCanonicalizing([$this->entityTypeId . ':' . 1], $this->entity->getCacheTags()); $this->assertEqualsCanonicalizing([$this->entityTypeId . ':' . 1], $this->entity->getCacheTagsToInvalidate()); @@ -570,7 +570,7 @@ class EntityUnitTest extends UnitTestCase { * @covers ::getCacheContexts * @covers ::addCacheContexts */ - public function testCacheContexts() { + public function testCacheContexts(): void { $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); @@ -592,7 +592,7 @@ class EntityUnitTest extends UnitTestCase { * @covers ::getCacheMaxAge * @covers ::mergeCacheMaxAge */ - public function testCacheMaxAge() { + public function testCacheMaxAge(): void { // Cache max age is permanent by default. $this->assertEquals(Cache::PERMANENT, $this->entity->getCacheMaxAge()); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index d9278aea237..378efcbb593 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -95,7 +95,7 @@ class EntityUrlTest extends UnitTestCase { * * @covers ::toUrl */ - public function testToUrlNoId() { + public function testToUrlNoId(): void { $entity = $this->getEntity(UrlTestEntity::class, []); $this->expectException(EntityMalformedException::class); @@ -166,7 +166,7 @@ class EntityUrlTest extends UnitTestCase { * @covers ::linkTemplates * @covers ::urlRouteParameters */ - public function testToUrlLinkTemplates($link_template, $expected_route_name) { + public function testToUrlLinkTemplates($link_template, $expected_route_name): void { $values = ['id' => static::ENTITY_ID, 'langcode' => $this->langcode]; $entity = $this->getEntity(UrlTestEntity::class, $values); $this->registerLinkTemplate($link_template); @@ -264,7 +264,7 @@ class EntityUrlTest extends UnitTestCase { * @covers ::linkTemplates * @covers ::urlRouteParameters */ - public function testToUrlLinkTemplateNoId($link_template, $expected_route_name) { + public function testToUrlLinkTemplateNoId($link_template, $expected_route_name): void { $entity = $this->getEntity(UrlTestEntity::class, ['id' => static::ENTITY_ID]); $this->registerLinkTemplate($link_template); @@ -354,7 +354,7 @@ class EntityUrlTest extends UnitTestCase { * @covers ::toUrl * @covers ::linkTemplates */ - public function testToUrlUriCallbackUndefined(array $bundle_info, $uri_callback) { + public function testToUrlUriCallbackUndefined(array $bundle_info, $uri_callback): void { $entity = $this->getEntity(UrlTestEntity::class, ['id' => static::ENTITY_ID]); $this->registerBundleInfo($bundle_info); @@ -432,7 +432,7 @@ class EntityUrlTest extends UnitTestCase { * * @covers ::uriRelationships */ - public function testUriRelationships() { + public function testUriRelationships(): void { $entity = $this->getEntity(UrlTestEntity::class, ['id' => static::ENTITY_ID]); $container_builder = new ContainerBuilder(); diff --git a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php index ea7f1f36b70..0ba944f287c 100644 --- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php @@ -102,7 +102,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getName * @dataProvider factoryTypeProvider */ - public function testFieldName($factory_name) { + public function testFieldName($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertEquals($this->storageDefinition->getName(), $definition->getName()); } @@ -111,7 +111,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getLabel * @dataProvider factoryTypeProvider */ - public function testFieldLabel($factory_name) { + public function testFieldLabel($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $label = $this->randomMachineName(); $definition->setLabel($label); @@ -123,7 +123,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getTargetBundle * @dataProvider factoryTypeProvider */ - public function testBundle($factory_name) { + public function testBundle($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $bundle = $this->randomMachineName(); $definition->setTargetBundle($bundle); @@ -134,7 +134,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getDescription * @dataProvider factoryTypeProvider */ - public function testFieldDescription($factory_name) { + public function testFieldDescription($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $description = $this->randomMachineName(); $definition->setDescription($description); @@ -145,7 +145,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getType * @dataProvider factoryTypeProvider */ - public function testFieldType($factory_name) { + public function testFieldType($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertEquals($this->fieldType, $definition->getType()); } @@ -156,7 +156,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getSettings * @dataProvider factoryTypeProvider */ - public function testFieldSettings($factory_name) { + public function testFieldSettings($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $setting = $this->randomMachineName(); $value = $this->randomMachineName(); @@ -172,7 +172,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getSettings * @dataProvider factoryTypeProvider */ - public function testDefaultFieldSettings($factory_name) { + public function testDefaultFieldSettings($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $expected_settings = $this->fieldTypeDefinition['field_settings'] + $this->fieldTypeDefinition['storage_settings']; $this->assertEquals($expected_settings, $definition->getSettings()); @@ -186,7 +186,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setDefaultValue * @dataProvider factoryTypeProvider */ - public function testFieldDefaultValue($factory_name) { + public function testFieldDefaultValue($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertEquals([], $definition->getDefaultValueLiteral()); @@ -236,7 +236,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setTranslatable * @dataProvider factoryTypeProvider */ - public function testFieldTranslatable($factory_name) { + public function testFieldTranslatable($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertFalse($definition->isTranslatable()); $definition->setTranslatable(TRUE); @@ -257,7 +257,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setRequired * @dataProvider factoryTypeProvider */ - public function testFieldRequired($factory_name) { + public function testFieldRequired($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertFalse($definition->isRequired()); $definition->setRequired(TRUE); @@ -272,7 +272,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setDefaultValueCallback * @dataProvider factoryTypeProvider */ - public function testDefaultValueCallback($factory_name) { + public function testDefaultValueCallback($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $callback = static::class . '::mockDefaultValueCallback'; // setDefaultValueCallback returns $this. @@ -286,7 +286,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setDefaultValueCallback * @dataProvider factoryTypeProvider */ - public function testInvalidDefaultValueCallback($factory_name) { + public function testInvalidDefaultValueCallback($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); // setDefaultValueCallback returns $this. $this->expectException(\InvalidArgumentException::class); @@ -299,7 +299,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::setDefaultValueCallback * @dataProvider factoryTypeProvider */ - public function testNullDefaultValueCallback($factory_name) { + public function testNullDefaultValueCallback($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); // setDefaultValueCallback returns $this. $this->assertSame($definition, $definition->setDefaultValueCallback(NULL)); @@ -313,7 +313,7 @@ class FieldDefinitionTest extends UnitTestCase { * @covers ::getDisplayOptions * @dataProvider factoryTypeProvider */ - public function testDisplayConfigurationSettings($factory_name) { + public function testDisplayConfigurationSettings($factory_name): void { $definition = $this->initializeFieldUsingFactory($factory_name); $this->assertEquals(FALSE, $definition->isDisplayConfigurable('foo')); $this->assertEquals(NULL, $definition->getDisplayOptions('foo')); diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index 0a25eabc845..d7c944852d2 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -153,7 +153,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::create * @covers ::doCreate */ - public function testCreateWithPredefinedUuid() { + public function testCreateWithPredefinedUuid(): void { $this->entityType->expects($this->once()) ->method('getClass') ->willReturn(get_class($this->getMockEntity())); @@ -178,7 +178,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::create * @covers ::doCreate */ - public function testCreateWithoutUuidKey() { + public function testCreateWithoutUuidKey(): void { // Set up the entity storage to expect no UUID key. $this->entityType->expects($this->once()) ->method('getClass') @@ -358,7 +358,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * * @depends testSaveConfigEntity */ - public function testSaveRenameConfigEntity(ConfigEntityInterface $entity) { + public function testSaveRenameConfigEntity(ConfigEntityInterface $entity): void { $this->entityType->expects($this->once()) ->method('getClass') ->willReturn(get_class($entity)); @@ -397,7 +397,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveContentEntity() { + public function testSaveContentEntity(): void { $this->entityType->expects($this->any()) ->method('getKeys') ->willReturn([ @@ -432,7 +432,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveInvalid() { + public function testSaveInvalid(): void { $this->setUpKeyValueEntityStorage(); $entity = $this->getMockEntity('Drupal\Core\Config\Entity\ConfigEntityBase'); @@ -451,7 +451,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::save * @covers ::doSave */ - public function testSaveDuplicate() { + public function testSaveDuplicate(): void { $this->setUpKeyValueEntityStorage(); $entity = $this->getMockEntity(EntityBaseTest::class, [['id' => 'foo']]); @@ -472,7 +472,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::load * @covers ::postLoad */ - public function testLoad() { + public function testLoad(): void { $entity = $this->getMockEntity(); $this->entityType->expects($this->once()) ->method('getClass') @@ -491,7 +491,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { /** * @covers ::load */ - public function testLoadMissingEntity() { + public function testLoadMissingEntity(): void { $this->setUpKeyValueEntityStorage(); $this->keyValueStore->expects($this->once()) @@ -508,7 +508,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::mapFromStorageRecords * @covers ::doLoadMultiple */ - public function testLoadMultipleAll() { + public function testLoadMultipleAll(): void { $expected['foo'] = $this->getMockEntity(EntityBaseTest::class, [['id' => 'foo']]); $expected['bar'] = $this->getMockEntity(EntityBaseTest::class, [['id' => 'bar']]); $this->entityType->expects($this->once()) @@ -533,7 +533,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::mapFromStorageRecords * @covers ::doLoadMultiple */ - public function testLoadMultipleIds() { + public function testLoadMultipleIds(): void { $entity = $this->getMockEntity(EntityBaseTest::class, [['id' => 'foo']]); $this->entityType->expects($this->once()) ->method('getClass') @@ -556,7 +556,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::delete * @covers ::doDelete */ - public function testDelete() { + public function testDelete(): void { $entities['foo'] = $this->getMockEntity(EntityBaseTest::class, [['id' => 'foo']]); $entities['bar'] = $this->getMockEntity(EntityBaseTest::class, [['id' => 'bar']]); $this->setUpKeyValueEntityStorage(); @@ -587,7 +587,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { * @covers ::delete * @covers ::doDelete */ - public function testDeleteNothing() { + public function testDeleteNothing(): void { $this->setUpKeyValueEntityStorage(); $this->moduleHandler->expects($this->never()) diff --git a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php index fcaa9b6a0a7..0c721ac908d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php @@ -49,7 +49,7 @@ class QueryTest extends UnitTestCase { * * @covers ::prepare */ - public function testNoBaseTable() { + public function testNoBaseTable(): void { $this->expectException(QueryException::class); $this->expectExceptionMessage('No base table for example_entity_query, invalid query.'); $this->query->execute(); @@ -60,7 +60,7 @@ class QueryTest extends UnitTestCase { * * @covers ::prepare */ - public function testNoRevisionTable() { + public function testNoRevisionTable(): void { $this->expectException(QueryException::class); $this->expectExceptionMessage('No revision table for example_entity_query, invalid query.'); $this->query->allRevisions()->execute(); diff --git a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php index db044f7e35d..c66e726693d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php @@ -61,7 +61,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { * @covers ::getAddPageRoute * @dataProvider providerTestGetAddPageRoute */ - public function testGetAddPageRoute(?Route $expected, EntityTypeInterface $entity_type) { + public function testGetAddPageRoute(?Route $expected, EntityTypeInterface $entity_type): void { $route = $this->routeProvider->getAddPageRoute($entity_type); $this->assertEquals($expected, $route); } @@ -99,7 +99,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { * @covers ::getAddFormRoute * @dataProvider providerTestGetAddFormRoute */ - public function testGetAddFormRoute(?Route $expected, EntityTypeInterface $entity_type, ?EntityTypeInterface $bundle_entity_type = NULL, ?FieldStorageDefinitionInterface $field_storage_definition = NULL) { + public function testGetAddFormRoute(?Route $expected, EntityTypeInterface $entity_type, ?EntityTypeInterface $bundle_entity_type = NULL, ?FieldStorageDefinitionInterface $field_storage_definition = NULL): void { if ($bundle_entity_type) { $this->entityTypeManager->getDefinition('the_bundle_entity_type_id')->willReturn($bundle_entity_type); @@ -200,7 +200,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { * @covers ::getCanonicalRoute * @dataProvider providerTestGetCanonicalRoute */ - public function testGetCanonicalRoute(?Route $expected, EntityTypeInterface $entity_type, ?FieldStorageDefinitionInterface $field_storage_definition = NULL) { + public function testGetCanonicalRoute(?Route $expected, EntityTypeInterface $entity_type, ?FieldStorageDefinitionInterface $field_storage_definition = NULL): void { if ($field_storage_definition) { $this->entityFieldManager->getFieldStorageDefinitions($entity_type->id()) ->willReturn([$entity_type->getKey('id') => $field_storage_definition]); @@ -260,7 +260,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { * @covers ::getCollectionRoute * @dataProvider providerTestGetCollectionRoute */ - public function testGetCollectionRoute(?Route $expected, EntityTypeInterface $entity_type) { + public function testGetCollectionRoute(?Route $expected, EntityTypeInterface $entity_type): void { $route = $this->routeProvider->getCollectionRoute($entity_type); $this->assertEquals($expected, $route); } @@ -352,7 +352,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { /** * @covers ::getEntityTypeIdKeyType */ - public function testGetEntityTypeIdKeyType() { + public function testGetEntityTypeIdKeyType(): void { $entity_type = $this->prophesize(EntityTypeInterface::class); $entity_type->entityClassImplements(FieldableEntityInterface::class)->willReturn(TRUE); $entity_type->id()->willReturn('the_entity_type_id'); @@ -369,7 +369,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase { /** * @covers ::getEntityTypeIdKeyType */ - public function testGetEntityTypeIdKeyTypeNotFieldable() { + public function testGetEntityTypeIdKeyTypeNotFieldable(): void { $entity_type = $this->prophesize(EntityTypeInterface::class); $entity_type->entityClassImplements(FieldableEntityInterface::class)->willReturn(FALSE); $this->entityFieldManager->getFieldStorageDefinitions(Argument::any())->shouldNotBeCalled(); diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php index 7351ae89439..4d468847ac8 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php @@ -39,7 +39,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @covers ::getTableNames */ - public function testGetTableNames() { + public function testGetTableNames(): void { // The storage definitions are only used in getColumnNames() so we do not // need to provide any here. $table_mapping = new TestDefaultTableMapping($this->entityType, []); @@ -70,7 +70,7 @@ class DefaultTableMappingTest extends UnitTestCase { * @covers ::getExtraColumns * @covers ::setExtraColumns */ - public function testGetAllColumns() { + public function testGetAllColumns(): void { // Set up single-column and multi-column definitions. $definitions['id'] = $this->setUpDefinition('id', ['value']); $definitions['name'] = $this->setUpDefinition('name', ['value']); @@ -176,7 +176,7 @@ class DefaultTableMappingTest extends UnitTestCase { * @covers ::getFieldNames * @covers ::setFieldNames */ - public function testGetFieldNames() { + public function testGetFieldNames(): void { // The storage definitions are only used in getColumnNames() so we do not // need to provide any here. $table_mapping = new TestDefaultTableMapping($this->entityType, []); @@ -206,7 +206,7 @@ class DefaultTableMappingTest extends UnitTestCase { * @covers ::__construct * @covers ::getColumnNames */ - public function testGetColumnNames() { + public function testGetColumnNames(): void { $definitions['test'] = $this->setUpDefinition('test', []); $table_mapping = new TestDefaultTableMapping($this->entityType, $definitions); $expected = []; @@ -238,7 +238,7 @@ class DefaultTableMappingTest extends UnitTestCase { * @covers ::getExtraColumns * @covers ::setExtraColumns */ - public function testGetExtraColumns() { + public function testGetExtraColumns(): void { // The storage definitions are only used in getColumnNames() so we do not // need to provide any here. $table_mapping = new TestDefaultTableMapping($this->entityType, []); @@ -279,7 +279,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @dataProvider providerTestGetFieldColumnName */ - public function testGetFieldColumnName($base_field, $columns, $column, $expected) { + public function testGetFieldColumnName($base_field, $columns, $column, $expected): void { $definitions['test'] = $this->setUpDefinition('test', $columns, $base_field); $table_mapping = new TestDefaultTableMapping($this->entityType, $definitions); $result = $table_mapping->getFieldColumnName($definitions['test'], $column); @@ -301,7 +301,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @dataProvider providerTestGetFieldColumnName */ - public function testGetFieldColumnNameInvalid($base_field, $columns, $column) { + public function testGetFieldColumnNameInvalid($base_field, $columns, $column): void { $definitions['test'] = $this->setUpDefinition('test', $columns, $base_field); // Mark field storage definition as custom storage. @@ -355,7 +355,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @dataProvider providerTestGetFieldTableName */ - public function testGetFieldTableName($table_names, $expected) { + public function testGetFieldTableName($table_names, $expected): void { $field_name = 'test'; $columns = ['test']; @@ -444,7 +444,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @covers ::getFieldTableName */ - public function testGetFieldTableNameInvalid() { + public function testGetFieldTableNameInvalid(): void { $table_mapping = new TestDefaultTableMapping($this->entityType, []); $this->expectException(SqlContentEntityStorageException::class); $this->expectExceptionMessage("Table information not available for the 'invalid_field_name' field."); @@ -457,7 +457,7 @@ class DefaultTableMappingTest extends UnitTestCase { * * @dataProvider providerTestGetDedicatedTableName */ - public function testGetDedicatedTableName($info, $expected_data_table, $expected_revision_table) { + public function testGetDedicatedTableName($info, $expected_data_table, $expected_revision_table): void { $entity_type_id = $info['entity_type_id']; $field_name = $info['field_name']; diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php index 5a20b34b6c4..e37afd82ab2 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -117,7 +117,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::getFieldSchemaData * @covers ::processIdentifierSchema */ - public function testGetSchemaBase() { + public function testGetSchemaBase(): void { $this->entityType = new ContentEntityType([ 'id' => 'entity_test', 'entity_keys' => ['id' => 'id'], @@ -410,7 +410,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::getEntityIndexName * @covers ::processIdentifierSchema */ - public function testGetSchemaRevisionable() { + public function testGetSchemaRevisionable(): void { $this->entityType = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityType') ->setConstructorArgs([ [ @@ -514,7 +514,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::getEntityIndexName * @covers ::processDataTable */ - public function testGetSchemaTranslatable() { + public function testGetSchemaTranslatable(): void { $this->entityType = new ContentEntityType([ 'id' => 'entity_test', 'entity_keys' => [ @@ -626,7 +626,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::initializeRevisionDataTable * @covers ::processRevisionDataTable */ - public function testGetSchemaRevisionableTranslatable() { + public function testGetSchemaRevisionableTranslatable(): void { $this->entityType = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityType') ->setConstructorArgs([ [ @@ -838,7 +838,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::getDedicatedTableSchema * @covers ::createDedicatedTableSchema */ - public function testDedicatedTableSchema() { + public function testDedicatedTableSchema(): void { $entity_type_id = 'entity_test'; $this->entityType = new ContentEntityType([ 'id' => 'entity_test', @@ -1015,7 +1015,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @covers ::getDedicatedTableSchema * @covers ::createDedicatedTableSchema */ - public function testDedicatedTableSchemaForEntityWithStringIdentifier() { + public function testDedicatedTableSchemaForEntityWithStringIdentifier(): void { $entity_type_id = 'entity_test'; $this->entityType = new ContentEntityType([ 'id' => 'entity_test', @@ -1453,7 +1453,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { /** * ::onEntityTypeUpdate. */ - public function testonEntityTypeUpdateWithNewIndex() { + public function testonEntityTypeUpdateWithNewIndex(): void { $this->entityType = $original_entity_type = new ContentEntityType([ 'id' => 'entity_test', 'entity_keys' => ['id' => 'id'], @@ -1554,7 +1554,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { * @dataProvider providerSchemaCastValue * @covers ::castValue */ - public function testCastValue($expected, $value, array $schema) { + public function testCastValue($expected, $value, array $schema): void { $this->assertSame($expected, SqlContentEntityStorageSchema::castValue($schema, $value)); } diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index 998795a9500..e27a27dbed7 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -155,7 +155,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetBaseTable */ - public function testGetBaseTable($base_table, $expected) { + public function testGetBaseTable($base_table, $expected): void { $this->entityType->expects($this->once()) ->method('getBaseTable') ->willReturn($base_table); @@ -197,7 +197,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetRevisionTable */ - public function testGetRevisionTable($revision_table, $expected) { + public function testGetRevisionTable($revision_table, $expected): void { $this->entityType->expects($this->any()) ->method('isRevisionable') ->willReturn(TRUE); @@ -238,7 +238,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::__construct * @covers ::getDataTable */ - public function testGetDataTable() { + public function testGetDataTable(): void { $this->entityType->expects($this->any()) ->method('isTranslatable') ->willReturn(TRUE); @@ -268,7 +268,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetRevisionDataTable */ - public function testGetRevisionDataTable($revision_data_table, $expected) { + public function testGetRevisionDataTable($revision_data_table, $expected): void { $this->entityType->expects($this->any()) ->method('isRevisionable') ->willReturn(TRUE); @@ -315,7 +315,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @covers ::setTableMapping */ - public function testSetTableMapping() { + public function testSetTableMapping(): void { $this->entityType->expects($this->any()) ->method('isRevisionable') ->willReturn(FALSE); @@ -362,7 +362,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::onEntityTypeCreate * @covers ::getTableMapping */ - public function testOnEntityTypeCreate() { + public function testOnEntityTypeCreate(): void { $columns = [ 'value' => [ 'type' => 'int', @@ -456,7 +456,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::__construct * @covers ::getTableMapping */ - public function testGetTableMappingEmpty() { + public function testGetTableMappingEmpty(): void { $this->setUpEntityStorage(); $mapping = $this->entityStorage->getTableMapping(); @@ -476,7 +476,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingSimple(array $entity_keys) { + public function testGetTableMappingSimple(array $entity_keys): void { $this->entityType->expects($this->any()) ->method('getKey') ->willReturnMap([ @@ -508,7 +508,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingSimpleWithFields(array $entity_keys) { + public function testGetTableMappingSimpleWithFields(array $entity_keys): void { $base_field_names = ['title', 'description', 'owner']; $field_names = array_merge(array_values(array_filter($entity_keys)), $base_field_names); $this->fieldDefinitions = $this->mockFieldDefinitions($field_names); @@ -542,7 +542,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::__construct * @covers ::getTableMapping */ - public function testGetTableMappingSimpleWithDedicatedStorageFields() { + public function testGetTableMappingSimpleWithDedicatedStorageFields(): void { $base_field_names = ['multi_valued_base_field']; // Set up one entity key in order to have a base table. @@ -583,7 +583,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingRevisionable(array $entity_keys) { + public function testGetTableMappingRevisionable(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys = [ 'id' => $entity_keys['id'], @@ -634,7 +634,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingRevisionableWithFields(array $entity_keys) { + public function testGetTableMappingRevisionableWithFields(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys = [ 'id' => $entity_keys['id'], @@ -712,7 +712,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingTranslatable(array $entity_keys) { + public function testGetTableMappingTranslatable(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys['langcode'] = 'langcode'; @@ -768,7 +768,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingTranslatableWithFields(array $entity_keys) { + public function testGetTableMappingTranslatableWithFields(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys['langcode'] = 'langcode'; @@ -828,7 +828,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingRevisionableTranslatable(array $entity_keys) { + public function testGetTableMappingRevisionableTranslatable(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys = [ 'id' => $entity_keys['id'], @@ -939,7 +939,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * * @dataProvider providerTestGetTableMappingSimple */ - public function testGetTableMappingRevisionableTranslatableWithFields(array $entity_keys) { + public function testGetTableMappingRevisionableTranslatableWithFields(array $entity_keys): void { // This allows to re-use the data provider. $entity_keys = [ 'id' => $entity_keys['id'], @@ -1064,7 +1064,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { /** * @covers ::create */ - public function testCreate() { + public function testCreate(): void { $language_manager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface'); $language = new Language(['id' => 'en']); @@ -1186,7 +1186,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::buildCacheId * @covers ::getFromPersistentCache */ - public function testLoadMultiplePersistentCached() { + public function testLoadMultiplePersistentCached(): void { $this->setUpModuleHandlerNoImplementations(); $key = 'values:' . $this->entityTypeId . ':1'; @@ -1222,7 +1222,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::getFromPersistentCache * @covers ::setPersistentCache */ - public function testLoadMultipleNoPersistentCache() { + public function testLoadMultipleNoPersistentCache(): void { $this->setUpModuleHandlerNoImplementations(); $id = 1; @@ -1273,7 +1273,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { * @covers ::getFromPersistentCache * @covers ::setPersistentCache */ - public function testLoadMultiplePersistentCacheMiss() { + public function testLoadMultiplePersistentCacheMiss(): void { $this->setUpModuleHandlerNoImplementations(); $id = 1; @@ -1330,7 +1330,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { /** * @covers ::hasData */ - public function testHasData() { + public function testHasData(): void { $query = $this->createMock('Drupal\Core\Entity\Query\QueryInterface'); $query->expects(($this->once())) ->method('accessCheck') @@ -1382,7 +1382,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { /** * Tests entity ID sanitization. */ - public function testCleanIds() { + public function testCleanIds(): void { $valid_ids = [ -1, 0, diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php index c3ec63df95e..e921327e0be 100644 --- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php @@ -226,42 +226,42 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getConstraints */ - public function testGetConstraints() { + public function testGetConstraints(): void { $this->assertIsArray($this->entityAdapter->getConstraints()); } /** * @covers ::getName */ - public function testGetName() { + public function testGetName(): void { $this->assertNull($this->entityAdapter->getName()); } /** * @covers ::getRoot */ - public function testGetRoot() { + public function testGetRoot(): void { $this->assertSame(spl_object_hash($this->entityAdapter), spl_object_hash($this->entityAdapter->getRoot())); } /** * @covers ::getPropertyPath */ - public function testGetPropertyPath() { + public function testGetPropertyPath(): void { $this->assertSame('', $this->entityAdapter->getPropertyPath()); } /** * @covers ::getParent */ - public function testGetParent() { + public function testGetParent(): void { $this->assertNull($this->entityAdapter->getParent()); } /** * @covers ::setContext */ - public function testSetContext() { + public function testSetContext(): void { $name = $this->randomMachineName(); $parent = $this->createMock('\Drupal\Core\TypedData\TraversableTypedDataInterface'); // Our mocked entity->setContext() returns NULL, so assert that. @@ -273,21 +273,21 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getValue */ - public function testGetValue() { + public function testGetValue(): void { $this->assertEquals($this->entity, $this->entityAdapter->getValue()); } /** * @covers ::getEntity */ - public function testGetEntity() { + public function testGetEntity(): void { $this->assertSame($this->entity, $this->entityAdapter->getEntity()); } /** * @covers ::setValue */ - public function testSetValue() { + public function testSetValue(): void { $this->entityAdapter->setValue(NULL); $this->assertNull($this->entityAdapter->getValue()); } @@ -295,14 +295,14 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $this->assertInstanceOf('\Drupal\Core\Field\FieldItemListInterface', $this->entityAdapter->get('id')); } /** * @covers ::get */ - public function testGetInvalidField() { + public function testGetInvalidField(): void { $this->expectException(\InvalidArgumentException::class); $this->entityAdapter->get('invalid'); } @@ -310,7 +310,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::get */ - public function testGetWithoutData() { + public function testGetWithoutData(): void { $this->entityAdapter->setValue(NULL); $this->expectException(MissingDataException::class); $this->entityAdapter->get('id'); @@ -319,7 +319,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { $id_items = [['value' => $this->id + 1]]; $this->fieldItemList->expects($this->once()) @@ -332,7 +332,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::set */ - public function testSetWithoutData() { + public function testSetWithoutData(): void { $this->entityAdapter->setValue(NULL); $id_items = [['value' => $this->id + 1]]; $this->expectException(MissingDataException::class); @@ -342,7 +342,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getProperties */ - public function testGetProperties() { + public function testGetProperties(): void { $fields = $this->entityAdapter->getProperties(); $this->assertInstanceOf('Drupal\Core\Field\FieldItemListInterface', $fields['id']); $this->assertInstanceOf('Drupal\Core\Field\FieldItemListInterface', $fields['revision_id']); @@ -351,7 +351,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::toArray */ - public function testToArray() { + public function testToArray(): void { $array = $this->entityAdapter->toArray(); // Mock field objects return NULL values, so test keys only. $this->assertArrayHasKey('id', $array); @@ -362,7 +362,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::toArray */ - public function testToArrayWithoutData() { + public function testToArrayWithoutData(): void { $this->entityAdapter->setValue(NULL); $this->expectException(MissingDataException::class); $this->entityAdapter->toArray(); @@ -371,7 +371,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::isEmpty */ - public function testIsEmpty() { + public function testIsEmpty(): void { $this->assertFalse($this->entityAdapter->isEmpty()); $this->entityAdapter->setValue(NULL); $this->assertTrue($this->entityAdapter->isEmpty()); @@ -380,7 +380,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::onChange */ - public function testOnChange() { + public function testOnChange(): void { $entity = $this->createMock('\Drupal\Core\Entity\ContentEntityInterface'); $entity->expects($this->once()) ->method('onChange') @@ -393,7 +393,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getDataDefinition */ - public function testGetDataDefinition() { + public function testGetDataDefinition(): void { $definition = $this->entityAdapter->getDataDefinition(); $this->assertInstanceOf('\Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface', $definition); $this->assertEquals($definition->getEntityTypeId(), $this->entityTypeId); @@ -403,7 +403,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getString */ - public function testGetString() { + public function testGetString(): void { $entity = $this->createMock('\Drupal\Core\Entity\ContentEntityInterface'); $entity->expects($this->once()) ->method('label') @@ -417,7 +417,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::applyDefaultValue */ - public function testApplyDefaultValue() { + public function testApplyDefaultValue(): void { // For each field on the entity the mock method has to be invoked once. $this->fieldItemList->expects($this->exactly(2)) ->method('applyDefaultValue'); @@ -427,7 +427,7 @@ class EntityAdapterUnitTest extends UnitTestCase { /** * @covers ::getIterator */ - public function testGetIterator() { + public function testGetIterator(): void { // Content entity test. $iterator = $this->entityAdapter->getIterator(); $fields = iterator_to_array($iterator); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php index e25dd83077c..cdd08cfbf43 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php @@ -401,7 +401,7 @@ class ActiveLinkResponseFilterTest extends UnitTestCase { * @dataProvider providerTestSetLinkActiveClass * @covers ::setLinkActiveClass */ - public function testSetLinkActiveClass($html_markup, $current_path, $is_front, $url_language, array $query, $expected_html_markup) { + public function testSetLinkActiveClass($html_markup, $current_path, $is_front, $url_language, array $query, $expected_html_markup): void { $this->assertSame($expected_html_markup, ActiveLinkResponseFilter::setLinkActiveClass($html_markup, $current_path, $is_front, $url_language, $query)); } @@ -410,7 +410,7 @@ class ActiveLinkResponseFilterTest extends UnitTestCase { * * @covers ::onResponse */ - public function testOnlyHtml() { + public function testOnlyHtml(): void { $session = new AnonymousUserSession(); $language_manager = new LanguageManager(new LanguageDefault([])); $request_stack = new RequestStack(); @@ -449,7 +449,7 @@ class ActiveLinkResponseFilterTest extends UnitTestCase { * * @covers ::onResponse */ - public function testSkipCertainResponseTypes() { + public function testSkipCertainResponseTypes(): void { $session = new AnonymousUserSession(); $language_manager = new LanguageManager(new LanguageDefault([])); $request_stack = new RequestStack(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php index 50cbfb2e147..1560d467141 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php @@ -130,7 +130,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase { /** * Tests onHandleException with a POST request. */ - public function testHandleWithPostRequest() { + public function testHandleWithPostRequest(): void { $request = Request::create('/test', 'POST', ['name' => 'druplicon', 'pass' => '12345']); $request_context = new RequestContext(); @@ -156,7 +156,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase { /** * Tests onHandleException with a GET request. */ - public function testHandleWithGetRequest() { + public function testHandleWithGetRequest(): void { $request = Request::create('/test', 'GET', ['name' => 'druplicon', 'pass' => '12345']); $request->attributes->set(AccessAwareRouterInterface::ACCESS_RESULT, AccessResult::forbidden()->addCacheTags(['druplicon'])); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php index db86952b950..12a1e02d97d 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php @@ -26,7 +26,7 @@ class ExceptionJsonSubscriberTest extends UnitTestCase { * @covers ::on4xx * @dataProvider providerTestOn4xx */ - public function testOn4xx(HttpExceptionInterface $exception, $expected_response_class) { + public function testOn4xx(HttpExceptionInterface $exception, $expected_response_class): void { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/test'); $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_REQUEST, $exception); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php index 5ed6330240d..b871ebedeac 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php @@ -21,7 +21,7 @@ class FinalExceptionSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnExceptionWithUnknownFormat() { + public function testOnExceptionWithUnknownFormat(): void { $config_factory = $this->getConfigFactoryStub(); $kernel = $this->prophesize(HttpKernelInterface::class); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/FinishResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/FinishResponseSubscriberTest.php index bcab1e7c65e..9c927c4da3d 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/FinishResponseSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/FinishResponseSubscriberTest.php @@ -82,7 +82,7 @@ class FinishResponseSubscriberTest extends UnitTestCase { * * @covers ::onRespond */ - public function testDefaultHeaders() { + public function testDefaultHeaders(): void { $finishSubscriber = new FinishResponseSubscriber( $this->languageManager, $this->getConfigFactoryStub(), @@ -113,7 +113,7 @@ class FinishResponseSubscriberTest extends UnitTestCase { * * @covers ::onRespond */ - public function testExistingHeaders() { + public function testExistingHeaders(): void { $finishSubscriber = new FinishResponseSubscriber( $this->languageManager, $this->getConfigFactoryStub(), diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php index 6b9b68be9b7..008a1b2008e 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ModuleRouteSubscriberTest.php @@ -54,7 +54,7 @@ class ModuleRouteSubscriberTest extends UnitTestCase { * @param bool $removed * Whether or not the route is expected to be removed from the collection. */ - public function testRemoveRoute($route_name, array $requirements, $removed) { + public function testRemoveRoute($route_name, array $requirements, $removed): void { $collection = new RouteCollection(); $route = new Route('', [], $requirements); $collection->add($route_name, $route); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php index 23d8fcd1878..9aa556a63da 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php @@ -22,7 +22,7 @@ class OptionsRequestSubscriberTest extends UnitTestCase { /** * @covers ::onRequest */ - public function testWithNonOptionRequest() { + public function testWithNonOptionRequest(): void { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/example', 'GET'); @@ -39,7 +39,7 @@ class OptionsRequestSubscriberTest extends UnitTestCase { /** * @covers ::onRequest */ - public function testWithoutMatchingRoutes() { + public function testWithoutMatchingRoutes(): void { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/example', 'OPTIONS'); @@ -57,7 +57,7 @@ class OptionsRequestSubscriberTest extends UnitTestCase { * @covers ::onRequest * @dataProvider providerTestOnRequestWithOptionsRequest */ - public function testWithOptionsRequest(RouteCollection $collection, $expected_header) { + public function testWithOptionsRequest(RouteCollection $collection, $expected_header): void { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/example', 'OPTIONS'); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php index 705de806814..75c73a7ef14 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/PathRootsSubscriberTest.php @@ -46,7 +46,7 @@ class PathRootsSubscriberTest extends UnitTestCase { * @covers ::onRouteAlter * @covers ::onRouteFinished */ - public function testSubscribing() { + public function testSubscribing(): void { // Ensure that onRouteFinished can be called without throwing notices // when no path roots got set. diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php index e8fbd62b3f8..de743a1bdc2 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php @@ -55,7 +55,7 @@ class PsrResponseSubscriberTest extends UnitTestCase { * * @covers ::onKernelView */ - public function testConvertsControllerResult() { + public function testConvertsControllerResult(): void { $event = $this->createEvent($this->createMock('Psr\Http\Message\ResponseInterface')); $this->psrResponseSubscriber->onKernelView($event); $this->assertInstanceOf(Response::class, $event->getResponse()); @@ -66,7 +66,7 @@ class PsrResponseSubscriberTest extends UnitTestCase { * * @covers ::onKernelView */ - public function testDoesNotConvertControllerResult() { + public function testDoesNotConvertControllerResult(): void { $event = $this->createEvent([]); $this->psrResponseSubscriber->onKernelView($event); $this->assertNull($event->getResponse()); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php index c567bc03980..92049c11098 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php @@ -86,7 +86,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase { * @covers ::checkRedirectUrl * @dataProvider providerTestDestinationRedirect */ - public function testDestinationRedirect(Request $request, $expected) { + public function testDestinationRedirect(Request $request, $expected): void { $dispatcher = new EventDispatcher(); $kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'); $response = new RedirectResponse('http://example.com/drupal'); @@ -127,7 +127,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase { /** * @dataProvider providerTestDestinationRedirectToExternalUrl */ - public function testDestinationRedirectToExternalUrl($request, $expected) { + public function testDestinationRedirectToExternalUrl($request, $expected): void { $dispatcher = new EventDispatcher(); $kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'); $response = new RedirectResponse('http://other-example.com'); @@ -142,7 +142,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase { /** * @covers ::checkRedirectUrl */ - public function testRedirectWithOptInExternalUrl() { + public function testRedirectWithOptInExternalUrl(): void { $dispatcher = new EventDispatcher(); $kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'); $response = new TrustedRedirectResponse('http://external-url.com'); @@ -175,7 +175,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase { /** * @dataProvider providerTestDestinationRedirectWithInvalidUrl */ - public function testDestinationRedirectWithInvalidUrl(Request $request) { + public function testDestinationRedirectWithInvalidUrl(Request $request): void { $dispatcher = new EventDispatcher(); $kernel = $this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'); $response = new RedirectResponse('http://example.com/drupal'); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php index debe1fa9daf..b4727398e9a 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php @@ -114,7 +114,7 @@ RSS; * @param string $expected_content * The expected content from the response. */ - public function testOnResponse($content, $expected_content) { + public function testOnResponse($content, $expected_content): void { $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), Request::create('/'), diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php index 1317ad61af2..eda539762b2 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php @@ -76,7 +76,7 @@ class SpecialAttributesRouteSubscriberTest extends UnitTestCase { * * @covers ::onAlterRoutes */ - public function testOnRouteBuildingValidVariables(Route $route) { + public function testOnRouteBuildingValidVariables(Route $route): void { $route_collection = new RouteCollection(); $route_collection->add('test', $route); @@ -94,7 +94,7 @@ class SpecialAttributesRouteSubscriberTest extends UnitTestCase { * @dataProvider providerTestOnRouteBuildingInvalidVariables * @covers ::onAlterRoutes */ - public function testOnRouteBuildingInvalidVariables(Route $route) { + public function testOnRouteBuildingInvalidVariables(Route $route): void { $route_collection = new RouteCollection(); $route_collection->add('test', $route); diff --git a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php index 5818422fdcd..e05fcf10701 100644 --- a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php @@ -24,7 +24,7 @@ class DefaultConfigTest extends UnitTestCase { * that were never installed. The default configuration of such extensions * would not exist. Installation hooks would never be executed. */ - public function testConfigIsEmpty() { + public function testConfigIsEmpty(): void { $config = Yaml::parse(file_get_contents($this->root . '/core/config/install/core.extension.yml')); $expected = [ 'module' => [], diff --git a/core/tests/Drupal/Tests/Core/Extension/DependencyTest.php b/core/tests/Drupal/Tests/Core/Extension/DependencyTest.php index b3f81fd2977..345a9ff7fc7 100644 --- a/core/tests/Drupal/Tests/Core/Extension/DependencyTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/DependencyTest.php @@ -18,7 +18,7 @@ class DependencyTest extends UnitTestCase { * @covers ::createFromString * @dataProvider providerCreateFromString */ - public function testCreateFromString($string, $expected_name, $expected_project, $expected_constraint) { + public function testCreateFromString($string, $expected_name, $expected_project, $expected_constraint): void { $dependency = Dependency::createFromString($string); $this->assertSame($expected_name, $dependency->getName()); $this->assertSame($expected_project, $dependency->getProject()); @@ -40,7 +40,7 @@ class DependencyTest extends UnitTestCase { /** * @covers ::isCompatible */ - public function testIsCompatible() { + public function testIsCompatible(): void { $dependency = new Dependency('paragraphs_demo', 'paragraphs', '>8.x-1.1'); $this->assertFalse($dependency->isCompatible('1.1')); $this->assertTrue($dependency->isCompatible('1.2')); @@ -51,7 +51,7 @@ class DependencyTest extends UnitTestCase { * * @covers ::__sleep */ - public function testSerialization() { + public function testSerialization(): void { $dependency = new Dependency('paragraphs_demo', 'paragraphs', '>8.x-1.1'); $this->assertTrue($dependency->isCompatible('1.2')); $reflected_constraint = (new \ReflectionObject($dependency))->getProperty('constraint'); diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php index 75d14c6c938..ff9d1a7d050 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php @@ -24,7 +24,7 @@ class ExtensionDiscoveryTest extends UnitTestCase { * * @covers ::scan */ - public function testExtensionDiscoveryVfs() { + public function testExtensionDiscoveryVfs(): void { // Set up the file system. $filesystem = []; @@ -72,7 +72,7 @@ class ExtensionDiscoveryTest extends UnitTestCase { * @covers ::scan * @runInSeparateProcess */ - public function testExtensionDiscoveryCache() { + public function testExtensionDiscoveryCache(): void { // Set up an extension object in the cache to mimic site prior to changing // \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory() to cache an // array instead of an object. Note we cannot use the VFS file system diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php index c5f1f4b7f5d..bdacfc99a14 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php @@ -26,7 +26,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getName */ - public function testGetNameWithNonExistingExtension() { + public function testGetNameWithNonExistingExtension(): void { [$cache, $info_parser, $module_handler, $state] = $this->getMocks(); $test_extension_list = new TestExtension($this->randomMachineName(), 'test_extension', $cache->reveal(), $info_parser->reveal(), $module_handler->reveal(), $state->reveal(), 'testing'); @@ -41,7 +41,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getName */ - public function testGetName() { + public function testGetName(): void { $test_extension_list = $this->setupTestExtensionList(); $this->assertEquals('test name', $test_extension_list->getName('test_name')); @@ -50,7 +50,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::get */ - public function testGetWithNonExistingExtension() { + public function testGetWithNonExistingExtension(): void { [$cache, $info_parser, $module_handler, $state] = $this->getMocks(); $test_extension_list = new TestExtension($this->randomMachineName(), 'test_extension', $cache->reveal(), $info_parser->reveal(), $module_handler->reveal(), $state->reveal(), 'testing'); @@ -65,7 +65,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $test_extension_list = $this->setupTestExtensionList(); $extension = $test_extension_list->get('test_name'); @@ -76,7 +76,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getList */ - public function testGetList() { + public function testGetList(): void { $test_extension_list = $this->setupTestExtensionList(); $extensions = $test_extension_list->getList(); @@ -88,7 +88,7 @@ class ExtensionListTest extends UnitTestCase { * @covers ::getExtensionInfo * @covers ::getAllInstalledInfo */ - public function testGetExtensionInfo() { + public function testGetExtensionInfo(): void { $test_extension_list = $this->setupTestExtensionList(); $test_extension_list->setInstalledExtensions(['test_name']); @@ -104,7 +104,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getAllAvailableInfo */ - public function testGetAllAvailableInfo() { + public function testGetAllAvailableInfo(): void { $test_extension_list = $this->setupTestExtensionList(); $infos = $test_extension_list->getAllAvailableInfo(); @@ -121,7 +121,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getAllInstalledInfo */ - public function testGetAllInstalledInfo() { + public function testGetAllInstalledInfo(): void { $test_extension_list = $this->setupTestExtensionList(['test_name', 'test_name_2']); $test_extension_list->setInstalledExtensions(['test_name_2']); @@ -139,7 +139,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getPathNames */ - public function testGetPathNames() { + public function testGetPathNames(): void { $test_extension_list = $this->setupTestExtensionList(); $filenames = $test_extension_list->getPathNames(); @@ -151,7 +151,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getPathname */ - public function testGetPathname() { + public function testGetPathname(): void { $test_extension_list = $this->setupTestExtensionList(); $pathname = $test_extension_list->getPathname('test_name'); @@ -162,7 +162,7 @@ class ExtensionListTest extends UnitTestCase { * @covers ::setPathname * @covers ::getPathname */ - public function testSetPathname() { + public function testSetPathname(): void { $test_extension_list = $this->setupTestExtensionList(); $test_extension_list->setPathname('test_name', 'vfs://drupal_root/example2/test_name/test_name.info.yml'); @@ -172,7 +172,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::getPath */ - public function testGetPath() { + public function testGetPath(): void { $test_extension_list = $this->setupTestExtensionList(); $path = $test_extension_list->getPath('test_name'); @@ -182,7 +182,7 @@ class ExtensionListTest extends UnitTestCase { /** * @covers ::reset */ - public function testReset() { + public function testReset(): void { $test_extension_list = $this->setupTestExtensionList(); $path = $test_extension_list->getPath('test_name'); @@ -212,7 +212,7 @@ class ExtensionListTest extends UnitTestCase { * * @dataProvider providerCheckIncompatibility */ - public function testCheckIncompatibility($additional_settings, $expected) { + public function testCheckIncompatibility($additional_settings, $expected): void { $test_extension_list = $this->setupTestExtensionList(['test_name'], $additional_settings); $this->assertSame($expected, $test_extension_list->checkIncompatibility('test_name')); } diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionSerializationTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionSerializationTest.php index 8016d36ed1c..d939774a769 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionSerializationTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionSerializationTest.php @@ -45,7 +45,7 @@ class ExtensionSerializationTest extends UnitTestCase { * @covers ::__sleep * @covers ::__wakeup */ - public function testServiceAppRouteUsage() { + public function testServiceAppRouteUsage(): void { $container = new ContainerBuilder(); // Set a dummy container app.root to test against. $container->setParameter('app.root', 'vfs://dummy_app_root'); @@ -70,7 +70,7 @@ class ExtensionSerializationTest extends UnitTestCase { * @covers ::__sleep * @covers ::__wakeup */ - public function testPublicProperties() { + public function testPublicProperties(): void { $container = new ContainerBuilder(); // Set a dummy container app.root to test against. $container->setParameter('app.root', 'vfs://dummy_app_root'); diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php index 4709d288b19..ebe81790854 100644 --- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php @@ -46,7 +46,7 @@ class InfoParserUnitTest extends UnitTestCase { * * @covers ::parse */ - public function testInfoParserNonExisting() { + public function testInfoParserNonExisting(): void { vfsStream::setup('modules'); $this->expectException('\Drupal\Core\Extension\InfoParserException'); $this->expectExceptionMessage('Unable to parse vfs://modules/does_not_exist.info.txt as it does not exist'); @@ -128,7 +128,7 @@ YML, * * @covers ::parse */ - public function testInfoParserBroken() { + public function testInfoParserBroken(): void { $broken_info = <<<BROKEN_INFO # info.yml for testing broken YAML parsing exception handling. name: File @@ -158,7 +158,7 @@ BROKEN_INFO; * * @covers ::parse */ - public function testTestingPackageMissingCoreVersionRequirement() { + public function testTestingPackageMissingCoreVersionRequirement(): void { $missing_core_version_requirement = <<<MISSING_CORE_VERSION_REQUIREMENT # info.yml for testing core_version_requirement. package: Testing @@ -182,7 +182,7 @@ MISSING_CORE_VERSION_REQUIREMENT; * * @covers ::parse */ - public function testInfoParserCommonInfo() { + public function testInfoParserCommonInfo(): void { $common = <<<COMMON core_version_requirement: '*' name: common_test @@ -215,7 +215,7 @@ COMMON; * * @covers ::parse */ - public function testInfoParserCoreInfo() { + public function testInfoParserCoreInfo(): void { $common = <<<CORE name: core_test type: module @@ -242,7 +242,7 @@ CORE; * * @dataProvider providerCoreIncompatibility */ - public function testCoreIncompatibility($test_case, $constraint, $expected) { + public function testCoreIncompatibility($test_case, $constraint, $expected): void { $core_incompatibility = <<<CORE_INCOMPATIBILITY core_version_requirement: $constraint name: common_test @@ -303,7 +303,7 @@ CORE_INCOMPATIBILITY; /** * Tests a profile info file. */ - public function testProfile() { + public function testProfile(): void { $profile = <<<PROFILE_TEST core_version_requirement: '*' name: The Perfect Profile @@ -326,7 +326,7 @@ PROFILE_TEST; * * @covers ::parse */ - public function testUnparsableCoreVersionRequirement() { + public function testUnparsableCoreVersionRequirement(): void { $unparsable_core_version_requirement = <<<UNPARSABLE_CORE_VERSION_REQUIREMENT # info.yml for testing invalid core_version_requirement value. name: Not this module @@ -355,7 +355,7 @@ UNPARSABLE_CORE_VERSION_REQUIREMENT; * * @dataProvider providerValidLifecycle */ - public function testValidLifecycle($lifecycle, $expected) { + public function testValidLifecycle($lifecycle, $expected): void { $info = <<<INFO package: Core core_version_requirement: '*' @@ -415,7 +415,7 @@ INFO; * * @dataProvider providerInvalidLifecycle */ - public function testInvalidLifecycle($lifecycle, $exception_message) { + public function testInvalidLifecycle($lifecycle, $exception_message): void { $info = <<<INFO package: Core core_version_requirement: '*' @@ -464,7 +464,7 @@ INFO; * * @dataProvider providerLifecycleLink */ - public function testLifecycleLink($lifecycle, $lifecycle_link = NULL, $exception_message = NULL) { + public function testLifecycleLink($lifecycle, $lifecycle_link = NULL, $exception_message = NULL): void { $info = <<<INFO package: Core core_version_requirement: '*' diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php index e411229d8bd..384a7ffc564 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php @@ -65,7 +65,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::load */ - public function testLoadModule() { + public function testLoadModule(): void { $module_handler = $this->getModuleHandler(); $this->assertFalse(function_exists('module_handler_test_hook')); $this->assertTrue($module_handler->load('module_handler_test')); @@ -85,7 +85,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::loadAll */ - public function testLoadAllModules() { + public function testLoadAllModules(): void { $module_handler = $this->getModuleHandler(); $module_handler->addModule('module_handler_test_all1', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1'); $module_handler->addModule('module_handler_test_all2', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2'); @@ -101,7 +101,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::reload */ - public function testModuleReloading() { + public function testModuleReloading(): void { $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([ $this->root, @@ -137,7 +137,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::isLoaded */ - public function testIsLoaded() { + public function testIsLoaded(): void { $module_handler = $this->getModuleHandler(); $this->assertFalse($module_handler->isLoaded()); $module_handler->loadAll(); @@ -149,7 +149,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::getModuleList */ - public function testGetModuleList() { + public function testGetModuleList(): void { $this->assertEquals($this->getModuleHandler()->getModuleList(), [ 'module_handler_test' => new Extension($this->root, 'module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module'), ]); @@ -160,14 +160,14 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::getModule */ - public function testGetModuleWithExistingModule() { + public function testGetModuleWithExistingModule(): void { $this->assertEquals($this->getModuleHandler()->getModule('module_handler_test'), new Extension($this->root, 'module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module')); } /** * @covers ::getModule */ - public function testGetModuleWithNonExistingModule() { + public function testGetModuleWithNonExistingModule(): void { $this->expectException(UnknownExtensionException::class); $this->getModuleHandler()->getModule('claire_alice_watch_my_little_pony_module_that_does_not_exist'); } @@ -177,7 +177,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::setModuleList */ - public function testSetModuleList() { + public function testSetModuleList(): void { $fixture_module_handler = $this->getModuleHandler(); $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([ @@ -205,7 +205,7 @@ class ModuleHandlerTest extends UnitTestCase { * @covers ::addModule * @covers ::add */ - public function testAddModule() { + public function testAddModule(): void { $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([ @@ -227,7 +227,7 @@ class ModuleHandlerTest extends UnitTestCase { * @covers ::addProfile * @covers ::add */ - public function testAddProfile() { + public function testAddProfile(): void { $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([ @@ -249,7 +249,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::moduleExists */ - public function testModuleExists() { + public function testModuleExists(): void { $module_handler = $this->getModuleHandler(); $this->assertTrue($module_handler->moduleExists('module_handler_test')); $this->assertFalse($module_handler->moduleExists('module_handler_test_added')); @@ -258,7 +258,7 @@ class ModuleHandlerTest extends UnitTestCase { /** * @covers ::loadAllIncludes */ - public function testLoadAllIncludes() { + public function testLoadAllIncludes(): void { $this->assertTrue(TRUE); $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([ @@ -288,7 +288,7 @@ class ModuleHandlerTest extends UnitTestCase { * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testLoadInclude() { + public function testLoadInclude(): void { $module_handler = $this->getModuleHandler(); // Include exists. $this->assertEquals(__DIR__ . '/modules/module_handler_test/hook_include.inc', $module_handler->loadInclude('module_handler_test', 'inc', 'hook_include')); @@ -302,7 +302,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::invoke */ - public function testInvokeModuleEnabled() { + public function testInvokeModuleEnabled(): void { $module_handler = $this->getModuleHandler(); $this->assertTrue($module_handler->invoke('module_handler_test', 'hook', [TRUE]), 'Installed module runs hook.'); $this->assertFalse($module_handler->invoke('module_handler_test', 'hook', [FALSE]), 'Installed module runs hook.'); @@ -315,7 +315,7 @@ class ModuleHandlerTest extends UnitTestCase { * @covers ::hasImplementations * @covers ::loadAllIncludes */ - public function testImplementsHookModuleEnabled() { + public function testImplementsHookModuleEnabled(): void { $module_handler = $this->getModuleHandler(); $this->assertTrue($module_handler->hasImplementations('hook', 'module_handler_test'), 'Installed module implementation found.'); @@ -331,7 +331,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::hasImplementations */ - public function testHasImplementations() { + public function testHasImplementations(): void { $module_handler = $this->getMockBuilder(ModuleHandler::class) ->setConstructorArgs([$this->root, [], $this->cacheBackend]) ->onlyMethods(['buildImplementationInfo']) @@ -359,7 +359,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::invokeAllWith */ - public function testCachedGetImplementations() { + public function testCachedGetImplementations(): void { $this->cacheBackend->expects($this->exactly(1)) ->method('get') ->willReturn((object) ['data' => ['hook' => ['module_handler_test' => 'test']]]); @@ -396,7 +396,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::invokeAllWith */ - public function testCachedGetImplementationsMissingMethod() { + public function testCachedGetImplementationsMissingMethod(): void { $this->cacheBackend->expects($this->exactly(1)) ->method('get') ->willReturn((object) [ @@ -439,7 +439,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::invokeAll */ - public function testInvokeAll() { + public function testInvokeAll(): void { $module_handler = $this->getModuleHandler(); $module_handler->addModule('module_handler_test_all1', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1'); $module_handler->addModule('module_handler_test_all2', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all2'); @@ -451,7 +451,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::writeCache */ - public function testWriteCache() { + public function testWriteCache(): void { $module_handler = $this->getModuleHandler(); $this->cacheBackend ->expects($this->exactly(2)) @@ -471,7 +471,7 @@ class ModuleHandlerTest extends UnitTestCase { * @covers ::getHookInfo * @covers ::buildHookInfo */ - public function testGetHookInfo() { + public function testGetHookInfo(): void { $module_handler = $this->getModuleHandler(); // Set up some synthetic results. $this->cacheBackend @@ -499,7 +499,7 @@ class ModuleHandlerTest extends UnitTestCase { * * @covers ::resetImplementations */ - public function testResetImplementations() { + public function testResetImplementations(): void { $module_handler = $this->getModuleHandler(); // Prime caches $module_handler->invokeAllWith('hook', function (callable $hook, string $module) {}); @@ -530,7 +530,7 @@ class ModuleHandlerTest extends UnitTestCase { /** * @covers ::getModuleDirectories */ - public function testGetModuleDirectories() { + public function testGetModuleDirectories(): void { $module_handler = $this->getModuleHandler(); $module_handler->setModuleList([]); $module_handler->addModule('node', 'core/modules/node'); diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php index af1c33a56d7..1b13648aa14 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleInfoTest.php @@ -22,7 +22,7 @@ class ModuleInfoTest extends UnitTestCase { * * @dataProvider coreModuleListDataProvider */ - public function testModuleInfo($module) { + public function testModuleInfo($module): void { $module_directory = __DIR__ . '/../../../../../modules/' . $module; $info = Yaml::decode(file_get_contents($module_directory . '/' . $module . '.info.yml')); $this->assertArrayHasKey('version', $info); diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php index d1900369c26..438fc0d759a 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php @@ -49,7 +49,7 @@ class ModuleRequiredByThemesUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateNoThemeDependency() { + public function testValidateNoThemeDependency(): void { $this->themeExtensionList->getAllInstalledInfo()->willReturn([ 'stable9' => [ 'name' => 'Stable 9', @@ -70,7 +70,7 @@ class ModuleRequiredByThemesUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateOneThemeDependency() { + public function testValidateOneThemeDependency(): void { $module = 'single_module'; $module_name = 'Single Module'; $theme = 'one_theme'; @@ -109,7 +109,7 @@ class ModuleRequiredByThemesUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateTwoThemeDependencies() { + public function testValidateTwoThemeDependencies(): void { $module = 'popular_module'; $module_name = 'Popular Module'; $theme1 = 'first_theme'; diff --git a/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php b/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php index 2e00d9e7481..93ac524faca 100644 --- a/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php @@ -32,7 +32,7 @@ class RequiredModuleUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateNoModule() { + public function testValidateNoModule(): void { $this->uninstallValidator->expects($this->once()) ->method('getModuleInfoByModule') ->willReturn([]); @@ -46,7 +46,7 @@ class RequiredModuleUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateNotRequired() { + public function testValidateNotRequired(): void { $module = $this->randomMachineName(); $this->uninstallValidator->expects($this->once()) @@ -61,7 +61,7 @@ class RequiredModuleUninstallValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testValidateRequired() { + public function testValidateRequired(): void { $module = $this->randomMachineName(); $this->uninstallValidator->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php index 0dc1de5b8b6..37cfa0f62c1 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php @@ -27,7 +27,7 @@ class ThemeExtensionListTest extends UnitTestCase { /** * Tests rebuild the theme data with theme parents. */ - public function testRebuildThemeDataWithThemeParents() { + public function testRebuildThemeDataWithThemeParents(): void { $extension_discovery = $this->prophesize(ExtensionDiscovery::class); $extension_discovery ->scan('theme') @@ -121,7 +121,7 @@ class ThemeExtensionListTest extends UnitTestCase { * * @group legacy */ - public function testGetBaseThemes(array $themes, $theme, array $expected) { + public function testGetBaseThemes(array $themes, $theme, array $expected): void { // Mocks and stubs. $module_handler = $this->prophesize(ModuleHandlerInterface::class); $state = new State(new KeyValueMemoryFactory(), new NullBackend('bin'), new NullLockBackend()); diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index b8c71ba4d77..576815f249b 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -71,7 +71,7 @@ class ThemeHandlerTest extends UnitTestCase { * @see \Drupal\Core\Extension\ThemeHandler::rebuildThemeData() * @group legacy */ - public function testRebuildThemeData() { + public function testRebuildThemeData(): void { $this->expectDeprecation("\Drupal\Core\Extension\ThemeHandlerInterface::rebuildThemeData() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal::service('extension.list.theme')->reset()->getList() instead. See https://www.drupal.org/node/3413196"); $this->themeList->expects($this->once()) ->method('reset') @@ -97,7 +97,7 @@ class ThemeHandlerTest extends UnitTestCase { /** * Tests empty libraries in theme.info.yml file. */ - public function testThemeLibrariesEmpty() { + public function testThemeLibrariesEmpty(): void { $theme = new Extension($this->root, 'theme', 'core/modules/system/tests/themes/test_theme_libraries_empty', 'test_theme_libraries_empty.info.yml'); try { $this->themeHandler->addTheme($theme); diff --git a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php index 61496932428..7486fb1c3b8 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php @@ -108,7 +108,7 @@ class FieldDefinitionListenerTest extends UnitTestCase { /** * @covers ::onFieldDefinitionCreate */ - public function testOnFieldDefinitionCreateNewField() { + public function testOnFieldDefinitionCreateNewField(): void { $field_definition = $this->prophesize(FieldDefinitionInterface::class); $field_definition->getTargetEntityTypeId()->willReturn('test_entity_type'); $field_definition->getTargetBundle()->willReturn('test_bundle'); @@ -139,7 +139,7 @@ class FieldDefinitionListenerTest extends UnitTestCase { /** * @covers ::onFieldDefinitionCreate */ - public function testOnFieldDefinitionCreateExistingField() { + public function testOnFieldDefinitionCreateExistingField(): void { $field_definition = $this->prophesize(FieldDefinitionInterface::class); $field_definition->getTargetEntityTypeId()->willReturn('test_entity_type'); $field_definition->getTargetBundle()->willReturn('test_bundle'); @@ -175,7 +175,7 @@ class FieldDefinitionListenerTest extends UnitTestCase { /** * @covers ::onFieldDefinitionUpdate */ - public function testOnFieldDefinitionUpdate() { + public function testOnFieldDefinitionUpdate(): void { $field_definition = $this->prophesize(FieldDefinitionInterface::class); $field_definition->getTargetEntityTypeId()->willReturn('test_entity_type'); @@ -192,7 +192,7 @@ class FieldDefinitionListenerTest extends UnitTestCase { /** * @covers ::onFieldDefinitionDelete */ - public function testOnFieldDefinitionDeleteMultipleBundles() { + public function testOnFieldDefinitionDeleteMultipleBundles(): void { $field_definition = $this->prophesize(FieldDefinitionInterface::class); $field_definition->getTargetEntityTypeId()->willReturn('test_entity_type'); $field_definition->getTargetBundle()->willReturn('test_bundle'); @@ -232,7 +232,7 @@ class FieldDefinitionListenerTest extends UnitTestCase { /** * @covers ::onFieldDefinitionDelete */ - public function testOnFieldDefinitionDeleteSingleBundles() { + public function testOnFieldDefinitionDeleteSingleBundles(): void { $field_definition = $this->prophesize(FieldDefinitionInterface::class); $field_definition->getTargetEntityTypeId()->willReturn('test_entity_type'); $field_definition->getTargetBundle()->willReturn('test_bundle'); diff --git a/core/tests/Drupal/Tests/Core/Field/FieldFilteredMarkupTest.php b/core/tests/Drupal/Tests/Core/Field/FieldFilteredMarkupTest.php index 645c67f5fbc..d82fda322d3 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldFilteredMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldFilteredMarkupTest.php @@ -19,7 +19,7 @@ class FieldFilteredMarkupTest extends UnitTestCase { * @covers ::create * @dataProvider providerTestCreate */ - public function testCreate($string, $expected, $instance_of_check) { + public function testCreate($string, $expected, $instance_of_check): void { $filtered_string = FieldFilteredMarkup::create($string); if ($instance_of_check) { @@ -52,7 +52,7 @@ class FieldFilteredMarkupTest extends UnitTestCase { /** * @covers ::displayAllowedTags */ - public function testDisplayAllowedTags() { + public function testDisplayAllowedTags(): void { $expected = '<a> <b> <big> <code> <del> <em> <i> <ins> <pre> <q> <small> <span> <strong> <sub> <sup> <tt> <ol> <ul> <li> <p> <br> <img>'; $this->assertSame($expected, FieldFilteredMarkup::displayAllowedTags()); diff --git a/core/tests/Drupal/Tests/Core/Field/FieldInputValueNormalizerTraitTest.php b/core/tests/Drupal/Tests/Core/Field/FieldInputValueNormalizerTraitTest.php index b846f9686c9..631e31374c4 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldInputValueNormalizerTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldInputValueNormalizerTraitTest.php @@ -19,7 +19,7 @@ class FieldInputValueNormalizerTraitTest extends UnitTestCase { * @dataProvider keyValueByDeltaTestCases * @covers ::normalizeValue */ - public function testKeyValueByDelta($input_value, $expected_value, $main_property_name = 'value') { + public function testKeyValueByDelta($input_value, $expected_value, $main_property_name = 'value'): void { $this->assertEquals($expected_value, $this->normalizeValue($input_value, $main_property_name)); } @@ -85,7 +85,7 @@ class FieldInputValueNormalizerTraitTest extends UnitTestCase { /** * @covers ::normalizeValue */ - public function testScalarWithNoMainProperty() { + public function testScalarWithNoMainProperty(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('A main property is required when normalizing scalar field values.'); $value = 'foo'; @@ -95,7 +95,7 @@ class FieldInputValueNormalizerTraitTest extends UnitTestCase { /** * @covers ::normalizeValue */ - public function testKeyValueByDeltaUndefinedVariables() { + public function testKeyValueByDeltaUndefinedVariables(): void { $this->assertEquals([], $this->normalizeValue($undefined_variable, 'value')); $this->assertEquals([], $this->normalizeValue($undefined_variable['undefined_key'], 'value')); } diff --git a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php index 629ebc8dc2e..5662ea0f3be 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php @@ -25,7 +25,7 @@ class FieldItemListTest extends UnitTestCase { * * @dataProvider providerTestEquals */ - public function testEquals($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL) { + public function testEquals($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL): void { // Mock the field type manager and place it in the container. $field_type_manager = $this->createMock('Drupal\Core\Field\FieldTypePluginManagerInterface'); @@ -167,7 +167,7 @@ class FieldItemListTest extends UnitTestCase { * * @dataProvider providerTestEquals */ - public function testHasAffectingChanges($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL) { + public function testHasAffectingChanges($expected, ?FieldItemInterface $first_field_item = NULL, ?FieldItemInterface $second_field_item = NULL): void { // Mock the field type manager and place it in the container. $field_type_manager = $this->createMock(FieldTypePluginManagerInterface::class); $container = new ContainerBuilder(); @@ -228,7 +228,7 @@ class FieldItemListTest extends UnitTestCase { /** * @covers ::equals */ - public function testEqualsEmptyItems() { + public function testEqualsEmptyItems(): void { /** @var \Drupal\Core\Field\FieldItemBase $fv */ $first_field_item = new FieldItemTestClass(); $first_field_item->setValue(['0' => 1, '1' => 2]); @@ -292,7 +292,7 @@ class FieldItemListTest extends UnitTestCase { /** * @covers ::defaultValuesForm */ - public function testDefaultValuesForm() { + public function testDefaultValuesForm(): void { $field_definition = $this->createMock(FieldDefinitionInterface::class); $field_definition->expects($this->any()) ->method('getType') @@ -316,7 +316,7 @@ class FieldItemListTest extends UnitTestCase { /** * @covers ::defaultValuesFormValidate */ - public function testDefaultValuesFormValidate() { + public function testDefaultValuesFormValidate(): void { $field_definition = $this->createMock(FieldDefinitionInterface::class); /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */ $field_list = $this->getMockBuilder(FieldItemList::class) @@ -337,7 +337,7 @@ class FieldItemListTest extends UnitTestCase { /** * @covers ::defaultValuesFormSubmit */ - public function testDefaultValuesFormSubmit() { + public function testDefaultValuesFormSubmit(): void { $field_definition = $this->createMock(FieldDefinitionInterface::class); /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */ $field_list = $this->getMockBuilder(FieldItemList::class) diff --git a/core/tests/Drupal/Tests/Core/Field/FieldTypePluginManagerTest.php b/core/tests/Drupal/Tests/Core/Field/FieldTypePluginManagerTest.php index 5e8aef87c08..38513190d11 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldTypePluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldTypePluginManagerTest.php @@ -79,7 +79,7 @@ class FieldTypePluginManagerTest extends UnitTestCase { /** * @covers ::getGroupedDefinitions */ - public function testGetGroupedDefinitions() { + public function testGetGroupedDefinitions(): void { $this->discovery->getDefinitions()->willReturn([ 'telephone' => [ 'category' => 'general', @@ -132,7 +132,7 @@ class FieldTypePluginManagerTest extends UnitTestCase { /** * @covers ::getGroupedDefinitions */ - public function testGetGroupedDefinitionsInvalid() { + public function testGetGroupedDefinitionsInvalid(): void { $this->discovery->getDefinitions()->willReturn([ 'string' => [ 'category' => 'text', @@ -172,7 +172,7 @@ class FieldTypePluginManagerTest extends UnitTestCase { /** * @covers ::getGroupedDefinitions */ - public function testGetGroupedDefinitionsEmpty() { + public function testGetGroupedDefinitionsEmpty(): void { $this->fieldTypeCategoryManager->getDefinitions()->willReturn([]); $this->assertEquals([], $this->fieldTypeManager->getGroupedDefinitions([])); } diff --git a/core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php b/core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php index b743c692b0f..0d3fc0aeeea 100644 --- a/core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php @@ -16,7 +16,7 @@ class PluginSettingsBaseTest extends UnitTestCase { /** * @covers ::getThirdPartySettings */ - public function testGetThirdPartySettings() { + public function testGetThirdPartySettings(): void { $plugin_settings = new TestPluginSettingsBase(); $this->assertSame([], $plugin_settings->getThirdPartySettings()); $this->assertSame([], $plugin_settings->getThirdPartySettings('test')); diff --git a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php index 12b049d9c70..7d159125731 100644 --- a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php @@ -51,7 +51,7 @@ class FileSystemTest extends UnitTestCase { /** * @covers ::chmod */ - public function testChmodFile() { + public function testChmodFile(): void { vfsStream::setup('dir'); vfsStream::create(['test.txt' => 'asdf']); $uri = 'vfs://dir/test.txt'; @@ -65,7 +65,7 @@ class FileSystemTest extends UnitTestCase { /** * @covers ::chmod */ - public function testChmodDir() { + public function testChmodDir(): void { vfsStream::setup('dir'); vfsStream::create(['nested_dir' => []]); $uri = 'vfs://dir/nested_dir'; @@ -79,7 +79,7 @@ class FileSystemTest extends UnitTestCase { /** * @covers ::chmod */ - public function testChmodUnsuccessful() { + public function testChmodUnsuccessful(): void { vfsStream::setup('dir'); $this->assertFalse($this->fileSystem->chmod('vfs://dir/test.txt')); } @@ -87,7 +87,7 @@ class FileSystemTest extends UnitTestCase { /** * @covers ::unlink */ - public function testUnlink() { + public function testUnlink(): void { vfsStream::setup('dir'); vfsStream::create(['test.txt' => 'asdf']); $uri = 'vfs://dir/test.txt'; @@ -106,7 +106,7 @@ class FileSystemTest extends UnitTestCase { * * @dataProvider providerTestBasename */ - public function testBasename($uri, $expected, $suffix = NULL) { + public function testBasename($uri, $expected, $suffix = NULL): void { $this->assertSame($expected, $this->fileSystem->basename($uri, $suffix)); } @@ -151,7 +151,7 @@ class FileSystemTest extends UnitTestCase { * * @covers ::createFilename */ - public function testInvalidUTF8() { + public function testInvalidUTF8(): void { vfsStream::setup('dir'); // cspell:disable-next-line $filename = "a\xFFsdf\x80€" . '.txt'; diff --git a/core/tests/Drupal/Tests/Core/File/FileUploadSanitizeNameEventTest.php b/core/tests/Drupal/Tests/Core/File/FileUploadSanitizeNameEventTest.php index 17e7bbe1f5b..7f69faabf68 100644 --- a/core/tests/Drupal/Tests/Core/File/FileUploadSanitizeNameEventTest.php +++ b/core/tests/Drupal/Tests/Core/File/FileUploadSanitizeNameEventTest.php @@ -21,7 +21,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { * @covers ::setFilename * @covers ::getFilename */ - public function testSetFilename() { + public function testSetFilename(): void { $event = new FileUploadSanitizeNameEvent('foo.txt', ''); $this->assertSame('foo.txt', $event->getFilename()); $event->setFilename('foo.html'); @@ -31,7 +31,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { /** * @covers ::setFilename */ - public function testSetFilenameException() { + public function testSetFilenameException(): void { $event = new FileUploadSanitizeNameEvent('foo.txt', ''); $this->assertSame('foo.txt', $event->getFilename()); $this->expectException(\InvalidArgumentException::class); @@ -43,7 +43,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { * @covers ::__construct * @covers ::setFilename */ - public function testConstructorException() { + public function testConstructorException(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('$filename must be a filename with no path information, "bar/foo.txt" provided'); new FileUploadSanitizeNameEvent('bar/foo.txt', ''); @@ -52,7 +52,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { /** * @covers ::getAllowedExtensions */ - public function testAllowedExtensions() { + public function testAllowedExtensions(): void { $event = new FileUploadSanitizeNameEvent('foo.txt', ''); $this->assertSame([], $event->getAllowedExtensions()); @@ -70,7 +70,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { * @param string $filename * The filename to test */ - public function testEventFilenameFunctions(string $filename) { + public function testEventFilenameFunctions(string $filename): void { $event = new FileUploadSanitizeNameEvent($filename, ''); $this->assertSame($filename, $event->getFilename()); } @@ -104,7 +104,7 @@ class FileUploadSanitizeNameEventTest extends UnitTestCase { /** * @covers ::stopPropagation */ - public function testStopPropagation() { + public function testStopPropagation(): void { $this->expectException(\RuntimeException::class); $event = new FileUploadSanitizeNameEvent('test.txt', ''); $event->stopPropagation(); diff --git a/core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php b/core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php index 74d9fe20ddf..1f078f2618a 100644 --- a/core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php +++ b/core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php @@ -38,7 +38,7 @@ class MemoryBackendTest extends UnitTestCase { /** * Tests an allowed flood event. */ - public function testAllowedProceeding() { + public function testAllowedProceeding(): void { $threshold = 2; $window_expired = -1; @@ -49,7 +49,7 @@ class MemoryBackendTest extends UnitTestCase { /** * Tests a flood event with more than the allowed calls. */ - public function testNotAllowedProceeding() { + public function testNotAllowedProceeding(): void { $threshold = 1; $window_expired = -1; @@ -65,7 +65,7 @@ class MemoryBackendTest extends UnitTestCase { * * @medium */ - public function testExpiring() { + public function testExpiring(): void { $threshold = 1; $window_expired = -1; @@ -83,7 +83,7 @@ class MemoryBackendTest extends UnitTestCase { /** * Tests a flood event with no expiring, so cron will not allow to proceed. */ - public function testNotExpiring() { + public function testNotExpiring(): void { $threshold = 2; $this->flood->register('test_event', 1); @@ -100,7 +100,7 @@ class MemoryBackendTest extends UnitTestCase { /** * Tests memory backend records events to the nearest microsecond. */ - public function testMemoryBackendThreshold() { + public function testMemoryBackendThreshold(): void { $this->flood->register('new event'); $this->assertTrue($this->flood->isAllowed('new event', '2')); $this->flood->register('new event'); diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php index 0604fda0b4b..318127b121b 100644 --- a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php @@ -16,7 +16,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase { /** * @covers ::config */ - public function testConfig() { + public function testConfig(): void { $trait = $this->createPartialMock(ConfiguredTrait::class, ['getEditableConfigNames']); // Set up some configuration in a mocked config factory. @@ -44,7 +44,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase { /** * @covers ::config */ - public function testConfigFactoryException() { + public function testConfigFactoryException(): void { $testObject = new ConfiguredTrait(); // There is no config factory available this should result in an exception. @@ -57,7 +57,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase { /** * @covers ::config */ - public function testConfigFactoryExceptionInvalidProperty() { + public function testConfigFactoryExceptionInvalidProperty(): void { $testObject = new ConfiguredTrait(); // There is no config factory available this should result in an exception. diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php index ba24a851541..a2588857886 100644 --- a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php @@ -114,7 +114,7 @@ class ConfigTargetTest extends UnitTestCase { * @covers ::fromForm * @covers ::fromString */ - public function testFromFormString() { + public function testFromFormString(): void { $form = [ 'group' => [ '#type' => 'details', @@ -136,7 +136,7 @@ class ConfigTargetTest extends UnitTestCase { /** * @covers ::fromForm */ - public function testFromFormConfigTarget() { + public function testFromFormConfigTarget(): void { $form = [ 'test' => [ '#type' => 'text', @@ -158,7 +158,7 @@ class ConfigTargetTest extends UnitTestCase { * @covers ::fromForm * @dataProvider providerTestFromFormException */ - public function testFromFormException(array $form, array $array_parents, string $exception_message) { + public function testFromFormException(array $form, array $array_parents, string $exception_message): void { $this->expectException(\LogicException::class); $this->expectExceptionMessage($exception_message); ConfigTarget::fromForm($array_parents, $form); diff --git a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php index aa597ec73bd..449964fd573 100644 --- a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php @@ -21,7 +21,7 @@ class ConfirmFormHelperTest extends UnitTestCase { * * @covers ::buildCancelLink */ - public function testCancelLinkTitle() { + public function testCancelLinkTitle(): void { $cancel_text = 'Cancel text'; $form = $this->createMock('Drupal\Core\Form\ConfirmFormInterface'); $form->expects($this->any()) @@ -38,7 +38,7 @@ class ConfirmFormHelperTest extends UnitTestCase { * * @covers ::buildCancelLink */ - public function testCancelLinkRoute() { + public function testCancelLinkRoute(): void { $route_name = 'foo_bar'; $cancel_route = new Url($route_name); $form = $this->createMock('Drupal\Core\Form\ConfirmFormInterface'); @@ -55,7 +55,7 @@ class ConfirmFormHelperTest extends UnitTestCase { * * @covers ::buildCancelLink */ - public function testCancelLinkRouteWithParams() { + public function testCancelLinkRouteWithParams(): void { $expected = Url::fromRoute('foo_bar.baz', ['baz' => 'banana'], ['absolute' => TRUE]); $form = $this->createMock('Drupal\Core\Form\ConfirmFormInterface'); $form->expects($this->any()) @@ -71,7 +71,7 @@ class ConfirmFormHelperTest extends UnitTestCase { * * @covers ::buildCancelLink */ - public function testCancelLinkRouteWithUrl() { + public function testCancelLinkRouteWithUrl(): void { $cancel_route = new Url( 'foo_bar.baz', [ 'baz' => 'banana', @@ -95,7 +95,7 @@ class ConfirmFormHelperTest extends UnitTestCase { * @covers ::buildCancelLink * @dataProvider providerTestCancelLinkDestination */ - public function testCancelLinkDestination($destination) { + public function testCancelLinkDestination($destination): void { $query = ['destination' => $destination]; $form = $this->createMock('Drupal\Core\Form\ConfirmFormInterface'); diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index 32b928b1896..4aea9f25bed 100644 --- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -76,7 +76,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnException() { + public function testOnException(): void { $form = ['#type' => 'form', '#build_id' => 'the_build_id']; $expected_form = $form + [ '#build_id_old' => 'the_build_id', @@ -101,7 +101,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnExceptionNewBuildId() { + public function testOnExceptionNewBuildId(): void { $form = ['#type' => 'form', '#build_id' => 'the_build_id']; $expected_form = $form + [ '#build_id_old' => 'a_new_build_id', @@ -126,7 +126,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnExceptionOtherClass() { + public function testOnExceptionOtherClass(): void { $request = new Request(); $exception = new \Exception(); @@ -139,7 +139,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnExceptionResponseBuilderException() { + public function testOnExceptionResponseBuilderException(): void { $form = ['#type' => 'form', '#build_id' => 'the_build_id']; $expected_form = $form + [ '#build_id_old' => 'the_build_id', @@ -162,7 +162,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::onException */ - public function testOnExceptionBrokenPostRequest() { + public function testOnExceptionBrokenPostRequest(): void { $this->formAjaxResponseBuilder->expects($this->never()) ->method('buildResponse'); @@ -209,7 +209,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { * @covers ::onException * @covers ::getFormAjaxException */ - public function testOnExceptionNestedException() { + public function testOnExceptionNestedException(): void { $form = ['#type' => 'form', '#build_id' => 'the_build_id']; $expected_form = $form + [ '#build_id_old' => 'the_build_id', @@ -233,7 +233,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { /** * @covers ::getFormAjaxException */ - public function testOnExceptionNestedWrongException() { + public function testOnExceptionNestedWrongException(): void { $nested_exception = new \Exception(); $exception = new \Exception('', 0, $nested_exception); $request = new Request(); diff --git a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php index 67ea2418447..92b91a582d6 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php @@ -47,7 +47,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseNoTriggeringElement() { + public function testBuildResponseNoTriggeringElement(): void { $this->renderer->expects($this->never()) ->method('renderResponse'); @@ -63,7 +63,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseNoCallable() { + public function testBuildResponseNoCallable(): void { $this->renderer->expects($this->never()) ->method('renderResponse'); @@ -81,7 +81,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseRenderArray() { + public function testBuildResponseRenderArray(): void { $triggering_element = [ '#ajax' => [ 'callback' => function (array $form, FormStateInterface $form_state) { @@ -112,7 +112,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseResponse() { + public function testBuildResponseResponse(): void { $triggering_element = [ '#ajax' => [ 'callback' => function (array $form, FormStateInterface $form_state) { @@ -137,7 +137,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseWithCommands() { + public function testBuildResponseWithCommands(): void { $triggering_element = [ '#ajax' => [ 'callback' => function (array $form, FormStateInterface $form_state) { @@ -170,7 +170,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase { /** * @covers ::buildResponse */ - public function testBuildResponseWithUpdateCommand() { + public function testBuildResponseWithUpdateCommand(): void { $triggering_element = [ '#ajax' => [ 'callback' => function (array $form, FormStateInterface $form_state) { diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php index 7e6590b797d..3137681d18e 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php @@ -55,7 +55,7 @@ class FormBuilderTest extends FormTestBase { * * @covers ::getFormId */ - public function testGetFormIdWithString() { + public function testGetFormIdWithString(): void { $form_arg = 'foo'; $form_state = new FormState(); $this->expectException(\InvalidArgumentException::class); @@ -66,7 +66,7 @@ class FormBuilderTest extends FormTestBase { /** * @covers ::getFormId */ - public function testGetFormIdWithNonFormClass() { + public function testGetFormIdWithNonFormClass(): void { $form_arg = \stdClass::class; $form_state = new FormState(); $this->expectException(\InvalidArgumentException::class); @@ -77,7 +77,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getFormId() method with a class name form ID. */ - public function testGetFormIdWithClassName() { + public function testGetFormIdWithClassName(): void { $form_arg = 'Drupal\Tests\Core\Form\TestForm'; $form_state = new FormState(); @@ -90,7 +90,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getFormId() method with an injected class name form ID. */ - public function testGetFormIdWithInjectedClassName() { + public function testGetFormIdWithInjectedClassName(): void { $container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); \Drupal::setContainer($container); @@ -106,7 +106,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getFormId() method with a form object. */ - public function testGetFormIdWithObject() { + public function testGetFormIdWithObject(): void { $expected_form_id = 'my_module_form_id'; $form_arg = $this->getMockForm($expected_form_id); @@ -121,7 +121,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getFormId() method with a base form object. */ - public function testGetFormIdWithBaseForm() { + public function testGetFormIdWithBaseForm(): void { $expected_form_id = 'my_module_form_id'; $base_form_id = 'my_module'; @@ -146,7 +146,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider formStateResponseProvider */ - public function testHandleFormStateResponse($class, $form_state_key) { + public function testHandleFormStateResponse($class, $form_state_key): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -187,7 +187,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the handling of a redirect when FormStateInterface::$response exists. */ - public function testHandleRedirectWithResponse() { + public function testHandleRedirectWithResponse(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -226,7 +226,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getForm() method with a string based form ID. */ - public function testGetFormWithString() { + public function testGetFormWithString(): void { $form_id = 'test_form_id'; $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The form class test_form_id could not be found or loaded.'); @@ -236,7 +236,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getForm() method with a form object. */ - public function testGetFormWithObject() { + public function testGetFormWithObject(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -250,7 +250,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getForm() method with a class name based form ID. */ - public function testGetFormWithClassString() { + public function testGetFormWithClassString(): void { $form_id = '\Drupal\Tests\Core\Form\TestForm'; $object = new TestForm(); $form = []; @@ -265,7 +265,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the buildForm() method with a string based form ID. */ - public function testBuildFormWithString() { + public function testBuildFormWithString(): void { $form_id = 'test_form_id'; $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The form class test_form_id could not be found or loaded.'); @@ -275,7 +275,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the buildForm() method with a class name based form ID. */ - public function testBuildFormWithClassString() { + public function testBuildFormWithClassString(): void { $form_id = '\Drupal\Tests\Core\Form\TestForm'; $object = new TestForm(); $form = []; @@ -290,7 +290,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the buildForm() method with a form object. */ - public function testBuildFormWithObject() { + public function testBuildFormWithObject(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -315,7 +315,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider providerTestBuildFormWithTriggeringElement */ - public function testBuildFormWithTriggeringElement($element_value, $input_value) { + public function testBuildFormWithTriggeringElement($element_value, $input_value): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -353,7 +353,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the rebuildForm() method for a POST submission. */ - public function testRebuildForm() { + public function testRebuildForm(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -393,7 +393,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the rebuildForm() method for a GET submission. */ - public function testRebuildFormOnGetRequest() { + public function testRebuildFormOnGetRequest(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); @@ -431,7 +431,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests the getCache() method. */ - public function testGetCache() { + public function testGetCache(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); $expected_form['#token'] = FALSE; @@ -474,7 +474,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests that HTML IDs are unique when rebuilding a form with errors. */ - public function testUniqueHtmlId() { + public function testUniqueHtmlId(): void { $form_id = 'test_form_id'; $expected_form = $form_id(); $expected_form['test']['#required'] = TRUE; @@ -500,7 +500,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests that HTML IDs are unique between 2 forms with the same element names. */ - public function testUniqueElementHtmlId() { + public function testUniqueElementHtmlId(): void { $form_id_1 = 'test_form_id'; $form_id_2 = 'test_form_id_2'; $expected_form = $form_id_1(); @@ -530,7 +530,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests that a cached form is deleted after submit. */ - public function testFormCacheDeletionCached() { + public function testFormCacheDeletionCached(): void { $form_id = 'test_form_id'; $form_build_id = $this->randomMachineName(); @@ -557,7 +557,7 @@ class FormBuilderTest extends FormTestBase { /** * Tests that an uncached form does not trigger cache set or delete. */ - public function testFormCacheDeletionUncached() { + public function testFormCacheDeletionUncached(): void { $form_id = 'test_form_id'; $form_build_id = $this->randomMachineName(); @@ -575,7 +575,7 @@ class FormBuilderTest extends FormTestBase { /** * @covers ::buildForm */ - public function testExceededFileSize() { + public function testExceededFileSize(): void { $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]); $request->setSession(new Session(new MockArraySessionStorage())); $request_stack = new RequestStack(); @@ -649,7 +649,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider providerTestChildAccessInheritance */ - public function testChildAccessInheritance($element, $access_checks) { + public function testChildAccessInheritance($element, $access_checks): void { $form_arg = new TestFormWithPredefinedForm(); $form_arg->setForm($element); @@ -812,7 +812,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider providerTestValueCallableIsSafe */ - public function testValueCallableIsSafe($callback, $expected) { + public function testValueCallableIsSafe($callback, $expected): void { $method = new \ReflectionMethod(FormBuilder::class, 'valueCallableIsSafe'); $is_safe = $method->invoke($this->formBuilder, $callback); $this->assertSame($expected, $is_safe); @@ -848,7 +848,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider providerTestInvalidToken */ - public function testInvalidToken($expected, $valid_token, $user_is_authenticated) { + public function testInvalidToken($expected, $valid_token, $user_is_authenticated): void { $form_token = 'the_form_token'; $form_id = 'test_form_id'; @@ -909,7 +909,7 @@ class FormBuilderTest extends FormTestBase { * * @dataProvider providerTestFormTokenCacheability */ - public function testFormTokenCacheability($token, $is_authenticated, $expected_form_cacheability, $expected_token_cacheability, $method) { + public function testFormTokenCacheability($token, $is_authenticated, $expected_form_cacheability, $expected_token_cacheability, $method): void { $user = $this->prophesize(AccountProxyInterface::class); $user->isAuthenticated() ->willReturn($is_authenticated); diff --git a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php index e83d5705c44..b59fb9ce55e 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php @@ -117,7 +117,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheValidToken() { + public function testGetCacheValidToken(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cache_token = 'the_cache_token'; @@ -141,7 +141,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheInvalidToken() { + public function testGetCacheInvalidToken(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cache_token = 'the_cache_token'; @@ -165,7 +165,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheAnonUser() { + public function testGetCacheAnonUser(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cached_form = ['#cache_token' => NULL]; @@ -187,7 +187,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheAuthUser() { + public function testGetCacheAuthUser(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cached_form = ['#cache_token' => NULL]; @@ -207,7 +207,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheNoForm() { + public function testGetCacheNoForm(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cached_form = NULL; @@ -226,7 +226,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::getCache */ - public function testGetCacheImmutableForm() { + public function testGetCacheImmutableForm(): void { $form_build_id = 'the_form_build_id'; $form_state = (new FormState()) ->addBuildInfo('immutable', TRUE); @@ -252,7 +252,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::loadCachedFormState */ - public function testLoadCachedFormState() { + public function testLoadCachedFormState(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cached_form = ['#cache_token' => NULL]; @@ -278,7 +278,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::loadCachedFormState */ - public function testLoadCachedFormStateWithFiles() { + public function testLoadCachedFormStateWithFiles(): void { $form_build_id = 'the_form_build_id'; $form_state = new FormState(); $cached_form = ['#cache_token' => NULL]; @@ -318,7 +318,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::setCache */ - public function testSetCacheWithForm() { + public function testSetCacheWithForm(): void { $form_build_id = 'the_form_build_id'; $form = [ '#form_id' => 'the_form_id', @@ -340,7 +340,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::setCache */ - public function testSetCacheWithoutForm() { + public function testSetCacheWithoutForm(): void { $form_build_id = 'the_form_build_id'; $form = NULL; $form_state = new FormState(); @@ -359,7 +359,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::setCache */ - public function testSetCacheAuthUser() { + public function testSetCacheAuthUser(): void { $form_build_id = 'the_form_build_id'; $form = []; $form_state = new FormState(); @@ -389,7 +389,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::setCache */ - public function testSetCacheBuildIdMismatch() { + public function testSetCacheBuildIdMismatch(): void { $form_build_id = 'the_form_build_id'; $form = [ '#form_id' => 'the_form_id', @@ -410,7 +410,7 @@ class FormCacheTest extends UnitTestCase { /** * @covers ::deleteCache */ - public function testDeleteCache() { + public function testDeleteCache(): void { $form_build_id = 'the_form_build_id'; $this->formCacheStore->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php b/core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php index 7eedb6d440b..535623e1f60 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php @@ -24,7 +24,7 @@ class FormElementHelperTest extends UnitTestCase { * * @dataProvider getElementByNameProvider */ - public function testGetElementByName($name, $form, $expected) { + public function testGetElementByName($name, $form, $expected): void { $this->assertSame($expected, FormElementHelper::getElementByName($name, $form)); } @@ -109,7 +109,7 @@ class FormElementHelperTest extends UnitTestCase { * * @dataProvider getElementTitleProvider */ - public function testGetElementTitle($name, $form, $expected) { + public function testGetElementTitle($name, $form, $expected): void { $element = FormElementHelper::getElementByName($name, $form); $this->assertSame($expected, FormElementHelper::getElementTitle($element)); } diff --git a/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php b/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php index f60ab6d0dff..e319d52b117 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php @@ -49,7 +49,7 @@ class FormErrorHandlerTest extends UnitTestCase { * @covers ::handleFormErrors * @covers ::displayErrorMessages */ - public function testDisplayErrorMessages() { + public function testDisplayErrorMessages(): void { $messages = [ 'invalid', 'invalid', @@ -125,7 +125,7 @@ class FormErrorHandlerTest extends UnitTestCase { * @covers ::handleFormErrors * @covers ::setElementErrorsFromFormState */ - public function testSetElementErrorsFromFormState() { + public function testSetElementErrorsFromFormState(): void { $form = [ '#parents' => [], '#array_parents' => [], diff --git a/core/tests/Drupal/Tests/Core/Form/FormHelperTest.php b/core/tests/Drupal/Tests/Core/Form/FormHelperTest.php index e39c3973a32..2da73b861e1 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormHelperTest.php @@ -19,7 +19,7 @@ class FormHelperTest extends UnitTestCase { * * @covers ::rewriteStatesSelector */ - public function testRewriteStatesSelector() { + public function testRewriteStatesSelector(): void { // Simple selectors. $value = ['value' => 'medium']; @@ -89,7 +89,7 @@ class FormHelperTest extends UnitTestCase { * @covers ::processStates * @dataProvider providerElements */ - public function testProcessStates($elements, $key) { + public function testProcessStates($elements, $key): void { $json = Json::encode($elements['#states']); FormHelper::processStates($elements); $this->assertEquals(['core/drupal.states'], $elements['#attached']['library']); diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php index 3924855fd97..0594c733b15 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php @@ -58,7 +58,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setFormState */ - public function testSetFormState() { + public function testSetFormState(): void { $form_state_additions = [ 'foo' => 'bar', ]; @@ -74,7 +74,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetAlwaysProcess($always_process) { + public function testSetAlwaysProcess($always_process): void { $this->decoratedFormState->setAlwaysProcess($always_process) ->shouldBeCalled(); @@ -86,7 +86,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testGetAlwaysProcess($always_process) { + public function testGetAlwaysProcess($always_process): void { $this->decoratedFormState->getAlwaysProcess() ->willReturn($always_process) ->shouldBeCalled(); @@ -97,7 +97,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setButtons */ - public function testSetButtons() { + public function testSetButtons(): void { $buttons = [ 'FOO' => 'BAR', ]; @@ -111,7 +111,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getButtons */ - public function testGetButtons() { + public function testGetButtons(): void { $buttons = [ 'FOO' => 'BAR', ]; @@ -128,7 +128,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetCached($cache) { + public function testSetCached($cache): void { $this->decoratedFormState->setCached($cache) ->shouldBeCalled(); @@ -140,7 +140,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsCached($cache) { + public function testIsCached($cache): void { $this->decoratedFormState->isCached() ->willReturn($cache) ->shouldBeCalled(); @@ -152,7 +152,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetCachedWithLogicException($cache) { + public function testSetCachedWithLogicException($cache): void { $this->decoratedFormState->setCached($cache) ->willThrow(\LogicException::class); $this->expectException(\LogicException::class); @@ -162,7 +162,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::disableCache */ - public function testDisableCache() { + public function testDisableCache(): void { $this->decoratedFormState->disableCache() ->shouldBeCalled(); @@ -172,7 +172,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setExecuted */ - public function testSetExecuted() { + public function testSetExecuted(): void { $this->decoratedFormState->setExecuted() ->shouldBeCalled(); @@ -188,7 +188,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::isExecuted()'s * return value. */ - public function testIsExecuted($executed) { + public function testIsExecuted($executed): void { $this->decoratedFormState->isExecuted() ->willReturn($executed) ->shouldBeCalled(); @@ -199,7 +199,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setGroups */ - public function testSetGroups() { + public function testSetGroups(): void { $groups = [ 'FOO' => 'BAR', ]; @@ -213,7 +213,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getGroups */ - public function testGetGroups() { + public function testGetGroups(): void { $groups = [ 'FOO' => 'BAR', ]; @@ -235,7 +235,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetHasFileElement($has_file_element) { + public function testSetHasFileElement($has_file_element): void { $this->decoratedFormState->setHasFileElement($has_file_element) ->shouldBeCalled(); @@ -247,7 +247,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testHasFileElement($has_file_element) { + public function testHasFileElement($has_file_element): void { $this->decoratedFormState->hasFileElement() ->willReturn($has_file_element) ->shouldBeCalled(); @@ -260,7 +260,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerLimitValidationErrors */ - public function testSetLimitValidationErrors($limit_validation_errors) { + public function testSetLimitValidationErrors($limit_validation_errors): void { $this->decoratedFormState->setLimitValidationErrors($limit_validation_errors) ->shouldBeCalled(); @@ -272,7 +272,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerLimitValidationErrors */ - public function testGetLimitValidationErrors($limit_validation_errors) { + public function testGetLimitValidationErrors($limit_validation_errors): void { $this->decoratedFormState->getLimitValidationErrors() ->willReturn($limit_validation_errors) ->shouldBeCalled(); @@ -299,7 +299,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetMethod($method) { + public function testSetMethod($method): void { $this->decoratedFormState->setMethod($method) ->shouldBeCalled(); @@ -311,7 +311,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerIsMethodType */ - public function testIsMethodType($expected_return_value, $method_type) { + public function testIsMethodType($expected_return_value, $method_type): void { $this->decoratedFormState->isMethodType($method_type) ->willReturn($expected_return_value) ->shouldBeCalled(); @@ -336,7 +336,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSetRequestMethod */ - public function testSetRequestMethod($method) { + public function testSetRequestMethod($method): void { $this->decoratedFormState->setRequestMethod($method) ->shouldBeCalled(); @@ -358,7 +358,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetValidationEnforced($must_validate) { + public function testSetValidationEnforced($must_validate): void { $this->decoratedFormState->setValidationEnforced($must_validate) ->shouldBeCalled(); @@ -370,7 +370,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsValidationEnforced($must_validate) { + public function testIsValidationEnforced($must_validate): void { $this->decoratedFormState->isValidationEnforced() ->willReturn($must_validate) ->shouldBeCalled(); @@ -383,7 +383,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testDisableRedirect($no_redirect) { + public function testDisableRedirect($no_redirect): void { $this->decoratedFormState->disableRedirect($no_redirect) ->shouldBeCalled(); @@ -395,7 +395,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsRedirectDisabled($no_redirect) { + public function testIsRedirectDisabled($no_redirect): void { $this->decoratedFormState->isRedirectDisabled() ->willReturn($no_redirect) ->shouldBeCalled(); @@ -408,7 +408,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetProcessInput($process_input) { + public function testSetProcessInput($process_input): void { $this->decoratedFormState->setProcessInput($process_input) ->shouldBeCalled(); @@ -420,7 +420,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsProcessingInput($process_input) { + public function testIsProcessingInput($process_input): void { $this->decoratedFormState->isProcessingInput() ->willReturn($process_input) ->shouldBeCalled(); @@ -433,7 +433,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetProgrammed($programmed) { + public function testSetProgrammed($programmed): void { $this->decoratedFormState->setProgrammed($programmed) ->shouldBeCalled(); @@ -445,7 +445,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsProgrammed($programmed) { + public function testIsProgrammed($programmed): void { $this->decoratedFormState->isProgrammed() ->willReturn($programmed) ->shouldBeCalled(); @@ -458,7 +458,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetProgrammedBypassAccessCheck($programmed_bypass_access_check) { + public function testSetProgrammedBypassAccessCheck($programmed_bypass_access_check): void { $this->decoratedFormState->setProgrammedBypassAccessCheck($programmed_bypass_access_check) ->shouldBeCalled(); @@ -470,7 +470,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsBypassingProgrammedAccessChecks($programmed_bypass_access_check) { + public function testIsBypassingProgrammedAccessChecks($programmed_bypass_access_check): void { $this->decoratedFormState->isBypassingProgrammedAccessChecks() ->willReturn($programmed_bypass_access_check) ->shouldBeCalled(); @@ -481,7 +481,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setRebuildInfo */ - public function testSetRebuildInfo() { + public function testSetRebuildInfo(): void { $rebuild_info = [ 'FOO' => 'BAR', ]; @@ -495,7 +495,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getRebuildInfo */ - public function testGetRebuildInfo() { + public function testGetRebuildInfo(): void { $rebuild_info = [ 'FOO' => 'BAR', ]; @@ -510,7 +510,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::addRebuildInfo */ - public function testAddRebuildInfo() { + public function testAddRebuildInfo(): void { $property = 'FOO'; $value = 'BAR'; @@ -522,7 +522,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setStorage */ - public function testSetStorage() { + public function testSetStorage(): void { $storage = [ 'FOO' => 'BAR', ]; @@ -536,7 +536,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getStorage */ - public function testGetStorage() { + public function testGetStorage(): void { $storage = [ 'FOO' => 'BAR', ]; @@ -556,7 +556,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setSubmitHandlers */ - public function testSetSubmitHandlers() { + public function testSetSubmitHandlers(): void { $submit_handlers = [ 'FOO' => 'BAR', ]; @@ -570,7 +570,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getSubmitHandlers */ - public function testGetSubmitHandlers() { + public function testGetSubmitHandlers(): void { $submit_handlers = [ 'FOO' => 'BAR', ]; @@ -585,7 +585,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setSubmitted */ - public function testSetSubmitted() { + public function testSetSubmitted(): void { $this->decoratedFormState->setSubmitted() ->shouldBeCalled(); @@ -602,7 +602,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::isSubmitted()'s return * value. */ - public function testIsSubmitted($submitted) { + public function testIsSubmitted($submitted): void { $this->decoratedFormState->isSubmitted() ->willReturn($submitted); @@ -612,7 +612,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setTemporary */ - public function testSetTemporary() { + public function testSetTemporary(): void { $temporary = [ 'FOO' => 'BAR', ]; @@ -626,7 +626,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getTemporary */ - public function testGetTemporary() { + public function testGetTemporary(): void { $temporary = [ 'FOO' => 'BAR', ]; @@ -652,7 +652,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::setTemporaryValue()'s $value * argument. */ - public function testSetTemporaryValue($key, $value) { + public function testSetTemporaryValue($key, $value): void { $this->decoratedFormState->setTemporaryValue($key, $value) ->shouldBeCalled(); @@ -683,7 +683,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::getTemporaryValue()'s return * value. */ - public function testGetTemporaryValue($key, $value = NULL) { + public function testGetTemporaryValue($key, $value = NULL): void { // Use PHPUnit for mocking, because Prophecy cannot mock methods that return // by reference. See \Prophecy\Doubler\Generator\Node::getCode(). $decorated_form_state = $this->createMock(FormStateInterface::class); @@ -721,7 +721,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::hasTemporaryValue()'s $key * argument. */ - public function testHasTemporaryValue($exists, $key) { + public function testHasTemporaryValue($exists, $key): void { $this->decoratedFormState->hasTemporaryValue($key) ->willReturn($exists) ->shouldBeCalled(); @@ -742,7 +742,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setTriggeringElement */ - public function testSetTriggeringElement() { + public function testSetTriggeringElement(): void { $triggering_element = [ 'FOO' => 'BAR', ]; @@ -756,7 +756,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getTriggeringElement */ - public function testGetTriggeringElement() { + public function testGetTriggeringElement(): void { $triggering_element = [ 'FOO' => 'BAR', ]; @@ -776,7 +776,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setValidateHandlers */ - public function testSetValidateHandlers() { + public function testSetValidateHandlers(): void { $validate_handlers = [ 'FOO' => 'BAR', ]; @@ -790,7 +790,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getValidateHandlers */ - public function testGetValidateHandlers() { + public function testGetValidateHandlers(): void { $validate_handlers = [ 'FOO' => 'BAR', ]; @@ -812,7 +812,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::setValidationComplete()'s $complete * argument. */ - public function testSetValidationComplete($complete) { + public function testSetValidationComplete($complete): void { $this->decoratedFormState->setValidationComplete($complete) ->shouldBeCalled(); @@ -829,7 +829,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * \Drupal\Core\Form\FormStateInterface::isValidationComplete()'s return * value. */ - public function testIsValidationComplete($complete) { + public function testIsValidationComplete($complete): void { $this->decoratedFormState->isValidationComplete() ->willReturn($complete) ->shouldBeCalled(); @@ -855,7 +855,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::loadInclude()'s * $name argument. */ - public function testLoadInclude($expected, $module, $type, $name) { + public function testLoadInclude($expected, $module, $type, $name): void { $this->decoratedFormState->loadInclude($module, $type, $name) ->willReturn($expected) ->shouldBeCalled(); @@ -881,7 +881,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getCacheableArray */ - public function testGetCacheableArray() { + public function testGetCacheableArray(): void { $cacheable_array = [ 'foo' => 'bar', ]; @@ -896,7 +896,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setCompleteForm */ - public function testSetCompleteForm() { + public function testSetCompleteForm(): void { $complete_form = [ 'FOO' => 'BAR', ]; @@ -910,7 +910,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getCompleteForm */ - public function testGetCompleteForm() { + public function testGetCompleteForm(): void { $complete_form = [ 'FOO' => 'BAR', ]; @@ -940,7 +940,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::set()'s $value * argument. */ - public function testSet($key, $value) { + public function testSet($key, $value): void { $this->decoratedFormState->set($key, $value) ->shouldBeCalled(); @@ -969,7 +969,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * (optional) Any valid value for * \Drupal\Core\Form\FormStateInterface::get()'s return value. */ - public function testGet($key, $value = NULL) { + public function testGet($key, $value = NULL): void { // Use PHPUnit for mocking, because Prophecy cannot mock methods that return // by reference. See \Prophecy\Doubler\Generator\Node::getCode(). @@ -1006,7 +1006,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::has()'s $key * argument. */ - public function testHas($exists, $key) { + public function testHas($exists, $key): void { $this->decoratedFormState->has($key) ->willReturn($exists) ->shouldBeCalled(); @@ -1027,7 +1027,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setBuildInfo */ - public function testSetBuildInfo() { + public function testSetBuildInfo(): void { $build_info = [ 'FOO' => 'BAR', ]; @@ -1041,7 +1041,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getBuildInfo */ - public function testGetBuildInfo() { + public function testGetBuildInfo(): void { $build_info = [ 'FOO' => 'BAR', ]; @@ -1056,7 +1056,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::addBuildInfo */ - public function testAddBuildInfo() { + public function testAddBuildInfo(): void { $property = 'FOO'; $value = 'BAR'; @@ -1069,7 +1069,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setUserInput */ - public function testSetUserInput() { + public function testSetUserInput(): void { $user_input = [ 'FOO' => 'BAR', ]; @@ -1083,7 +1083,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getUserInput */ - public function testGetUserInput() { + public function testGetUserInput(): void { $user_input = [ 'FOO' => 'BAR', ]; @@ -1103,7 +1103,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getValues */ - public function testGetValues() { + public function testGetValues(): void { $values = [ 'FOO' => 'BAR', ]; @@ -1123,7 +1123,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getValue */ - public function testGetValue() { + public function testGetValue(): void { $key = 'FOO'; $value = 'BAR'; @@ -1143,7 +1143,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setValues */ - public function testSetValues() { + public function testSetValues(): void { $values = [ 'foo' => 'Foo', 'bar' => ['Bar'], @@ -1158,7 +1158,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setValue */ - public function testSetValue() { + public function testSetValue(): void { $key = 'FOO'; $value = 'BAR'; @@ -1171,7 +1171,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::unsetValue */ - public function testUnsetValue() { + public function testUnsetValue(): void { $key = 'FOO'; $this->decoratedFormState->unsetValue($key) @@ -1183,7 +1183,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::hasValue */ - public function testHasValue() { + public function testHasValue(): void { $key = ['foo', 'bar']; $has = TRUE; @@ -1197,7 +1197,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::isValueEmpty */ - public function testIsValueEmpty() { + public function testIsValueEmpty(): void { $key = ['foo', 'bar']; $is_empty = TRUE; @@ -1211,7 +1211,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setValueForElement */ - public function testSetValueForElement() { + public function testSetValueForElement(): void { $element = [ '#type' => 'foo', ]; @@ -1226,7 +1226,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setResponse */ - public function testSetResponse() { + public function testSetResponse(): void { $response = $this->createMock(Response::class); $this->decoratedFormState->setResponse($response) @@ -1238,7 +1238,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getResponse */ - public function testGetResponse() { + public function testGetResponse(): void { $response = $this->createMock(Response::class); $this->decoratedFormState->getResponse() @@ -1251,7 +1251,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setRedirect */ - public function testSetRedirect() { + public function testSetRedirect(): void { $route_name = 'foo'; $route_parameters = [ 'bar' => 'baz', @@ -1269,7 +1269,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setRedirectUrl */ - public function testSetRedirectUrl() { + public function testSetRedirectUrl(): void { $url = new Url('foo'); $this->decoratedFormState->setRedirectUrl($url) @@ -1287,7 +1287,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::getRedirect()'s * return value. */ - public function testGetRedirect($expected) { + public function testGetRedirect($expected): void { $this->decoratedFormState->getRedirect() ->willReturn($expected) ->shouldBeCalled(); @@ -1310,7 +1310,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setErrorByName */ - public function testSetErrorByName() { + public function testSetErrorByName(): void { $name = 'foo'; $message = 'bar'; @@ -1323,7 +1323,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setError */ - public function testSetError() { + public function testSetError(): void { $element = [ '#foo' => 'bar', ]; @@ -1338,7 +1338,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::clearErrors */ - public function testClearErrors() { + public function testClearErrors(): void { $this->decoratedFormState->clearErrors() ->shouldBeCalled(); @@ -1348,7 +1348,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getError */ - public function testGetError() { + public function testGetError(): void { $element = [ '#foo' => 'bar', ]; @@ -1364,7 +1364,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getErrors */ - public function testGetErrors() { + public function testGetErrors(): void { $errors = [ 'foo' => 'bar', ]; @@ -1384,7 +1384,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * Any valid value for \Drupal\Core\Form\FormStateInterface::setRebuild()'s * $rebuild argument. */ - public function testSetRebuild($rebuild) { + public function testSetRebuild($rebuild): void { $this->decoratedFormState->setRebuild($rebuild) ->shouldBeCalled(); @@ -1396,7 +1396,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testIsRebuilding($rebuild) { + public function testIsRebuilding($rebuild): void { $this->decoratedFormState->isRebuilding() ->willReturn($rebuild) ->shouldBeCalled(); @@ -1409,7 +1409,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testSetInvalidToken($expected) { + public function testSetInvalidToken($expected): void { $this->decoratedFormState->setInvalidToken($expected) ->shouldBeCalled(); @@ -1421,7 +1421,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerSingleBooleanArgument */ - public function testHasInvalidToken($expected) { + public function testHasInvalidToken($expected): void { $this->decoratedFormState->hasInvalidToken() ->willReturn($expected) ->shouldBeCalled(); @@ -1434,7 +1434,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { * * @dataProvider providerPrepareCallback */ - public function testPrepareCallback($unprepared_callback, callable $prepared_callback) { + public function testPrepareCallback($unprepared_callback, callable $prepared_callback): void { $this->decoratedFormState->prepareCallback(Argument::is($unprepared_callback)) ->willReturn($prepared_callback) ->shouldBeCalled(); @@ -1468,7 +1468,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setFormObject */ - public function testSetFormObject() { + public function testSetFormObject(): void { $form = $this->createMock(FormInterface::class); $this->decoratedFormState->setFormObject($form) @@ -1480,7 +1480,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getFormObject */ - public function testGetFormObject() { + public function testGetFormObject(): void { $form = $this->createMock(FormInterface::class); $this->decoratedFormState->getFormObject() @@ -1493,7 +1493,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::setCleanValueKeys */ - public function testSetCleanValueKeys() { + public function testSetCleanValueKeys(): void { $keys = ['BAR']; $this->decoratedFormState->setCleanValueKeys($keys) @@ -1505,7 +1505,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::getCleanValueKeys */ - public function testGetCleanValueKeys() { + public function testGetCleanValueKeys(): void { $keys = ['BAR']; $this->decoratedFormState->getCleanValueKeys() @@ -1518,7 +1518,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::addCleanValueKey */ - public function testAddCleanValueKey() { + public function testAddCleanValueKey(): void { $key = 'BAR'; $this->decoratedFormState->addCleanValueKey($key) @@ -1530,7 +1530,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { /** * @covers ::cleanValues */ - public function testCleanValues() { + public function testCleanValues(): void { $this->decoratedFormState->cleanValues() ->shouldBeCalled(); diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php index 3aadbc411d4..708e2b32b8d 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php @@ -25,7 +25,7 @@ class FormStateTest extends UnitTestCase { * * @dataProvider providerTestGetRedirect */ - public function testGetRedirect($form_state_additions, $expected) { + public function testGetRedirect($form_state_additions, $expected): void { $form_state = (new FormState())->setFormState($form_state_additions); $redirect = $form_state->getRedirect(); $this->assertEquals($expected, $redirect); @@ -58,7 +58,7 @@ class FormStateTest extends UnitTestCase { * * @covers ::setError */ - public function testSetError() { + public function testSetError(): void { $form_state = new FormState(); $element['#parents'] = ['foo', 'bar']; $form_state->setError($element, 'Fail'); @@ -72,7 +72,7 @@ class FormStateTest extends UnitTestCase { * * @dataProvider providerTestGetError */ - public function testGetError($errors, $parents, $error = NULL) { + public function testGetError($errors, $parents, $error = NULL): void { $element['#parents'] = $parents; $form_state = (new FormState())->setFormState([ 'errors' => $errors, @@ -100,7 +100,7 @@ class FormStateTest extends UnitTestCase { * * @dataProvider providerTestSetErrorByName */ - public function testSetErrorByName($limit_validation_errors, $expected_errors) { + public function testSetErrorByName($limit_validation_errors, $expected_errors): void { $form_state = new FormState(); $form_state->setLimitValidationErrors($limit_validation_errors); $form_state->clearErrors(); @@ -130,7 +130,7 @@ class FormStateTest extends UnitTestCase { * * @covers ::setErrorByName */ - public function testFormErrorsDuringSubmission() { + public function testFormErrorsDuringSubmission(): void { $form_state = new FormState(); $form_state->setValidationComplete(); $this->expectException(\LogicException::class); @@ -141,7 +141,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::prepareCallback */ - public function testPrepareCallbackValidMethod() { + public function testPrepareCallbackValidMethod(): void { $form_state = new FormState(); $form_state->setFormObject(new PrepareCallbackTestForm()); $processed_callback = $form_state->prepareCallback('::buildForm'); @@ -151,7 +151,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::prepareCallback */ - public function testPrepareCallbackInValidMethod() { + public function testPrepareCallbackInValidMethod(): void { $form_state = new FormState(); $form_state->setFormObject(new PrepareCallbackTestForm()); $processed_callback = $form_state->prepareCallback('not_a_method'); @@ -162,7 +162,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::prepareCallback */ - public function testPrepareCallbackArray() { + public function testPrepareCallbackArray(): void { $form_state = new FormState(); $form_state->setFormObject(new PrepareCallbackTestForm()); $callback = [$form_state->getFormObject(), 'buildForm']; @@ -173,7 +173,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::loadInclude */ - public function testLoadInclude() { + public function testLoadInclude(): void { $type = 'some_type'; $module = 'some_module'; $name = 'some_name'; @@ -190,7 +190,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::loadInclude */ - public function testLoadIncludeNoName() { + public function testLoadIncludeNoName(): void { $type = 'some_type'; $module = 'some_module'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') @@ -206,7 +206,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::loadInclude */ - public function testLoadIncludeNotFound() { + public function testLoadIncludeNotFound(): void { $type = 'some_type'; $module = 'some_module'; $form_state = $this->getMockBuilder('Drupal\Core\Form\FormState') @@ -222,7 +222,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::loadInclude */ - public function testLoadIncludeAlreadyLoaded() { + public function testLoadIncludeAlreadyLoaded(): void { $type = 'some_type'; $module = 'some_module'; $name = 'some_name'; @@ -248,7 +248,7 @@ class FormStateTest extends UnitTestCase { * * @dataProvider providerTestIsCached */ - public function testIsCached($cache_key, $no_cache_key, $expected) { + public function testIsCached($cache_key, $no_cache_key, $expected): void { $form_state = (new FormState())->setFormState([ 'cache' => $cache_key, 'no_cache' => $no_cache_key, @@ -302,7 +302,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::setCached */ - public function testSetCachedPost() { + public function testSetCachedPost(): void { $form_state = new FormState(); $form_state->setRequestMethod('POST'); $form_state->setCached(); @@ -312,7 +312,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::setCached */ - public function testSetCachedGet() { + public function testSetCachedGet(): void { $form_state = new FormState(); $form_state->setRequestMethod('GET'); $this->expectException(\LogicException::class); @@ -326,7 +326,7 @@ class FormStateTest extends UnitTestCase { * * @dataProvider providerTestIsMethodType */ - public function testIsMethodType($set_method_type, $input, $expected) { + public function testIsMethodType($set_method_type, $input, $expected): void { $form_state = (new FormState()) ->setMethod($set_method_type); $this->assertSame($expected, $form_state->isMethodType($input)); @@ -365,7 +365,7 @@ class FormStateTest extends UnitTestCase { * @covers ::hasTemporaryValue * @covers ::setTemporaryValue */ - public function testTemporaryValue() { + public function testTemporaryValue(): void { $form_state = new FormState(); $this->assertFalse($form_state->hasTemporaryValue('rainbow_sparkles')); $form_state->setTemporaryValue('rainbow_sparkles', 'yes'); @@ -379,7 +379,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::getCleanValueKeys */ - public function testGetCleanValueKeys() { + public function testGetCleanValueKeys(): void { $form_state = new FormState(); $this->assertSame($form_state->getCleanValueKeys(), ['form_id', 'form_token', 'form_build_id', 'op']); } @@ -387,7 +387,7 @@ class FormStateTest extends UnitTestCase { /** * @covers ::setCleanValueKeys */ - public function testSetCleanValueKeys() { + public function testSetCleanValueKeys(): void { $form_state = new FormState(); $form_state->setCleanValueKeys(['key1', 'key2']); $this->assertSame($form_state->getCleanValueKeys(), ['key1', 'key2']); @@ -409,7 +409,7 @@ class FormStateTest extends UnitTestCase { * * @covers ::cleanValues */ - public function testCleanValues($form_state) { + public function testCleanValues($form_state): void { $form_state->setValue('value_to_keep', 'magic_ponies'); $this->assertSame($form_state->cleanValues()->getValues(), ['value_to_keep' => 'magic_ponies']); } @@ -418,7 +418,7 @@ class FormStateTest extends UnitTestCase { * @covers ::setValues * @covers ::getValues */ - public function testGetValues() { + public function testGetValues(): void { $values = [ 'foo' => 'bar', ]; diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php index 1b931f3027d..d99a939d42a 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php @@ -19,7 +19,7 @@ class FormStateValuesTraitTest extends UnitTestCase { * * @covers ::setValueForElement */ - public function testSetValueForElement() { + public function testSetValueForElement(): void { $element = [ '#parents' => [ 'foo', @@ -43,7 +43,7 @@ class FormStateValuesTraitTest extends UnitTestCase { * * @dataProvider providerGetValue */ - public function testGetValue($key, $expected, $default = NULL) { + public function testGetValue($key, $expected, $default = NULL): void { $form_state = (new FormStateValuesTraitStub())->setValues([ 'foo' => 'one', 'bar' => [ @@ -91,7 +91,7 @@ class FormStateValuesTraitTest extends UnitTestCase { /** * @covers ::getValue */ - public function testGetValueModifyReturn() { + public function testGetValueModifyReturn(): void { $initial_values = $values = [ 'foo' => 'one', 'bar' => [ @@ -113,7 +113,7 @@ class FormStateValuesTraitTest extends UnitTestCase { * * @dataProvider providerSetValue */ - public function testSetValue($key, $value, $expected) { + public function testSetValue($key, $value, $expected): void { $form_state = (new FormStateValuesTraitStub())->setValues([ 'bar' => 'wrong', ]); @@ -149,7 +149,7 @@ class FormStateValuesTraitTest extends UnitTestCase { * * @dataProvider providerHasValue */ - public function testHasValue($key, $expected) { + public function testHasValue($key, $expected): void { $form_state = (new FormStateValuesTraitStub())->setValues([ 'foo' => 'one', 'bar' => [ @@ -198,7 +198,7 @@ class FormStateValuesTraitTest extends UnitTestCase { * * @dataProvider providerIsValueEmpty */ - public function testIsValueEmpty($key, $expected) { + public function testIsValueEmpty($key, $expected): void { $form_state = (new FormStateValuesTraitStub())->setValues([ 'foo' => 'one', 'bar' => [ diff --git a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php index 83dbfec7378..ebeffbc8f17 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php @@ -56,7 +56,7 @@ class FormSubmitterTest extends UnitTestCase { /** * @covers ::doSubmitForm */ - public function testHandleFormSubmissionNotSubmitted() { + public function testHandleFormSubmissionNotSubmitted(): void { $form_submitter = $this->getFormSubmitter(); $form = []; $form_state = new FormState(); @@ -69,7 +69,7 @@ class FormSubmitterTest extends UnitTestCase { /** * @covers ::doSubmitForm */ - public function testHandleFormSubmissionNoRedirect() { + public function testHandleFormSubmissionNoRedirect(): void { $form_submitter = $this->getFormSubmitter(); $form = []; $form_state = (new FormState()) @@ -86,7 +86,7 @@ class FormSubmitterTest extends UnitTestCase { * * @dataProvider providerTestHandleFormSubmissionWithResponses */ - public function testHandleFormSubmissionWithResponses($class, $form_state_key) { + public function testHandleFormSubmissionWithResponses($class, $form_state_key): void { $response = $this->getMockBuilder($class) ->disableOriginalConstructor() ->getMock(); @@ -117,7 +117,7 @@ class FormSubmitterTest extends UnitTestCase { * * @covers ::redirectForm */ - public function testRedirectWithNull() { + public function testRedirectWithNull(): void { $form_submitter = $this->getFormSubmitter(); $form_state = $this->createMock('Drupal\Core\Form\FormStateInterface'); @@ -143,7 +143,7 @@ class FormSubmitterTest extends UnitTestCase { * * @dataProvider providerTestRedirectWithUrl */ - public function testRedirectWithUrl(Url $redirect_value, $result, $status = 303) { + public function testRedirectWithUrl(Url $redirect_value, $result, $status = 303): void { $container = new ContainerBuilder(); $container->set('url_generator', $this->urlGenerator); \Drupal::setContainer($container); @@ -190,7 +190,7 @@ class FormSubmitterTest extends UnitTestCase { * * @covers ::redirectForm */ - public function testRedirectWithResponseObject() { + public function testRedirectWithResponseObject(): void { $form_submitter = $this->getFormSubmitter(); $redirect = new RedirectResponse('/example'); $form_state = $this->createMock('Drupal\Core\Form\FormStateInterface'); @@ -208,7 +208,7 @@ class FormSubmitterTest extends UnitTestCase { * * @covers ::redirectForm */ - public function testRedirectWithoutResult() { + public function testRedirectWithoutResult(): void { $form_submitter = $this->getFormSubmitter(); $this->urlGenerator->expects($this->never()) ->method('generateFromRoute'); @@ -229,7 +229,7 @@ class FormSubmitterTest extends UnitTestCase { /** * @covers ::executeSubmitHandlers */ - public function testExecuteSubmitHandlers() { + public function testExecuteSubmitHandlers(): void { $form_submitter = $this->getFormSubmitter(); $mock = $this->prophesize(MockFormBase::class); $mock diff --git a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php index b80768cf531..18952cecd8c 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php @@ -56,7 +56,7 @@ class FormValidatorTest extends UnitTestCase { * @covers ::validateForm * @covers ::finalizeValidation */ - public function testValidationComplete() { + public function testValidationComplete(): void { $form_validator = new FormValidator(new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler); $form = []; @@ -71,7 +71,7 @@ class FormValidatorTest extends UnitTestCase { * * @covers ::validateForm */ - public function testPreventDuplicateValidation() { + public function testPreventDuplicateValidation(): void { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) ->onlyMethods(['doValidateForm']) @@ -91,7 +91,7 @@ class FormValidatorTest extends UnitTestCase { * * @covers ::validateForm */ - public function testMustValidate() { + public function testMustValidate(): void { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) ->onlyMethods(['doValidateForm']) @@ -111,7 +111,7 @@ class FormValidatorTest extends UnitTestCase { /** * @covers ::validateForm */ - public function testValidateInvalidFormToken() { + public function testValidateInvalidFormToken(): void { $request_stack = new RequestStack(); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/test/example?foo=bar']); $request_stack->push($request); @@ -141,7 +141,7 @@ class FormValidatorTest extends UnitTestCase { /** * @covers ::validateForm */ - public function testValidateValidFormToken() { + public function testValidateValidFormToken(): void { $request_stack = new RequestStack(); $this->csrfToken->expects($this->once()) ->method('validate') @@ -170,7 +170,7 @@ class FormValidatorTest extends UnitTestCase { * * @dataProvider providerTestHandleErrorsWithLimitedValidation */ - public function testHandleErrorsWithLimitedValidation($sections, $triggering_element, $values, $expected) { + public function testHandleErrorsWithLimitedValidation($sections, $triggering_element, $values, $expected): void { $form_validator = new FormValidator(new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler); $triggering_element['#limit_validation_errors'] = $sections; @@ -263,7 +263,7 @@ class FormValidatorTest extends UnitTestCase { /** * @covers ::executeValidateHandlers */ - public function testExecuteValidateHandlers() { + public function testExecuteValidateHandlers(): void { $form_validator = new FormValidator(new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler); $mock = $this->getMockBuilder(FormValidatorTestMockInterface::class) @@ -294,7 +294,7 @@ class FormValidatorTest extends UnitTestCase { * * @dataProvider providerTestRequiredErrorMessage */ - public function testRequiredErrorMessage($element, $expected_message) { + public function testRequiredErrorMessage($element, $expected_message): void { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) ->onlyMethods(['executeValidateHandlers']) @@ -342,7 +342,7 @@ class FormValidatorTest extends UnitTestCase { /** * @covers ::doValidateForm */ - public function testElementValidate() { + public function testElementValidate(): void { $form_validator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler]) ->onlyMethods(['executeValidateHandlers']) @@ -372,7 +372,7 @@ class FormValidatorTest extends UnitTestCase { * * @dataProvider providerTestPerformRequiredValidation */ - public function testPerformRequiredValidation($element, $expected_message, $call_watchdog) { + public function testPerformRequiredValidation($element, $expected_message, $call_watchdog): void { $form_validator = new FormValidator(new RequestStack(), $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $this->formErrorHandler); if ($call_watchdog) { diff --git a/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php b/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php index 25f6bf5668a..bdba83a6891 100644 --- a/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php +++ b/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php @@ -18,7 +18,7 @@ class OptGroupTest extends UnitTestCase { * * @dataProvider providerTestFlattenOptions */ - public function testFlattenOptions($options) { + public function testFlattenOptions($options): void { $this->assertSame(['foo' => 'foo'], OptGroup::flattenOptions($options)); } diff --git a/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php b/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php index 6bd6bab57e3..b0efd7279a6 100644 --- a/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php +++ b/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php @@ -68,7 +68,7 @@ class SubformStateTest extends UnitTestCase { * @param string $expected * The expected state values. */ - public function testGetValues(array $parents, $expected) { + public function testGetValues(array $parents, $expected): void { $parent_form_state = new FormState(); $parent_form_state->setValues(static::$formStateValues); @@ -107,7 +107,7 @@ class SubformStateTest extends UnitTestCase { * @param string $expected * The expected state values. */ - public function testGetValuesBroken(array $parents, $expected) { + public function testGetValuesBroken(array $parents, $expected): void { $this->expectException(\UnexpectedValueException::class); $this->testGetValues($parents, $expected); } @@ -134,7 +134,7 @@ class SubformStateTest extends UnitTestCase { * * @dataProvider providerTestGetValue */ - public function testGetValue($parents, $key, $expected, $default = NULL) { + public function testGetValue($parents, $key, $expected, $default = NULL): void { $parent_form_state = new FormState(); $parent_form_state->setValues(static::$formStateValues); @@ -168,7 +168,7 @@ class SubformStateTest extends UnitTestCase { * * @dataProvider providerTestGetValueBroken */ - public function testGetValueBroken(array $parents, $key, $expected, $default = NULL) { + public function testGetValueBroken(array $parents, $key, $expected, $default = NULL): void { $this->expectException(\UnexpectedValueException::class); $this->testGetValue($parents, $key, $expected, $default); } @@ -192,7 +192,7 @@ class SubformStateTest extends UnitTestCase { * * @dataProvider providerTestSetValues */ - public function testSetValues($parents, $new_values, $expected) { + public function testSetValues($parents, $new_values, $expected): void { $parent_form_state = new FormState(); $parent_form_state->setValues(static::$formStateValues); @@ -223,7 +223,7 @@ class SubformStateTest extends UnitTestCase { * * @dataProvider providerTestSetValuesBroken */ - public function testSetValuesBroken($parents, $new_values, $expected) { + public function testSetValuesBroken($parents, $new_values, $expected): void { $this->expectException(\UnexpectedValueException::class); $this->testSetValues($parents, $new_values, $expected); } @@ -247,7 +247,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::getCompleteFormState */ - public function testGetCompleteFormStateWithParentCompleteForm() { + public function testGetCompleteFormStateWithParentCompleteForm(): void { $parent_form_state = $this->prophesize(FormStateInterface::class); $subform_state = SubformState::createForSubform($this->parentForm['dog'], $this->parentForm, $parent_form_state->reveal()); $this->assertSame($parent_form_state->reveal(), $subform_state->getCompleteFormState()); @@ -256,7 +256,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::getCompleteFormState */ - public function testGetCompleteFormStateWithParentSubform() { + public function testGetCompleteFormStateWithParentSubform(): void { $complete_form_state = $this->prophesize(FormStateInterface::class); $parent_form_state = $this->prophesize(SubformStateInterface::class); $parent_form_state->getCompleteFormState() @@ -269,7 +269,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::setLimitValidationErrors */ - public function testSetLimitValidationErrors() { + public function testSetLimitValidationErrors(): void { $parent_limit_validation_errors = ['dog', 'name']; $limit_validation_errors = ['name']; @@ -284,7 +284,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::getLimitValidationErrors */ - public function testGetLimitValidationErrors() { + public function testGetLimitValidationErrors(): void { $parent_limit_validation_errors = ['dog', 'name']; $limit_validation_errors = ['name']; @@ -300,7 +300,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::setErrorByName */ - public function testSetErrorByName() { + public function testSetErrorByName(): void { $parent_form_error_name = 'dog][name'; $subform_error_name = 'name'; // cSpell:disable-next-line @@ -317,7 +317,7 @@ class SubformStateTest extends UnitTestCase { /** * @covers ::getFormObject */ - public function testFormObject() { + public function testFormObject(): void { $parent_form_state = $this->prophesize(FormStateInterface::class); $parent_form_object = $this->prophesize(FormInterface::class)->reveal(); $parent_form_state->getFormObject()->willReturn($parent_form_object)->shouldBeCalledOnce(); diff --git a/core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php b/core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php index edd771a7408..91587fd5203 100644 --- a/core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php +++ b/core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php @@ -31,7 +31,7 @@ class CacheableExceptionTest extends UnitTestCase { /** * @covers \Drupal\Core\Http\Exception\CacheableHttpException */ - public function testCacheableHttpException() { + public function testCacheableHttpException(): void { $exception = new CacheableHttpException((new CacheableMetadata())->setCacheContexts(['route']), 500, 'test message', NULL, ['X-Drupal-Exception' => 'Test'], 123); $this->assertSame(['route'], $exception->getCacheContexts()); $this->assertSame(500, $exception->getStatusCode()); @@ -43,7 +43,7 @@ class CacheableExceptionTest extends UnitTestCase { /** * @dataProvider providerTestExceptions */ - public function testExceptions($status_code, $class, $argument = NULL, $expected_headers = []) { + public function testExceptions($status_code, $class, $argument = NULL, $expected_headers = []): void { $cacheable_metadata = (new CacheableMetadata())->setCacheContexts(['route']); $message = "$class test message"; if ($argument) { diff --git a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php index d880ee1d645..527258fc75b 100644 --- a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php @@ -44,7 +44,7 @@ class ClientFactoryTest extends UnitTestCase { * @param array $expected_config_keys * The expected config keys. */ - public function testCreateFromOptions($settings_config, $parameter_config, $expected_config_keys) { + public function testCreateFromOptions($settings_config, $parameter_config, $expected_config_keys): void { if ($settings_config) { new Settings(['http_client_config' => $settings_config]); } diff --git a/core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php b/core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php index 57530376ee2..1bc4abd3c66 100644 --- a/core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php @@ -29,7 +29,7 @@ class TrustedHostsRequestFactoryTest extends UnitTestCase { * @covers ::createRequest * @dataProvider providerTestCreateRequest */ - public function testCreateRequest($host, $server, $expected) { + public function testCreateRequest($host, $server, $expected): void { $request_factory = new TrustedHostsRequestFactory($host); $request = $request_factory->createRequest([], [], [], [], [], $server, []); $this->assertEquals($expected, $request->getHost()); diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php index 57ac5de1064..673aeb534eb 100644 --- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -153,7 +153,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getHeight(). */ - public function testGetHeight() { + public function testGetHeight(): void { $this->getTestImage(FALSE); $this->assertEquals(100, $this->image->getHeight()); } @@ -161,7 +161,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getWidth(). */ - public function testGetWidth() { + public function testGetWidth(): void { $this->getTestImage(FALSE); $this->assertEquals(88, $this->image->getWidth()); } @@ -169,7 +169,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getFileSize. */ - public function testGetFileSize() { + public function testGetFileSize(): void { $this->getTestImage(FALSE); $this->assertEquals(3905, $this->image->getFileSize()); } @@ -177,7 +177,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getToolkit()->getType(). */ - public function testGetType() { + public function testGetType(): void { $this->getTestImage(FALSE); $this->assertEquals(IMAGETYPE_PNG, $this->image->getToolkit()->getType()); } @@ -185,7 +185,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getMimeType(). */ - public function testGetMimeType() { + public function testGetMimeType(): void { $this->getTestImage(FALSE); $this->assertEquals('image/png', $this->image->getMimeType()); } @@ -193,7 +193,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::isValid(). */ - public function testIsValid() { + public function testIsValid(): void { $this->getTestImage(FALSE); $this->assertTrue($this->image->isValid()); $this->assertFileIsReadable($this->image->getSource()); @@ -202,7 +202,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::getToolkitId(). */ - public function testGetToolkitId() { + public function testGetToolkitId(): void { $this->getTestImage(FALSE); $this->assertEquals('gd', $this->image->getToolkitId()); } @@ -210,7 +210,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::save(). */ - public function testSave() { + public function testSave(): void { $this->getTestImage(); // This will fail if save() method isn't called on the toolkit. $toolkit = $this->getToolkitMock(); @@ -239,7 +239,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::save(). */ - public function testSaveFails() { + public function testSaveFails(): void { $this->getTestImage(); // This will fail if save() method isn't called on the toolkit. $this->toolkit->expects($this->once()) @@ -252,7 +252,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::save(). */ - public function testChmodFails() { + public function testChmodFails(): void { $this->getTestImage(); // This will fail if save() method isn't called on the toolkit. $toolkit = $this->getToolkitMock(); @@ -281,7 +281,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::parseFile(). */ - public function testParseFileFails() { + public function testParseFileFails(): void { $toolkit = $this->getToolkitMock(); $image = new Image($toolkit, 'magic-foobar.png'); @@ -292,7 +292,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scale(). */ - public function testScaleWidth() { + public function testScaleWidth(): void { $this->getTestImageForOperation('Scale'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -305,7 +305,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scale(). */ - public function testScaleHeight() { + public function testScaleHeight(): void { $this->getTestImageForOperation('Scale'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -318,7 +318,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scale(). */ - public function testScaleSame() { + public function testScaleSame(): void { $this->getTestImageForOperation('Scale'); // Dimensions are the same, resize should not be called. $this->toolkitOperation->expects($this->once()) @@ -333,7 +333,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scaleAndCrop(). */ - public function testScaleAndCropWidth() { + public function testScaleAndCropWidth(): void { $this->getTestImageForOperation('ScaleAndCrop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -346,7 +346,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scaleAndCrop(). */ - public function testScaleAndCropHeight() { + public function testScaleAndCropHeight(): void { $this->getTestImageForOperation('ScaleAndCrop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -359,7 +359,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::scaleAndCrop(). */ - public function testScaleAndCropFails() { + public function testScaleAndCropFails(): void { $this->getTestImageForOperation('ScaleAndCrop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -375,7 +375,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::crop(). */ - public function testCropWidth() { + public function testCropWidth(): void { $this->getTestImageForOperation('Crop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -389,7 +389,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::crop(). */ - public function testCropHeight() { + public function testCropHeight(): void { $this->getTestImageForOperation('Crop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -403,7 +403,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::crop(). */ - public function testCrop() { + public function testCrop(): void { $this->getTestImageForOperation('Crop'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -416,7 +416,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::convert(). */ - public function testConvert() { + public function testConvert(): void { $this->getTestImageForOperation('Convert'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -429,7 +429,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::resize(). */ - public function testResize() { + public function testResize(): void { $this->getTestImageForOperation('Resize'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -444,7 +444,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::resize(). */ - public function testFloatResize() { + public function testFloatResize(): void { $this->getTestImageForOperation('Resize'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -459,7 +459,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::desaturate(). */ - public function testDesaturate() { + public function testDesaturate(): void { $this->getTestImageForOperation('Desaturate'); $this->toolkitOperation->expects($this->once()) ->method('execute') @@ -471,7 +471,7 @@ class ImageTest extends UnitTestCase { /** * Tests \Drupal\Core\Image\Image::rotate(). */ - public function testRotate() { + public function testRotate(): void { $this->getTestImageForOperation('Rotate'); $this->toolkitOperation->expects($this->once()) ->method('execute') diff --git a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php index e347ed5fe25..a3692788c17 100644 --- a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php @@ -17,7 +17,7 @@ class LanguageUnitTest extends UnitTestCase { /** * @covers ::__construct */ - public function testConstruct() { + public function testConstruct(): void { $name = $this->randomMachineName(); $language_code = $this->randomMachineName(2); $uuid = $this->randomMachineName(); @@ -31,7 +31,7 @@ class LanguageUnitTest extends UnitTestCase { /** * @covers ::getName */ - public function testGetName() { + public function testGetName(): void { $name = $this->randomMachineName(); $language_code = $this->randomMachineName(2); $language = new Language(['id' => $language_code, 'name' => $name]); @@ -41,7 +41,7 @@ class LanguageUnitTest extends UnitTestCase { /** * @covers ::getId */ - public function testGetLangcode() { + public function testGetLangcode(): void { $language_code = $this->randomMachineName(2); $language = new Language(['id' => $language_code]); $this->assertSame($language_code, $language->getId()); @@ -50,7 +50,7 @@ class LanguageUnitTest extends UnitTestCase { /** * @covers ::getDirection */ - public function testGetDirection() { + public function testGetDirection(): void { $language_code = $this->randomMachineName(2); $language = new Language(['id' => $language_code, 'direction' => LanguageInterface::DIRECTION_RTL]); $this->assertSame(LanguageInterface::DIRECTION_RTL, $language->getDirection()); @@ -59,7 +59,7 @@ class LanguageUnitTest extends UnitTestCase { /** * @covers ::isDefault */ - public function testIsDefault() { + public function testIsDefault(): void { $language_default = $this->getMockBuilder('Drupal\Core\Language\LanguageDefault')->disableOriginalConstructor()->getMock(); $container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container->expects($this->any()) @@ -94,7 +94,7 @@ class LanguageUnitTest extends UnitTestCase { * @param array $expected * The expected array of keys. */ - public function testSortArrayOfLanguages(array $languages, array $expected) { + public function testSortArrayOfLanguages(array $languages, array $expected): void { Language::sort($languages); $this->assertSame($expected, array_keys($languages)); } diff --git a/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php b/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php index 9bb982c9f12..7ab62f52c14 100644 --- a/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php +++ b/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php @@ -18,7 +18,7 @@ class LayoutDefaultTest extends UnitTestCase { * @covers ::build * @dataProvider providerTestBuild */ - public function testBuild($regions, $expected) { + public function testBuild($regions, $expected): void { $definition = new LayoutDefinition([ 'theme_hook' => 'layout', 'library' => 'core/drupal', diff --git a/core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php index 7610bf16bf5..62547d63c97 100644 --- a/core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php @@ -104,7 +104,7 @@ class LayoutPluginManagerTest extends UnitTestCase { * @covers ::getDefinitions * @covers ::providerExists */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $expected = [ 'module_a_provided_layout', 'theme_a_provided_layout', @@ -121,7 +121,7 @@ class LayoutPluginManagerTest extends UnitTestCase { * @covers ::getDefinition * @covers ::processDefinition */ - public function testGetDefinition() { + public function testGetDefinition(): void { $layout_definition = $this->layoutPluginManager->getDefinition('theme_a_provided_layout'); $this->assertSame('theme_a_provided_layout', $layout_definition->id()); $this->assertSame('2 column layout', (string) $layout_definition->getLabel()); @@ -243,7 +243,7 @@ class LayoutPluginManagerTest extends UnitTestCase { /** * @covers ::processDefinition */ - public function testProcessDefinition() { + public function testProcessDefinition(): void { $this->moduleHandler->alter('layout', Argument::type('array'))->shouldNotBeCalled(); $this->expectException(InvalidPluginDefinitionException::class); $this->expectExceptionMessage('The "module_a_derived_layout:array_based" layout definition must extend ' . LayoutDefinition::class); @@ -265,7 +265,7 @@ EOS; /** * @covers ::getThemeImplementations */ - public function testGetThemeImplementations() { + public function testGetThemeImplementations(): void { $core_path = '/core/lib/Drupal/Core'; $expected = [ 'layout' => [ @@ -297,7 +297,7 @@ EOS; /** * @covers ::getCategories */ - public function testGetCategories() { + public function testGetCategories(): void { $expected = [ 'Columns: 1', 'Columns: 2', @@ -309,7 +309,7 @@ EOS; /** * @covers ::getSortedDefinitions */ - public function testGetSortedDefinitions() { + public function testGetSortedDefinitions(): void { // Sorted by category first, then label. $expected = [ 'module_a_provided_layout', @@ -326,7 +326,7 @@ EOS; /** * @covers ::getGroupedDefinitions */ - public function testGetGroupedDefinitions() { + public function testGetGroupedDefinitions(): void { $category_expected = [ 'Columns: 1' => [ 'module_a_provided_layout', diff --git a/core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php b/core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php index 6c54105dc26..634a9c23a23 100644 --- a/core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php +++ b/core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php @@ -33,7 +33,7 @@ class DrupalStandardsListenerDeprecationTest extends UnitTestCase { * * @covers ::testFunction */ - public function testDeprecation() { + public function testDeprecation(): void { // Meaningless assertion so this test is not risky. $this->assertTrue(TRUE); } diff --git a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php index 0fcefcd0a8b..8796ed8b6a1 100644 --- a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php +++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php @@ -31,7 +31,7 @@ class LockBackendAbstractTest extends UnitTestCase { /** * Tests the wait() method when lockMayBeAvailable() returns TRUE. */ - public function testWaitFalse() { + public function testWaitFalse(): void { $this->lock->expects($this->any()) ->method('lockMayBeAvailable') ->with($this->equalTo('test_name')) @@ -46,7 +46,7 @@ class LockBackendAbstractTest extends UnitTestCase { * Waiting could take 1 second so we need to extend the possible runtime. * @medium */ - public function testWaitTrue() { + public function testWaitTrue(): void { $this->lock->expects($this->any()) ->method('lockMayBeAvailable') ->with($this->equalTo('test_name')) @@ -58,7 +58,7 @@ class LockBackendAbstractTest extends UnitTestCase { /** * Tests the getLockId() method. */ - public function testGetLockId() { + public function testGetLockId(): void { $lock_id = $this->lock->getLockId(); $this->assertIsString($lock_id); // Example lock ID would be '7213141505232b6ee2cb967.27683891'. diff --git a/core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php b/core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php index 5e88cd9be7c..0b63b0fadac 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php @@ -29,7 +29,7 @@ class LogMessageParserTest extends UnitTestCase { * @dataProvider providerTestParseMessagePlaceholders * @covers ::parseMessagePlaceholders */ - public function testParseMessagePlaceholders(array $value, array $expected) { + public function testParseMessagePlaceholders(array $value, array $expected): void { $parser = new LogMessageParser(); $message_placeholders = $parser->parseMessagePlaceholders($value['message'], $value['context']); $this->assertEquals($expected['message'], $value['message']); diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php index 6ff5700fe95..1d0cc3e8428 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php @@ -20,7 +20,7 @@ class LoggerChannelFactoryTest extends UnitTestCase { * * @covers ::get */ - public function testGet() { + public function testGet(): void { $factory = new LoggerChannelFactory( $this->createMock(RequestStack::class), $this->createMock(AccountInterface::class), diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php index 2028dcff1ee..718fa92f3ed 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @@ -35,7 +35,7 @@ class LoggerChannelTest extends UnitTestCase { * @covers ::setCurrentUser * @covers ::setRequestStack */ - public function testLog(callable $expected, bool $request = FALSE, bool $account = FALSE) { + public function testLog(callable $expected, bool $request = FALSE, bool $account = FALSE): void { $channel = new LoggerChannel('test'); $message = $this->randomMachineName(); $logger = $this->createMock('Psr\Log\LoggerInterface'); @@ -72,7 +72,7 @@ class LoggerChannelTest extends UnitTestCase { * * @covers ::log */ - public function testLogRecursionProtection() { + public function testLogRecursionProtection(): void { $channel = new LoggerChannel('test'); $logger = $this->createMock('Psr\Log\LoggerInterface'); $logger->expects($this->exactly(LoggerChannel::MAX_CALL_DEPTH)) @@ -88,7 +88,7 @@ class LoggerChannelTest extends UnitTestCase { * @covers ::addLogger * @covers ::sortLoggers */ - public function testSortLoggers() { + public function testSortLoggers(): void { $channel = new LoggerChannel($this->randomMachineName()); $index_order = ''; for ($i = 0; $i < 4; $i++) { diff --git a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php index f0cac252767..4dc84914763 100644 --- a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php @@ -18,7 +18,7 @@ class MailFormatHelperTest extends UnitTestCase { /** * @covers ::wrapMail */ - public function testWrapMail() { + public function testWrapMail(): void { $delimiter = "End of header\n"; $long_file_name = $this->randomMachineName(64) . '.docx'; $headers_in_body = 'Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; name="' . $long_file_name . "\"\n"; diff --git a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php index c4640b90ae5..bbb7efb1206 100644 --- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php @@ -154,7 +154,7 @@ class MailManagerTest extends UnitTestCase { * * @covers ::getInstance */ - public function testGetInstance() { + public function testGetInstance(): void { $interface = [ 'default' => 'php_mail', 'example_testkey' => 'test_mail_collector', @@ -177,7 +177,7 @@ class MailManagerTest extends UnitTestCase { * * @covers ::mail */ - public function testMailInRenderContext() { + public function testMailInRenderContext(): void { $interface = [ 'default' => 'php_mail', 'example_testkey' => 'test_mail_collector', diff --git a/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/PhpMailTest.php b/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/PhpMailTest.php index 35d783e7725..760e2a0199d 100644 --- a/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/PhpMailTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/PhpMailTest.php @@ -109,7 +109,7 @@ class PhpMailTest extends UnitTestCase { * * @covers ::mail */ - public function testMail() { + public function testMail(): void { // Setup a mail message. $message = [ 'id' => 'example_key', diff --git a/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/SymfonyMailerTest.php b/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/SymfonyMailerTest.php index 40fa0911daa..169d6cc2853 100644 --- a/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/SymfonyMailerTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/Plugin/Mail/SymfonyMailerTest.php @@ -23,7 +23,7 @@ class SymfonyMailerTest extends UnitTestCase { * * @covers ::format */ - public function testFormatResemblesHtml() { + public function testFormatResemblesHtml(): void { // Populate global $base_path to avoid notices generated by // MailFormatHelper::htmlToMailUrls() global $base_path; @@ -67,7 +67,7 @@ class SymfonyMailerTest extends UnitTestCase { * * @covers ::mail */ - public function testMail() { + public function testMail(): void { // Setup a mail message. $message = [ 'id' => 'example_key', diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php index ccba55d707e..00663971b36 100644 --- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php @@ -68,7 +68,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitle() { + public function testGetTitle(): void { $title = 'Example'; $this->pluginDefinition['title'] = (new TranslatableMarkup($title, [], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) @@ -83,7 +83,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitleWithContext() { + public function testGetTitleWithContext(): void { $title = 'Example'; $this->pluginDefinition['title'] = (new TranslatableMarkup($title, [], ['context' => 'context'], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) @@ -98,7 +98,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitleWithTitleArguments() { + public function testGetTitleWithTitleArguments(): void { $title = 'Example @test'; $this->pluginDefinition['title'] = (new TranslatableMarkup($title, ['@test' => 'value'], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) @@ -114,7 +114,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getRouteName */ - public function testGetRouteName($route_name = 'test_route_name') { + public function testGetRouteName($route_name = 'test_route_name'): void { $this->pluginDefinition['route_name'] = $route_name; $this->setupContextualLinkDefault(); @@ -124,7 +124,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getGroup */ - public function testGetGroup($group_name = 'test_group') { + public function testGetGroup($group_name = 'test_group'): void { $this->pluginDefinition['group'] = $group_name; $this->setupContextualLinkDefault(); @@ -134,7 +134,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getOptions */ - public function testGetOptions($options = ['key' => 'value']) { + public function testGetOptions($options = ['key' => 'value']): void { $this->pluginDefinition['options'] = $options; $this->setupContextualLinkDefault(); @@ -144,7 +144,7 @@ class ContextualLinkDefaultTest extends UnitTestCase { /** * @covers ::getWeight */ - public function testGetWeight($weight = 5) { + public function testGetWeight($weight = 5): void { $this->pluginDefinition['weight'] = $weight; $this->setupContextualLinkDefault(); diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php index 4d235bec59b..0780db15ee2 100644 --- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php @@ -100,7 +100,7 @@ class ContextualLinkManagerTest extends UnitTestCase { * * @see \Drupal\Core\Menu\ContextualLinkManager::getContextualLinkPluginsByGroup() */ - public function testGetContextualLinkPluginsByGroup() { + public function testGetContextualLinkPluginsByGroup(): void { $definitions = [ 'test_plugin1' => [ 'id' => 'test_plugin1', @@ -139,7 +139,7 @@ class ContextualLinkManagerTest extends UnitTestCase { /** * Tests the getContextualLinkPluginsByGroup method with a prefilled cache. */ - public function testGetContextualLinkPluginsByGroupWithCache() { + public function testGetContextualLinkPluginsByGroupWithCache(): void { $definitions = [ 'test_plugin1' => [ 'id' => 'test_plugin1', @@ -174,7 +174,7 @@ class ContextualLinkManagerTest extends UnitTestCase { * * @see \Drupal\Core\Menu\ContextualLinkManager::processDefinition() */ - public function testProcessDefinitionWithoutRoute() { + public function testProcessDefinitionWithoutRoute(): void { $definition = [ 'class' => '\Drupal\Core\Menu\ContextualLinkDefault', 'group' => 'example', @@ -189,7 +189,7 @@ class ContextualLinkManagerTest extends UnitTestCase { * * @see \Drupal\Core\Menu\ContextualLinkManager::processDefinition() */ - public function testProcessDefinitionWithoutGroup() { + public function testProcessDefinitionWithoutGroup(): void { $definition = [ 'class' => '\Drupal\Core\Menu\ContextualLinkDefault', 'route_name' => 'example', @@ -204,7 +204,7 @@ class ContextualLinkManagerTest extends UnitTestCase { * * @see \Drupal\Core\Menu\ContextualLinkManager::getContextualLinksArrayByGroup() */ - public function testGetContextualLinksArrayByGroup() { + public function testGetContextualLinksArrayByGroup(): void { $definitions = [ 'test_plugin1' => [ 'id' => 'test_plugin1', @@ -264,7 +264,7 @@ class ContextualLinkManagerTest extends UnitTestCase { * * @see \Drupal\Core\Menu\ContextualLinkManager::getContextualLinksArrayByGroup() */ - public function testGetContextualLinksArrayByGroupAccessCheck() { + public function testGetContextualLinksArrayByGroupAccessCheck(): void { $definitions = [ 'test_plugin1' => [ 'id' => 'test_plugin1', @@ -307,7 +307,7 @@ class ContextualLinkManagerTest extends UnitTestCase { /** * Tests the plugins alter hook. */ - public function testPluginDefinitionAlter() { + public function testPluginDefinitionAlter(): void { $definitions['test_plugin'] = [ 'id' => 'test_plugin', 'class' => ContextualLinkDefault::class, diff --git a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php index 8d0eba684e6..367d08d5d8d 100644 --- a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php @@ -150,7 +150,7 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase { * * @covers ::generateIndexAndSort */ - public function testGenerateIndexAndSort() { + public function testGenerateIndexAndSort(): void { $this->mockTree(); $tree = $this->originalTree; $tree = $this->defaultMenuTreeManipulators->generateIndexAndSort($tree); @@ -174,7 +174,7 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase { * @covers ::checkAccess * @covers ::menuLinkCheckAccess */ - public function testCheckAccess() { + public function testCheckAccess(): void { // Those menu links that are non-external will have their access checks // performed. 9 routes, but 1 is external, 2 already have their 'access' // property set, and 1 is a child if an inaccessible menu link, so only 5 @@ -282,7 +282,7 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase { * * @covers ::flatten */ - public function testFlatten() { + public function testFlatten(): void { $this->mockTree(); $tree = $this->defaultMenuTreeManipulators->flatten($this->originalTree); $this->assertEquals([1, 2, 5, 6, 8, 9], array_keys($this->originalTree)); @@ -296,7 +296,7 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase { * @covers ::collectNodeLinks * @covers ::checkAccess */ - public function testCheckNodeAccess() { + public function testCheckNodeAccess(): void { $links = [ 1 => MenuLinkMock::create(['id' => 'node.1', 'route_name' => 'entity.node.canonical', 'title' => 'foo', 'parent' => '', 'route_parameters' => ['node' => 1]]), 2 => MenuLinkMock::create(['id' => 'node.2', 'route_name' => 'entity.node.canonical', 'title' => 'bar', 'parent' => '', 'route_parameters' => ['node' => 2]]), diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php index 09bf2b601e1..85d1c6989da 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php @@ -81,7 +81,7 @@ class LocalActionDefaultTest extends UnitTestCase { * * @see \Drupal\Core\Menu\LocalTaskDefault::getTitle() */ - public function testGetTitle() { + public function testGetTitle(): void { $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) ->method('translateString') @@ -97,7 +97,7 @@ class LocalActionDefaultTest extends UnitTestCase { * * @see \Drupal\Core\Menu\LocalTaskDefault::getTitle() */ - public function testGetTitleWithContext() { + public function testGetTitleWithContext(): void { $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [], ['context' => 'context'], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) ->method('translateString') @@ -111,7 +111,7 @@ class LocalActionDefaultTest extends UnitTestCase { /** * Tests the getTitle method with title arguments. */ - public function testGetTitleWithTitleArguments() { + public function testGetTitleWithTitleArguments(): void { $this->pluginDefinition['title'] = (new TranslatableMarkup('Example @test', ['@test' => 'value'], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) ->method('translateString') diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php index b2ab4446e9b..d3198aa3101 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php @@ -137,7 +137,7 @@ class LocalActionManagerTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitle() { + public function testGetTitle(): void { $local_action = $this->createMock('Drupal\Core\Menu\LocalActionInterface'); $local_action->expects($this->once()) ->method('getTitle') @@ -156,7 +156,7 @@ class LocalActionManagerTest extends UnitTestCase { * * @dataProvider getActionsForRouteProvider */ - public function testGetActionsForRoute($route_appears, array $plugin_definitions, array $expected_actions) { + public function testGetActionsForRoute($route_appears, array $plugin_definitions, array $expected_actions): void { $this->discovery->expects($this->any()) ->method('getDefinitions') ->willReturn($plugin_definitions); diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php index 223fb5a6d6c..8548e3cee16 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php @@ -83,7 +83,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getRouteParameters */ - public function testGetRouteParametersForStaticRoute() { + public function testGetRouteParametersForStaticRoute(): void { $this->pluginDefinition = [ 'route_name' => 'test_route', ]; @@ -102,7 +102,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getRouteParameters */ - public function testGetRouteParametersInPluginDefinitions() { + public function testGetRouteParametersInPluginDefinitions(): void { $this->pluginDefinition = [ 'route_name' => 'test_route', 'route_parameters' => ['parameter' => 'example'], @@ -122,7 +122,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getRouteParameters */ - public function testGetRouteParametersForDynamicRouteWithNonUpcastedParameters() { + public function testGetRouteParametersForDynamicRouteWithNonUpcastedParameters(): void { $this->pluginDefinition = [ 'route_name' => 'test_route', ]; @@ -145,7 +145,7 @@ class LocalTaskDefaultTest extends UnitTestCase { * * @covers ::getRouteParameters */ - public function testGetRouteParametersForDynamicRouteWithUpcastedParameters() { + public function testGetRouteParametersForDynamicRouteWithUpcastedParameters(): void { $this->pluginDefinition = [ 'route_name' => 'test_route', ]; @@ -167,7 +167,7 @@ class LocalTaskDefaultTest extends UnitTestCase { * * @covers ::getRouteParameters */ - public function testGetRouteParametersForDynamicRouteWithUpcastedParametersEmptyRawParameters() { + public function testGetRouteParametersForDynamicRouteWithUpcastedParametersEmptyRawParameters(): void { $this->pluginDefinition = [ 'route_name' => 'test_route', ]; @@ -231,7 +231,7 @@ class LocalTaskDefaultTest extends UnitTestCase { * @dataProvider providerTestGetWeight * @covers ::getWeight */ - public function testGetWeight($plugin_definition, $plugin_id, $expected_weight) { + public function testGetWeight($plugin_definition, $plugin_id, $expected_weight): void { $this->pluginDefinition = $plugin_definition; $this->pluginId = $plugin_id; $this->setupLocalTaskDefault(); @@ -243,7 +243,7 @@ class LocalTaskDefaultTest extends UnitTestCase { * @covers ::getActive * @covers ::setActive */ - public function testActive() { + public function testActive(): void { $this->setupLocalTaskDefault(); $this->assertFalse($this->localTaskBase->getActive()); @@ -254,7 +254,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitle() { + public function testGetTitle(): void { $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) ->method('translateString') @@ -268,7 +268,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitleWithContext() { + public function testGetTitleWithContext(): void { $title = 'Example'; $this->pluginDefinition['title'] = (new TranslatableMarkup($title, [], ['context' => 'context'], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) @@ -283,7 +283,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getTitle */ - public function testGetTitleWithTitleArguments() { + public function testGetTitleWithTitleArguments(): void { $this->pluginDefinition['title'] = (new TranslatableMarkup('Example @test', ['@test' => 'value'], [], $this->stringTranslation)); $this->stringTranslation->expects($this->once()) ->method('translateString') @@ -297,7 +297,7 @@ class LocalTaskDefaultTest extends UnitTestCase { /** * @covers ::getOptions */ - public function testGetOptions() { + public function testGetOptions(): void { $this->pluginDefinition['options'] = [ 'attributes' => ['class' => ['example']], ]; @@ -324,7 +324,7 @@ class LocalTaskDefaultTest extends UnitTestCase { * @covers ::getCacheTags * @covers ::getCacheMaxAge */ - public function testCacheabilityMetadata() { + public function testCacheabilityMetadata(): void { $this->pluginDefinition['cache_contexts'] = ['route']; $this->pluginDefinition['cache_tags'] = ['kitten']; $this->pluginDefinition['cache_max_age'] = 3600; diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 5ee43089ad2..582faf10d55 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -120,7 +120,7 @@ class LocalTaskManagerTest extends UnitTestCase { * * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getLocalTasksForRoute() */ - public function testGetLocalTasksForRouteSingleLevelTitle() { + public function testGetLocalTasksForRouteSingleLevelTitle(): void { $definitions = $this->getLocalTaskFixtures(); $this->pluginDiscovery->expects($this->once()) @@ -144,7 +144,7 @@ class LocalTaskManagerTest extends UnitTestCase { * * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getLocalTasksForRoute() */ - public function testGetLocalTasksForRouteForChild() { + public function testGetLocalTasksForRouteForChild(): void { $definitions = $this->getLocalTaskFixtures(); $this->pluginDiscovery->expects($this->once()) @@ -166,7 +166,7 @@ class LocalTaskManagerTest extends UnitTestCase { /** * Tests the cache of the local task manager with an empty initial cache. */ - public function testGetLocalTaskForRouteWithEmptyCache() { + public function testGetLocalTaskForRouteWithEmptyCache(): void { $definitions = $this->getLocalTaskFixtures(); $this->pluginDiscovery->expects($this->once()) @@ -197,7 +197,7 @@ class LocalTaskManagerTest extends UnitTestCase { /** * Tests the cache of the local task manager with a filled initial cache. */ - public function testGetLocalTaskForRouteWithFilledCache() { + public function testGetLocalTaskForRouteWithFilledCache(): void { $this->pluginDiscovery->expects($this->never()) ->method('getDefinitions'); @@ -224,7 +224,7 @@ class LocalTaskManagerTest extends UnitTestCase { * * @see \Drupal\system\Plugin\Type\MenuLocalTaskManager::getTitle() */ - public function testGetTitle() { + public function testGetTitle(): void { $menu_local_task = $this->createMock('Drupal\Core\Menu\LocalTaskInterface'); $menu_local_task->expects($this->once()) ->method('getTitle'); @@ -396,7 +396,7 @@ class LocalTaskManagerTest extends UnitTestCase { /** * @covers ::getTasksBuild */ - public function testGetTasksBuildWithCacheabilityMetadata() { + public function testGetTasksBuildWithCacheabilityMetadata(): void { $definitions = $this->getLocalTaskFixtures(); $this->pluginDiscovery->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php index 54c2d22eb6b..75727693a80 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php @@ -142,7 +142,7 @@ class MenuActiveTrailTest extends UnitTestCase { * @covers ::getActiveLink * @dataProvider provider */ - public function testGetActiveLink(Request $request, $links, $menu_name, $expected_link) { + public function testGetActiveLink(Request $request, $links, $menu_name, $expected_link): void { $this->requestStack->push($request); if ($links !== FALSE) { $this->menuLinkManager->expects($this->exactly(2)) @@ -162,7 +162,7 @@ class MenuActiveTrailTest extends UnitTestCase { * @covers ::getActiveTrailIds * @dataProvider provider */ - public function testGetActiveTrailIds(Request $request, $links, $menu_name, $expected_link, $expected_trail) { + public function testGetActiveTrailIds(Request $request, $links, $menu_name, $expected_link, $expected_trail): void { $expected_trail_ids = array_combine($expected_trail, $expected_trail); $this->requestStack->push($request); @@ -195,7 +195,7 @@ class MenuActiveTrailTest extends UnitTestCase { * * @covers ::getCid */ - public function testGetCid() { + public function testGetCid(): void { $data = $this->provider()[1]; /** @var \Symfony\Component\HttpFoundation\Request $request */ $request = $data[0]; diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultFormTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultFormTest.php index f1ab40a3bfe..c7aa7448369 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultFormTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultFormTest.php @@ -24,7 +24,7 @@ class MenuLinkDefaultFormTest extends UnitTestCase { /** * @covers ::extractFormValues */ - public function testExtractFormValues() { + public function testExtractFormValues(): void { $menu_link_manager = $this->prophesize(MenuLinkManagerInterface::class); $menu_parent_form_selector = $this->prophesize(MenuParentFormSelectorInterface::class); $module_handler = $this->prophesize(ModuleHandlerInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php index 2e300cfffad..11519f5a6f0 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php @@ -17,7 +17,7 @@ class MenuLinkDefaultTest extends UnitTestCase { /** * @covers ::updateLink */ - public function testUpdateLink() { + public function testUpdateLink(): void { $plugin_definition = [ 'title' => 'Hey jude', 'enabled' => 1, @@ -41,7 +41,7 @@ class MenuLinkDefaultTest extends UnitTestCase { /** * @covers ::updateLink */ - public function testUpdateLinkWithoutPersist() { + public function testUpdateLinkWithoutPersist(): void { $plugin_definition = [ 'title' => 'Hey jude', 'enabled' => 1, diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php index 720b0da0381..c378ea39951 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php @@ -21,7 +21,7 @@ class MenuLinkTreeElementTest extends UnitTestCase { * * @covers ::__construct */ - public function testConstruction() { + public function testConstruction(): void { $link = MenuLinkMock::create(['id' => 'test']); $item = new MenuLinkTreeElement($link, FALSE, 3, FALSE, []); $this->assertSame($link, $item->link); @@ -36,7 +36,7 @@ class MenuLinkTreeElementTest extends UnitTestCase { * * @covers ::count */ - public function testCount() { + public function testCount(): void { $link_1 = MenuLinkMock::create(['id' => 'test_1']); $link_2 = MenuLinkMock::create(['id' => 'test_2']); $child_item = new MenuLinkTreeElement($link_2, FALSE, 2, FALSE, []); diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php index bc63907c88e..cd467b61f62 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php @@ -46,7 +46,7 @@ class MenuTreeParametersTest extends UnitTestCase { * @covers ::setMinDepth * @dataProvider providerTestSetMinDepth */ - public function testSetMinDepth($min_depth, $expected) { + public function testSetMinDepth($min_depth, $expected): void { $parameters = new MenuTreeParameters(); $parameters->setMinDepth($min_depth); $this->assertEquals($expected, $parameters->minDepth); @@ -57,7 +57,7 @@ class MenuTreeParametersTest extends UnitTestCase { * * @covers ::addExpandedParents */ - public function testAddExpanded() { + public function testAddExpanded(): void { $parameters = new MenuTreeParameters(); // Verify default value. @@ -83,7 +83,7 @@ class MenuTreeParametersTest extends UnitTestCase { * * @covers ::addCondition */ - public function testAddCondition() { + public function testAddCondition(): void { $parameters = new MenuTreeParameters(); // Verify default value. @@ -116,7 +116,7 @@ class MenuTreeParametersTest extends UnitTestCase { * * @covers ::onlyEnabledLinks */ - public function testOnlyEnabledLinks() { + public function testOnlyEnabledLinks(): void { $parameters = new MenuTreeParameters(); $parameters->onlyEnabledLinks(); $this->assertEquals(1, $parameters->conditions['enabled']); @@ -127,7 +127,7 @@ class MenuTreeParametersTest extends UnitTestCase { * * @covers ::setTopLevelOnly */ - public function testSetTopLevelOnly() { + public function testSetTopLevelOnly(): void { $parameters = new MenuTreeParameters(); $parameters->setTopLevelOnly(); $this->assertEquals(1, $parameters->maxDepth); @@ -138,7 +138,7 @@ class MenuTreeParametersTest extends UnitTestCase { * * @covers ::excludeRoot */ - public function testExcludeRoot() { + public function testExcludeRoot(): void { $parameters = new MenuTreeParameters(); $parameters->excludeRoot(); $this->assertEquals(1, $parameters->minDepth); @@ -148,7 +148,7 @@ class MenuTreeParametersTest extends UnitTestCase { * @covers ::serialize * @covers ::unserialize */ - public function testSerialize() { + public function testSerialize(): void { $parameters = new MenuTreeParameters(); $parameters->setRoot(1); $parameters->setMinDepth('2'); diff --git a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php index 7e5acedecc6..f934071037c 100644 --- a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php @@ -18,7 +18,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { * * @covers ::reload */ - public function testReload() { + public function testReload(): void { $config_factory = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface'); $config_factory->expects($this->once()) ->method('reset') @@ -37,7 +37,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { * @covers ::loadOverride * @covers ::getConfig */ - public function testLoadOverride($overrides, $id, $expected) { + public function testLoadOverride($overrides, $id, $expected): void { $config_factory = $this->getConfigFactoryStub(['core.menu.static_menu_link_overrides' => ['definitions' => $overrides]]); $static_override = new StaticMenuLinkOverrides($config_factory); @@ -65,7 +65,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { * @covers ::loadMultipleOverrides * @covers ::getConfig */ - public function testLoadMultipleOverrides() { + public function testLoadMultipleOverrides(): void { $overrides = []; $overrides['test1'] = ['parent' => 'test0']; $overrides['test2'] = ['parent' => 'test1']; @@ -84,7 +84,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { * @covers ::loadOverride * @covers ::getConfig */ - public function testSaveOverride() { + public function testSaveOverride(): void { $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() ->getMock(); @@ -146,7 +146,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { * * @dataProvider providerTestDeleteOverrides */ - public function testDeleteOverrides($ids, array $old_definitions, array $new_definitions) { + public function testDeleteOverrides($ids, array $old_definitions, array $new_definitions): void { $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php index 227cfc83533..2b143781956 100644 --- a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php +++ b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php @@ -44,7 +44,7 @@ class ChainRequestPolicyTest extends UnitTestCase { * * @covers ::check */ - public function testEmptyChain() { + public function testEmptyChain(): void { $result = $this->policy->check($this->request); $this->assertNull($result); } @@ -54,7 +54,7 @@ class ChainRequestPolicyTest extends UnitTestCase { * * @covers ::check */ - public function testNullRuleChain() { + public function testNullRuleChain(): void { $rule = $this->createMock('Drupal\Core\PageCache\RequestPolicyInterface'); $rule->expects($this->once()) ->method('check') @@ -73,7 +73,7 @@ class ChainRequestPolicyTest extends UnitTestCase { * @dataProvider providerChainExceptionOnInvalidReturnValue * @covers ::check */ - public function testChainExceptionOnInvalidReturnValue($return_value) { + public function testChainExceptionOnInvalidReturnValue($return_value): void { $rule = $this->createMock('Drupal\Core\PageCache\RequestPolicyInterface'); $rule->expects($this->once()) ->method('check') @@ -109,7 +109,7 @@ class ChainRequestPolicyTest extends UnitTestCase { * @dataProvider providerAllowIfAnyRuleReturnedAllow * @covers ::check */ - public function testAllowIfAnyRuleReturnedAllow($return_values) { + public function testAllowIfAnyRuleReturnedAllow($return_values): void { foreach ($return_values as $return_value) { $rule = $this->createMock('Drupal\Core\PageCache\RequestPolicyInterface'); $rule->expects($this->once()) @@ -140,7 +140,7 @@ class ChainRequestPolicyTest extends UnitTestCase { /** * Asserts that check() returns immediately when a rule returned DENY. */ - public function testStopChainOnFirstDeny() { + public function testStopChainOnFirstDeny(): void { $rule1 = $this->createMock('Drupal\Core\PageCache\RequestPolicyInterface'); $rule1->expects($this->once()) ->method('check') diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php index 377d5a16d5f..9b4d77d7859 100644 --- a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php +++ b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php @@ -53,7 +53,7 @@ class ChainResponsePolicyTest extends UnitTestCase { * * @covers ::check */ - public function testEmptyChain() { + public function testEmptyChain(): void { $result = $this->policy->check($this->response, $this->request); $this->assertNull($result); } @@ -63,7 +63,7 @@ class ChainResponsePolicyTest extends UnitTestCase { * * @covers ::check */ - public function testNullRuleChain() { + public function testNullRuleChain(): void { $rule = $this->createMock('Drupal\Core\PageCache\ResponsePolicyInterface'); $rule->expects($this->once()) ->method('check') @@ -82,7 +82,7 @@ class ChainResponsePolicyTest extends UnitTestCase { * @dataProvider providerChainExceptionOnInvalidReturnValue * @covers ::check */ - public function testChainExceptionOnInvalidReturnValue($return_value) { + public function testChainExceptionOnInvalidReturnValue($return_value): void { $rule = $this->createMock('Drupal\Core\PageCache\ResponsePolicyInterface'); $rule->expects($this->once()) ->method('check') @@ -115,7 +115,7 @@ class ChainResponsePolicyTest extends UnitTestCase { /** * Asserts that check() returns immediately when a rule returned DENY. */ - public function testStopChainOnFirstDeny() { + public function testStopChainOnFirstDeny(): void { $rule1 = $this->createMock('Drupal\Core\PageCache\ResponsePolicyInterface'); $rule1->expects($this->once()) ->method('check') diff --git a/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php b/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php index 99eb53cd733..ca09b31d162 100644 --- a/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php +++ b/core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php @@ -40,7 +40,7 @@ class CommandLineOrUnsafeMethodTest extends UnitTestCase { * @dataProvider providerTestHttpMethod * @covers ::check */ - public function testHttpMethod($expected_result, $method) { + public function testHttpMethod($expected_result, $method): void { $this->policy->expects($this->once()) ->method('isCli') ->willReturn(FALSE); @@ -74,7 +74,7 @@ class CommandLineOrUnsafeMethodTest extends UnitTestCase { * * @covers ::check */ - public function testIsCli() { + public function testIsCli(): void { $this->policy->expects($this->once()) ->method('isCli') ->willReturn(TRUE); diff --git a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php index 026705cc986..2cff1b71984 100644 --- a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php +++ b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php @@ -44,7 +44,7 @@ class NoSessionOpenTest extends UnitTestCase { * * @covers ::check */ - public function testNoAllowUnlessSessionCookiePresent() { + public function testNoAllowUnlessSessionCookiePresent(): void { $request_without_session = new Request(); $request_with_session = Request::create('/', 'GET', [], ['some-session-name' => 'some-session-id']); diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php index c5717ffa231..e0043a8467d 100644 --- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php +++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php @@ -148,7 +148,7 @@ class EntityConverterTest extends UnitTestCase { * * @covers ::applies */ - public function testApplies(array $definition, $name, Route $route, $applies) { + public function testApplies(array $definition, $name, Route $route, $applies): void { $this->entityTypeManager->expects($this->any()) ->method('hasDefinition') ->willReturnCallback(function ($entity_type) { @@ -179,7 +179,7 @@ class EntityConverterTest extends UnitTestCase { * * @covers ::convert */ - public function testConvert($value, array $definition, array $defaults, $expected_result) { + public function testConvert($value, array $definition, array $defaults, $expected_result): void { $this->setUpMocks(); $this->entityRepository->expects($this->any()) @@ -209,7 +209,7 @@ class EntityConverterTest extends UnitTestCase { /** * Tests the convert() method with an invalid entity type. */ - public function testConvertWithInvalidEntityType() { + public function testConvertWithInvalidEntityType(): void { $this->setUpMocks(); $plugin_id = 'invalid_id'; @@ -227,7 +227,7 @@ class EntityConverterTest extends UnitTestCase { /** * Tests the convert() method with an invalid dynamic entity type. */ - public function testConvertWithInvalidDynamicEntityType() { + public function testConvertWithInvalidDynamicEntityType(): void { $this->expectException(ParamNotConvertedException::class); $this->expectExceptionMessage('The "foo" parameter was not converted because the "invalid_id" parameter is missing.'); $this->entityConverter->convert('id', ['type' => 'entity:{invalid_id}'], 'foo', ['foo' => 'id']); diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php index 37101bcdcc1..1b712bd7ebb 100644 --- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php +++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php @@ -51,7 +51,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { /** * @covers ::applies */ - public function testNonApplyingRoute() { + public function testNonApplyingRoute(): void { $route = new Route('/test'); $this->assertFalse($this->converter->applies([], 'test_revision', $route)); } @@ -59,7 +59,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { /** * @covers ::applies */ - public function testApplyingRoute() { + public function testApplyingRoute(): void { $route = $this->getTestRoute(); $this->assertTrue($this->converter->applies($route->getOption('parameters')['test_revision'], 'test_revision', $route)); } @@ -71,7 +71,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { * * @covers ::convert */ - public function testConvert($value, array $definition, array $defaults, $expected_result) { + public function testConvert($value, array $definition, array $defaults, $expected_result): void { $storage = $this->prophesize(RevisionableStorageInterface::class); $storage->loadRevision('valid_id')->willReturn((object) ['revision_id' => 'valid_id']); $storage->loadRevision('invalid_id')->willReturn(NULL); @@ -105,7 +105,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { * * @covers ::convert */ - public function testConvertWithInvalidEntityType() { + public function testConvertWithInvalidEntityType(): void { $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class); $entity_type_manager->getStorage('invalid_entity_type_id')->willThrow(new InvalidPluginDefinitionException('invalid_entity_type_id')); $entity_repository = $this->prophesize(EntityRepositoryInterface::class); @@ -120,7 +120,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { * * @covers ::convert */ - public function testConvertWithInvalidType() { + public function testConvertWithInvalidType(): void { $this->expectException(ParamNotConvertedException::class); $this->expectExceptionMessage('The type definition "entity_revision_{entity_type_id}" is invalid. The expected format is "entity_revision:<entity_type_id>".'); $this->converter->convert('valid_id', ['type' => 'entity_revision_{entity_type_id}'], 'foo', ['foo' => 'valid_id']); @@ -131,7 +131,7 @@ class EntityRevisionParamConverterTest extends UnitTestCase { * * @covers ::convert */ - public function testConvertWithInvalidDynamicEntityType() { + public function testConvertWithInvalidDynamicEntityType(): void { $this->expectException(ParamNotConvertedException::class); $this->expectExceptionMessage('The "foo" parameter was not converted because the "invalid_entity_type_id" parameter is missing.'); $this->converter->convert('valid_id', ['type' => 'entity_revision:{invalid_entity_type_id}'], 'foo', ['foo' => 'valid_id']); diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php index e518f99e6ef..f48e26295e1 100644 --- a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php +++ b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php @@ -38,7 +38,7 @@ class ParamConverterManagerTest extends UnitTestCase { * * @covers ::getConverter */ - public function testGetConverter($name, $class) { + public function testGetConverter($name, $class): void { $converter = $this->getMockBuilder('Drupal\Core\ParamConverter\ParamConverterInterface') ->setMockClassName($class) ->getMock(); @@ -55,7 +55,7 @@ class ParamConverterManagerTest extends UnitTestCase { * * @covers ::getConverter */ - public function testGetConverterException() { + public function testGetConverterException(): void { $this->expectException(\InvalidArgumentException::class); $this->manager->getConverter('undefined.converter'); } @@ -129,7 +129,7 @@ class ParamConverterManagerTest extends UnitTestCase { * * @dataProvider providerTestSetRouteParameterConverters */ - public function testSetRouteParameterConverters($path, $parameters = NULL, $expected = NULL) { + public function testSetRouteParameterConverters($path, $parameters = NULL, $expected = NULL): void { $converter = $this->createMock('Drupal\Core\ParamConverter\ParamConverterInterface'); $converter->expects($this->any()) ->method('applies') @@ -170,7 +170,7 @@ class ParamConverterManagerTest extends UnitTestCase { /** * @covers ::convert */ - public function testConvert() { + public function testConvert(): void { $route = new Route('/test/{id}/{literal}/{null}'); $parameters = [ 'id' => [ @@ -207,7 +207,7 @@ class ParamConverterManagerTest extends UnitTestCase { /** * @covers ::convert */ - public function testConvertNoConverting() { + public function testConvertNoConverting(): void { $route = new Route('/test'); $defaults = [ RouteObjectInterface::ROUTE_OBJECT => $route, @@ -223,7 +223,7 @@ class ParamConverterManagerTest extends UnitTestCase { /** * @covers ::convert */ - public function testConvertMissingParam() { + public function testConvertMissingParam(): void { $route = new Route('/test/{id}'); $parameters = [ 'id' => [ diff --git a/core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php b/core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php index aa8db53413e..43659958e1d 100644 --- a/core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php @@ -18,7 +18,7 @@ class DefaultPasswordGeneratorTest extends UnitTestCase { /** * @covers ::generate */ - public function testGenerate() { + public function testGenerate(): void { $generator = new DefaultPasswordGenerator(); $password = $generator->generate(); $this->assertEquals(10, strlen($password)); diff --git a/core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php b/core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php index ec62177e967..1cbfc0c7d60 100644 --- a/core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php +++ b/core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php @@ -47,7 +47,7 @@ class PhpPasswordTest extends UnitTestCase { * @covers ::hash * @covers ::needsRehash */ - public function testPasswordNeedsUpdate() { + public function testPasswordNeedsUpdate(): void { $weakHash = (new PhpPassword(PASSWORD_BCRYPT, ['cost' => 4]))->hash($this->password); $this->assertTrue($this->passwordHasher->needsRehash($weakHash), 'Password hash with weak cost settings needs a new hash.'); } @@ -58,7 +58,7 @@ class PhpPasswordTest extends UnitTestCase { * @covers ::check * @covers ::needsRehash */ - public function testPasswordChecking() { + public function testPasswordChecking(): void { $this->assertTrue($this->passwordHasher->check($this->password, $this->passwordHash), 'Password check succeeds.'); $this->assertFalse($this->passwordHasher->needsRehash($this->passwordHash), 'Does not need a new hash.'); } @@ -70,7 +70,7 @@ class PhpPasswordTest extends UnitTestCase { * @covers ::check * @covers ::needsRehash */ - public function testPasswordRehashing() { + public function testPasswordRehashing(): void { // Increment the cost by one. $strongHasher = new PhpPassword(PASSWORD_BCRYPT, ['cost' => 6]); $this->assertTrue($strongHasher->needsRehash($this->passwordHash), 'Needs a new hash after incrementing the cost option.'); @@ -91,7 +91,7 @@ class PhpPasswordTest extends UnitTestCase { * * @dataProvider providerLongPasswords */ - public function testLongPassword($password, $allowed) { + public function testLongPassword($password, $allowed): void { $passwordHash = $this->passwordHasher->hash($password); diff --git a/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php b/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php index 1213e9e3509..13ab4f0b2c9 100644 --- a/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php +++ b/core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php @@ -44,7 +44,7 @@ class PathMatcherTest extends UnitTestCase { * * @dataProvider getMatchPathData */ - public function testMatchPath($patterns, $paths) { + public function testMatchPath($patterns, $paths): void { foreach ($paths as $path => $expected_result) { $actual_result = $this->pathMatcher->matchPath($path, $patterns); $this->assertEquals($actual_result, $expected_result, "Tried matching the path '$path' to the pattern '$patterns'."); diff --git a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php index 3391aeb9424..b7b25b5f85d 100644 --- a/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Path/PathValidatorTest.php @@ -71,7 +71,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithFrontpage() { + public function testIsValidWithFrontpage(): void { $this->accessAwareRouter->expects($this->never()) ->method('match'); @@ -83,7 +83,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithNone() { + public function testIsValidWithNone(): void { $this->accessAwareRouter->expects($this->never()) ->method('match'); @@ -95,7 +95,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithExternalUrl() { + public function testIsValidWithExternalUrl(): void { $this->accessAwareRouter->expects($this->never()) ->method('match'); @@ -107,7 +107,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithInvalidExternalUrl() { + public function testIsValidWithInvalidExternalUrl(): void { $this->accessAwareRouter->expects($this->never()) ->method('match'); @@ -120,7 +120,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::isValid * @covers ::getPathAttributes */ - public function testIsValidWithLinkToAnyPageAccount() { + public function testIsValidWithLinkToAnyPageAccount(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -143,7 +143,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithoutLinkToAnyPageAccount() { + public function testIsValidWithoutLinkToAnyPageAccount(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -166,7 +166,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithPathAlias() { + public function testIsValidWithPathAlias(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -191,7 +191,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::isValid * @covers ::getPathAttributes */ - public function testIsValidWithAccessDenied() { + public function testIsValidWithAccessDenied(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -213,7 +213,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::isValid * @covers ::getPathAttributes */ - public function testIsValidWithResourceNotFound() { + public function testIsValidWithResourceNotFound(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -235,7 +235,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::isValid * @covers ::getPathAttributes */ - public function testIsValidWithParamNotConverted() { + public function testIsValidWithParamNotConverted(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -257,7 +257,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::isValid * @covers ::getPathAttributes */ - public function testIsValidWithMethodNotAllowed() { + public function testIsValidWithMethodNotAllowed(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -280,7 +280,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithFailingParameterConverting() { + public function testIsValidWithFailingParameterConverting(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -303,7 +303,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::isValid */ - public function testIsValidWithNotExistingPath() { + public function testIsValidWithNotExistingPath(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -327,7 +327,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::getUrlIfValid * @covers ::getPathAttributes */ - public function testGetUrlIfValidWithAccess() { + public function testGetUrlIfValidWithAccess(): void { $this->account->expects($this->exactly(2)) ->method('hasPermission') ->with('link to any page') @@ -360,7 +360,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::getUrlIfValid */ - public function testGetUrlIfValidWithQuery() { + public function testGetUrlIfValidWithQuery(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -386,7 +386,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::getUrlIfValid */ - public function testGetUrlIfValidWithoutAccess() { + public function testGetUrlIfValidWithoutAccess(): void { $this->account->expects($this->once()) ->method('hasPermission') ->with('link to any page') @@ -410,7 +410,7 @@ class PathValidatorTest extends UnitTestCase { * * @covers ::getUrlIfValid */ - public function testGetUrlIfValidWithFrontPageAndQueryAndFragments() { + public function testGetUrlIfValidWithFrontPageAndQueryAndFragments(): void { $url = $this->pathValidator->getUrlIfValid('<front>?hei=sen#berg'); $this->assertEquals('<front>', $url->getRouteName()); $this->assertEquals(['hei' => 'sen'], $url->getOptions()['query']); @@ -423,7 +423,7 @@ class PathValidatorTest extends UnitTestCase { * @covers ::getUrlIfValidWithoutAccessCheck * @covers ::getPathAttributes */ - public function testGetUrlIfValidWithoutAccessCheck() { + public function testGetUrlIfValidWithoutAccessCheck(): void { $this->account->expects($this->never()) ->method('hasPermission') ->with('link to any page'); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php index 9cdd35e54e9..9fbee0465dc 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php @@ -25,7 +25,7 @@ class PathProcessorFrontTest extends UnitTestCase { * @covers ::processInbound * @dataProvider providerProcessInbound */ - public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = []) { + public function testProcessInbound($frontpage_path, $path, $expected, array $expected_query = []): void { $config_factory = $this->prophesize(ConfigFactoryInterface::class); $config = $this->prophesize(ImmutableConfig::class); $config_factory->get('system.site') @@ -58,7 +58,7 @@ class PathProcessorFrontTest extends UnitTestCase { * * @covers ::processInbound */ - public function testProcessInboundBadConfig() { + public function testProcessInboundBadConfig(): void { $config_factory = $this->prophesize(ConfigFactoryInterface::class); $config = $this->prophesize(ImmutableConfig::class); $config_factory->get('system.site') diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php index a7018c32b52..b5b80a1bf0e 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -78,7 +78,7 @@ class PathProcessorTest extends UnitTestCase { /** * Tests resolving the inbound path to the system path. */ - public function testProcessInbound() { + public function testProcessInbound(): void { // Create an alias manager stub. $alias_manager = $this->getMockBuilder(AliasManager::class) diff --git a/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php index 6ea9efd4ea2..a7de9884d9c 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php @@ -52,7 +52,7 @@ class CategorizingPluginManagerTraitTest extends UnitTestCase { /** * @covers ::getCategories */ - public function testGetCategories() { + public function testGetCategories(): void { $this->assertSame([ 'fruits', 'vegetables', @@ -62,7 +62,7 @@ class CategorizingPluginManagerTraitTest extends UnitTestCase { /** * @covers ::getSortedDefinitions */ - public function testGetSortedDefinitions() { + public function testGetSortedDefinitions(): void { $sorted = $this->pluginManager->getSortedDefinitions(); $this->assertSame(['apple', 'mango', 'cucumber'], array_keys($sorted)); } @@ -70,7 +70,7 @@ class CategorizingPluginManagerTraitTest extends UnitTestCase { /** * @covers ::getGroupedDefinitions */ - public function testGetGroupedDefinitions() { + public function testGetGroupedDefinitions(): void { $grouped = $this->pluginManager->getGroupedDefinitions(); $this->assertSame(['fruits', 'vegetables'], array_keys($grouped)); $this->assertSame(['apple', 'mango'], array_keys($grouped['fruits'])); @@ -80,7 +80,7 @@ class CategorizingPluginManagerTraitTest extends UnitTestCase { /** * @covers ::processDefinitionCategory */ - public function testProcessDefinitionCategory() { + public function testProcessDefinitionCategory(): void { // Existing category. $definition = [ 'label' => 'some', diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php index 1fd6da4f1ac..abb88f01604 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php @@ -74,7 +74,7 @@ class ContextDefinitionIsSatisfiedTest extends UnitTestCase { * * @dataProvider providerTestIsSatisfiedBy */ - public function testIsSatisfiedBy($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL) { + public function testIsSatisfiedBy($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL): void { $context = new Context($definition, $value); $this->assertSame($expected, $requirement->isSatisfiedBy($context)); } diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php index 9758a52f958..588124f8403 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php @@ -33,7 +33,7 @@ class ContextDefinitionTest extends UnitTestCase { * @covers ::getDataDefinition * @uses \Drupal */ - public function testGetDataDefinition($is_multiple) { + public function testGetDataDefinition($is_multiple): void { $data_type = 'valid'; $mock_data_definition = $this->createMock(ContextDefinitionInterface::class); $mock_data_definition->expects($this->once()) @@ -106,7 +106,7 @@ class ContextDefinitionTest extends UnitTestCase { * @covers ::getDataDefinition * @uses \Drupal */ - public function testGetDataDefinitionInvalidType($is_multiple) { + public function testGetDataDefinitionInvalidType($is_multiple): void { // Since we're trying to make getDataDefinition() throw an exception in // isolation, we use a data type which is not valid. $data_type = 'not_valid'; @@ -172,7 +172,7 @@ class ContextDefinitionTest extends UnitTestCase { * @covers ::getConstraint * @uses \Drupal */ - public function testGetConstraint($expected, $constraint_array, $constraint) { + public function testGetConstraint($expected, $constraint_array, $constraint): void { $mock_context_definition = $this->getMockBuilder('Drupal\Core\Plugin\Context\ContextDefinition') ->disableOriginalConstructor() ->onlyMethods([ @@ -190,7 +190,7 @@ class ContextDefinitionTest extends UnitTestCase { * @covers ::getDefaultValue * @covers ::setDefaultValue */ - public function testDefaultValue() { + public function testDefaultValue(): void { $context_definition = new ContextDefinition(); $this->assertNull($context_definition->getDefaultValue()); $context_definition->setDefaultValue('test'); diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php index ba24da9008c..fef689c098c 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php @@ -50,7 +50,7 @@ class ContextTest extends UnitTestCase { /** * @covers ::getContextValue */ - public function testDefaultValue() { + public function testDefaultValue(): void { $this->setUpDefaultValue('test'); $context = new Context($this->contextDefinition); @@ -61,7 +61,7 @@ class ContextTest extends UnitTestCase { /** * @covers ::getContextData */ - public function testDefaultDataValue() { + public function testDefaultDataValue(): void { $this->setUpDefaultValue('test'); $context = new Context($this->contextDefinition); @@ -72,7 +72,7 @@ class ContextTest extends UnitTestCase { /** * @covers ::getContextData */ - public function testNullDataValue() { + public function testNullDataValue(): void { $this->setUpDefaultValue(NULL); $context = new Context($this->contextDefinition); @@ -83,7 +83,7 @@ class ContextTest extends UnitTestCase { /** * @covers ::setContextValue */ - public function testSetContextValueTypedData() { + public function testSetContextValueTypedData(): void { $this->contextDefinition = $this->createMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface'); @@ -95,7 +95,7 @@ class ContextTest extends UnitTestCase { /** * @covers ::setContextValue */ - public function testSetContextValueCacheableDependency() { + public function testSetContextValueCacheableDependency(): void { $container = new Container(); $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php index c1f253096a1..6a1a14e4946 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php @@ -108,7 +108,7 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase { * * @dataProvider providerTestIsSatisfiedBy */ - public function testIsSatisfiedBy($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL) { + public function testIsSatisfiedBy($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL): void { $entity_storage = $this->prophesize(EntityStorageInterface::class); $content_entity_storage = $this->prophesize(ContentEntityStorageInterface::class); $this->entityTypeManager->getStorage('test_config')->willReturn($entity_storage->reveal()); @@ -192,7 +192,7 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase { * * @dataProvider providerTestIsSatisfiedByGenerateBundledEntity */ - public function testIsSatisfiedByGenerateBundledEntity($expected, array $requirement_bundles, array $candidate_bundles, ?array $bundles_to_instantiate = NULL) { + public function testIsSatisfiedByGenerateBundledEntity($expected, array $requirement_bundles, array $candidate_bundles, ?array $bundles_to_instantiate = NULL): void { // If no bundles are explicitly specified, instantiate all bundles. if (!$bundles_to_instantiate) { $bundles_to_instantiate = $candidate_bundles; @@ -289,7 +289,7 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase { * * @dataProvider providerTestIsSatisfiedByPassBundledEntity */ - public function testIsSatisfiedByPassBundledEntity($expected, $requirement_constraint) { + public function testIsSatisfiedByPassBundledEntity($expected, $requirement_constraint): void { $entity_type = new EntityType(['id' => 'test_content']); $this->entityTypeManager->getDefinitions()->willReturn([ 'test_content' => $entity_type, diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php index 82240491a19..da4130d7611 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php @@ -35,7 +35,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getRuntimeContexts */ - public function testGetRuntimeContextsSingle() { + public function testGetRuntimeContextsSingle(): void { $contexts = $this->setupContextAndProvider('test_provider', ['test_context']); $lazy_context_repository = new LazyContextRepository($this->container, ['test_provider']); @@ -46,7 +46,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getRuntimeContexts */ - public function testGetRuntimeMultipleContextsPerService() { + public function testGetRuntimeMultipleContextsPerService(): void { $contexts = $this->setupContextAndProvider('test_provider', ['test_context0', 'test_context1']); $lazy_context_repository = new LazyContextRepository($this->container, ['test_provider']); @@ -57,7 +57,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getRuntimeContexts */ - public function testGetRuntimeMultipleContextProviders() { + public function testGetRuntimeMultipleContextProviders(): void { $contexts0 = $this->setupContextAndProvider('test_provider', ['test_context0', 'test_context1'], ['test_context0']); $contexts1 = $this->setupContextAndProvider('test_provider2', ['test1_context0', 'test1_context1'], ['test1_context0']); @@ -69,7 +69,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getRuntimeContexts */ - public function testInvalidContextId() { + public function testInvalidContextId(): void { $lazy_context_repository = new LazyContextRepository($this->container, ['test_provider']); $this->expectException(\AssertionError::class); $this->expectExceptionMessage('You must provide the context IDs in the @{service_id}:{unqualified_context_id} format.'); @@ -79,7 +79,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getRuntimeContexts */ - public function testGetRuntimeStaticCache() { + public function testGetRuntimeStaticCache(): void { $context0 = new Context(new ContextDefinition('example')); $context1 = new Context(new ContextDefinition('example')); @@ -98,7 +98,7 @@ class LazyContextRepositoryTest extends UnitTestCase { /** * @covers ::getAvailableContexts */ - public function testGetAvailableContexts() { + public function testGetAvailableContexts(): void { $contexts0 = $this->setupContextAndProvider('test_provider0', ['test0_context0', 'test0_context1']); $contexts1 = $this->setupContextAndProvider('test_provider1', ['test1_context0', 'test1_context1']); diff --git a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php index cff3e9bc65e..221293855b9 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php @@ -70,7 +70,7 @@ class ContextHandlerTest extends UnitTestCase { * * @dataProvider providerTestCheckRequirements */ - public function testCheckRequirements($contexts, $requirements, $expected) { + public function testCheckRequirements($contexts, $requirements, $expected): void { $contexts = array_map(function ($context) { $mock = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $mock->expects($this->atLeastOnce()) @@ -121,7 +121,7 @@ class ContextHandlerTest extends UnitTestCase { * * @dataProvider providerTestGetMatchingContexts */ - public function testGetMatchingContexts($contexts, $requirement, $expected = NULL) { + public function testGetMatchingContexts($contexts, $requirement, $expected = NULL): void { $contexts = array_map(function ($context) { $mock = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $mock->expects($this->atLeastOnce()) @@ -172,7 +172,7 @@ class ContextHandlerTest extends UnitTestCase { * * @dataProvider providerTestFilterPluginDefinitionsByContexts */ - public function testFilterPluginDefinitionsByContexts($has_context, $definitions, $expected) { + public function testFilterPluginDefinitionsByContexts($has_context, $definitions, $expected): void { if ($has_context) { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $expected_context_definition = (new ContextDefinition('string'))->setConstraints(['Blank' => []]); @@ -299,7 +299,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMapping() { + public function testApplyContextMapping(): void { $context_hit = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context_hit->expects($this->atLeastOnce()) ->method('hasContextValue') @@ -340,7 +340,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingMissingRequired() { + public function testApplyContextMappingMissingRequired(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->never()) ->method('getContextValue'); @@ -377,7 +377,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingMissingNotRequired() { + public function testApplyContextMappingMissingNotRequired(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->never()) ->method('getContextValue'); @@ -412,7 +412,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingNoValueRequired() { + public function testApplyContextMappingNoValueRequired(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->never()) ->method('getContextValue'); @@ -447,7 +447,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingNoValueNonRequired() { + public function testApplyContextMappingNoValueNonRequired(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->never()) ->method('getContextValue'); @@ -480,7 +480,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingConfigurableAssigned() { + public function testApplyContextMappingConfigurableAssigned(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->atLeastOnce()) ->method('hasContextValue') @@ -519,7 +519,7 @@ class ContextHandlerTest extends UnitTestCase { /** * @covers ::applyContextMapping */ - public function testApplyContextMappingConfigurableAssignedMiss() { + public function testApplyContextMappingConfigurableAssignedMiss(): void { $context = $this->createMock('Drupal\Core\Plugin\Context\ContextInterface'); $context->expects($this->never()) ->method('getContextValue'); diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php index a4b9e379caa..f957384a702 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php @@ -27,7 +27,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::has */ - public function testHas() { + public function testHas(): void { $this->setupPluginCollection(); $definitions = $this->getPluginDefinitions(); @@ -41,7 +41,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $this->setupPluginCollection($this->once()); $apple = $this->pluginInstances['apple']; @@ -51,7 +51,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::get */ - public function testGetNotExistingPlugin() { + public function testGetNotExistingPlugin(): void { $this->setupPluginCollection(); $this->expectException(PluginNotFoundException::class); $this->expectExceptionMessage("Plugin ID 'pear' was not found."); @@ -84,7 +84,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { * @covers ::sortHelper * @dataProvider providerTestSortHelper */ - public function testSortHelper($plugin_id_1, $plugin_id_2, $expected) { + public function testSortHelper($plugin_id_1, $plugin_id_2, $expected): void { $this->setupPluginCollection($this->any()); if ($expected != 0) { $expected = $expected > 0 ? 1 : -1; @@ -95,7 +95,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::getConfiguration */ - public function testGetConfiguration() { + public function testGetConfiguration(): void { $this->setupPluginCollection($this->exactly(3)); // The expected order matches $this->config. $expected = ['banana', 'cherry', 'apple']; @@ -118,7 +118,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::addInstanceId */ - public function testAddInstanceId() { + public function testAddInstanceId(): void { $this->setupPluginCollection($this->exactly(4)); $expected = [ 'banana' => 'banana', @@ -146,7 +146,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::removeInstanceId */ - public function testRemoveInstanceId() { + public function testRemoveInstanceId(): void { $this->setupPluginCollection($this->exactly(2)); $this->defaultPluginCollection->removeInstanceId('cherry'); $config = $this->defaultPluginCollection->getConfiguration(); @@ -156,7 +156,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::setInstanceConfiguration */ - public function testSetInstanceConfiguration() { + public function testSetInstanceConfiguration(): void { $this->setupPluginCollection($this->exactly(3)); $expected = [ 'id' => 'cherry', @@ -173,7 +173,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { * * @covers ::setInstanceConfiguration */ - public function testSetInstanceConfigurationPluginChange() { + public function testSetInstanceConfigurationPluginChange(): void { $configurable_plugin = $this->prophesize(ConfigurableInterface::class); $configurable_config = ['id' => 'configurable', 'foo' => 'bar']; $configurable_plugin->getConfiguration()->willReturn($configurable_config); @@ -202,7 +202,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::count */ - public function testCount() { + public function testCount(): void { $this->setupPluginCollection(); $this->assertCount(3, $this->defaultPluginCollection); } @@ -210,7 +210,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::clear */ - public function testClear() { + public function testClear(): void { $this->setupPluginCollection($this->exactly(6)); $this->defaultPluginCollection->getConfiguration(); $this->defaultPluginCollection->getConfiguration(); @@ -221,7 +221,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::set */ - public function testSet() { + public function testSet(): void { $this->setupPluginCollection($this->exactly(4)); $instance = $this->pluginManager->createInstance('cherry', $this->config['cherry']); $this->defaultPluginCollection->set('cherry2', $instance); @@ -247,7 +247,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::getConfiguration */ - public function testConfigurableGetConfiguration() { + public function testConfigurableGetConfiguration(): void { $this->setupPluginCollection($this->exactly(3)); $config = $this->defaultPluginCollection->getConfiguration(); $this->assertSame($this->config, $config); @@ -256,7 +256,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { /** * @covers ::setConfiguration */ - public function testConfigurableSetConfiguration() { + public function testConfigurableSetConfiguration(): void { $this->setupPluginCollection($this->exactly(2)); $this->defaultPluginCollection->setConfiguration(['apple' => ['value' => 'pineapple', 'id' => 'apple']]); @@ -279,7 +279,7 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase { * * @covers ::getConfiguration */ - public function testConfigurableInterface() { + public function testConfigurableInterface(): void { $configurable_plugin = $this->prophesize(ConfigurableInterface::class); $configurable_config = ['id' => 'configurable', 'foo' => 'bar']; $configurable_plugin->getConfiguration()->willReturn($configurable_config); diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index 5a03eb56c9c..0a7f41cc03a 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -70,7 +70,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with a plugin that extends a non-installed class. */ - public function testDefaultPluginManagerWithPluginExtendingNonInstalledClass() { + public function testDefaultPluginManagerWithPluginExtendingNonInstalledClass(): void { $definitions = []; $definitions['extending_non_installed_class'] = [ 'id' => 'extending_non_installed_class', @@ -89,7 +89,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with a disabled module. */ - public function testDefaultPluginManagerWithDisabledModule() { + public function testDefaultPluginManagerWithDisabledModule(): void { $definitions = $this->expectedDefinitions; $definitions['cherry'] = [ 'id' => 'cherry', @@ -114,7 +114,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager and object plugin definitions. */ - public function testDefaultPluginManagerWithObjects() { + public function testDefaultPluginManagerWithObjects(): void { $definitions = $this->expectedDefinitions; $definitions['cherry'] = (object) [ 'id' => 'cherry', @@ -139,7 +139,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager behavior for a missing plugin ID. */ - public function testGetDefinitionPluginNotFoundException() { + public function testGetDefinitionPluginNotFoundException(): void { $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); $this->expectException(PluginNotFoundException::class); @@ -150,7 +150,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with no cache and altering. */ - public function testDefaultPluginManager() { + public function testDefaultPluginManager(): void { $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface'); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); @@ -159,7 +159,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with no cache and altering. */ - public function testDefaultPluginManagerWithAlter() { + public function testDefaultPluginManagerWithAlter(): void { $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler') ->disableOriginalConstructor() ->getMock(); @@ -179,7 +179,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with caching and altering. */ - public function testDefaultPluginManagerWithEmptyCache() { + public function testDefaultPluginManagerWithEmptyCache(): void { $cid = $this->randomMachineName(); $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend') ->disableOriginalConstructor() @@ -204,7 +204,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with caching and altering. */ - public function testDefaultPluginManagerWithFilledCache() { + public function testDefaultPluginManagerWithFilledCache(): void { $cid = $this->randomMachineName(); $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend') ->disableOriginalConstructor() @@ -227,7 +227,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager with caching disabled. */ - public function testDefaultPluginManagerNoCache() { + public function testDefaultPluginManagerNoCache(): void { $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface'); $cid = $this->randomMachineName(); @@ -251,7 +251,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * Tests the plugin manager cache clear with tags. */ - public function testCacheClearWithTags() { + public function testCacheClearWithTags(): void { $cid = $this->randomMachineName(); $cache_backend = $this->createMock('Drupal\Core\Cache\CacheBackendInterface'); $cache_tags_invalidator = $this->createMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface'); @@ -276,7 +276,7 @@ class DefaultPluginManagerTest extends UnitTestCase { * * @covers ::createInstance */ - public function testCreateInstanceWithJustValidInterfaces() { + public function testCreateInstanceWithJustValidInterfaces(): void { $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface'); foreach ($this->expectedDefinitions as $plugin_id => $definition) { @@ -289,7 +289,7 @@ class DefaultPluginManagerTest extends UnitTestCase { * * @covers ::createInstance */ - public function testCreateInstanceWithInvalidInterfaces() { + public function testCreateInstanceWithInvalidInterfaces(): void { $module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'); $module_handler->expects($this->any()) @@ -318,7 +318,7 @@ class DefaultPluginManagerTest extends UnitTestCase { * * @covers ::getDefinitions */ - public function testGetDefinitionsWithoutRequiredInterface() { + public function testGetDefinitionsWithoutRequiredInterface(): void { $module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'); $module_handler->expects($this->any()) @@ -343,7 +343,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * @covers ::getCacheContexts */ - public function testGetCacheContexts() { + public function testGetCacheContexts(): void { $module_handler = $this->prophesize(ModuleHandlerInterface::class); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, $module_handler->reveal(), NULL); $cache_contexts = $plugin_manager->getCacheContexts(); @@ -356,7 +356,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * @covers ::getCacheTags */ - public function testGetCacheTags() { + public function testGetCacheTags(): void { $module_handler = $this->prophesize(ModuleHandlerInterface::class); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, $module_handler->reveal(), NULL); $cache_tags = $plugin_manager->getCacheTags(); @@ -369,7 +369,7 @@ class DefaultPluginManagerTest extends UnitTestCase { /** * @covers ::getCacheMaxAge */ - public function testGetCacheMaxAge() { + public function testGetCacheMaxAge(): void { $module_handler = $this->prophesize(ModuleHandlerInterface::class); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, $module_handler->reveal(), NULL); $cache_max_age = $plugin_manager->getCacheMaxAge(); @@ -380,7 +380,7 @@ class DefaultPluginManagerTest extends UnitTestCase { * @covers ::findDefinitions * @covers ::extractProviderFromDefinition */ - public function testProviderExists() { + public function testProviderExists(): void { $definitions = []; $definitions['array_based_found'] = ['provider' => 'module_found']; $definitions['array_based_missing'] = ['provider' => 'module_missing']; @@ -406,7 +406,7 @@ class DefaultPluginManagerTest extends UnitTestCase { * @covers ::processDefinition * @dataProvider providerTestProcessDefinition */ - public function testProcessDefinition($definition, $expected) { + public function testProcessDefinition($definition, $expected): void { $module_handler = $this->prophesize(ModuleHandlerInterface::class); $plugin_manager = new TestPluginManagerWithDefaults($this->namespaces, $this->expectedDefinitions, $module_handler->reveal(), NULL); diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php index 43ccb8fd864..c428a9c78db 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php @@ -36,7 +36,7 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase /** * Tests the get() method. */ - public function testGet() { + public function testGet(): void { $this->setupPluginCollection($this->once()); $apple = $this->pluginInstances['apple']; @@ -48,7 +48,7 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase * @covers ::getConfiguration * @covers ::setConfiguration */ - public function testAddInstanceId() { + public function testAddInstanceId(): void { $this->setupPluginCollection($this->any()); $this->assertEquals(['id' => 'apple', 'key' => 'value'], $this->defaultPluginCollection->get('apple')->getConfiguration()); @@ -64,7 +64,7 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase /** * @covers ::getInstanceIds */ - public function testGetInstanceIds() { + public function testGetInstanceIds(): void { $this->setupPluginCollection($this->any()); $this->assertEquals(['apple' => 'apple'], $this->defaultPluginCollection->getInstanceIds()); @@ -75,7 +75,7 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase /** * @covers ::setConfiguration */ - public function testConfigurableSetConfiguration() { + public function testConfigurableSetConfiguration(): void { $this->setupPluginCollection($this->any()); $this->defaultPluginCollection->setConfiguration(['apple' => ['value' => 'pineapple', 'id' => 'apple']]); diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php index b1bebdd43ad..14c56887280 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php @@ -16,7 +16,7 @@ class ContainerDerivativeDiscoveryDecoratorTest extends UnitTestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $example_service = $this->createMock('Symfony\Contracts\EventDispatcher\EventDispatcherInterface'); $example_container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') ->onlyMethods(['get']) diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php index 2e3fd33f05a..e82f496b3ac 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php @@ -39,7 +39,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { * * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher() */ - public function testGetDerivativeFetcher() { + public function testGetDerivativeFetcher(): void { $definitions = []; $definitions['non_container_aware_discovery'] = [ 'id' => 'non_container_aware_discovery', @@ -65,7 +65,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { /** * Tests the getDerivativeFetcher method with objects instead of arrays. */ - public function testGetDerivativeFetcherWithAnnotationObjects() { + public function testGetDerivativeFetcherWithAnnotationObjects(): void { $definitions = []; $definitions['non_container_aware_discovery'] = (object) [ 'id' => 'non_container_aware_discovery', @@ -95,7 +95,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { * * @covers ::getDeriverClass */ - public function testGetDeriverClassWithClassedDefinitions() { + public function testGetDeriverClassWithClassedDefinitions(): void { $definitions = []; $definition = $this->prophesize(DerivablePluginDefinitionInterface::class); $definition->id()->willReturn('non_container_aware_discovery'); @@ -117,7 +117,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { /** * @covers ::getDeriverClass */ - public function testGetDeriverClassWithInvalidClassedDefinitions() { + public function testGetDeriverClassWithInvalidClassedDefinitions(): void { $definition = $this->prophesize(DerivablePluginDefinitionInterface::class); $definition->id()->willReturn('non_existent_discovery'); $definition->getDeriver()->willReturn('\Drupal\system\Tests\Plugin\NonExistentDeriver'); @@ -140,7 +140,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { * * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\ */ - public function testNonExistentDerivativeFetcher() { + public function testNonExistentDerivativeFetcher(): void { $definitions = []; // Do this with a class that doesn't exist. $definitions['non_existent_discovery'] = [ @@ -162,7 +162,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { * * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\ */ - public function testInvalidDerivativeFetcher() { + public function testInvalidDerivativeFetcher(): void { $definitions = []; // Do this with a class that doesn't implement the interface. $definitions['invalid_discovery'] = [ @@ -182,7 +182,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { /** * Tests derivative definitions when a definition already exists. */ - public function testExistingDerivative() { + public function testExistingDerivative(): void { $definitions = []; $definitions['non_container_aware_discovery'] = [ 'id' => 'non_container_aware_discovery', @@ -222,7 +222,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase { /** * Tests a single definition when a derivative already exists. */ - public function testSingleExistingDerivative() { + public function testSingleExistingDerivative(): void { $base_definition = [ 'id' => 'non_container_aware_discovery', 'deriver' => '\Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery', diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php index f5020d85706..8b60c5215a5 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php @@ -43,7 +43,7 @@ class HookDiscoveryTest extends UnitTestCase { * * @see \Drupal\Core\Plugin\Discovery::getDefinitions() */ - public function testGetDefinitionsWithoutPlugins() { + public function testGetDefinitionsWithoutPlugins(): void { $this->assertCount(0, $this->hookDiscovery->getDefinitions()); } @@ -52,7 +52,7 @@ class HookDiscoveryTest extends UnitTestCase { * * @see \Drupal\Core\Plugin\Discovery::getDefinitions() */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $this->moduleHandler->expects($this->atLeastOnce()) ->method('invokeAllWith') ->with('test_plugin') @@ -81,7 +81,7 @@ class HookDiscoveryTest extends UnitTestCase { * * @see \Drupal\Core\Plugin\Discovery::getDefinition() */ - public function testGetDefinition() { + public function testGetDefinition(): void { $this->moduleHandler->expects($this->exactly(4)) ->method('invokeAllWith') ->with('test_plugin') @@ -110,7 +110,7 @@ class HookDiscoveryTest extends UnitTestCase { * * @see \Drupal\Core\Plugin\Discovery::getDefinition() */ - public function testGetDefinitionWithUnknownID() { + public function testGetDefinitionWithUnknownID(): void { $this->expectException(PluginNotFoundException::class); $this->hookDiscovery->getDefinition('test_non_existent', TRUE); } diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDirectoryDiscoveryTest.php index 8f5d9dad20a..8b8b1c7c919 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDirectoryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDirectoryDiscoveryTest.php @@ -20,7 +20,7 @@ class YamlDirectoryDiscoveryTest extends UnitTestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { vfsStream::setup('modules', NULL, [ 'module_a' => [ 'subdir1' => [ @@ -68,7 +68,7 @@ class YamlDirectoryDiscoveryTest extends UnitTestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitionsWithTranslatableDefinitions() { + public function testGetDefinitionsWithTranslatableDefinitions(): void { vfsStream::setup('modules', NULL, [ 'module_a' => [ 'subdir1' => [ diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php index 634979c8d51..cac65e81d82 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryDecoratorTest.php @@ -72,7 +72,7 @@ class YamlDiscoveryDecoratorTest extends UnitTestCase { /** * Tests the getDefinitions() method. */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $definitions = $this->discoveryDecorator->getDefinitions(); $this->assertIsArray($definitions); diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php index fe41eb82a23..6ed2aca673b 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php @@ -53,7 +53,7 @@ class YamlDiscoveryTest extends UnitTestCase { /** * Tests the getDefinitions() method. */ - public function testGetDefinitions() { + public function testGetDefinitions(): void { $definitions = $this->discovery->getDefinitions(); $this->assertIsArray($definitions); @@ -75,7 +75,7 @@ class YamlDiscoveryTest extends UnitTestCase { /** * @covers ::getDefinitions */ - public function testGetDefinitionsWithTranslatableDefinitions() { + public function testGetDefinitionsWithTranslatableDefinitions(): void { vfsStream::setup('root'); $file_1 = <<<'EOS' @@ -113,7 +113,7 @@ EOS; /** * Tests the getDefinition() method. */ - public function testGetDefinition() { + public function testGetDefinition(): void { $definitions = $this->discovery->getDefinitions(); // Test the getDefinition() method. foreach ($this->expectedKeys as $expected_key) { diff --git a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php index 15896ffb7ca..93a4e1942e8 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php @@ -22,7 +22,7 @@ class FilteredPluginManagerTraitTest extends UnitTestCase { * @covers ::getFilteredDefinitions * @dataProvider providerTestGetFilteredDefinitions */ - public function testGetFilteredDefinitions($contexts, $expected) { + public function testGetFilteredDefinitions($contexts, $expected): void { // Start with two plugins. $definitions = []; $definitions['plugin1'] = ['id' => 'plugin1']; diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php index 0befb6181f4..ac07454f576 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php @@ -26,7 +26,7 @@ class PluginDependencyTraitTest extends UnitTestCase { * * @dataProvider providerTestPluginDependencies */ - public function testGetPluginDependencies(ProphecyInterface $plugin, $definition, array $expected) { + public function testGetPluginDependencies(ProphecyInterface $plugin, $definition, array $expected): void { $test_class = new TestPluginDependency(); $module_handler = $this->prophesize(ModuleHandlerInterface::class); @@ -58,7 +58,7 @@ class PluginDependencyTraitTest extends UnitTestCase { * @param array $expected * The expected dependencies. */ - public function testCalculatePluginDependencies(ProphecyInterface $plugin, $definition, array $expected) { + public function testCalculatePluginDependencies(ProphecyInterface $plugin, $definition, array $expected): void { $test_class = new TestPluginDependency(); $module_handler = $this->prophesize(ModuleHandlerInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php index cc1da0d5809..b987a2bdafb 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php @@ -46,7 +46,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstance() { + public function testCreateInstance(): void { $plugin_form = $this->prophesize(PluginFormInterface::class); $expected = $plugin_form->reveal(); @@ -63,7 +63,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstanceUsingPlugin() { + public function testCreateInstanceUsingPlugin(): void { $this->classResolver->getInstanceFromDefinition(Argument::cetera())->shouldNotBeCalled(); $plugin = $this->prophesize(PluginWithFormsInterface::class)->willImplement(PluginFormInterface::class); @@ -77,7 +77,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstanceUsingPluginWithSlashes() { + public function testCreateInstanceUsingPluginWithSlashes(): void { $this->classResolver->getInstanceFromDefinition(Argument::cetera())->shouldNotBeCalled(); $plugin = $this->prophesize(PluginWithFormsInterface::class)->willImplement(PluginFormInterface::class); @@ -91,7 +91,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstanceDefaultFallback() { + public function testCreateInstanceDefaultFallback(): void { $this->classResolver->getInstanceFromDefinition(Argument::cetera())->shouldNotBeCalled(); $plugin = $this->prophesize(PluginWithFormsInterface::class)->willImplement(PluginFormInterface::class); @@ -106,7 +106,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstancePluginAware() { + public function testCreateInstancePluginAware(): void { $plugin_form = $this->prophesize(PluginFormInterface::class)->willImplement(PluginAwareInterface::class); $expected = $plugin_form->reveal(); @@ -126,7 +126,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstanceDefinitionException() { + public function testCreateInstanceDefinitionException(): void { $this->expectException(InvalidPluginDefinitionException::class); $this->expectExceptionMessage('The "the_plugin_id" plugin did not specify a "anything" form class'); @@ -141,7 +141,7 @@ class PluginFormFactoryTest extends UnitTestCase { /** * @covers ::createInstance */ - public function testCreateInstanceInvalidException() { + public function testCreateInstanceInvalidException(): void { $this->expectException(InvalidPluginDefinitionException::class); $this->expectExceptionMessage('The "the_plugin_id" plugin did not specify a valid "invalid" form class, must implement \Drupal\Core\Plugin\PluginFormInterface'); diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php index 46ede2cb185..459d26de709 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php @@ -22,7 +22,7 @@ class PluginWithFormsTraitTest extends UnitTestCase { * @covers ::hasFormClass * @dataProvider providerGetFormClass */ - public function testGetFormClass(PluginWithFormsInterface $block_plugin, $operation, $expected_class) { + public function testGetFormClass(PluginWithFormsInterface $block_plugin, $operation, $expected_class): void { $this->assertSame($expected_class, $block_plugin->getFormClass($operation)); $this->assertSame($expected_class !== NULL, $block_plugin->hasFormClass($operation)); } diff --git a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php index 7a0c86f02e4..c78304372c6 100644 --- a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php +++ b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php @@ -51,7 +51,7 @@ class PrivateKeyTest extends UnitTestCase { /** * Tests PrivateKey::get(). */ - public function testGet() { + public function testGet(): void { $this->state->expects($this->once()) ->method('get') ->with('system.private_key') @@ -63,14 +63,14 @@ class PrivateKeyTest extends UnitTestCase { /** * Tests PrivateKey::get() with no private key from state. */ - public function testGetNoState() { + public function testGetNoState(): void { $this->assertIsString($this->privateKey->get()); } /** * Tests PrivateKey::setPrivateKey(). */ - public function testSet() { + public function testSet(): void { $random_name = $this->randomMachineName(); $this->state->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php index 8f2c03d76d7..b3d291118b2 100644 --- a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php @@ -34,7 +34,7 @@ class ProxyBuilderTest extends UnitTestCase { * @covers ::buildParameter * @covers ::buildMethodBody */ - public function testBuildComplexMethod() { + public function testBuildComplexMethod(): void { $class = 'Drupal\Tests\Core\ProxyBuilder\TestServiceComplexMethod'; $result = $this->proxyBuilder->build($class); diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 2e25d3e54ca..2307b355e7b 100644 --- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -35,7 +35,7 @@ class BubbleableMetadataTest extends UnitTestCase { * @covers ::merge * @dataProvider providerTestMerge */ - public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, BubbleableMetadata $expected) { + public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, BubbleableMetadata $expected): void { // Verify that if the second operand is a CacheableMetadata object, not a // BubbleableMetadata object, that BubbleableMetadata::merge() doesn't // attempt to merge assets. @@ -113,7 +113,7 @@ class BubbleableMetadataTest extends UnitTestCase { * @covers ::setAttachments * @dataProvider providerTestAddAttachments */ - public function testAddAttachments(BubbleableMetadata $initial, $attachments, BubbleableMetadata $expected) { + public function testAddAttachments(BubbleableMetadata $initial, $attachments, BubbleableMetadata $expected): void { $test = $initial; $test->addAttachments($attachments); $this->assertEquals($expected, $test); @@ -134,7 +134,7 @@ class BubbleableMetadataTest extends UnitTestCase { * @covers ::applyTo * @dataProvider providerTestApplyTo */ - public function testApplyTo(BubbleableMetadata $metadata, array $render_array, array $expected) { + public function testApplyTo(BubbleableMetadata $metadata, array $render_array, array $expected): void { $this->assertNull($metadata->applyTo($render_array)); $this->assertEquals($expected, $render_array); } @@ -199,7 +199,7 @@ class BubbleableMetadataTest extends UnitTestCase { * @covers ::createFromRenderArray * @dataProvider providerTestCreateFromRenderArray */ - public function testCreateFromRenderArray(array $render_array, BubbleableMetadata $expected) { + public function testCreateFromRenderArray(array $render_array, BubbleableMetadata $expected): void { $this->assertEquals($expected, BubbleableMetadata::createFromRenderArray($render_array)); } @@ -242,7 +242,7 @@ class BubbleableMetadataTest extends UnitTestCase { * * @covers ::mergeAttachments */ - public function testMergeAttachmentsLibraryMerging() { + public function testMergeAttachmentsLibraryMerging(): void { $a['#attached'] = [ 'library' => [ 'core/drupal', @@ -393,7 +393,7 @@ class BubbleableMetadataTest extends UnitTestCase { * * @dataProvider providerTestMergeAttachmentsHtmlHeadMerging */ - public function testMergeAttachmentsHtmlHeadMerging($a, $b, $expected) { + public function testMergeAttachmentsHtmlHeadMerging($a, $b, $expected): void { $this->assertSame($expected, BubbleableMetadata::mergeAttachments($a, $b)); } @@ -466,7 +466,7 @@ class BubbleableMetadataTest extends UnitTestCase { * * @dataProvider providerTestMergeAttachmentsHtmlHeadLinkMerging */ - public function testMergeAttachmentsHtmlHeadLinkMerging($a, $b, $expected) { + public function testMergeAttachmentsHtmlHeadLinkMerging($a, $b, $expected): void { $this->assertSame($expected, BubbleableMetadata::mergeAttachments($a, $b)); } @@ -532,7 +532,7 @@ class BubbleableMetadataTest extends UnitTestCase { * * @dataProvider providerTestMergeAttachmentsHttpHeaderMerging */ - public function testMergeAttachmentsHttpHeaderMerging($a, $b, $expected) { + public function testMergeAttachmentsHttpHeaderMerging($a, $b, $expected): void { $this->assertSame($expected, BubbleableMetadata::mergeAttachments($a, $b)); } @@ -598,7 +598,7 @@ class BubbleableMetadataTest extends UnitTestCase { * @covers ::addCacheableDependency * @dataProvider providerTestMerge */ - public function testAddCacheableDependency(BubbleableMetadata $a, $b, BubbleableMetadata $expected) { + public function testAddCacheableDependency(BubbleableMetadata $a, $b, BubbleableMetadata $expected): void { $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php index 104f0fec140..d0c09e97fc5 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php @@ -17,7 +17,7 @@ class HtmlTagTest extends RendererTestBase { /** * @covers ::getInfo */ - public function testGetInfo() { + public function testGetInfo(): void { $htmlTag = new HtmlTag([], 'test', 'test'); $info = $htmlTag->getInfo(); $this->assertArrayHasKey('#pre_render', $info); @@ -29,7 +29,7 @@ class HtmlTagTest extends RendererTestBase { * @covers ::preRenderHtmlTag * @dataProvider providerPreRenderHtmlTag */ - public function testPreRenderHtmlTag($element, $expected) { + public function testPreRenderHtmlTag($element, $expected): void { $result = HtmlTag::preRenderHtmlTag($element); foreach ($result as &$child) { if (is_array($child) && isset($child['#tag'])) { diff --git a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php index 1361a55ee1d..32acfc71540 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php @@ -25,7 +25,7 @@ class MachineNameTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $input) { + public function testValueCallback($expected, $input): void { $element = []; $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, MachineName::valueCallback($element, $input, $form_state)); @@ -48,7 +48,7 @@ class MachineNameTest extends UnitTestCase { /** * @covers ::processMachineName */ - public function testProcessMachineName() { + public function testProcessMachineName(): void { $form_state = new FormState(); $element = [ diff --git a/core/tests/Drupal/Tests/Core/Render/Element/PasswordConfirmTest.php b/core/tests/Drupal/Tests/Core/Render/Element/PasswordConfirmTest.php index 1862a3a343e..d1e20b098f7 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/PasswordConfirmTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/PasswordConfirmTest.php @@ -19,7 +19,7 @@ class PasswordConfirmTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $element, $input) { + public function testValueCallback($expected, $element, $input): void { $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, PasswordConfirm::valueCallback($element, $input, $form_state)); } diff --git a/core/tests/Drupal/Tests/Core/Render/Element/PasswordTest.php b/core/tests/Drupal/Tests/Core/Render/Element/PasswordTest.php index 9085722c3ec..32bd56d52d1 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/PasswordTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/PasswordTest.php @@ -19,7 +19,7 @@ class PasswordTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $input) { + public function testValueCallback($expected, $input): void { $element = []; $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, Password::valueCallback($element, $input, $form_state)); diff --git a/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php b/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php index 4e9a0667398..7c078c61d5a 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/RenderElementTest.php @@ -47,7 +47,7 @@ class RenderElementTest extends UnitTestCase { /** * @covers ::preRenderAjaxForm */ - public function testPreRenderAjaxForm() { + public function testPreRenderAjaxForm(): void { $request = Request::create('/test'); $request->query->set('foo', 'bar'); $this->requestStack->push($request); @@ -78,7 +78,7 @@ class RenderElementTest extends UnitTestCase { /** * @covers ::preRenderAjaxForm */ - public function testPreRenderAjaxFormWithQueryOptions() { + public function testPreRenderAjaxFormWithQueryOptions(): void { $request = Request::create('/test'); $request->query->set('foo', 'bar'); $this->requestStack->push($request); diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php index 95d7bcb952c..fc58c1db4ef 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php @@ -20,7 +20,7 @@ class TableSelectTest extends UnitTestCase { /** * @covers ::processTableselect */ - public function testProcessTableselectWithLinkTitle() { + public function testProcessTableselectWithLinkTitle(): void { $element = []; $form_state = new FormState(); $complete_form = []; @@ -45,7 +45,7 @@ class TableSelectTest extends UnitTestCase { /** * @covers ::processTableselect */ - public function testProcessTableselectWithStringTitle() { + public function testProcessTableselectWithStringTitle(): void { $element = []; $form_state = new FormState(); $complete_form = []; diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php index e66a2819a40..f2b971eab60 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php @@ -19,7 +19,7 @@ class TextareaTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $input) { + public function testValueCallback($expected, $input): void { $element = []; $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, Textarea::valueCallback($element, $input, $form_state)); diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php index 5ec874b2d92..2459a87092c 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php @@ -19,7 +19,7 @@ class TextfieldTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $input) { + public function testValueCallback($expected, $input): void { $element = []; $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, Textfield::valueCallback($element, $input, $form_state)); diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php index 40f1bea21ab..25dc5263160 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php @@ -19,7 +19,7 @@ class TokenTest extends UnitTestCase { * * @dataProvider providerTestValueCallback */ - public function testValueCallback($expected, $input) { + public function testValueCallback($expected, $input): void { $element = []; $form_state = $this->prophesize(FormStateInterface::class)->reveal(); $this->assertSame($expected, Token::valueCallback($element, $input, $form_state)); diff --git a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php index 601b2a43bc9..a9ede9f13c8 100644 --- a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php @@ -74,7 +74,7 @@ class ElementInfoManagerTest extends UnitTestCase { * * @dataProvider providerTestGetInfoElementPlugin */ - public function testGetInfoElementPlugin($plugin_class, $expected_info) { + public function testGetInfoElementPlugin($plugin_class, $expected_info): void { $this->moduleHandler->expects($this->once()) ->method('alter') ->with('element_info', $this->anything()) @@ -141,7 +141,7 @@ class ElementInfoManagerTest extends UnitTestCase { /** * @covers ::getInfoProperty */ - public function testGetInfoProperty() { + public function testGetInfoProperty(): void { $this->themeManager ->method('getActiveTheme') ->willReturn(new ActiveTheme(['name' => 'test'])); diff --git a/core/tests/Drupal/Tests/Core/Render/ElementTest.php b/core/tests/Drupal/Tests/Core/Render/ElementTest.php index 709793dff07..fd71a85a59d 100644 --- a/core/tests/Drupal/Tests/Core/Render/ElementTest.php +++ b/core/tests/Drupal/Tests/Core/Render/ElementTest.php @@ -17,7 +17,7 @@ class ElementTest extends UnitTestCase { /** * Tests the property() method. */ - public function testProperty() { + public function testProperty(): void { $this->assertTrue(Element::property('#property')); $this->assertFalse(Element::property('property')); $this->assertFalse(Element::property('property#')); @@ -27,7 +27,7 @@ class ElementTest extends UnitTestCase { /** * Tests the properties() method. */ - public function testProperties() { + public function testProperties(): void { $element = [ '#property1' => 'property1', '#property2' => 'property2', @@ -43,7 +43,7 @@ class ElementTest extends UnitTestCase { /** * Tests the child() method. */ - public function testChild() { + public function testChild(): void { $this->assertFalse(Element::child('#property')); $this->assertTrue(Element::child('property')); $this->assertTrue(Element::child('property#')); @@ -52,7 +52,7 @@ class ElementTest extends UnitTestCase { /** * Tests the children() method. */ - public function testChildren() { + public function testChildren(): void { $element = [ 'child2' => ['#weight' => 10], 'child1' => ['#weight' => 0], @@ -104,7 +104,7 @@ class ElementTest extends UnitTestCase { /** * Tests the children() method with an invalid key. */ - public function testInvalidChildren() { + public function testInvalidChildren(): void { $element = [ 'foo' => 'bar', ]; @@ -116,7 +116,7 @@ class ElementTest extends UnitTestCase { /** * Tests the children() method with an ignored key/value pair. */ - public function testIgnoredChildren() { + public function testIgnoredChildren(): void { $element = [ 'foo' => NULL, ]; @@ -133,7 +133,7 @@ class ElementTest extends UnitTestCase { * * @dataProvider providerVisibleChildren */ - public function testVisibleChildren(array $element, array $expected_keys) { + public function testVisibleChildren(array $element, array $expected_keys): void { $this->assertSame($expected_keys, Element::getVisibleChildren($element)); } @@ -161,7 +161,7 @@ class ElementTest extends UnitTestCase { * * @dataProvider providerTestSetAttributes */ - public function testSetAttributes($element, $map, $expected_element) { + public function testSetAttributes($element, $map, $expected_element): void { Element::setAttributes($element, $map); $this->assertSame($expected_element, $element); } @@ -183,7 +183,7 @@ class ElementTest extends UnitTestCase { * * @dataProvider providerTestIsEmpty */ - public function testIsEmpty(array $element, $expected) { + public function testIsEmpty(array $element, $expected): void { $this->assertSame(Element::isEmpty($element), $expected); } @@ -229,7 +229,7 @@ class ElementTest extends UnitTestCase { * @covers ::isRenderArray * @dataProvider dataProviderIsRenderArray */ - public function testIsRenderArray($build, $expected) { + public function testIsRenderArray($build, $expected): void { $this->assertSame( $expected, Element::isRenderArray($build) diff --git a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php index 2c54d6146bc..64e0d242318 100644 --- a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php @@ -52,7 +52,7 @@ class MetadataBubblingUrlGeneratorTest extends UrlGeneratorTest { * * @dataProvider providerUrlBubbleableMetadataBubbling */ - public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, $invocations, array $options) { + public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, $invocations, array $options): void { $self = $this; $this->renderer->expects($this->exactly($invocations)) diff --git a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php index 3d9282d60e6..34e2f44b88d 100644 --- a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php @@ -20,7 +20,7 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase { * * @dataProvider providerProcessPlaceholders */ - public function testProcessPlaceholders($strategies, $placeholders, $result) { + public function testProcessPlaceholders($strategies, $placeholders, $result): void { $chained_placeholder_strategy = new ChainedPlaceholderStrategy(); foreach ($strategies as $strategy) { @@ -125,7 +125,7 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase { /** * @covers ::processPlaceholders */ - public function testProcessPlaceholdersNoStrategies() { + public function testProcessPlaceholdersNoStrategies(): void { // Placeholders but no strategies defined. $placeholders = [ 'assert-me' => ['#markup' => 'I-am-a-llama-that-will-lead-to-an-assertion-by-the-chained-placeholder-strategy.'], @@ -140,7 +140,7 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase { /** * @covers ::processPlaceholders */ - public function testProcessPlaceholdersWithRoguePlaceholderStrategy() { + public function testProcessPlaceholdersWithRoguePlaceholderStrategy(): void { // Placeholders but no strategies defined. $placeholders = [ 'assert-me' => ['#markup' => 'llama'], diff --git a/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php index def952bb9de..065cdc6d15a 100644 --- a/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php @@ -32,7 +32,7 @@ class PlaceholderGeneratorTest extends RendererTestBase { * @covers ::createPlaceholder * @dataProvider providerCreatePlaceholderGeneratesValidHtmlMarkup */ - public function testCreatePlaceholderGeneratesValidHtmlMarkup(array $element) { + public function testCreatePlaceholderGeneratesValidHtmlMarkup(array $element): void { $build = $this->placeholderGenerator->createPlaceholder($element); $original_placeholder_markup = (string) $build['#markup']; @@ -49,7 +49,7 @@ class PlaceholderGeneratorTest extends RendererTestBase { * * @covers ::createPlaceholder */ - public function testRenderPlaceholdersDifferentSortedContextsTags() { + public function testRenderPlaceholdersDifferentSortedContextsTags(): void { $contexts_1 = ['user', 'foo']; $contexts_2 = ['foo', 'user']; $tags_1 = ['current-temperature', 'foo']; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index cc4088d3da2..52944069309 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -35,7 +35,7 @@ class RendererBubblingTest extends RendererTestBase { /** * Tests bubbling of assets when NOT using #pre_render callbacks. */ - public function testBubblingWithoutPreRender() { + public function testBubblingWithoutPreRender(): void { $this->setUpRequest(); $this->setUpMemoryCache(); @@ -79,7 +79,7 @@ class RendererBubblingTest extends RendererTestBase { /** * Tests cache context bubbling with a custom cache bin. */ - public function testContextBubblingCustomCacheBin() { + public function testContextBubblingCustomCacheBin(): void { $bin = $this->randomMachineName(); $this->setUpRequest(); @@ -135,7 +135,7 @@ class RendererBubblingTest extends RendererTestBase { * * @dataProvider providerTestContextBubblingEdgeCases */ - public function testContextBubblingEdgeCases(array $element, array $expected_top_level_contexts, $expected_cache_item) { + public function testContextBubblingEdgeCases(array $element, array $expected_top_level_contexts, $expected_cache_item): void { $this->setUpRequest(); $this->setUpMemoryCache(); $this->cacheContextsManager->expects($this->any()) @@ -314,7 +314,7 @@ class RendererBubblingTest extends RendererTestBase { * @todo Revisit now that we have self-healing tests for VariationCache. This * is essentially a clone of the other bubbling tests now. */ - public function testConditionalCacheContextBubblingSelfHealing() { + public function testConditionalCacheContextBubblingSelfHealing(): void { $current_user_role = &$this->currentUserRole; $this->setUpRequest(); @@ -445,7 +445,7 @@ class RendererBubblingTest extends RendererTestBase { * * @dataProvider providerTestBubblingWithPrerender */ - public function testBubblingWithPrerender($test_element) { + public function testBubblingWithPrerender($test_element): void { $this->setUpRequest(); $this->setUpMemoryCache(); @@ -529,7 +529,7 @@ class RendererBubblingTest extends RendererTestBase { /** * Tests that an element's cache keys cannot be changed during its rendering. */ - public function testOverWriteCacheKeys() { + public function testOverWriteCacheKeys(): void { $this->setUpRequest(); $this->setUpMemoryCache(); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererDebugTest.php b/core/tests/Drupal/Tests/Core/Render/RendererDebugTest.php index f8c506ac8bd..d365bae0d5e 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererDebugTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererDebugTest.php @@ -24,7 +24,7 @@ class RendererDebugTest extends RendererTestBase { /** * Test render debug output. */ - public function testDebugOutput() { + public function testDebugOutput(): void { $this->setUpRequest(); $this->setUpMemoryCache(); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index 4d8c52d82e6..874ae1350db 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -803,7 +803,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::doRender * @covers ::replacePlaceholders */ - public function testRecursivePlaceholder() { + public function testRecursivePlaceholder(): void { $args = [static::randomContextValue()]; $element = []; $element['#create_placeholder'] = TRUE; @@ -822,7 +822,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testInvalidLazyBuilder() { + public function testInvalidLazyBuilder(): void { $element = []; $element['#lazy_builder'] = '\Drupal\Tests\Core\Render\PlaceholdersTest::callback'; @@ -835,7 +835,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testInvalidLazyBuilderArguments() { + public function testInvalidLazyBuilderArguments(): void { $element = []; $element['#lazy_builder'] = ['\Drupal\Tests\Core\Render\PlaceholdersTest::callback', 'arg1', 'arg2']; @@ -850,7 +850,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * * @see testNonScalarLazyBuilderCallbackContext */ - public function testScalarLazyBuilderCallbackContext() { + public function testScalarLazyBuilderCallbackContext(): void { $element = []; $element['#lazy_builder'] = [ '\Drupal\Tests\Core\Render\PlaceholdersTest::callback', @@ -872,7 +872,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testNonScalarLazyBuilderCallbackContext() { + public function testNonScalarLazyBuilderCallbackContext(): void { $element = []; $element['#lazy_builder'] = [ '\Drupal\Tests\Core\Render\PlaceholdersTest::callback', @@ -896,7 +896,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testChildrenPlusBuilder() { + public function testChildrenPlusBuilder(): void { $element = []; $element['#lazy_builder'] = ['Drupal\Tests\Core\Render\RecursivePlaceholdersTest::callback', []]; $element['child_a']['#markup'] = 'Oh hai!'; @@ -911,7 +911,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testPropertiesPlusBuilder() { + public function testPropertiesPlusBuilder(): void { $element = []; $element['#lazy_builder'] = ['Drupal\Tests\Core\Render\RecursivePlaceholdersTest::callback', []]; $element['#llama'] = '#awesome'; @@ -926,7 +926,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testCreatePlaceholderPropertyWithoutLazyBuilder() { + public function testCreatePlaceholderPropertyWithoutLazyBuilder(): void { $element = []; $element['#create_placeholder'] = TRUE; @@ -958,7 +958,7 @@ class RendererPlaceholdersTest extends RendererTestBase { * @covers \Drupal\Core\Render\RenderCache::get * @covers ::replacePlaceholders */ - public function testRenderChildrenPlaceholdersDifferentArguments() { + public function testRenderChildrenPlaceholdersDifferentArguments(): void { $this->setUpRequest(); $this->setupMemoryCache(); $this->cacheContextsManager->expects($this->any()) @@ -1057,7 +1057,7 @@ HTML; * @covers \Drupal\Core\Render\RenderCache::get * @covers ::replacePlaceholders */ - public function testRenderLazyBuilderPreview() { + public function testRenderLazyBuilderPreview(): void { $this->setUpRequest(); $this->setupMemoryCache(); $this->renderCache = new TestPlaceholderingRenderCache($this->requestStack, $this->cacheFactory, $this->cacheContextsManager, $this->placeholderGenerator); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php index ba74ff893f3..98afe1484c8 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php @@ -34,7 +34,7 @@ class RendererRecursionTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderRecursionWithNestedRenderRoot() { + public function testRenderRecursionWithNestedRenderRoot(): void { [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); @@ -66,7 +66,7 @@ class RendererRecursionTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderRecursionWithNestedRender() { + public function testRenderRecursionWithNestedRender(): void { [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); @@ -100,7 +100,7 @@ class RendererRecursionTest extends RendererTestBase { * @covers ::renderRoot * @covers ::renderInIsolation */ - public function testRenderRecursionWithNestedRenderInIsolation() { + public function testRenderRecursionWithNestedRenderInIsolation(): void { [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index d14a083c177..bdbc2fa87d9 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -41,7 +41,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerTestRenderBasic */ - public function testRenderBasic($build, $expected, ?callable $setup_code = NULL) { + public function testRenderBasic($build, $expected, ?callable $setup_code = NULL): void { if (isset($setup_code)) { $setup_code = $setup_code->bindTo($this); $setup_code($this->themeManager); @@ -487,7 +487,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderSorting() { + public function testRenderSorting(): void { $first = $this->randomMachineName(); $second = $this->randomMachineName(); // Build an array with '#weight' set for each element. @@ -522,7 +522,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderSortingWithSetHashSorted() { + public function testRenderSortingWithSetHashSorted(): void { $first = $this->randomMachineName(); $second = $this->randomMachineName(); // The same array structure again, but with #sorted set to TRUE. @@ -549,7 +549,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerAccessValues */ - public function testRenderWithPresetAccess($access) { + public function testRenderWithPresetAccess($access): void { $build = [ '#access' => $access, ]; @@ -563,7 +563,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerAccessValues */ - public function testRenderWithAccessCallbackCallable($access) { + public function testRenderWithAccessCallbackCallable($access): void { $build = [ '#access_callback' => function () use ($access) { return $access; @@ -581,7 +581,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerAccessValues */ - public function testRenderWithAccessPropertyAndCallback($access) { + public function testRenderWithAccessPropertyAndCallback($access): void { $build = [ '#access' => $access, '#access_callback' => function () { @@ -598,7 +598,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerAccessValues */ - public function testRenderWithAccessControllerResolved($access) { + public function testRenderWithAccessControllerResolved($access): void { switch ($access) { case AccessResult::allowed(): @@ -629,7 +629,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderAccessCacheabilityDependencyInheritance() { + public function testRenderAccessCacheabilityDependencyInheritance(): void { $build = [ '#access' => AccessResult::allowed()->addCacheContexts(['user']), ]; @@ -651,7 +651,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerRenderTwice */ - public function testRenderTwice($build) { + public function testRenderTwice($build): void { $this->assertEquals('kittens', $this->renderer->renderRoot($build)); $this->assertEquals('kittens', $build['#markup']); $this->assertEquals(['kittens-147'], $build['#cache']['tags']); @@ -703,7 +703,7 @@ class RendererTest extends RendererTestBase { /** * Ensures that #access is taken in account when rendering #render_children. */ - public function testRenderChildrenAccess() { + public function testRenderChildrenAccess(): void { $build = [ '#access' => FALSE, '#render_children' => TRUE, @@ -754,7 +754,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderWithoutThemeArguments() { + public function testRenderWithoutThemeArguments(): void { $element = [ '#theme' => 'common_test_foo', ]; @@ -772,7 +772,7 @@ class RendererTest extends RendererTestBase { * @covers ::render * @covers ::doRender */ - public function testRenderWithThemeArguments() { + public function testRenderWithThemeArguments(): void { $element = [ '#theme' => 'common_test_foo', '#foo' => $this->randomMachineName(), @@ -830,7 +830,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerRenderCache */ - public function testRenderCache($child_access, $expected_tags) { + public function testRenderCache($child_access, $expected_tags): void { $this->setUpRequest(); $this->setUpMemoryCache(); @@ -880,7 +880,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerTestRenderCacheMaxAge */ - public function testRenderCacheMaxAge($max_age, $is_render_cached, $render_cache_item_expire) { + public function testRenderCacheMaxAge($max_age, $is_render_cached, $render_cache_item_expire): void { $this->setUpRequest(); $this->setUpMemoryCache(); @@ -925,7 +925,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerTestRenderCacheProperties */ - public function testRenderCacheProperties(array $expected_results) { + public function testRenderCacheProperties(array $expected_results): void { $this->setUpRequest(); $this->setUpMemoryCache(); @@ -993,7 +993,7 @@ class RendererTest extends RendererTestBase { * * @dataProvider providerTestAddCacheableDependency */ - public function testAddCacheableDependency(array $build, $object, array $expected) { + public function testAddCacheableDependency(array $build, $object, array $expected): void { $this->renderer->addCacheableDependency($build, $object); $this->assertEquals($build, $expected); } diff --git a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php index 647a1819ef0..451fdad716a 100644 --- a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php @@ -141,7 +141,7 @@ class RoleAccessCheckTest extends UnitTestCase { * * @dataProvider roleAccessProvider */ - public function testRoleAccess($path, $grant_accounts, $deny_accounts) { + public function testRoleAccess($path, $grant_accounts, $deny_accounts): void { $cache_contexts_manager = $this->prophesize(CacheContextsManager::class); $cache_contexts_manager->assertValidTokens()->willReturn(TRUE); $cache_contexts_manager->reveal(); diff --git a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php index 7541dbd687e..625814a39c9 100644 --- a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php +++ b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php @@ -35,7 +35,7 @@ class RouteProcessorManagerTest extends UnitTestCase { /** * Tests the Route process manager functionality. */ - public function testRouteProcessorManager() { + public function testRouteProcessorManager(): void { $route = new Route(''); $parameters = ['test' => 'test']; $route_name = 'test_name'; diff --git a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php index 3b62244155c..af5f10d6f3a 100644 --- a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php @@ -70,7 +70,7 @@ class AcceptHeaderMatcherTest extends UnitTestCase { * * @dataProvider acceptFilterProvider */ - public function testAcceptFiltering($accept_header, $format, $included_route, $excluded_route) { + public function testAcceptFiltering($accept_header, $format, $included_route, $excluded_route): void { $collection = $this->fixtures->sampleRouteCollection(); $request = Request::create('path/two', 'GET'); @@ -89,7 +89,7 @@ class AcceptHeaderMatcherTest extends UnitTestCase { /** * Confirms that the AcceptHeaderMatcher throws an exception for no-route. */ - public function testNoRouteFound() { + public function testNoRouteFound(): void { // Remove the sample routes that would match any method. $routes = $this->fixtures->sampleRouteCollection(); $routes->remove('route_a'); diff --git a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php index 95e0bb96a8f..1b7aaa74881 100644 --- a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php @@ -77,7 +77,7 @@ class AccessAwareRouterTest extends UnitTestCase { /** * Tests the matchRequest() function for access allowed. */ - public function testMatchRequestAllowed() { + public function testMatchRequestAllowed(): void { $this->setupRouter(); $request = new Request(); $access_result = AccessResult::allowed(); @@ -97,7 +97,7 @@ class AccessAwareRouterTest extends UnitTestCase { /** * Tests the matchRequest() function for access denied. */ - public function testMatchRequestDenied() { + public function testMatchRequestDenied(): void { $this->setupRouter(); $request = new Request(); $access_result = AccessResult::forbidden(); @@ -112,7 +112,7 @@ class AccessAwareRouterTest extends UnitTestCase { /** * Tests the matchRequest() function for access denied with reason message. */ - public function testCheckAccessResultWithReason() { + public function testCheckAccessResultWithReason(): void { $this->setupRouter(); $request = new Request(); $reason = $this->getRandomGenerator()->string(); @@ -131,7 +131,7 @@ class AccessAwareRouterTest extends UnitTestCase { * * @covers ::__call */ - public function testCall() { + public function testCall(): void { $mock_router = $this->createMock(RouterInterface::class); $this->router = $this->getMockBuilder(MockRouterInterface::class) diff --git a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php index e22aeebf65c..c04de331560 100644 --- a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php @@ -48,7 +48,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase { * * @dataProvider providerTestSafeRequestFilter */ - public function testSafeRequestFilter($method) { + public function testSafeRequestFilter($method): void { $collection = $this->fixtures->sampleRouteCollection(); $collection->addCollection($this->fixtures->contentRouteCollection()); @@ -70,7 +70,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase { /** * Tests that XML-restricted routes get filtered out on JSON requests. */ - public function testJsonRequest() { + public function testJsonRequest(): void { $collection = $this->fixtures->sampleRouteCollection(); $collection->addCollection($this->fixtures->contentRouteCollection()); @@ -89,7 +89,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase { /** * Tests route filtering on POST form submission requests. */ - public function testPostForm() { + public function testPostForm(): void { $collection = $this->fixtures->sampleRouteCollection(); $collection->addCollection($this->fixtures->contentRouteCollection()); @@ -108,7 +108,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase { * * @covers ::filter */ - public function testNoRouteFound() { + public function testNoRouteFound(): void { $matcher = new ContentTypeHeaderMatcher(); $routes = $this->fixtures->contentRouteCollection(); @@ -124,7 +124,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase { * * @covers ::filter */ - public function testContentTypeRequestHeaderMissing() { + public function testContentTypeRequestHeaderMissing(): void { $matcher = new ContentTypeHeaderMatcher(); $routes = $this->fixtures->contentRouteCollection(); diff --git a/core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php b/core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php index 92e5b705e55..5ec49e52926 100644 --- a/core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php @@ -41,7 +41,7 @@ class CurrentRouteMatchTest extends RouteMatchTestBase { * @covers ::getCurrentRouteMatch * @covers ::getRouteMatch */ - public function testGetCurrentRouteObject() { + public function testGetCurrentRouteObject(): void { $request_stack = new RequestStack(); $request = new Request(); @@ -78,7 +78,7 @@ class CurrentRouteMatchTest extends RouteMatchTestBase { /** * @covers ::getRouteMatchFromRequest */ - public function testGetRouteMatchFromRequestWithRouting() { + public function testGetRouteMatchFromRequestWithRouting(): void { $request_stack = new RequestStack(); $request = new Request(); $request_stack->push($request); @@ -93,7 +93,7 @@ class CurrentRouteMatchTest extends RouteMatchTestBase { /** * @covers ::getRouteMatchFromRequest */ - public function testGetRouteMatchFromRequest() { + public function testGetRouteMatchFromRequest(): void { $request_stack = new RequestStack(); $request = new Request(); $request_stack->push($request); @@ -112,7 +112,7 @@ class CurrentRouteMatchTest extends RouteMatchTestBase { /** * @covers ::resetRouteMatch */ - public function testResetRouteMatch() { + public function testResetRouteMatch(): void { $route = new Route('/test-route/{foo}'); $request = new Request(); $request->attributes->set(RouteObjectInterface::ROUTE_NAME, 'test_route'); diff --git a/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php b/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php index 54df9e2b819..c34e9afde60 100644 --- a/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php @@ -47,7 +47,7 @@ class LazyRouteCollectionTest extends UnitTestCase { * @covers ::getIterator * @covers ::all */ - public function testGetIterator() { + public function testGetIterator(): void { $this->routeProvider->expects($this->exactly(2)) ->method('getRoutesByNames') ->with(NULL) @@ -60,7 +60,7 @@ class LazyRouteCollectionTest extends UnitTestCase { /** * @covers ::count */ - public function testCount() { + public function testCount(): void { $this->routeProvider ->method('getRoutesByNames') ->with(NULL) @@ -74,7 +74,7 @@ class LazyRouteCollectionTest extends UnitTestCase { * * @covers ::get */ - public function testGetName() { + public function testGetName(): void { // Hit. $this->routeProvider ->method('getRouteByName') diff --git a/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php b/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php index 31ac253a4df..0f6bf9fb226 100644 --- a/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php @@ -20,7 +20,7 @@ class MethodFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testWithAllowedMethod() { + public function testWithAllowedMethod(): void { $request = Request::create('/test', 'GET'); $collection = new RouteCollection(); $collection->add('test_route.get', new Route('/test', [], [], [], '', [], ['GET'])); @@ -35,7 +35,7 @@ class MethodFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testWithAllowedMethodAndMultipleMatchingRoutes() { + public function testWithAllowedMethodAndMultipleMatchingRoutes(): void { $request = Request::create('/test', 'GET'); $collection = new RouteCollection(); $collection->add('test_route.get', new Route('/test', [], [], [], '', [], ['GET'])); @@ -53,7 +53,7 @@ class MethodFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testMethodNotAllowedException() { + public function testMethodNotAllowedException(): void { $request = Request::create('/test', 'PATCH'); $collection = new RouteCollection(); $collection->add('test_route.get', new Route('/test', [], [], [], '', [], ['GET'])); @@ -67,7 +67,7 @@ class MethodFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testMethodNotAllowedExceptionWithMultipleRoutes() { + public function testMethodNotAllowedExceptionWithMultipleRoutes(): void { $request = Request::create('/test', 'PATCH'); $collection = new RouteCollection(); $collection->add('test_route.get', new Route('/test', [], [], [], '', [], ['GET'])); @@ -83,7 +83,7 @@ class MethodFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testFilteredMethods() { + public function testFilteredMethods(): void { $request = Request::create('/test', 'PATCH'); $collection = new RouteCollection(); $collection->add('test_route.get', new Route('/test', [], [], [], '', [], ['GET'])); @@ -104,7 +104,7 @@ class MethodFilterTest extends UnitTestCase { * * @covers ::filter */ - public function testCollectionOrder() { + public function testCollectionOrder(): void { $request = Request::create('/test', 'GET'); $collection = new RouteCollection(); diff --git a/core/tests/Drupal/Tests/Core/Routing/PathChangedHelperTest.php b/core/tests/Drupal/Tests/Core/Routing/PathChangedHelperTest.php index ce07c2fc931..9018d058fa1 100644 --- a/core/tests/Drupal/Tests/Core/Routing/PathChangedHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/PathChangedHelperTest.php @@ -20,7 +20,7 @@ class PathChangedHelperTest extends UnitTestCase { * * @covers ::__construct */ - public function testPathChangedHelperException() { + public function testPathChangedHelperException(): void { $route_match = $this->prophesize(RouteMatchInterface::class); $route_match->getRouteName()->willReturn('path.changed.not-bc'); diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php index 2bf84130126..199262f3f3f 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php @@ -73,7 +73,7 @@ class RedirectDestinationTest extends UnitTestCase { * * @covers ::get */ - public function testGet(Request $request, $expected_destination) { + public function testGet(Request $request, $expected_destination): void { $this->requestStack->push($request); $this->setupUrlGenerator(); @@ -87,7 +87,7 @@ class RedirectDestinationTest extends UnitTestCase { * * @covers ::getAsArray */ - public function testGetAsArray(Request $request, $expected_destination) { + public function testGetAsArray(Request $request, $expected_destination): void { $this->requestStack->push($request); $this->setupUrlGenerator(); @@ -125,7 +125,7 @@ class RedirectDestinationTest extends UnitTestCase { * @covers ::set * @covers ::get */ - public function testSetBeforeGetCall() { + public function testSetBeforeGetCall(): void { $this->redirectDestination->set('/example'); $this->assertEquals('/example', $this->redirectDestination->get()); } @@ -134,7 +134,7 @@ class RedirectDestinationTest extends UnitTestCase { * @covers ::set * @covers ::get */ - public function testSetAfterGetCall() { + public function testSetAfterGetCall(): void { $request = Request::create('/'); $request->query->set('destination', '/other-example'); $this->requestStack->push($request); diff --git a/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php b/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php index af9c6199a8c..fb0157a58c6 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php @@ -24,7 +24,7 @@ class RequestFormatRouteFilterTest extends UnitTestCase { * @covers ::filter * @dataProvider filterProvider */ - public function testFilter(RouteCollection $collection, $request_format, array $expected_filtered_collection) { + public function testFilter(RouteCollection $collection, $request_format, array $expected_filtered_collection): void { $route_filter = new RequestFormatRouteFilter(); $request = new Request(); @@ -63,7 +63,7 @@ class RequestFormatRouteFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testNoRouteFound() { + public function testNoRouteFound(): void { $url = $this->prophesize(GeneratedUrl::class); $url_assembler = $this->prophesize(UnroutedUrlAssemblerInterface::class); $url_assembler->assemble('http://localhost/test?_format=xml', ['query' => ['_format' => 'json'], 'external' => TRUE], TRUE) @@ -89,7 +89,7 @@ class RequestFormatRouteFilterTest extends UnitTestCase { /** * @covers ::filter */ - public function testNoRouteFoundWhenNoRequestFormatAndSingleRouteWithMultipleFormats() { + public function testNoRouteFoundWhenNoRequestFormatAndSingleRouteWithMultipleFormats(): void { $this->expectException(NotAcceptableHttpException::class); $this->expectExceptionMessage('No route found for the specified format html.'); diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php index bf108cd2c42..325a0319b48 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php @@ -99,7 +99,7 @@ class RouteBuilderTest extends UnitTestCase { /** * Tests that the route rebuilding both locks and unlocks. */ - public function testRebuildLockingUnlocking() { + public function testRebuildLockingUnlocking(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') @@ -119,7 +119,7 @@ class RouteBuilderTest extends UnitTestCase { /** * Tests route rebuilding with a blocking lock. */ - public function testRebuildBlockingLock() { + public function testRebuildBlockingLock(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') @@ -143,7 +143,7 @@ class RouteBuilderTest extends UnitTestCase { * * @see \Drupal\Core\Routing\RouteBuilder::rebuild() */ - public function testRebuildWithStaticModuleRoutes() { + public function testRebuildWithStaticModuleRoutes(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') @@ -189,7 +189,7 @@ class RouteBuilderTest extends UnitTestCase { * * @see \Drupal\Core\Routing\RouteBuilder::rebuild() */ - public function testRebuildWithProviderBasedRoutes() { + public function testRebuildWithProviderBasedRoutes(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') @@ -254,7 +254,7 @@ class RouteBuilderTest extends UnitTestCase { /** * Tests \Drupal\Core\Routing\RouteBuilder::rebuildIfNeeded() method. */ - public function testRebuildIfNeeded() { + public function testRebuildIfNeeded(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') @@ -282,7 +282,7 @@ class RouteBuilderTest extends UnitTestCase { * * @see \Drupal\Core\Routing\RouteBuilder::rebuild() */ - public function testRebuildWithOverriddenRouteClass() { + public function testRebuildWithOverriddenRouteClass(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('router_rebuild') diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php index 9c282fac1ff..5b34e631958 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php @@ -25,7 +25,7 @@ class RouteCompilerTest extends UnitTestCase { * * @dataProvider providerTestGetFit */ - public function testGetFit($path, $expected) { + public function testGetFit($path, $expected): void { $route_compiler = new RouteCompiler(); $result = $route_compiler->getFit($path); $this->assertSame($expected, $result); @@ -54,7 +54,7 @@ class RouteCompilerTest extends UnitTestCase { /** * Confirms that a route compiles properly with the necessary data. */ - public function testCompilation() { + public function testCompilation(): void { $route = new Route('/test/{something}/more'); $route->setOption('compiler_class', RouteCompiler::class); $compiled = $route->compile(); @@ -66,7 +66,7 @@ class RouteCompilerTest extends UnitTestCase { /** * Confirms that a compiled route with default values has the correct outline. */ - public function testCompilationDefaultValue() { + public function testCompilationDefaultValue(): void { // Because "here" has a default value, it should not factor into the outline // or the fitness. $route = new Route('/test/{something}/more/{here}', [ diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTest.php index 47ebf10829e..85fa3e400fc 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTest.php @@ -28,7 +28,7 @@ class RouteMatchTest extends RouteMatchTestBase { * @covers ::createFromRequest * @covers ::__construct */ - public function testRouteMatchFromRequest() { + public function testRouteMatchFromRequest(): void { $request = new Request(); // A request that hasn't been routed yet. diff --git a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php index a18b0a80af3..41e1eb9dc48 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php @@ -52,7 +52,7 @@ class RoutePreloaderTest extends UnitTestCase { /** * Tests onAlterRoutes with just admin routes. */ - public function testOnAlterRoutesWithAdminRoutes() { + public function testOnAlterRoutesWithAdminRoutes(): void { $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent') ->disableOriginalConstructor() ->getMock(); @@ -73,7 +73,7 @@ class RoutePreloaderTest extends UnitTestCase { /** * Tests onAlterRoutes with "admin" appearing in the path. */ - public function testOnAlterRoutesWithAdminPathNoAdminRoute() { + public function testOnAlterRoutesWithAdminPathNoAdminRoute(): void { $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent') ->disableOriginalConstructor() ->getMock(); @@ -96,7 +96,7 @@ class RoutePreloaderTest extends UnitTestCase { /** * Tests onAlterRoutes with admin routes and non admin routes. */ - public function testOnAlterRoutesWithNonAdminRoutes() { + public function testOnAlterRoutesWithNonAdminRoutes(): void { $event = $this->getMockBuilder('Drupal\Core\Routing\RouteBuildEvent') ->disableOriginalConstructor() ->getMock(); @@ -134,7 +134,7 @@ class RoutePreloaderTest extends UnitTestCase { /** * Tests onRequest on a non html request. */ - public function testOnRequestNonHtml() { + public function testOnRequestNonHtml(): void { $event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\KernelEvent') ->disableOriginalConstructor() ->getMock(); @@ -155,7 +155,7 @@ class RoutePreloaderTest extends UnitTestCase { /** * Tests onRequest on a html request. */ - public function testOnRequestOnHtml() { + public function testOnRequestOnHtml(): void { $event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\KernelEvent') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/Routing/RouterTest.php b/core/tests/Drupal/Tests/Core/Routing/RouterTest.php index cdee3b81c35..254cf466931 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouterTest.php @@ -24,7 +24,7 @@ class RouterTest extends UnitTestCase { /** * @covers ::applyFitOrder */ - public function testMatchesWithDifferentFitOrder() { + public function testMatchesWithDifferentFitOrder(): void { $route_provider = $this->prophesize(RouteProviderInterface::class); $route_collection = new RouteCollection(); diff --git a/core/tests/Drupal/Tests/Core/Routing/RouterUnsupportedTest.php b/core/tests/Drupal/Tests/Core/Routing/RouterUnsupportedTest.php index cc306b0812e..4996d76988f 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouterUnsupportedTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouterUnsupportedTest.php @@ -21,7 +21,7 @@ class RouterUnsupportedTest extends UnitTestCase { /** * @covers ::generate */ - public function testGenerateUnsupported() { + public function testGenerateUnsupported(): void { $this->expectException(\BadMethodCallException::class); $route_provider = $this->prophesize(RouteProviderInterface::class); $current_path_stack = $this->prophesize(CurrentPathStack::class); diff --git a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php index 440904c014b..fb6183466a5 100644 --- a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php @@ -22,7 +22,7 @@ class TrustedRedirectResponseTest extends UnitTestCase { /** * @covers ::setTargetUrl */ - public function testSetTargetUrlWithInternalUrl() { + public function testSetTargetUrlWithInternalUrl(): void { $redirect_response = new TrustedRedirectResponse('/example'); $redirect_response->setTargetUrl('/example2'); @@ -32,7 +32,7 @@ class TrustedRedirectResponseTest extends UnitTestCase { /** * @covers ::setTargetUrl */ - public function testSetTargetUrlWithUntrustedUrl() { + public function testSetTargetUrlWithUntrustedUrl(): void { $request_context = new RequestContext(); $request_context->setCompleteBaseUrl('https://www.drupal.org'); $container = new ContainerBuilder(); @@ -48,7 +48,7 @@ class TrustedRedirectResponseTest extends UnitTestCase { /** * @covers ::setTargetUrl */ - public function testSetTargetUrlWithTrustedUrl() { + public function testSetTargetUrlWithTrustedUrl(): void { $redirect_response = new TrustedRedirectResponse('/example'); $redirect_response->setTrustedTargetUrl('http://good-external-url.com/example'); @@ -59,7 +59,7 @@ class TrustedRedirectResponseTest extends UnitTestCase { * @covers ::createFromRedirectResponse * @dataProvider providerCreateFromRedirectResponse */ - public function testCreateFromRedirectResponse($redirect_response) { + public function testCreateFromRedirectResponse($redirect_response): void { $trusted_redirect_response = TrustedRedirectResponse::createFromRedirectResponse($redirect_response); // The trusted redirect response is always a CacheableResponseInterface instance. diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 068f13f23b7..26c3b7663a5 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -207,7 +207,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that generated routes will have aliased paths. */ - public function testAliasGeneration() { + public function testAliasGeneration(): void { $url = $this->generator->generate('test_1'); $this->assertEquals('/hello/world', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -227,7 +227,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that generated routes will have aliased paths using interface constants. */ - public function testAliasGenerationUsingInterfaceConstants() { + public function testAliasGenerationUsingInterfaceConstants(): void { $url = $this->generator->generate('test_1', [], UrlGenerator::ABSOLUTE_PATH); $this->assertEquals('/hello/world', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -247,7 +247,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * @covers ::generateFromRoute */ - public function testUrlGenerationWithDisabledPathProcessing() { + public function testUrlGenerationWithDisabledPathProcessing(): void { $path_processor = $this->prophesize(OutboundPathProcessorInterface::class); $path_processor->processOutbound(Argument::cetera())->shouldNotBeCalled(); @@ -261,7 +261,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * @covers ::generateFromRoute */ - public function testUrlGenerationWithDisabledPathProcessingByRoute() { + public function testUrlGenerationWithDisabledPathProcessingByRoute(): void { $path_processor = $this->prophesize(OutboundPathProcessorInterface::class); $path_processor->processOutbound(Argument::cetera())->shouldNotBeCalled(); @@ -278,7 +278,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * @covers ::generateFromRoute */ - public function testUrlGenerationWithDisabledPathProcessingByRouteAndOptedInPathProcessing() { + public function testUrlGenerationWithDisabledPathProcessingByRouteAndOptedInPathProcessing(): void { $path_processor = $this->prophesize(OutboundPathProcessorInterface::class); $path_processor->processOutbound('/test/one', Argument::cetera())->willReturn('/hello/world')->shouldBeCalled(); @@ -295,7 +295,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Tests URL generation in a subdirectory. */ - public function testGetPathFromRouteWithSubdirectory() { + public function testGetPathFromRouteWithSubdirectory(): void { $this->routeProcessorManager->expects($this->once()) ->method('processOutbound'); @@ -306,7 +306,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that generated routes will have aliased paths. */ - public function testAliasGenerationWithParameters() { + public function testAliasGenerationWithParameters(): void { $url = $this->generator->generate('test_2', ['Lassie' => '5']); $this->assertEquals('/goodbye/cruel/world', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -339,7 +339,7 @@ class UrlGeneratorTest extends UnitTestCase { * * @dataProvider providerTestAliasGenerationWithOptions */ - public function testAliasGenerationWithOptions($route_name, $route_parameters, $options, $expected) { + public function testAliasGenerationWithOptions($route_name, $route_parameters, $options, $expected): void { $this->assertGenerateFromRoute($route_name, $route_parameters, $options, $expected, (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT)); } @@ -388,7 +388,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Tests URL generation from route with trailing start and end slashes. */ - public function testGetPathFromRouteTrailing() { + public function testGetPathFromRouteTrailing(): void { $this->routeProcessorManager->expects($this->once()) ->method('processOutbound'); @@ -399,7 +399,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that absolute URLs work with generated routes. */ - public function testAbsoluteURLGeneration() { + public function testAbsoluteURLGeneration(): void { $url = $this->generator->generate('test_1', [], TRUE); $this->assertEquals('http://localhost/hello/world', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -417,7 +417,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that absolute URLs work with generated routes using interface constants. */ - public function testAbsoluteURLGenerationUsingInterfaceConstants() { + public function testAbsoluteURLGenerationUsingInterfaceConstants(): void { $url = $this->generator->generate('test_1', [], UrlGenerator::ABSOLUTE_URL); $this->assertEquals('http://localhost/hello/world', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -435,7 +435,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Confirms that explicitly setting the base_url works with generated routes. */ - public function testBaseURLGeneration() { + public function testBaseURLGeneration(): void { $options = ['base_url' => 'http://www.example.com:8888']; $this->assertGenerateFromRoute('test_1', [], $options, 'http://www.example.com:8888/hello/world', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT)); @@ -457,7 +457,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * Tests the 'scheme' route requirement during URL generation. */ - public function testUrlGenerationWithHttpsRequirement() { + public function testUrlGenerationWithHttpsRequirement(): void { $url = $this->generator->generate('test_4', [], TRUE); $this->assertEquals('https://localhost/test/four', $url); // No cacheability to test; UrlGenerator::generate() doesn't support @@ -483,7 +483,7 @@ class UrlGeneratorTest extends UnitTestCase { * * @dataProvider providerTestNoPath */ - public function testNoPath($options, $expected_url) { + public function testNoPath($options, $expected_url): void { $url = $this->generator->generateFromRoute('<none>', [], $options); $this->assertEquals($expected_url, $url); } @@ -511,7 +511,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * @covers \Drupal\Core\Routing\UrlGenerator::generateFromRoute */ - public function testGenerateWithPathProcessorChangingOptions() { + public function testGenerateWithPathProcessorChangingOptions(): void { $path_processor = $this->createMock(OutboundPathProcessorInterface::CLASS); $path_processor->expects($this->atLeastOnce()) ->method('processOutbound') diff --git a/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php b/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php index 60b454ac5ff..0b6e0c4d49b 100644 --- a/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php @@ -21,7 +21,7 @@ class DoTrustedCallbackTraitTest extends UnitTestCase { * @covers ::doTrustedCallback * @dataProvider providerTestTrustedCallbacks */ - public function testTrustedCallbacks(callable $callback, $extra_trusted_interface = NULL) { + public function testTrustedCallbacks(callable $callback, $extra_trusted_interface = NULL): void { $return = $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::THROW_EXCEPTION, $extra_trusted_interface); $this->assertSame('test', $return); } @@ -50,7 +50,7 @@ class DoTrustedCallbackTraitTest extends UnitTestCase { * @covers ::doTrustedCallback * @dataProvider providerTestUntrustedCallbacks */ - public function testUntrustedCallbacks(callable $callback, $extra_trusted_interface = NULL) { + public function testUntrustedCallbacks(callable $callback, $extra_trusted_interface = NULL): void { $this->expectException(UntrustedCallbackException::class); $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::THROW_EXCEPTION, $extra_trusted_interface); } @@ -72,7 +72,7 @@ class DoTrustedCallbackTraitTest extends UnitTestCase { /** * @dataProvider errorTypeProvider */ - public function testException($callback) { + public function testException($callback): void { $this->expectException(UntrustedCallbackException::class); $this->expectExceptionMessage('Drupal\Tests\Core\Security\UntrustedObject::callback is not trusted'); $this->doTrustedCallback($callback, [], '%s is not trusted'); @@ -82,7 +82,7 @@ class DoTrustedCallbackTraitTest extends UnitTestCase { * @dataProvider errorTypeProvider * @group legacy */ - public function testSilencedDeprecation($callback) { + public function testSilencedDeprecation($callback): void { $this->expectDeprecation('Drupal\Tests\Core\Security\UntrustedObject::callback is not trusted'); $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION); } diff --git a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php index b7f55934346..ee3394b6391 100644 --- a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php +++ b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php @@ -60,7 +60,7 @@ class RequestSanitizerTest extends UnitTestCase { * * @dataProvider providerTestRequestSanitization */ - public function testRequestSanitization(Request $request, array $expected = [], ?array $expected_errors = NULL, array $whitelist = []) { + public function testRequestSanitization(Request $request, array $expected = [], ?array $expected_errors = NULL, array $whitelist = []): void { // Set up globals. $_GET = $request->query->all(); $_POST = $request->request->all(); @@ -215,7 +215,7 @@ class RequestSanitizerTest extends UnitTestCase { * * @dataProvider providerTestAcceptableDestinations */ - public function testAcceptableDestinationGet($destination) { + public function testAcceptableDestinationGet($destination): void { // Set up a GET request. $request = $this->createRequestForTesting(['destination' => $destination]); @@ -237,7 +237,7 @@ class RequestSanitizerTest extends UnitTestCase { * * @dataProvider providerTestSanitizedDestinations */ - public function testSanitizedDestinationGet($destination) { + public function testSanitizedDestinationGet($destination): void { // Set up a GET request. $request = $this->createRequestForTesting(['destination' => $destination]); @@ -259,7 +259,7 @@ class RequestSanitizerTest extends UnitTestCase { * * @dataProvider providerTestAcceptableDestinations */ - public function testAcceptableDestinationPost($destination) { + public function testAcceptableDestinationPost($destination): void { // Set up a POST request. $request = $this->createRequestForTesting([], ['destination' => $destination]); @@ -281,7 +281,7 @@ class RequestSanitizerTest extends UnitTestCase { * * @dataProvider providerTestSanitizedDestinations */ - public function testSanitizedDestinationPost($destination) { + public function testSanitizedDestinationPost($destination): void { // Set up a POST request. $request = $this->createRequestForTesting([], ['destination' => $destination]); diff --git a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php index ebd6002999c..9f14175e85d 100644 --- a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php @@ -48,7 +48,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that access policies are properly processed. */ - public function testCalculatePermissions() { + public function testCalculatePermissions(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $access_policy = new BarAccessPolicy(); @@ -63,7 +63,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that access policies that do not apply are not processed. */ - public function testCalculatePermissionsNoApply() { + public function testCalculatePermissionsNoApply(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $access_policy = new BarAccessPolicy(); @@ -79,7 +79,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that access policies can alter the final result. */ - public function testAlterPermissions() { + public function testAlterPermissions(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $processor = $this->setUpAccessPolicyProcessor(); @@ -97,7 +97,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that alters that do not apply are not processed. */ - public function testAlterPermissionsNoApply() { + public function testAlterPermissionsNoApply(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $processor = $this->setUpAccessPolicyProcessor(); @@ -112,7 +112,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that access policies which do nothing are properly processed. */ - public function testEmptyCalculator() { + public function testEmptyCalculator(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $access_policy = new EmptyAccessPolicy(); @@ -128,7 +128,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that everything works if no access policies are present. */ - public function testNoCalculators() { + public function testNoCalculators(): void { $account = $this->prophesize(AccountInterface::class)->reveal(); $processor = $this->setUpAccessPolicyProcessor(); @@ -141,7 +141,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests the wrong scope exception. */ - public function testWrongScopeException() { + public function testWrongScopeException(): void { $processor = $this->setUpAccessPolicyProcessor(); $processor->addAccessPolicy(new AlwaysAddsAccessPolicy()); @@ -153,7 +153,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests the multiple scopes exception. */ - public function testMultipleScopeException() { + public function testMultipleScopeException(): void { $processor = $this->setUpAccessPolicyProcessor(); $processor->addAccessPolicy(new FooAccessPolicy()); $processor->addAccessPolicy(new AlwaysAddsAccessPolicy()); @@ -166,7 +166,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests the multiple scopes exception. */ - public function testMultipleScopeAlterException() { + public function testMultipleScopeAlterException(): void { $processor = $this->setUpAccessPolicyProcessor(); $processor->addAccessPolicy(new FooAccessPolicy()); $processor->addAccessPolicy(new AlwaysAltersAccessPolicy()); @@ -188,7 +188,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { * * @dataProvider accountSwitcherProvider */ - public function testAccountSwitcher(bool $has_user_context, bool $is_current_user, bool $should_call_switcher) { + public function testAccountSwitcher(bool $has_user_context, bool $is_current_user, bool $should_call_switcher): void { $account = $this->prophesize(AccountInterface::class); $account->id()->willReturn(2); $account = $account->reveal(); @@ -253,7 +253,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { * * @dataProvider cachingProvider */ - public function testCaching(bool $db_cache_hit, bool $static_cache_hit) { + public function testCaching(bool $db_cache_hit, bool $static_cache_hit): void { if ($static_cache_hit) { $this->assertFalse($db_cache_hit, 'DB cache should never be checked when there is a static hit.'); } @@ -313,7 +313,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that only the cache contexts for policies that apply are added. */ - public function testCacheContexts() { + public function testCacheContexts(): void { // BazAccessPolicy and BarAlterAccessPolicy shouldn't add any contexts. $initial_cacheability = (new CacheableMetadata())->addCacheContexts(['foo', 'bar']); $final_cacheability = (new CacheableMetadata())->addCacheContexts(['foo', 'bar'])->addCacheTags(['access_policies']); @@ -336,7 +336,7 @@ class AccessPolicyProcessorTest extends UnitTestCase { /** * Tests that the persistent cache contexts are added properly. */ - public function testCacheContextCaching() { + public function testCacheContextCaching(): void { $cache_entry = new \stdClass(); $cache_entry->data = ['baz']; diff --git a/core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php b/core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php index 770a732fceb..98a35b8fcf8 100644 --- a/core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php +++ b/core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php @@ -23,7 +23,7 @@ class AccountProxyTest extends UnitTestCase { * @covers ::id * @covers ::setInitialAccountId */ - public function testId() { + public function testId(): void { $dispatcher = $this->prophesize(EventDispatcherInterface::class); $dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event()); $account_proxy = new AccountProxy($dispatcher->reveal()); @@ -43,7 +43,7 @@ class AccountProxyTest extends UnitTestCase { /** * @covers ::setInitialAccountId */ - public function testSetInitialAccountIdException() { + public function testSetInitialAccountIdException(): void { $this->expectException(\LogicException::class); $dispatcher = $this->prophesize(EventDispatcherInterface::class); $dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event()); @@ -56,7 +56,7 @@ class AccountProxyTest extends UnitTestCase { /** * @covers ::hasRole */ - public function testHasRole() { + public function testHasRole(): void { $dispatcher = $this->prophesize(EventDispatcherInterface::class); $dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event()); $account_proxy = new AccountProxy($dispatcher->reveal()); diff --git a/core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php index 23631aa86dd..18783b85260 100644 --- a/core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php +++ b/core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php @@ -20,7 +20,7 @@ class AnonymousUserSessionTest extends UnitTestCase { * @covers ::getRoles * @todo Move roles constants to a class/interface */ - public function testUserGetRoles() { + public function testUserGetRoles(): void { $anonymous_user = new AnonymousUserSession(); $this->assertEquals([RoleInterface::ANONYMOUS_ID], $anonymous_user->getRoles()); $this->assertEquals([], $anonymous_user->getRoles(TRUE)); diff --git a/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php b/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php index 85cd51e2de5..15a4a904208 100644 --- a/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php +++ b/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php @@ -24,7 +24,7 @@ class CalculatedPermissionsItemTest extends UnitTestCase { * @covers ::getPermissions * @covers ::isAdmin */ - public function testConstructor() { + public function testConstructor(): void { $scope = 'some_scope'; $item = new CalculatedPermissionsItem(['bar', 'baz', 'bar'], FALSE, $scope, 'foo'); @@ -44,7 +44,7 @@ class CalculatedPermissionsItemTest extends UnitTestCase { * @covers ::hasPermission * @depends testConstructor */ - public function testHasPermission() { + public function testHasPermission(): void { $item = new CalculatedPermissionsItem(['bar'], FALSE, 'some_scope', 'foo'); $this->assertFalse($item->hasPermission('baz'), 'Missing permission was not found.'); $this->assertTrue($item->hasPermission('bar'), 'Existing permission was found.'); @@ -56,7 +56,7 @@ class CalculatedPermissionsItemTest extends UnitTestCase { * @covers ::hasPermission * @depends testConstructor */ - public function testHasPermissionWithAdminFlag() { + public function testHasPermissionWithAdminFlag(): void { $item = new CalculatedPermissionsItem(['bar'], TRUE, 'some_scope', 'foo'); $this->assertTrue($item->hasPermission('baz'), 'Missing permission was found.'); $this->assertTrue($item->hasPermission('bar'), 'Existing permission was found.'); diff --git a/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsTest.php b/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsTest.php index d24d3bfc539..fa5f4a62dff 100644 --- a/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsTest.php +++ b/core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsTest.php @@ -21,7 +21,7 @@ class CalculatedPermissionsTest extends UnitTestCase { /** * Tests that the object values were set in the constructor. */ - public function testConstructor() { + public function testConstructor(): void { $item_a = new CalculatedPermissionsItem(['baz'], FALSE, 'scope_a', 'foo'); $item_b = new CalculatedPermissionsItem(['bob', 'charlie'], FALSE, 'scope_b', 1); diff --git a/core/tests/Drupal/Tests/Core/Session/MetadataBagTest.php b/core/tests/Drupal/Tests/Core/Session/MetadataBagTest.php index 379b434379d..f9a796ece37 100644 --- a/core/tests/Drupal/Tests/Core/Session/MetadataBagTest.php +++ b/core/tests/Drupal/Tests/Core/Session/MetadataBagTest.php @@ -17,7 +17,7 @@ class MetadataBagTest extends UnitTestCase { /** * @covers ::stampNew */ - public function testStampNew() { + public function testStampNew(): void { $metadata = new MetadataBag(new Settings([])); $metadata->setCsrfTokenSeed('a_cryptographically_secure_long_random_string_should_used_here'); $metadata->stampNew(); diff --git a/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php b/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php index 067472b3b05..3d905051695 100644 --- a/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php @@ -96,7 +96,7 @@ class PermissionsHashGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateRegular() { + public function testGenerateRegular(): void { $permissions = new CalculatedPermissions( (new RefinableCalculatedPermissions())->addItem(new CalculatedPermissionsItem([ 'permission foo', @@ -117,7 +117,7 @@ class PermissionsHashGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateAdmin() { + public function testGenerateAdmin(): void { $permissions = new CalculatedPermissions((new RefinableCalculatedPermissions())->addItem(new CalculatedPermissionsItem([], TRUE))); $this->processor->processAccessPolicies($this->account1)->willReturn($permissions); $this->processor->processAccessPolicies($this->account2)->willReturn($permissions); @@ -136,7 +136,7 @@ class PermissionsHashGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateNoAccessPolicies() { + public function testGenerateNoAccessPolicies(): void { $permissions = new CalculatedPermissions(new RefinableCalculatedPermissions()); $this->processor->processAccessPolicies($this->account1)->willReturn($permissions); $this->processor->processAccessPolicies($this->account2)->willReturn($permissions); @@ -155,7 +155,7 @@ class PermissionsHashGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateCache() { + public function testGenerateCache(): void { $permissions = new CalculatedPermissions(new RefinableCalculatedPermissions()); $this->processor->processAccessPolicies($this->account1)->willReturn($permissions); $this->processor->processAccessPolicies($this->account2)->willReturn($permissions); diff --git a/core/tests/Drupal/Tests/Core/Session/RefinableCalculatedPermissionsTest.php b/core/tests/Drupal/Tests/Core/Session/RefinableCalculatedPermissionsTest.php index 454a8674183..43b6d127094 100644 --- a/core/tests/Drupal/Tests/Core/Session/RefinableCalculatedPermissionsTest.php +++ b/core/tests/Drupal/Tests/Core/Session/RefinableCalculatedPermissionsTest.php @@ -23,7 +23,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { /** * Tests the addition of a calculated permissions item. */ - public function testAddItem() { + public function testAddItem(): void { $calculated_permissions = new RefinableCalculatedPermissions(); $scope = 'some_scope'; @@ -46,7 +46,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { * * @depends testAddItem */ - public function testAddItemOverwrite() { + public function testAddItemOverwrite(): void { $calculated_permissions = new RefinableCalculatedPermissions(); $scope = 'some_scope'; @@ -63,7 +63,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { * * @depends testAddItem */ - public function testRemoveItem() { + public function testRemoveItem(): void { $scope = 'some_scope'; $item = new CalculatedPermissionsItem(['bar'], FALSE, $scope, 'foo'); @@ -78,7 +78,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { * * @depends testAddItem */ - public function testRemoveItems() { + public function testRemoveItems(): void { $scope = 'some_scope'; $item = new CalculatedPermissionsItem(['bar'], FALSE, $scope, 'foo'); @@ -94,7 +94,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { * * @depends testAddItem */ - public function testRemoveItemsByScope() { + public function testRemoveItemsByScope(): void { $scope_a = 'cat'; $scope_b = 'dog'; @@ -115,7 +115,7 @@ class RefinableCalculatedPermissionsTest extends UnitTestCase { * * @depends testAddItem */ - public function testMerge() { + public function testMerge(): void { $scope = 'some_scope'; $cache_context_manager = $this->prophesize(CacheContextsManager::class); diff --git a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php index fd85368f4c4..aa03d6b5dc3 100644 --- a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php +++ b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php @@ -32,7 +32,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestGeneratedCookieDomain */ - public function testGeneratedCookieDomain($uri, $expected_domain) { + public function testGeneratedCookieDomain($uri, $expected_domain): void { $config = $this->createSessionConfiguration(); $request = Request::create($uri); @@ -71,7 +71,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestEnforcedCookieDomain */ - public function testEnforcedCookieDomain($uri, $expected_domain) { + public function testEnforcedCookieDomain($uri, $expected_domain): void { $config = $this->createSessionConfiguration(['cookie_domain' => '.example.com']); $request = Request::create($uri); @@ -109,7 +109,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestCookieSecure */ - public function testCookieSecure($uri, $expected_secure) { + public function testCookieSecure($uri, $expected_secure): void { $config = $this->createSessionConfiguration(); $request = Request::create($uri); @@ -121,7 +121,7 @@ class SessionConfigurationTest extends UnitTestCase { /** * Test that session.cookie_samesite is configured correctly. */ - public function testSameSiteCookie() { + public function testSameSiteCookie(): void { $request = Request::create('https://example.com'); $config = $this->createSessionConfiguration(['cookie_samesite' => 'Strict']); @@ -137,7 +137,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestCookieSecure */ - public function testCookieSecureNotOverridable($uri, $expected_secure) { + public function testCookieSecureNotOverridable($uri, $expected_secure): void { $config = $this->createSessionConfiguration(['cookie_secure' => FALSE]); $request = Request::create($uri); @@ -170,7 +170,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestGeneratedSessionName */ - public function testGeneratedSessionName($uri, $expected_name) { + public function testGeneratedSessionName($uri, $expected_name): void { $config = $this->createSessionConfiguration(); $request = Request::create($uri); @@ -218,7 +218,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestEnforcedSessionName */ - public function testEnforcedSessionNameViaCookieDomain($uri, $expected_name) { + public function testEnforcedSessionNameViaCookieDomain($uri, $expected_name): void { $config = $this->createSessionConfiguration(['cookie_domain' => '.example.com']); $request = Request::create($uri); @@ -266,7 +266,7 @@ class SessionConfigurationTest extends UnitTestCase { * * @dataProvider providerTestConstructorDefaultSettings */ - public function testConstructorDefaultSettings(array $options, int $expected_sid_length, int $expected_sid_bits_per_character, string $expected_name_suffix) { + public function testConstructorDefaultSettings(array $options, int $expected_sid_length, int $expected_sid_bits_per_character, string $expected_name_suffix): void { $config = $this->createSessionConfiguration($options); $options = $config->getOptions(Request::createFromGlobals()); $this->assertSame($expected_sid_length, $options['sid_length']); diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php index 2957033911c..db79fca4b17 100644 --- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php +++ b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php @@ -57,7 +57,7 @@ class UserSessionTest extends UnitTestCase { * @covers ::getRoles * @todo Move roles constants to a class/interface */ - public function testUserGetRoles() { + public function testUserGetRoles(): void { $user = $this->createUserSession(['role_two'], TRUE); $this->assertEquals([RoleInterface::AUTHENTICATED_ID, 'role_two'], $user->getRoles()); $this->assertEquals(['role_two'], $user->getRoles(TRUE)); @@ -68,7 +68,7 @@ class UserSessionTest extends UnitTestCase { * * @covers ::hasRole */ - public function testHasRole() { + public function testHasRole(): void { $user1 = $this->createUserSession(['role_one']); $user2 = $this->createUserSession(['role_one', 'role_two']); $user3 = $this->createUserSession(['role_two'], TRUE); diff --git a/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php b/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php index 0f2c7498d75..27c3a0e0741 100644 --- a/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php @@ -46,7 +46,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase { * @covers ::isSessionWritable * @covers ::write */ - public function testConstructWriteSafeSessionHandlerDefaultArgs() { + public function testConstructWriteSafeSessionHandlerDefaultArgs(): void { $session_id = 'some-id'; $session_data = 'serialized-session-data'; @@ -72,7 +72,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase { * @covers ::isSessionWritable * @covers ::write */ - public function testConstructWriteSafeSessionHandlerDisableWriting() { + public function testConstructWriteSafeSessionHandlerDisableWriting(): void { $session_id = 'some-id'; $session_data = 'serialized-session-data'; @@ -91,7 +91,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase { * @covers ::setSessionWritable * @covers ::write */ - public function testSetSessionWritable() { + public function testSetSessionWritable(): void { $session_id = 'some-id'; $session_data = 'serialized-session-data'; @@ -136,7 +136,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase { * @covers ::gc * @dataProvider providerTestOtherMethods */ - public function testOtherMethods($method, $expected_result, $args) { + public function testOtherMethods($method, $expected_result, $args): void { $invocation = $this->wrappedSessionHandler->expects($this->exactly(2)) ->method($method) ->willReturn($expected_result); diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php index a2908c00e69..d378dcf983c 100644 --- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php +++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php @@ -48,7 +48,7 @@ class SettingsTest extends UnitTestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { // Test stored settings. $this->assertEquals($this->config['one'], Settings::get('one'), 'The correct setting was not returned.'); $this->assertEquals($this->config['two'], Settings::get('two'), 'The correct setting was not returned.'); @@ -61,14 +61,14 @@ class SettingsTest extends UnitTestCase { /** * @covers ::getAll */ - public function testGetAll() { + public function testGetAll(): void { $this->assertEquals($this->config, Settings::getAll()); } /** * @covers ::getInstance */ - public function testGetInstance() { + public function testGetInstance(): void { $singleton = $this->settings->getInstance(); $this->assertEquals($singleton, $this->settings); } @@ -78,7 +78,7 @@ class SettingsTest extends UnitTestCase { * * @covers ::getHashSalt */ - public function testGetHashSalt() { + public function testGetHashSalt(): void { $this->assertSame($this->config['hash_salt'], $this->settings->getHashSalt()); } @@ -89,7 +89,7 @@ class SettingsTest extends UnitTestCase { * * @dataProvider providerTestGetHashSaltEmpty */ - public function testGetHashSaltEmpty(array $config) { + public function testGetHashSaltEmpty(array $config): void { // Re-create settings with no 'hash_salt' key. $settings = new Settings($config); $this->expectException(\RuntimeException::class); @@ -114,7 +114,7 @@ class SettingsTest extends UnitTestCase { * * @covers ::__sleep */ - public function testSerialize() { + public function testSerialize(): void { $this->expectException(\LogicException::class); serialize(new Settings([])); } @@ -124,7 +124,7 @@ class SettingsTest extends UnitTestCase { * * @covers ::getApcuPrefix */ - public function testGetApcuPrefix() { + public function testGetApcuPrefix(): void { $settings = new Settings([ 'hash_salt' => 123, 'apcu_ensure_unique_prefix' => TRUE, @@ -143,7 +143,7 @@ class SettingsTest extends UnitTestCase { * * @covers ::getInstance */ - public function testGetInstanceReflection() { + public function testGetInstanceReflection(): void { $settings = new Settings([]); $class = new \ReflectionClass(Settings::class); diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php index e406d11a02a..f88be207f40 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php @@ -21,7 +21,7 @@ class ContentLengthTest extends UnitTestCase { * @covers ::handle * @dataProvider providerTestSetContentLengthHeader */ - public function testHandle(false|int $expected_header, Response $response) { + public function testHandle(false|int $expected_header, Response $response): void { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/'); $kernel->handle($request, HttpKernelInterface::MAIN_REQUEST, TRUE)->willReturn($response); diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php index 594d6075db0..b5d76f38d27 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php @@ -42,7 +42,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { * * @covers ::getContentType */ - public function testAjaxIframeUpload() { + public function testAjaxIframeUpload(): void { $request = new Request(); $request->request->set('ajax_iframe_upload', '1'); @@ -54,7 +54,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { * * @covers ::getContentType */ - public function testFormatViaQueryParameter() { + public function testFormatViaQueryParameter(): void { $request = new Request(); $request->query->set('_format', 'bob'); @@ -66,7 +66,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { * * @covers ::getContentType */ - public function testUnknownContentTypeReturnsNull() { + public function testUnknownContentTypeReturnsNull(): void { $request = new Request(); $this->assertNull($this->contentNegotiation->getContentType($request)); @@ -77,7 +77,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { * * @covers ::getContentType */ - public function testUnknownContentTypeButAjaxRequest() { + public function testUnknownContentTypeButAjaxRequest(): void { $request = new Request(); $request->headers->set('X-Requested-With', 'XMLHttpRequest'); @@ -89,7 +89,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { * * @covers ::handle */ - public function testHandle() { + public function testHandle(): void { $request = $this->prophesize(Request::class); // Default empty format list should not set any formats. @@ -122,7 +122,7 @@ class NegotiationMiddlewareTest extends UnitTestCase { /** * @covers ::registerFormat */ - public function testSetFormat() { + public function testSetFormat(): void { $app = $this->createMock(HttpKernelInterface::class); $app->expects($this->once()) ->method('handle') diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php index dbc4e54de26..84af0968d8e 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php @@ -38,7 +38,7 @@ class ReverseProxyMiddlewareTest extends UnitTestCase { /** * Tests that subscriber does not act when reverse proxy is not set. */ - public function testNoProxy() { + public function testNoProxy(): void { $settings = new Settings([]); $this->assertEquals(0, $settings->get('reverse_proxy')); @@ -59,7 +59,7 @@ class ReverseProxyMiddlewareTest extends UnitTestCase { * * @dataProvider reverseProxyEnabledProvider */ - public function testReverseProxyEnabled($provided_settings, $expected_trusted_header_set) { + public function testReverseProxyEnabled($provided_settings, $expected_trusted_header_set): void { // Enable reverse proxy and add test values. $settings = new Settings(['reverse_proxy' => 1] + $provided_settings); $this->trustedHeadersAreSet($settings, $expected_trusted_header_set); diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php index a125ef27fb7..8f597af977f 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php @@ -20,7 +20,7 @@ class ByteSizeMarkupTest extends UnitTestCase { * @covers ::create * @dataProvider providerTestCommonFormatSize */ - public function testCommonFormatSize($expected, $input) { + public function testCommonFormatSize($expected, $input): void { $size = ByteSizeMarkup::create($input, NULL, $this->getStringTranslationStub()); $this->assertInstanceOf(TranslatableMarkup::class, $size); $this->assertEquals($expected, $size); diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php index b1af945cad2..15833c74b5e 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php @@ -21,7 +21,7 @@ class PluralTranslatableMarkupTest extends UnitTestCase { * * @dataProvider providerPluralTranslatableMarkupSerialization */ - public function testPluralTranslatableMarkupSerialization($count, $expected_text) { + public function testPluralTranslatableMarkupSerialization($count, $expected_text): void { // Add a mock string translation service to the container. $container = new ContainerBuilder(); $container->set('string_translation', $this->getStringTranslationStub()); @@ -46,7 +46,7 @@ class PluralTranslatableMarkupTest extends UnitTestCase { /** * Tests when the plural translation is missing. */ - public function testMissingPluralTranslation() { + public function testMissingPluralTranslation(): void { $markup = PluralTranslatableMarkup::createFromTranslatedString(2, 'There is no plural delimiter @count'); $this->assertEquals('There is no plural delimiter 2', $markup->render()); } diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php index 338c21a5c77..f3aca4a2466 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php @@ -53,7 +53,7 @@ class TranslatableMarkupTest extends UnitTestCase { * * @covers ::__toString */ - public function testToString() { + public function testToString(): void { $translation = $this->createMock(TranslationInterface::class); $string = 'May I have an exception?'; @@ -86,7 +86,7 @@ class TranslatableMarkupTest extends UnitTestCase { /** * @covers ::__construct */ - public function testIsStringAssertion() { + public function testIsStringAssertion(): void { $translation = $this->getStringTranslationStub(); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('$string ("foo") must be a string.'); @@ -96,7 +96,7 @@ class TranslatableMarkupTest extends UnitTestCase { /** * @covers ::__construct */ - public function testIsStringAssertionWithFormattableMarkup() { + public function testIsStringAssertionWithFormattableMarkup(): void { $formattable_string = new FormattableMarkup('@bar', ['@bar' => 'foo']); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('$string ("foo") must be a string.'); diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php index 5d8f7ca9bc8..70d0a96e7a3 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php @@ -49,7 +49,7 @@ class TranslationManagerTest extends UnitTestCase { /** * @dataProvider providerTestFormatPlural */ - public function testFormatPlural($count, $singular, $plural, array $args, array $options, $expected) { + public function testFormatPlural($count, $singular, $plural, array $args, array $options, $expected): void { $langcode = empty($options['langcode']) ? 'fr' : $options['langcode']; $translator = $this->createMock('\Drupal\Core\StringTranslation\Translator\TranslatorInterface'); $translator->expects($this->once()) @@ -77,7 +77,7 @@ class TranslationManagerTest extends UnitTestCase { * * @dataProvider providerTestTranslatePlaceholder */ - public function testTranslatePlaceholder($string, array $args, $expected_string) { + public function testTranslatePlaceholder($string, array $args, $expected_string): void { $actual = $this->translationManager->translate($string, $args); $this->assertInstanceOf(MarkupInterface::class, $actual); $this->assertEquals($expected_string, (string) $actual); diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php index 14850309076..e013aaed8cd 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php @@ -19,7 +19,7 @@ class TranslationWrapperTest extends UnitTestCase { /** * @covers ::__construct */ - public function testTranslationWrapper() { + public function testTranslationWrapper(): void { $object = new TranslationWrapper('Backward compatibility'); $this->assertInstanceOf(TranslatableMarkup::class, $object); } diff --git a/core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php b/core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php index 1a022273390..5bf7cd35f3a 100644 --- a/core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php +++ b/core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php @@ -101,7 +101,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::get */ - public function testGet() { + public function testGet(): void { $calls = ['1:test_2', '1:test', '1:test']; $this->keyValue->expects($this->exactly(count($calls))) ->method('get') @@ -124,7 +124,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::set */ - public function testSetWithNoLockAvailable() { + public function testSetWithNoLockAvailable(): void { $this->lock->expects($this->exactly(2)) ->method('acquire') ->with('1:test') @@ -145,7 +145,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::set */ - public function testSet() { + public function testSet(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('1:test') @@ -168,7 +168,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::getMetadata */ - public function testGetMetadata() { + public function testGetMetadata(): void { $this->keyValue->expects($this->exactly(2)) ->method('get') ->with('1:test') @@ -189,7 +189,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::delete */ - public function testDeleteLocking() { + public function testDeleteLocking(): void { $this->keyValue->expects($this->once()) ->method('get') ->with('1:test') @@ -216,7 +216,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::delete */ - public function testDeleteWithNoLockAvailable() { + public function testDeleteWithNoLockAvailable(): void { $this->keyValue->expects($this->once()) ->method('get') ->with('1:test') @@ -241,7 +241,7 @@ class PrivateTempStoreTest extends UnitTestCase { * * @covers ::delete */ - public function testDelete() { + public function testDelete(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('1:test_2') diff --git a/core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php b/core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php index f0d474c534a..78b70369831 100644 --- a/core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php +++ b/core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php @@ -100,7 +100,7 @@ class SharedTempStoreTest extends UnitTestCase { /** * @covers ::get */ - public function testGet() { + public function testGet(): void { $calls = ['test_2', 'test']; $this->keyValue->expects($this->exactly(count($calls))) ->method('get') @@ -121,7 +121,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::getIfOwner */ - public function testGetIfOwner() { + public function testGetIfOwner(): void { $calls = ['test_2', 'test', 'test']; $this->keyValue->expects($this->exactly(count($calls))) ->method('get') @@ -144,7 +144,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::set */ - public function testSetWithNoLockAvailable() { + public function testSetWithNoLockAvailable(): void { $this->lock->expects($this->exactly(2)) ->method('acquire') ->with('test') @@ -165,7 +165,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::set */ - public function testSet() { + public function testSet(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('test') @@ -188,7 +188,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::setIfNotExists */ - public function testSetIfNotExists() { + public function testSetIfNotExists(): void { $this->keyValue->expects($this->once()) ->method('setWithExpireIfNotExists') ->with('test', $this->ownObject, 604800) @@ -202,7 +202,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::setIfOwner */ - public function testSetIfOwnerWhenNotExists() { + public function testSetIfOwnerWhenNotExists(): void { $this->keyValue->expects($this->once()) ->method('setWithExpireIfNotExists') ->willReturn(TRUE); @@ -215,7 +215,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::setIfOwner */ - public function testSetIfOwnerNoObject() { + public function testSetIfOwnerNoObject(): void { $this->keyValue->expects($this->once()) ->method('setWithExpireIfNotExists') ->willReturn(FALSE); @@ -233,7 +233,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::setIfOwner */ - public function testSetIfOwner() { + public function testSetIfOwner(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('test') @@ -257,7 +257,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::getMetadata */ - public function testGetMetadata() { + public function testGetMetadata(): void { $this->keyValue->expects($this->exactly(2)) ->method('get') ->with('test') @@ -277,7 +277,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::delete */ - public function testDelete() { + public function testDelete(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('test') @@ -300,7 +300,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::delete */ - public function testDeleteWithNoLockAvailable() { + public function testDeleteWithNoLockAvailable(): void { $this->lock->expects($this->exactly(2)) ->method('acquire') ->with('test') @@ -321,7 +321,7 @@ class SharedTempStoreTest extends UnitTestCase { * * @covers ::deleteIfOwner */ - public function testDeleteIfOwner() { + public function testDeleteIfOwner(): void { $this->lock->expects($this->once()) ->method('acquire') ->with('test_2') @@ -350,7 +350,7 @@ class SharedTempStoreTest extends UnitTestCase { /** * Tests the serialization of a shared temp store. */ - public function testSerialization() { + public function testSerialization(): void { // Add an unserializable request to the request stack. If the tempstore // didn't use DependencySerializationTrait, an exception would be thrown // when we try to serialize the tempstore. diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php index 4590a145b44..6de70227fa5 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php @@ -35,7 +35,7 @@ class AttributeHelperTest extends UnitTestCase { * @covers ::attributeExists * @dataProvider providerTestAttributeExists */ - public function testAttributeExists(array $test_data, $test_attribute, $expected) { + public function testAttributeExists(array $test_data, $test_attribute, $expected): void { $this->assertSame($expected, AttributeHelper::attributeExists($test_attribute, $test_data)); $attributes = new Attribute($test_data); $this->assertSame($expected, AttributeHelper::attributeExists($test_attribute, $attributes)); @@ -63,7 +63,7 @@ class AttributeHelperTest extends UnitTestCase { * @covers ::mergeCollections * @dataProvider providerTestMergeCollections */ - public function testMergeCollections($original, $merge, $expected) { + public function testMergeCollections($original, $merge, $expected): void { $this->assertEquals($expected, AttributeHelper::mergeCollections($original, $merge)); $this->assertEquals(new Attribute($expected), AttributeHelper::mergeCollections(new Attribute($original), $merge)); } @@ -71,7 +71,7 @@ class AttributeHelperTest extends UnitTestCase { /** * @covers ::mergeCollections */ - public function testMergeCollectionsArgumentException() { + public function testMergeCollectionsArgumentException(): void { $attributes = new Attribute(['class' => ['example-class']]); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid collection argument'); diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php index 4b708c23948..f76bc92c757 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php @@ -23,7 +23,7 @@ class AttributeTest extends UnitTestCase { /** * Tests the constructor of the attribute class. */ - public function testConstructor() { + public function testConstructor(): void { $attribute = new Attribute(['class' => ['example-class']]); $this->assertTrue(isset($attribute['class'])); $this->assertEquals(new AttributeArray('class', ['example-class']), $attribute['class']); @@ -49,7 +49,7 @@ class AttributeTest extends UnitTestCase { /** * Tests set of values. */ - public function testSet() { + public function testSet(): void { $attribute = new Attribute(); $attribute['class'] = ['example-class']; @@ -60,7 +60,7 @@ class AttributeTest extends UnitTestCase { /** * Tests adding new values to an existing part of the attribute. */ - public function testAdd() { + public function testAdd(): void { $attribute = new Attribute(['class' => ['example-class']]); $attribute['class'][] = 'other-class'; @@ -70,7 +70,7 @@ class AttributeTest extends UnitTestCase { /** * Tests removing of values. */ - public function testRemove() { + public function testRemove(): void { $attribute = new Attribute(['class' => ['example-class']]); unset($attribute['class']); $this->assertFalse(isset($attribute['class'])); @@ -80,7 +80,7 @@ class AttributeTest extends UnitTestCase { * Tests setting attributes. * @covers ::setAttribute */ - public function testSetAttribute() { + public function testSetAttribute(): void { $attribute = new Attribute(); // Test adding various attributes. @@ -108,7 +108,7 @@ class AttributeTest extends UnitTestCase { * Tests removing attributes. * @covers ::removeAttribute */ - public function testRemoveAttribute() { + public function testRemoveAttribute(): void { $attributes = [ 'alt' => 'Alternative text', 'id' => 'bunny', @@ -147,7 +147,7 @@ class AttributeTest extends UnitTestCase { * Tests adding class attributes with the AttributeArray helper method. * @covers ::addClass */ - public function testAddClasses() { + public function testAddClasses(): void { // Add empty Attribute object with no classes. $attribute = new Attribute(); @@ -199,7 +199,7 @@ class AttributeTest extends UnitTestCase { * Tests removing class attributes with the AttributeArray helper method. * @covers ::removeClass */ - public function testRemoveClasses() { + public function testRemoveClasses(): void { // Add duplicate class to ensure that both duplicates are removed. $classes = ['example-class', 'aa', 'xx', 'yy', 'red', 'green', 'blue', 'red']; $attribute = new Attribute(['class' => $classes]); @@ -230,7 +230,7 @@ class AttributeTest extends UnitTestCase { * Tests checking for class names with the Attribute method. * @covers ::hasClass */ - public function testHasClass() { + public function testHasClass(): void { // Test an attribute without any classes. $attribute = new Attribute(); $this->assertFalse($attribute->hasClass('a-class-nowhere-to-be-found')); @@ -246,7 +246,7 @@ class AttributeTest extends UnitTestCase { * @covers ::removeClass * @covers ::addClass */ - public function testChainAddRemoveClasses() { + public function testChainAddRemoveClasses(): void { $attribute = new Attribute( ['class' => ['example-class', 'red', 'green', 'blue']] ); @@ -266,7 +266,7 @@ class AttributeTest extends UnitTestCase { * @covers ::removeClass * @covers ::addClass */ - public function testTwigAddRemoveClasses($template, $expected, $seed_attributes = []) { + public function testTwigAddRemoveClasses($template, $expected, $seed_attributes = []): void { $loader = new StringLoader(); $twig = new Environment($loader); $data = ['attributes' => new Attribute($seed_attributes)]; @@ -322,7 +322,7 @@ class AttributeTest extends UnitTestCase { /** * Tests iterating on the values of the attribute. */ - public function testIterate() { + public function testIterate(): void { $attribute = new Attribute(['class' => ['example-class'], 'id' => 'example-id']); $counter = 0; @@ -342,7 +342,7 @@ class AttributeTest extends UnitTestCase { /** * Tests printing of an attribute. */ - public function testPrint() { + public function testPrint(): void { $attribute = new Attribute(['class' => ['example-class'], 'id' => 'example-id', 'enabled' => TRUE]); $content = $this->randomMachineName(); @@ -360,7 +360,7 @@ class AttributeTest extends UnitTestCase { * @covers ::createAttributeValue * @dataProvider providerTestAttributeValues */ - public function testAttributeValues(array $attributes, $expected) { + public function testAttributeValues(array $attributes, $expected): void { $this->assertEquals($expected, (new Attribute($attributes))->__toString()); } @@ -458,7 +458,7 @@ class AttributeTest extends UnitTestCase { /** * Tests the storage method. */ - public function testStorage() { + public function testStorage(): void { $attribute = new Attribute(['class' => ['example-class']]); $this->assertEquals(['class' => new AttributeArray('class', ['example-class'])], $attribute->storage()); @@ -485,7 +485,7 @@ class AttributeTest extends UnitTestCase { * @covers ::hasAttribute * @dataProvider providerTestHasAttribute */ - public function testHasAttribute(array $test_data, $test_attribute, $expected) { + public function testHasAttribute(array $test_data, $test_attribute, $expected): void { $attributes = new Attribute($test_data); $this->assertSame($expected, $attributes->hasAttribute($test_attribute)); } @@ -509,14 +509,14 @@ class AttributeTest extends UnitTestCase { * @covers ::merge * @dataProvider providerTestMerge */ - public function testMerge($original, $merge, $expected) { + public function testMerge($original, $merge, $expected): void { $this->assertEquals($expected, $original->merge($merge)); } /** * @covers ::merge */ - public function testMergeArgumentException() { + public function testMergeArgumentException(): void { $attributes = new Attribute(['class' => ['example-class']]); $this->expectException(\TypeError::class); $attributes->merge('not an array'); diff --git a/core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php b/core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php index 861d1d4c0fe..bd7cfe96638 100644 --- a/core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php +++ b/core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php @@ -16,7 +16,7 @@ class ThemeRegistryLoaderTest extends UnitTestCase { /** * @covers ::findTemplate */ - public function testLoaderReturnsFalseForExistsOnNonexistent() { + public function testLoaderReturnsFalseForExistsOnNonexistent(): void { $registry = $this->prophesize('Drupal\Core\Theme\Registry'); $runtime = $this->prophesize('Drupal\Core\Utility\ThemeRegistry'); $runtime->has('foo') diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php index cfa4c6ba001..e89c0c12fc7 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php @@ -96,7 +96,7 @@ class TwigExtensionTest extends UnitTestCase { * * @dataProvider providerTestEscaping */ - public function testEscaping($template, $expected) { + public function testEscaping($template, $expected): void { $loader = new FilesystemLoader(); $twig = new Environment($loader, [ 'debug' => TRUE, @@ -148,7 +148,7 @@ class TwigExtensionTest extends UnitTestCase { /** * Tests the active_theme function. */ - public function testActiveTheme() { + public function testActiveTheme(): void { $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme') ->disableOriginalConstructor() ->getMock(); @@ -169,7 +169,7 @@ class TwigExtensionTest extends UnitTestCase { /** * Tests the format_date filter. */ - public function testFormatDate() { + public function testFormatDate(): void { $this->dateFormatter->expects($this->exactly(1)) ->method('format') ->willReturnCallback(function ($timestamp) { @@ -187,7 +187,7 @@ class TwigExtensionTest extends UnitTestCase { /** * Tests the file_url filter. */ - public function testFileUrl() { + public function testFileUrl(): void { $this->fileUrlGenerator->expects($this->once()) ->method('generateString') ->with('public://picture.jpg') @@ -203,7 +203,7 @@ class TwigExtensionTest extends UnitTestCase { /** * Tests the active_theme_path function. */ - public function testActiveThemePath() { + public function testActiveThemePath(): void { $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme') ->disableOriginalConstructor() ->getMock(); @@ -227,7 +227,7 @@ class TwigExtensionTest extends UnitTestCase { * * @covers ::escapeFilter */ - public function testSafeStringEscaping() { + public function testSafeStringEscaping(): void { $loader = new FilesystemLoader(); $twig = new Environment($loader, [ 'debug' => TRUE, @@ -249,7 +249,7 @@ class TwigExtensionTest extends UnitTestCase { /** * @covers ::safeJoin */ - public function testSafeJoin() { + public function testSafeJoin(): void { $this->renderer->expects($this->any()) ->method('render') ->with(['#markup' => '<strong>will be rendered</strong>', '#printed' => FALSE]) @@ -288,7 +288,7 @@ class TwigExtensionTest extends UnitTestCase { /** * @dataProvider providerTestRenderVar */ - public function testRenderVar($result, $input) { + public function testRenderVar($result, $input): void { $this->renderer->expects($this->any()) ->method('render') ->with($result += ['#printed' => FALSE]) @@ -312,7 +312,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::escapeFilter * @covers ::bubbleArgMetadata */ - public function testEscapeWithGeneratedLink() { + public function testEscapeWithGeneratedLink(): void { $loader = new FilesystemLoader(); $twig = new Environment($loader, [ 'debug' => TRUE, @@ -345,7 +345,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::renderVar * @covers ::bubbleArgMetadata */ - public function testRenderVarWithGeneratedLink() { + public function testRenderVarWithGeneratedLink(): void { $link = new GeneratedLink(); $link->setGeneratedLink('<a href="http://example.com"></a>'); $link->addCacheTags(['foo']); @@ -369,7 +369,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::renderVar * @dataProvider providerTestRenderVarEarlyReturn */ - public function testRenderVarEarlyReturn($expected, $input) { + public function testRenderVarEarlyReturn($expected, $input): void { $result = $this->systemUnderTest->renderVar($input); $this->assertSame($expected, $result); } @@ -397,7 +397,7 @@ class TwigExtensionTest extends UnitTestCase { * * @covers ::createAttribute */ - public function testCreateAttribute() { + public function testCreateAttribute(): void { $name = '__string_template_test_1__'; $loader = new ArrayLoader([$name => "{% for iteration in iterations %}<div{{ create_attribute(iteration) }}></div>{% endfor %}"]); $twig = new Environment($loader); @@ -425,7 +425,7 @@ class TwigExtensionTest extends UnitTestCase { /** * @covers ::getLink */ - public function testLinkWithOverriddenAttributes() { + public function testLinkWithOverriddenAttributes(): void { $url = Url::fromRoute('<front>', [], ['attributes' => ['class' => ['foo']]]); $build = $this->systemUnderTest->getLink('test', $url, ['class' => ['bar']]); @@ -439,7 +439,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::suggestThemeHook * @dataProvider providerTestTwigAddSuggestionFilter */ - public function testTwigAddSuggestionFilter($original_render_array, $suggestion, $expected_render_array) { + public function testTwigAddSuggestionFilter($original_render_array, $suggestion, $expected_render_array): void { $processed_render_array = $this->systemUnderTest->suggestThemeHook($original_render_array, $suggestion); $this->assertEquals($expected_render_array, $processed_render_array); } @@ -555,7 +555,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::addClass * @dataProvider providerTestTwigAddClass */ - public function testTwigAddClass($element, $classes, $expected_result) { + public function testTwigAddClass($element, $classes, $expected_result): void { $processed = $this->systemUnderTest->addClass($element, $classes); $this->assertEquals($expected_result, $processed); } @@ -605,7 +605,7 @@ class TwigExtensionTest extends UnitTestCase { * @covers ::setAttribute * @dataProvider providerTestTwigSetAttribute */ - public function testTwigSetAttribute($element, $key, $value, $expected_result) { + public function testTwigSetAttribute($element, $key, $value, $expected_result): void { $processed = $this->systemUnderTest->setAttribute($element, $key, $value); $this->assertEquals($expected_result, $processed); } diff --git a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php index 82400aab7c5..9af863dcc85 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php @@ -47,7 +47,7 @@ class TwigSandboxTest extends UnitTestCase { * * @dataProvider getTwigEntityDangerousMethods */ - public function testEntityDangerousMethods($template) { + public function testEntityDangerousMethods($template): void { $entity = $this->createMock('Drupal\Core\Entity\EntityInterface'); $this->expectException(SecurityError::class); $this->twig->render($template, ['entity' => $entity]); @@ -69,7 +69,7 @@ class TwigSandboxTest extends UnitTestCase { /** * Tests that white listed classes can be extended. */ - public function testExtendedClass() { + public function testExtendedClass(): void { $this->assertEquals(' class="kitten"', $this->twig->render('{{ attribute.addClass("kitten") }}', ['attribute' => new TestAttribute()])); } @@ -78,7 +78,7 @@ class TwigSandboxTest extends UnitTestCase { * * Currently "get", "has", and "is" are the only allowed prefixes. */ - public function testEntitySafePrefixes() { + public function testEntitySafePrefixes(): void { $entity = $this->createMock('Drupal\Core\Entity\EntityInterface'); $entity->expects($this->atLeastOnce()) ->method('hasLinkTemplate') @@ -108,7 +108,7 @@ class TwigSandboxTest extends UnitTestCase { * Currently the following methods are whitelisted: id, label, bundle, and * get. */ - public function testEntitySafeMethods() { + public function testEntitySafeMethods(): void { $entity = $this->getMockBuilder(ContentEntityBaseMockableClass::class) ->disableOriginalConstructor() ->getMock(); @@ -144,7 +144,7 @@ class TwigSandboxTest extends UnitTestCase { /** * Tests that safe methods inside Url objects can be called. */ - public function testUrlSafeMethods() { + public function testUrlSafeMethods(): void { $url = $this->getMockBuilder('Drupal\Core\Url') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php b/core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php index 2b388facd23..9951d3970aa 100644 --- a/core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php @@ -18,7 +18,7 @@ class AssertContentTraitTest extends UnitTestCase { /** * @covers ::getTextContent */ - public function testGetTextContent() { + public function testGetTextContent(): void { $raw_content = <<<EOT diff --git a/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php b/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php index ad8e2eeba54..43ff47406ec 100644 --- a/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php @@ -39,7 +39,7 @@ class BrowserTestBaseTest extends UnitTestCase { /** * @covers ::getHttpClient */ - public function testGetHttpClient() { + public function testGetHttpClient(): void { // Our stand-in for the Guzzle client object. $expected = new \stdClass(); @@ -62,7 +62,7 @@ class BrowserTestBaseTest extends UnitTestCase { /** * @covers ::getHttpClient */ - public function testGetHttpClientException() { + public function testGetHttpClientException(): void { // A driver type that isn't BrowserKitDriver. This should cause a // RuntimeException. $btb = $this->mockBrowserTestBaseWithDriver(new \stdClass()); @@ -79,7 +79,7 @@ class BrowserTestBaseTest extends UnitTestCase { * * @covers ::tearDown */ - public function testTearDownWithoutSetUp() { + public function testTearDownWithoutSetUp(): void { $method = 'cleanupEnvironment'; $this->assertTrue(method_exists(BrowserTestBase::class, $method)); $btb = $this->getMockBuilder(BrowserTestBaseMockableClass::class) diff --git a/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php b/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php index 2eaebb14c5b..49599b0e4ae 100644 --- a/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php +++ b/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php @@ -27,7 +27,7 @@ class JUnitConverterTest extends UnitTestCase { * Tests errors reported. * @covers ::xmlToRows */ - public function testXmlToRowsWithErrors() { + public function testXmlToRowsWithErrors(): void { $phpunit_error_xml = __DIR__ . '/fixtures/phpunit_error.xml'; $res = JUnitConverter::xmlToRows(1, $phpunit_error_xml); @@ -48,7 +48,7 @@ class JUnitConverterTest extends UnitTestCase { /** * @covers ::xmlToRows */ - public function testXmlToRowsEmptyFile() { + public function testXmlToRowsEmptyFile(): void { // File system with an empty XML file. vfsStream::setup('junit_test', NULL, ['empty.xml' => '']); $this->assertSame([], JUnitConverter::xmlToRows(23, vfsStream::url('junit_test/empty.xml'))); @@ -57,7 +57,7 @@ class JUnitConverterTest extends UnitTestCase { /** * @covers ::xmlElementToRows */ - public function testXmlElementToRows() { + public function testXmlElementToRows(): void { $junit = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <testsuites> @@ -84,7 +84,7 @@ EOD; /** * @covers ::convertTestCaseToSimpletestRow */ - public function testConvertTestCaseToSimpletestRow() { + public function testConvertTestCaseToSimpletestRow(): void { $junit = <<<EOD <testcase name="testGetTestClasses" class="Drupal\Tests\simpletest\Unit\TestDiscoveryTest" classname="Drupal.Tests.simpletest.Unit.TestDiscoveryTest" file="/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php" line="108" assertions="2" time="0.100787"/> EOD; diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitAutoloaderTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitAutoloaderTest.php index 1620a8970c0..98322cfcfb5 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitAutoloaderTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitAutoloaderTest.php @@ -16,7 +16,7 @@ class PhpUnitAutoloaderTest extends UnitTestCase { /** * Tests loading of classes provided by test sub modules. */ - public function testPhpUnitTestClassesLoading() { + public function testPhpUnitTestClassesLoading(): void { $this->assertTrue(class_exists('\Drupal\phpunit_test\PhpUnitTestDummyClass'), 'Class provided by test module was not autoloaded.'); } diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeIsolatedTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeIsolatedTest.php index 92fa96d2a16..f62d39d185e 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeIsolatedTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeIsolatedTest.php @@ -18,7 +18,7 @@ use Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass; */ class PhpUnitBridgeIsolatedTest extends UnitTestCase { - public function testDeprecatedClass() { + public function testDeprecatedClass(): void { $this->expectDeprecation('Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass is deprecated.'); $deprecated = new FixtureDeprecatedClass(); $this->assertEquals('test', $deprecated->testFunction()); diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php index 79420875f4e..d964a2f42be 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php @@ -18,13 +18,13 @@ class PhpUnitBridgeTest extends UnitTestCase { /** * Tests class-level deprecation. */ - public function testDeprecatedClass() { + public function testDeprecatedClass(): void { $this->expectDeprecation('Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass is deprecated.'); $deprecated = new FixtureDeprecatedClass(); $this->assertEquals('test', $deprecated->testFunction()); } - public function testDeprecatedFunction() { + public function testDeprecatedFunction(): void { $this->markTestIncomplete('Modules are not loaded for unit tests, so deprecated_test_function() will not be available.'); $this->assertEquals('known_return_value', \deprecation_test_function()); } diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php index 926a7cdedc5..5ec76e7820f 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php @@ -22,7 +22,7 @@ class PhpUnitCliTest extends UnitTestCase { * us from committing tests which don't break under run-tests.sh, but do * break under the PHPUnit CLI test runner tool. */ - public function testPhpUnitListTests() { + public function testPhpUnitListTests(): void { $command = [ 'vendor/bin/phpunit', '--configuration', diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php index c8dc2cd27b6..8047ece4fc4 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php @@ -23,7 +23,7 @@ class PhpUnitTestRunnerTest extends UnitTestCase { * * @covers ::execute */ - public function testRunTestsError() { + public function testRunTestsError(): void { $test_id = 23; $log_path = 'test_log_path'; @@ -86,7 +86,7 @@ class PhpUnitTestRunnerTest extends UnitTestCase { /** * @covers ::phpUnitCommand */ - public function testPhpUnitCommand() { + public function testPhpUnitCommand(): void { $runner = new PhpUnitTestRunner($this->root, sys_get_temp_dir()); $this->assertMatchesRegularExpression('/phpunit/', $runner->phpUnitCommand()); } @@ -94,7 +94,7 @@ class PhpUnitTestRunnerTest extends UnitTestCase { /** * @covers ::xmlLogFilePath */ - public function testXmlLogFilePath() { + public function testXmlLogFilePath(): void { $runner = new PhpUnitTestRunner($this->root, sys_get_temp_dir()); $this->assertStringEndsWith('phpunit-23.xml', $runner->xmlLogFilePath(23)); } @@ -144,7 +144,7 @@ class PhpUnitTestRunnerTest extends UnitTestCase { * @dataProvider providerTestSummarizeResults * @covers ::summarizeResults */ - public function testSummarizeResults($results, $has_status) { + public function testSummarizeResults($results, $has_status): void { $runner = new PhpUnitTestRunner($this->root, sys_get_temp_dir()); $summary = $runner->summarizeResults($results); diff --git a/core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php b/core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php index dbcb853143d..957b2f61f97 100644 --- a/core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php +++ b/core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php @@ -69,7 +69,7 @@ COMPOUND * @covers ::parseContents * @dataProvider provideTestFileContents */ - public function testParseContents($expected, $contents) { + public function testParseContents($expected, $contents): void { $parser = new TestFileParser(); $ref_parse = new \ReflectionMethod($parser, 'parseContents'); @@ -80,7 +80,7 @@ COMPOUND /** * @covers ::getTestListFromFile */ - public function testGetTestListFromFile() { + public function testGetTestListFromFile(): void { $parser = new TestFileParser(); $this->assertEquals( ['Drupal\Tests\Core\Test\RunTests\TestFileParserTest'], diff --git a/core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php b/core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php index a96d79e38a6..1660ac381ed 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php @@ -19,7 +19,7 @@ class TestDatabaseTest extends UnitTestCase { /** * @covers ::__construct */ - public function testConstructorException() { + public function testConstructorException(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage("Invalid database prefix: blah1253"); new TestDatabase('blah1253'); @@ -33,7 +33,7 @@ class TestDatabaseTest extends UnitTestCase { * * @dataProvider providerTestConstructor */ - public function testConstructor($db_prefix, $expected_db_prefix, $expected_site_path) { + public function testConstructor($db_prefix, $expected_db_prefix, $expected_site_path): void { $test_db = new TestDatabase($db_prefix); $this->assertEquals($expected_db_prefix, $test_db->getDatabasePrefix()); $this->assertEquals($expected_site_path, $test_db->getTestSitePath()); @@ -58,7 +58,7 @@ class TestDatabaseTest extends UnitTestCase { * @covers ::getTestSitePath * @covers ::getPhpErrorLogPath */ - public function testConstructorNullPrefix() { + public function testConstructorNullPrefix(): void { // We use a stub class here because we can't mock getTestLock() so that it's // available before the constructor is called. $test_db = new TestTestDatabase(NULL); diff --git a/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php index 9b9053c3ba8..c747e896eee 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php @@ -24,7 +24,7 @@ class TestDiscoveryTest extends UnitTestCase { * @covers ::getTestInfo * @dataProvider infoParserProvider */ - public function testTestInfoParser($expected, $classname, $doc_comment = NULL) { + public function testTestInfoParser($expected, $classname, $doc_comment = NULL): void { $info = TestDiscovery::getTestInfo($classname, $doc_comment); $this->assertEquals($expected, $info); } @@ -205,7 +205,7 @@ class TestDiscoveryTest extends UnitTestCase { /** * @covers ::getTestInfo */ - public function testTestInfoParserMissingGroup() { + public function testTestInfoParserMissingGroup(): void { $classname = 'Drupal\KernelTests\field\BulkDeleteTest'; $doc_comment = <<<EOT /** @@ -220,7 +220,7 @@ EOT; /** * @covers ::getTestInfo */ - public function testTestInfoParserMissingSummary() { + public function testTestInfoParserMissingSummary(): void { $classname = 'Drupal\KernelTests\field\BulkDeleteTest'; $doc_comment = <<<EOT /** @@ -299,7 +299,7 @@ EOF; /** * @covers ::getTestClasses */ - public function testGetTestClasses() { + public function testGetTestClasses(): void { $this->setupVfsWithTestClasses(); $extensions = [ 'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'), @@ -368,7 +368,7 @@ EOF; /** * @covers ::getTestClasses */ - public function testGetTestClassesWithSelectedTypes() { + public function testGetTestClassesWithSelectedTypes(): void { $this->setupVfsWithTestClasses(); $extensions = [ 'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'), @@ -413,7 +413,7 @@ EOF; /** * @covers ::getTestClasses */ - public function testGetTestsInProfiles() { + public function testGetTestsInProfiles(): void { $this->setupVfsWithTestClasses(); $class_loader = $this->prophesize(ClassLoader::class); @@ -443,7 +443,7 @@ EOF; * @covers ::getPhpunitTestSuite * @dataProvider providerTestGetPhpunitTestSuite */ - public function testGetPhpunitTestSuite($classname, $expected) { + public function testGetPhpunitTestSuite($classname, $expected): void { $this->assertEquals($expected, TestDiscovery::getPhpunitTestSuite($classname)); } @@ -470,7 +470,7 @@ EOF; * * @covers ::getTestInfo */ - public function testGetTestInfoEmptyDocblock() { + public function testGetTestInfoEmptyDocblock(): void { // If getTestInfo() performed reflection, it won't be able to find the // class we asked it to analyze, so it will throw a ReflectionException. // We want to make sure it didn't do that, because we already did some @@ -485,7 +485,7 @@ EOF; * * @covers ::scanDirectory */ - public function testScanDirectoryNoAbstract() { + public function testScanDirectoryNoAbstract(): void { $this->setupVfsWithTestClasses(); $files = TestDiscovery::scanDirectory('Drupal\\Tests\\test_module\\Kernel\\', vfsStream::url('drupal/modules/test_module/tests/src/Kernel')); $this->assertNotEmpty($files); diff --git a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php index b6f74c017f4..ba1d28a50c6 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php @@ -26,7 +26,7 @@ class TestSetupTraitTest extends UnitTestCase { * * @covers ::changeDatabasePrefix */ - public function testChangeDatabasePrefix() { + public function testChangeDatabasePrefix(): void { $root = dirname(__FILE__, 7); putenv('SIMPLETEST_DB=pgsql://user:pass@127.0.0.1/db'); $connection_info = Database::convertDbUrlToConnectionInfo('mysql://user:pass@localhost/db', $root); diff --git a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php index 13fdffbb790..db4ccefa9cb 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php @@ -14,7 +14,7 @@ class TestSuiteBaseTest extends TestCase { /** * Tests the assumption that local time is in 'Australia/Sydney'. */ - public function testLocalTimeZone() { + public function testLocalTimeZone(): void { // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php $this->assertEquals('Australia/Sydney', date_default_timezone_get()); } diff --git a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php index 612dbb10797..4d38efb908d 100644 --- a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php @@ -56,7 +56,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { * @covers ::applies * @dataProvider providerTestApplies */ - public function testApplies($request_data, $expected) { + public function testApplies($request_data, $expected): void { $request = new Request(); foreach ($request_data as $key => $data) { $request->query->set($key, $data); @@ -80,7 +80,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { /** * @covers ::determineActiveTheme */ - public function testDetermineActiveThemeValidToken() { + public function testDetermineActiveThemeValidToken(): void { $theme = 'claro'; $theme_token = 'valid_theme_token'; @@ -98,7 +98,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { /** * @covers ::determineActiveTheme */ - public function testDetermineActiveThemeInvalidToken() { + public function testDetermineActiveThemeInvalidToken(): void { $theme = 'claro'; $theme_token = 'invalid_theme_token'; $request = new Request(); @@ -116,7 +116,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { /** * @covers ::determineActiveTheme */ - public function testDetermineActiveThemeDefaultTheme() { + public function testDetermineActiveThemeDefaultTheme(): void { $theme = 'stark'; // When the theme is the system default, an empty string is provided as the // theme token. See system_js_settings_alter(). diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php index 8eec15748d4..4e0555eb2ae 100644 --- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php @@ -21,7 +21,7 @@ class ComponentMetadataTest extends UnitTestCaseTest { * * @dataProvider dataProviderMetadata */ - public function testMetadata(array $metadata_info, array $expectations) { + public function testMetadata(array $metadata_info, array $expectations): void { $metadata = new ComponentMetadata($metadata_info, 'foo/', FALSE); $this->assertSame($expectations['path'], $metadata->path); $this->assertSame($expectations['status'], $metadata->status); @@ -34,7 +34,7 @@ class ComponentMetadataTest extends UnitTestCaseTest { * * @dataProvider dataProviderMetadata */ - public function testMetadataEnforceSchema(array $metadata_info, array $expectations, bool $missing_schema) { + public function testMetadataEnforceSchema(array $metadata_info, array $expectations, bool $missing_schema): void { if ($missing_schema) { $this->expectException(InvalidComponentException::class); $this->expectExceptionMessage('The component "' . $metadata_info['id'] . '" does not provide schema information. Schema definitions are mandatory for components declared in modules. For components declared in themes, schema definitions are only mandatory if the "enforce_prop_schemas" key is set to "true" in the theme info file.'); diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php index f962d50de02..b36717f3a24 100644 --- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentPluginManagerTest.php @@ -44,7 +44,7 @@ class ComponentPluginManagerTest extends ComponentKernelTestBase { * * And not from the enclosing directory. */ - public function testMismatchingFolderName() { + public function testMismatchingFolderName(): void { $this->expectException(ComponentNotFoundException::class); $this->manager->find('sdc_theme_test:mismatching-folder-name'); } diff --git a/core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php b/core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php index dbd6ee68851..b00a01663b4 100644 --- a/core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php +++ b/core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php @@ -17,7 +17,7 @@ class CoreThemesAutoloadedForTests extends UnitTestCase { /** * Confirms that core/themes is autoloaded for tests. */ - public function testCoreThemesAutoloadedForTests() { + public function testCoreThemesAutoloadedForTests(): void { $this->assertTrue(class_exists(ClaroPreRender::class), 'core/themes (ClaroPreRender) is registered with the tests autoloader'); } diff --git a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php index 7f6a63ab81b..a7f14c67bb5 100644 --- a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php @@ -123,7 +123,7 @@ class RegistryTest extends UnitTestCase { /** * Tests getting the theme registry defined by a module. */ - public function testGetRegistryForModule() { + public function testGetRegistryForModule(): void { $test_theme = new ActiveTheme([ 'name' => 'test_theme', 'path' => 'core/modules/system/tests/themes/test_theme/test_theme.info.yml', @@ -205,7 +205,7 @@ class RegistryTest extends UnitTestCase { * @param array $expected * The expected results. */ - public function testPostProcessExtension($defined_functions, $hooks, $expected) { + public function testPostProcessExtension($defined_functions, $hooks, $expected): void { static::$functions['user'] = $defined_functions; $theme = $this->prophesize(ActiveTheme::class); diff --git a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php index bda597a2b05..62ebf8d1ccb 100644 --- a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php @@ -62,7 +62,7 @@ class ThemeNegotiatorTest extends UnitTestCase { * * @see \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme() */ - public function testDetermineActiveTheme() { + public function testDetermineActiveTheme(): void { $negotiator = $this->createMock('Drupal\Core\Theme\ThemeNegotiatorInterface'); $negotiator->expects($this->once()) ->method('determineActiveTheme') @@ -90,7 +90,7 @@ class ThemeNegotiatorTest extends UnitTestCase { * * @see \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme() */ - public function testDetermineActiveThemeWithPriority() { + public function testDetermineActiveThemeWithPriority(): void { $negotiators = []; $negotiator = $this->createMock('Drupal\Core\Theme\ThemeNegotiatorInterface'); @@ -130,7 +130,7 @@ class ThemeNegotiatorTest extends UnitTestCase { * * @see \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme() */ - public function testDetermineActiveThemeWithAccessCheck() { + public function testDetermineActiveThemeWithAccessCheck(): void { $negotiators = []; $negotiator = $this->createMock('Drupal\Core\Theme\ThemeNegotiatorInterface'); @@ -175,7 +175,7 @@ class ThemeNegotiatorTest extends UnitTestCase { * * @see \Drupal\Core\Theme\ThemeNegotiatorInterface */ - public function testDetermineActiveThemeWithNotApplyingNegotiator() { + public function testDetermineActiveThemeWithNotApplyingNegotiator(): void { $negotiators = []; $negotiator = $this->createMock('Drupal\Core\Theme\ThemeNegotiatorInterface'); diff --git a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php index b395c49ed9f..088e70325f4 100644 --- a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php +++ b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php @@ -32,7 +32,7 @@ class PhpTransliterationTest extends UnitTestCase { * * @dataProvider providerTestPhpTransliterationWithAlter */ - public function testPhpTransliterationWithAlter($langcode, $original, $expected, $printable = NULL) { + public function testPhpTransliterationWithAlter($langcode, $original, $expected, $printable = NULL): void { if ($printable === NULL) { $printable = $original; } diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php index c1a04940801..f43d9bcd7dc 100644 --- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php @@ -94,7 +94,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { * * @covers ::validate */ - public function testValidateWithGroups() { + public function testValidateWithGroups(): void { $this->expectException(\LogicException::class); $this->recursiveValidator->validate('test', NULL, 'test group'); } @@ -104,7 +104,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { * * @covers ::validate */ - public function testValidateWithoutTypedData() { + public function testValidateWithoutTypedData(): void { $this->expectException(\InvalidArgumentException::class); $this->recursiveValidator->validate('test'); } @@ -112,7 +112,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testBasicValidateWithoutConstraints() { + public function testBasicValidateWithoutConstraints(): void { $typed_data = $this->typedDataManager->create(DataDefinition::create('string')); $violations = $this->recursiveValidator->validate($typed_data); $this->assertCount(0, $violations); @@ -121,7 +121,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testBasicValidateWithConstraint() { + public function testBasicValidateWithConstraint(): void { $typed_data = $this->typedDataManager->create( DataDefinition::create('string') ->addConstraint('Callback', [ @@ -141,7 +141,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testBasicValidateWithMultipleConstraints() { + public function testBasicValidateWithMultipleConstraints(): void { $options = [ 'callback' => function ($value, ExecutionContextInterface $context) { $context->addViolation('test violation'); @@ -159,7 +159,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validate */ - public function testPropertiesValidateWithMultipleLevels() { + public function testPropertiesValidateWithMultipleLevels(): void { $typed_data = $this->buildExampleTypedDataWithProperties(); @@ -227,7 +227,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validateProperty */ - public function testValidatePropertyWithCustomGroup() { + public function testValidatePropertyWithCustomGroup(): void { $tree = [ 'value' => [], 'properties' => [ @@ -244,7 +244,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { * * @dataProvider providerTestValidatePropertyWithInvalidObjects */ - public function testValidatePropertyWithInvalidObjects($object) { + public function testValidatePropertyWithInvalidObjects($object): void { $this->expectException(\InvalidArgumentException::class); $this->recursiveValidator->validateProperty($object, 'key1', NULL); } @@ -263,7 +263,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validateProperty */ - public function testValidateProperty() { + public function testValidateProperty(): void { $typed_data = $this->buildExampleTypedDataWithProperties(); $violations = $this->recursiveValidator->validateProperty($typed_data, 'key_with_properties'); @@ -283,7 +283,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { * * @dataProvider providerTestValidatePropertyWithInvalidObjects */ - public function testValidatePropertyValueWithInvalidObjects($object) { + public function testValidatePropertyValueWithInvalidObjects($object): void { $this->expectException(\InvalidArgumentException::class); $this->recursiveValidator->validatePropertyValue($object, 'key1', [], NULL); } @@ -291,7 +291,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { /** * @covers ::validatePropertyValue */ - public function testValidatePropertyValue() { + public function testValidatePropertyValue(): void { $typed_data = $this->buildExampleTypedDataWithProperties(['subkey1' => 'subvalue11', 'subkey2' => 'subvalue22']); $violations = $this->recursiveValidator->validatePropertyValue($typed_data, 'key_with_properties', $typed_data->get('key_with_properties')); diff --git a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php index 801d52de5ba..46fb739c7e1 100644 --- a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php +++ b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php @@ -69,7 +69,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @dataProvider providerFromUri */ - public function testFromUri($uri, $is_external) { + public function testFromUri($uri, $is_external): void { $url = Url::fromUri($uri); $this->assertInstanceOf('Drupal\Core\Url', $url); @@ -104,7 +104,7 @@ class UnroutedUrlTest extends UnitTestCase { * @covers ::fromUri * @dataProvider providerFromInvalidUri */ - public function testFromInvalidUri($uri) { + public function testFromInvalidUri($uri): void { $this->expectException(\InvalidArgumentException::class); $url = Url::fromUri($uri); } @@ -134,7 +134,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::createFromRequest */ - public function testCreateFromRequest() { + public function testCreateFromRequest(): void { $request = Request::create('/test-path'); $this->router->expects($this->once()) @@ -154,7 +154,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::isExternal */ - public function testIsExternal($uri, $is_external) { + public function testIsExternal($uri, $is_external): void { $url = Url::fromUri($uri); $this->assertSame($url->isExternal(), $is_external); } @@ -167,7 +167,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::toString */ - public function testToString($uri) { + public function testToString($uri): void { $url = Url::fromUri($uri); $this->assertSame($uri, $url->toString()); } @@ -180,7 +180,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::getRouteName */ - public function testGetRouteName($uri) { + public function testGetRouteName($uri): void { $url = Url::fromUri($uri); $this->expectException(\UnexpectedValueException::class); $url->getRouteName(); @@ -194,7 +194,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::getRouteParameters */ - public function testGetRouteParameters($uri) { + public function testGetRouteParameters($uri): void { $url = Url::fromUri($uri); $this->expectException(\UnexpectedValueException::class); $url->getRouteParameters(); @@ -208,7 +208,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::getInternalPath */ - public function testGetInternalPath($uri) { + public function testGetInternalPath($uri): void { $url = Url::fromUri($uri); $this->expectException(\Exception::class); $url->getInternalPath(); @@ -222,7 +222,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::getUri */ - public function testGetUri($uri) { + public function testGetUri($uri): void { $url = Url::fromUri($uri); $this->assertNotNull($url->getUri()); } @@ -235,7 +235,7 @@ class UnroutedUrlTest extends UnitTestCase { * * @covers ::getOptions */ - public function testGetOptions($uri) { + public function testGetOptions($uri): void { $url = Url::fromUri($uri); $this->assertIsArray($url->getOptions()); } diff --git a/core/tests/Drupal/Tests/Core/Update/UpdateHookRegistryTest.php b/core/tests/Drupal/Tests/Core/Update/UpdateHookRegistryTest.php index a39e9f66aea..9ee418937da 100644 --- a/core/tests/Drupal/Tests/Core/Update/UpdateHookRegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Update/UpdateHookRegistryTest.php @@ -90,7 +90,7 @@ class UpdateHookRegistryTest extends UnitTestCase { /** * @covers ::getAvailableUpdates */ - public function testGetVersions() { + public function testGetVersions(): void { $module_name = 'drupal\tests\core\update\under_test'; $update_registry = new UpdateHookRegistry([], $this->keyValueFactory); @@ -108,7 +108,7 @@ class UpdateHookRegistryTest extends UnitTestCase { * @covers ::setInstalledVersion * @covers ::deleteInstalledVersion */ - public function testGetInstalledVersion() { + public function testGetInstalledVersion(): void { $versions = [ 'module1' => 1, 'module2' => 20, diff --git a/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php b/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php index 72d2ef35eab..d183cd752d1 100644 --- a/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php @@ -183,7 +183,7 @@ EOS; /** * @covers ::getPendingUpdateFunctions */ - public function testGetPendingUpdateFunctionsNoExistingUpdates() { + public function testGetPendingUpdateFunctionsNoExistingUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -227,7 +227,7 @@ EOS; /** * @covers ::getPendingUpdateFunctions */ - public function testGetPendingUpdateFunctionsWithLoadedModulesButNotEnabled() { + public function testGetPendingUpdateFunctionsWithLoadedModulesButNotEnabled(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -262,7 +262,7 @@ EOS; /** * @covers ::getPendingUpdateFunctions */ - public function testGetPendingUpdateFunctionsExistingUpdates() { + public function testGetPendingUpdateFunctionsExistingUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -309,7 +309,7 @@ EOS; /** * @covers ::getPendingUpdateInformation */ - public function testGetPendingUpdateInformation() { + public function testGetPendingUpdateInformation(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -357,7 +357,7 @@ EOS; /** * @covers ::getPendingUpdateInformation */ - public function testGetPendingUpdateInformationWithExistingUpdates() { + public function testGetPendingUpdateInformationWithExistingUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -407,7 +407,7 @@ EOS; /** * @covers ::getPendingUpdateInformation */ - public function testGetPendingUpdateInformationWithRemovedUpdates() { + public function testGetPendingUpdateInformationWithRemovedUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); @@ -434,7 +434,7 @@ EOS; /** * @covers ::getUpdateFunctions */ - public function testGetUpdateFunctions() { + public function testGetUpdateFunctions(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class)->reveal(); @@ -470,7 +470,7 @@ EOS; /** * @covers ::registerInvokedUpdates */ - public function testRegisterInvokedUpdatesWithoutExistingUpdates() { + public function testRegisterInvokedUpdatesWithoutExistingUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); $key_value->get('existing_updates', []) @@ -510,7 +510,7 @@ EOS; /** * @covers ::registerInvokedUpdates */ - public function testRegisterInvokedUpdatesWithMultiple() { + public function testRegisterInvokedUpdatesWithMultiple(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); $key_value->get('existing_updates', []) @@ -550,7 +550,7 @@ EOS; /** * @covers ::registerInvokedUpdates */ - public function testRegisterInvokedUpdatesWithExistingUpdates() { + public function testRegisterInvokedUpdatesWithExistingUpdates(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); $key_value->get('existing_updates', []) @@ -585,7 +585,7 @@ EOS; /** * @covers ::filterOutInvokedUpdatesByExtension */ - public function testFilterOutInvokedUpdatesByExtension() { + public function testFilterOutInvokedUpdatesByExtension(): void { $this->setupBasicExtensions(); $key_value = $this->prophesize(KeyValueStoreInterface::class); $key_value->get('existing_updates', []) @@ -625,7 +625,7 @@ EOS; /** * @covers ::getPendingUpdateFunctions */ - public function testGetPendingCustomUpdateFunctions() { + public function testGetPendingCustomUpdateFunctions(): void { // Set up a simplified module structure with custom update hooks. $info_a = <<<'EOS' type: module diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index be30899f53f..1693234623d 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -148,7 +148,7 @@ class UrlTest extends UnitTestCase { * * @covers ::fromRoute */ - public function testFromRouteFront() { + public function testFromRouteFront(): void { $url = Url::fromRoute('<front>'); $this->assertSame('<front>', $url->getRouteName()); } @@ -159,7 +159,7 @@ class UrlTest extends UnitTestCase { * @covers ::fromUserInput * @dataProvider providerFromValidInternalUri */ - public function testFromUserInput($path) { + public function testFromUserInput($path): void { $url = Url::fromUserInput($path); $uri = $url->getUri(); @@ -191,7 +191,7 @@ class UrlTest extends UnitTestCase { * @covers ::fromUserInput * @dataProvider providerFromInvalidInternalUri */ - public function testFromInvalidUserInput($path) { + public function testFromInvalidUserInput($path): void { $this->expectException(\InvalidArgumentException::class); $url = Url::fromUserInput($path); } @@ -201,7 +201,7 @@ class UrlTest extends UnitTestCase { * * @covers ::fromUri */ - public function testFromRoutedPathWithInvalidRoute() { + public function testFromRoutedPathWithInvalidRoute(): void { $this->pathValidator->expects($this->once()) ->method('getUrlIfValidWithoutAccessCheck') ->with('invalid-path') @@ -216,7 +216,7 @@ class UrlTest extends UnitTestCase { * * @covers ::fromUri */ - public function testFromRoutedPathWithValidRoute() { + public function testFromRoutedPathWithValidRoute(): void { $url = Url::fromRoute('test_route'); $this->pathValidator->expects($this->once()) ->method('getUrlIfValidWithoutAccessCheck') @@ -231,7 +231,7 @@ class UrlTest extends UnitTestCase { * * @covers ::createFromRequest */ - public function testCreateFromRequest() { + public function testCreateFromRequest(): void { $attributes = [ '_raw_variables' => new InputBag([ 'color' => 'chartreuse', @@ -255,7 +255,7 @@ class UrlTest extends UnitTestCase { * * @covers ::createFromRequest */ - public function testUrlFromRequestInvalid() { + public function testUrlFromRequestInvalid(): void { $request = Request::create('/test-path'); $this->router->expects($this->once()) @@ -274,7 +274,7 @@ class UrlTest extends UnitTestCase { * * @covers ::isExternal */ - public function testIsExternal($urls) { + public function testIsExternal($urls): void { foreach ($urls as $url) { $this->assertFalse($url->isExternal()); } @@ -290,7 +290,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getUri */ - public function testGetUriForInternalUrl($urls) { + public function testGetUriForInternalUrl($urls): void { $this->expectException(\UnexpectedValueException::class); foreach ($urls as $url) { $url->getUri(); @@ -302,7 +302,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getUri */ - public function testGetUriForExternalUrl() { + public function testGetUriForExternalUrl(): void { $url = Url::fromUri('http://example.com/test'); $this->assertEquals('http://example.com/test', $url->getUri()); } @@ -313,7 +313,7 @@ class UrlTest extends UnitTestCase { * @covers ::getUri * @covers ::isExternal */ - public function testGetUriForProtocolRelativeUrl() { + public function testGetUriForProtocolRelativeUrl(): void { $url = Url::fromUri('//example.com/test'); $this->assertEquals('//example.com/test', $url->getUri()); $this->assertTrue($url->isExternal()); @@ -329,7 +329,7 @@ class UrlTest extends UnitTestCase { * * @depends testUrlFromRequest */ - public function testGetInternalPath($urls) { + public function testGetInternalPath($urls): void { $map = []; $map[] = ['view.frontpage.page_1', [], '/node']; $map[] = ['node_view', ['node' => '1'], '/node/1']; @@ -360,7 +360,7 @@ class UrlTest extends UnitTestCase { * * @covers ::toString */ - public function testToString($urls) { + public function testToString($urls): void { foreach ($urls as $index => $url) { $path = array_pop($this->map[$index]); $this->assertSame($path, $url->toString()); @@ -380,7 +380,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getRouteName */ - public function testGetRouteName($urls) { + public function testGetRouteName($urls): void { foreach ($urls as $index => $url) { $this->assertSame($this->map[$index][0], $url->getRouteName()); } @@ -391,7 +391,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getRouteName */ - public function testGetRouteNameWithExternalUrl() { + public function testGetRouteNameWithExternalUrl(): void { $url = Url::fromUri('http://example.com'); $this->expectException(\UnexpectedValueException::class); $url->getRouteName(); @@ -407,7 +407,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getRouteParameters */ - public function testGetRouteParameters($urls) { + public function testGetRouteParameters($urls): void { foreach ($urls as $index => $url) { $this->assertSame($this->map[$index][1], $url->getRouteParameters()); } @@ -418,7 +418,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getRouteParameters */ - public function testGetRouteParametersWithExternalUrl() { + public function testGetRouteParametersWithExternalUrl(): void { $url = Url::fromUri('http://example.com'); $this->expectException(\UnexpectedValueException::class); $url->getRouteParameters(); @@ -434,7 +434,7 @@ class UrlTest extends UnitTestCase { * * @covers ::getOptions */ - public function testGetOptions($urls) { + public function testGetOptions($urls): void { foreach ($urls as $index => $url) { $this->assertSame($this->map[$index][2], $url->getOptions()); } @@ -445,7 +445,7 @@ class UrlTest extends UnitTestCase { * * @covers ::setOptions */ - public function testSetOptions() { + public function testSetOptions(): void { $url = Url::fromRoute('test_route', []); $this->assertEquals([], $url->getOptions()); $url->setOptions(['foo' => 'bar']); @@ -459,7 +459,7 @@ class UrlTest extends UnitTestCase { * * @covers ::mergeOptions */ - public function testMergeOptions() { + public function testMergeOptions(): void { $url = Url::fromRoute('test_route', [], ['foo' => 'bar', 'bar' => ['key' => 'value']]); $url->mergeOptions(['bar' => ['key' => 'value1', 'key2' => 'value2']]); $this->assertEquals(['foo' => 'bar', 'bar' => ['key' => 'value1', 'key2' => 'value2']], $url->getOptions()); @@ -475,7 +475,7 @@ class UrlTest extends UnitTestCase { * @covers ::accessManager * @dataProvider accessProvider */ - public function testAccessRouted($access) { + public function testAccessRouted($access): void { $account = $this->createMock('Drupal\Core\Session\AccountInterface'); $url = new TestUrl('entity.node.canonical', ['node' => 3]); $url->setAccessManager($this->getMockAccessManager($access, $account)); @@ -487,7 +487,7 @@ class UrlTest extends UnitTestCase { * * @covers ::access */ - public function testAccessUnrouted() { + public function testAccessUnrouted(): void { $account = $this->createMock('Drupal\Core\Session\AccountInterface'); $url = TestUrl::fromUri('base:kittens'); $access_manager = $this->createMock('Drupal\Core\Access\AccessManagerInterface'); @@ -500,7 +500,7 @@ class UrlTest extends UnitTestCase { /** * Tests the fromRouteMatch() method. */ - public function testFromRouteMatch() { + public function testFromRouteMatch(): void { $route = new Route('/test-route/{foo}'); $route_match = new RouteMatch('test_route', $route, ['foo' => (object) [1]], ['foo' => 1]); $url = Url::fromRouteMatch($route_match); @@ -574,7 +574,7 @@ class UrlTest extends UnitTestCase { * * @dataProvider providerTestEntityUris */ - public function testEntityUris($uri, $options, $route_name, $route_parameters, $query, $fragment) { + public function testEntityUris($uri, $options, $route_name, $route_parameters, $query, $fragment): void { $url = Url::fromUri($uri, $options); $this->assertSame($route_name, $url->getRouteName()); $this->assertEquals($route_parameters, $url->getRouteParameters()); @@ -587,7 +587,7 @@ class UrlTest extends UnitTestCase { * * @covers ::fromUri */ - public function testInvalidEntityUriParameter() { + public function testInvalidEntityUriParameter(): void { // Make the mocked URL generator behave like the actual one. $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') @@ -605,7 +605,7 @@ class UrlTest extends UnitTestCase { * * @dataProvider providerTestToUriStringForEntity */ - public function testToUriStringForEntity($uri, $options, $uri_string) { + public function testToUriStringForEntity($uri, $options, $uri_string): void { $url = Url::fromUri($uri, $options); $this->assertSame($url->toUriString(), $uri_string); } @@ -628,7 +628,7 @@ class UrlTest extends UnitTestCase { * * @dataProvider providerTestToUriStringForInternal */ - public function testToUriStringForInternal($uri, $options, $uri_string) { + public function testToUriStringForInternal($uri, $options, $uri_string): void { $url = Url::fromRoute('entity.test_entity.canonical', ['test_entity' => '1']); $this->pathValidator->expects($this->any()) ->method('getUrlIfValidWithoutAccessCheck') @@ -672,7 +672,7 @@ class UrlTest extends UnitTestCase { * @covers ::fromUri * @dataProvider providerFromValidInternalUri */ - public function testFromValidInternalUri($path) { + public function testFromValidInternalUri($path): void { $url = Url::fromUri('internal:' . $path); $this->assertInstanceOf('Drupal\Core\Url', $url); } @@ -712,7 +712,7 @@ class UrlTest extends UnitTestCase { * @covers ::fromUri * @dataProvider providerFromInvalidInternalUri */ - public function testFromInvalidInternalUri($path) { + public function testFromInvalidInternalUri($path): void { $this->expectException(\InvalidArgumentException::class); Url::fromUri('internal:' . $path); } @@ -747,7 +747,7 @@ class UrlTest extends UnitTestCase { * * @covers ::fromUri */ - public function testFromUriNumber() { + public function testFromUriNumber(): void { $url = Url::fromUri('base:2015/10/06'); $this->assertSame($url->toUriString(), 'base:/2015/10/06'); } @@ -759,7 +759,7 @@ class UrlTest extends UnitTestCase { * * @dataProvider providerTestToUriStringForRoute */ - public function testToUriStringForRoute($uri, $options, $uri_string) { + public function testToUriStringForRoute($uri, $options, $uri_string): void { $url = Url::fromUri($uri, $options); $this->assertSame($url->toUriString(), $uri_string); } @@ -784,7 +784,7 @@ class UrlTest extends UnitTestCase { /** * @covers ::fromUri */ - public function testFromRouteUriWithMissingRouteName() { + public function testFromRouteUriWithMissingRouteName(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage("The route URI 'route:' is invalid."); Url::fromUri('route:'); diff --git a/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php b/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php index 01bb1b97272..ed94cd09ff4 100644 --- a/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php @@ -41,7 +41,7 @@ class CallableResolverTest extends UnitTestCase { /** * @covers ::getCallableFromDefinition */ - public function testCallbackResolver() { + public function testCallbackResolver(): void { $cases = [ 'Inline function' => [ function ($suffix) { @@ -109,7 +109,7 @@ class CallableResolverTest extends UnitTestCase { * @dataProvider callableResolverExceptionHandlingTestCases * @covers ::getCallableFromDefinition */ - public function testCallbackResolverExceptionHandling($definition, $exception_class, $exception_message) { + public function testCallbackResolverExceptionHandling($definition, $exception_class, $exception_message): void { $this->expectException($exception_class); $this->expectExceptionMessage($exception_message); $this->resolver->getCallableFromDefinition($definition); diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php index 4ff0cdfe881..67afbed60bf 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -110,7 +110,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @dataProvider providerTestGenerateHrefs */ - public function testGenerateHrefs($route_name, array $parameters, $absolute, $expected_url) { + public function testGenerateHrefs($route_name, array $parameters, $absolute, $expected_url): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with($route_name, $parameters, ['absolute' => $absolute] + $this->defaultOptions) @@ -131,7 +131,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerate() { + public function testGenerate(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_1', [], ['fragment' => 'the-fragment'] + $this->defaultOptions) @@ -161,7 +161,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateNoLink() { + public function testGenerateNoLink(): void { $this->urlGenerator->expects($this->never()) ->method('generateFromRoute'); $this->moduleHandler->expects($this->exactly(2)) @@ -193,7 +193,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateNone() { + public function testGenerateNone(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('<none>', [], ['set_active_class' => TRUE] + $this->defaultOptions) @@ -216,7 +216,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateButton() { + public function testGenerateButton(): void { $this->urlGenerator->expects($this->never()) ->method('generateFromRoute'); $this->moduleHandler->expects($this->exactly(2)) @@ -247,7 +247,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateExternal() { + public function testGenerateExternal(): void { $this->urlAssembler->expects($this->once()) ->method('assemble') ->with('https://www.drupal.org', ['set_active_class' => TRUE, 'external' => TRUE] + $this->defaultOptions) @@ -281,7 +281,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateUrlWithQuotes() { + public function testGenerateUrlWithQuotes(): void { $this->urlAssembler->expects($this->once()) ->method('assemble') ->with('base:example', ['query' => ['foo' => '"bar"', 'zoo' => 'baz']] + $this->defaultOptions) @@ -312,7 +312,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateAttributes() { + public function testGenerateAttributes(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_1', [], $this->defaultOptions) @@ -337,7 +337,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateQuery() { + public function testGenerateQuery(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_1', [], ['query' => ['test' => 'value']] + $this->defaultOptions) @@ -360,7 +360,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateParametersAsQuery() { + public function testGenerateParametersAsQuery(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_1', ['test' => 'value'], $this->defaultOptions) @@ -381,7 +381,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateOptions() { + public function testGenerateOptions(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_1', [], ['key' => 'value'] + $this->defaultOptions) @@ -403,7 +403,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateXss() { + public function testGenerateXss(): void { $this->urlGenerator->expects($this->once()) ->method('generateFromRoute') ->with('test_route_4', [], $this->defaultOptions) @@ -421,7 +421,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateWithHtml() { + public function testGenerateWithHtml(): void { $this->urlGenerator->expects($this->exactly(2)) ->method('generateFromRoute') ->with('test_route_5', [], $this->defaultOptions) @@ -460,7 +460,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateActive() { + public function testGenerateActive(): void { $this->urlGenerator->expects($this->exactly(5)) ->method('generateFromRoute') ->willReturnCallback(function ($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) { @@ -551,7 +551,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @see \Drupal\Core\Utility\LinkGenerator::generate() */ - public function testGenerateBubbleableMetadata() { + public function testGenerateBubbleableMetadata(): void { $options = ['query' => [], 'language' => NULL, 'set_active_class' => FALSE, 'absolute' => FALSE]; $this->urlGenerator->expects($this->any()) ->method('generateFromRoute') @@ -582,7 +582,7 @@ class LinkGeneratorTest extends UnitTestCase { * * @covers ::generate */ - public function testGenerateWithAlterHook() { + public function testGenerateWithAlterHook(): void { $options = ['query' => [], 'language' => NULL, 'set_active_class' => FALSE, 'absolute' => FALSE]; $this->urlGenerator->expects($this->any()) ->method('generateFromRoute') @@ -621,7 +621,7 @@ class LinkGeneratorTest extends UnitTestCase { * * This is a regression test for https://www.drupal.org/node/2842399. */ - public function testGenerateTwice() { + public function testGenerateTwice(): void { $this->urlGenerator->expects($this->any()) ->method('generateFromRoute') ->willReturn((new GeneratedUrl())->setGeneratedUrl('/')); diff --git a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php index 1aa30dba066..df3ede5da3b 100644 --- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php @@ -107,7 +107,7 @@ class TokenTest extends UnitTestCase { /** * @covers ::getInfo */ - public function testGetInfo() { + public function testGetInfo(): void { $token_info = [ 'types' => [ 'foo' => [ @@ -153,7 +153,7 @@ class TokenTest extends UnitTestCase { /** * @covers ::replace */ - public function testReplaceWithBubbleableMetadataObject() { + public function testReplaceWithBubbleableMetadataObject(): void { $this->moduleHandler->expects($this->any()) ->method('invokeAll') ->willReturn(['[node:title]' => 'hello world']); @@ -182,7 +182,7 @@ class TokenTest extends UnitTestCase { /** * @covers ::replace */ - public function testReplaceWithHookTokensWithBubbleableMetadata() { + public function testReplaceWithHookTokensWithBubbleableMetadata(): void { $this->moduleHandler->expects($this->any()) ->method('invokeAll') ->willReturnCallback(function ($hook_name, $args) { @@ -218,7 +218,7 @@ class TokenTest extends UnitTestCase { * @covers ::replace * @covers ::replace */ - public function testReplaceWithHookTokensAlterWithBubbleableMetadata() { + public function testReplaceWithHookTokensAlterWithBubbleableMetadata(): void { $this->moduleHandler->expects($this->any()) ->method('invokeAll') ->willReturn([]); @@ -255,7 +255,7 @@ class TokenTest extends UnitTestCase { /** * @covers ::resetInfo */ - public function testResetInfo() { + public function testResetInfo(): void { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['token_info']); @@ -267,7 +267,7 @@ class TokenTest extends UnitTestCase { * @covers ::replace * @dataProvider providerTestReplaceEscaping */ - public function testReplaceEscaping($string, array $tokens, $expected) { + public function testReplaceEscaping($string, array $tokens, $expected): void { $this->moduleHandler->expects($this->any()) ->method('invokeAll') ->willReturnCallback(function ($type, $args) { @@ -301,7 +301,7 @@ class TokenTest extends UnitTestCase { /** * @covers ::replacePlain */ - public function testReplacePlain() { + public function testReplacePlain(): void { $this->setupSiteTokens(); $base = 'Wow, great "[site:name]" has a slogan "[site:slogan]"'; $plain = $this->token->replacePlain($base); @@ -311,7 +311,7 @@ class TokenTest extends UnitTestCase { /** * Scans dummy text, then tests the output. */ - public function testScan() { + public function testScan(): void { // Define text with valid and not valid, fake and existing token-like // strings. $text = 'First a [valid:simple], but dummy token, and a dummy [valid:token with: spaces].'; diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php index d0eb9c871a7..a323484a68f 100644 --- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php @@ -59,7 +59,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { /** * @covers ::assemble */ - public function testAssembleWithNeitherExternalNorDomainLocalUri() { + public function testAssembleWithNeitherExternalNorDomainLocalUri(): void { $this->expectException(\InvalidArgumentException::class); $this->unroutedUrlAssembler->assemble('wrong-url'); } @@ -67,7 +67,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { /** * @covers ::assemble */ - public function testAssembleWithLeadingSlash() { + public function testAssembleWithLeadingSlash(): void { $this->expectException(\InvalidArgumentException::class); $this->unroutedUrlAssembler->assemble('/drupal.org'); } @@ -78,7 +78,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { * * @dataProvider providerTestAssembleWithExternalUrl */ - public function testAssembleWithExternalUrl($uri, array $options, $expected) { + public function testAssembleWithExternalUrl($uri, array $options, $expected): void { $this->setupRequestStack(FALSE); $this->assertEquals($expected, $this->unroutedUrlAssembler->assemble($uri, $options)); $generated_url = $this->unroutedUrlAssembler->assemble($uri, $options, TRUE); @@ -113,7 +113,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { * * @dataProvider providerTestAssembleWithLocalUri */ - public function testAssembleWithLocalUri($uri, array $options, $subdir, $expected) { + public function testAssembleWithLocalUri($uri, array $options, $subdir, $expected): void { $this->setupRequestStack($subdir); $this->assertEquals($expected, $this->unroutedUrlAssembler->assemble($uri, $options)); @@ -139,7 +139,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { /** * @covers ::assemble */ - public function testAssembleWithNotEnabledProcessing() { + public function testAssembleWithNotEnabledProcessing(): void { $this->setupRequestStack(FALSE); $this->pathProcessor->expects($this->never()) ->method('processOutbound'); @@ -150,7 +150,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { /** * @covers ::assemble */ - public function testAssembleWithEnabledProcessing() { + public function testAssembleWithEnabledProcessing(): void { $this->setupRequestStack(FALSE); $this->pathProcessor->expects($this->exactly(2)) ->method('processOutbound') @@ -174,7 +174,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { /** * @covers ::assemble */ - public function testAssembleWithStartingSlashEnabledProcessing() { + public function testAssembleWithStartingSlashEnabledProcessing(): void { $this->setupRequestStack(FALSE); $this->pathProcessor->expects($this->exactly(2)) ->method('processOutbound') diff --git a/core/tests/Drupal/Tests/ExpectDeprecationTest.php b/core/tests/Drupal/Tests/ExpectDeprecationTest.php index 349a34f015f..df6045b075d 100644 --- a/core/tests/Drupal/Tests/ExpectDeprecationTest.php +++ b/core/tests/Drupal/Tests/ExpectDeprecationTest.php @@ -19,7 +19,7 @@ class ExpectDeprecationTest extends TestCase { /** * Tests expectDeprecation. */ - public function testExpectDeprecation() { + public function testExpectDeprecation(): void { $this->expectDeprecation('Test deprecation'); // phpcs:ignore Drupal.Semantics.FunctionTriggerError @trigger_error('Test deprecation', E_USER_DEPRECATED); @@ -31,7 +31,7 @@ class ExpectDeprecationTest extends TestCase { * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testExpectDeprecationInIsolation() { + public function testExpectDeprecationInIsolation(): void { $this->expectDeprecation('Test isolated deprecation'); // phpcs:ignore Drupal.Semantics.FunctionTriggerError @trigger_error('Test isolated deprecation', E_USER_DEPRECATED); diff --git a/core/tests/Drupal/Tests/PhpCs/SortTest.php b/core/tests/Drupal/Tests/PhpCs/SortTest.php index 6927f442ccd..ec8b04eb5af 100644 --- a/core/tests/Drupal/Tests/PhpCs/SortTest.php +++ b/core/tests/Drupal/Tests/PhpCs/SortTest.php @@ -31,14 +31,14 @@ class SortTest extends TestCase { /** * Tests that the phpcs.xml.dist file exists. */ - public function testFileExists() { + public function testFileExists(): void { $this->assertFileExists($this->filePath); } /** * Tests that the phpcs.xml.dist file is properly sorted. */ - public function testSorted() { + public function testSorted(): void { $content = file_get_contents($this->filePath); $xml_encoder = new XmlEncoder(); $xml_encoded = $xml_encoder->decode($content, 'xml'); diff --git a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php index 42d6c78fb45..893a55e9309 100644 --- a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php +++ b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php @@ -50,7 +50,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testInstallWithNonExistingFile() { + public function testInstallWithNonExistingFile(): void { $command_line = $this->php . ' core/scripts/test-site.php install --setup-file "this-class-does-not-exist" --db-url "' . getenv('SIMPLETEST_DB') . '"'; $process = Process::fromShellCommandline($command_line, $this->root); $process->run(); @@ -61,7 +61,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testInstallWithFileWithNoClass() { + public function testInstallWithFileWithNoClass(): void { $command_line = $this->php . ' core/scripts/test-site.php install --setup-file core/tests/fixtures/empty_file.php.module --db-url "' . getenv('SIMPLETEST_DB') . '"'; $process = Process::fromShellCommandline($command_line, $this->root); $process->run(); @@ -72,7 +72,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testInstallWithNonSetupClass() { + public function testInstallWithNonSetupClass(): void { $this->markTestIncomplete('Fix this test in https://www.drupal.org/project/drupal/issues/2962157.'); // Use __FILE__ to test absolute paths. @@ -87,7 +87,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testInstallScript() { + public function testInstallScript(): void { $simpletest_path = $this->root . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . 'simpletest'; if (!is_writable($simpletest_path)) { $this->markTestSkipped("Requires the directory $simpletest_path to exist and be writable"); @@ -187,7 +187,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testInstallInDifferentLanguage() { + public function testInstallInDifferentLanguage(): void { $simpletest_path = $this->root . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . 'simpletest'; if (!is_writable($simpletest_path)) { $this->markTestSkipped("Requires the directory $simpletest_path to exist and be writable"); @@ -224,7 +224,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testTearDownDbPrefixValidation() { + public function testTearDownDbPrefixValidation(): void { $command_line = $this->php . ' core/scripts/test-site.php tear-down not-a-valid-prefix'; $process = Process::fromShellCommandline($command_line, $this->root); $process->setTimeout(500); @@ -236,7 +236,7 @@ class TestSiteApplicationTest extends UnitTestCase { /** * @coversNothing */ - public function testUserLogin() { + public function testUserLogin(): void { $this->markTestIncomplete('Fix this test in https://www.drupal.org/project/drupal/issues/2962157.'); $simpletest_path = $this->root . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . 'simpletest'; if (!is_writable($simpletest_path)) { diff --git a/core/tests/Drupal/Tests/Traits/Core/Config/SchemaConfigListenerTestTrait.php b/core/tests/Drupal/Tests/Traits/Core/Config/SchemaConfigListenerTestTrait.php index 89493d5ef4a..8dd7e2398c4 100644 --- a/core/tests/Drupal/Tests/Traits/Core/Config/SchemaConfigListenerTestTrait.php +++ b/core/tests/Drupal/Tests/Traits/Core/Config/SchemaConfigListenerTestTrait.php @@ -14,7 +14,7 @@ trait SchemaConfigListenerTestTrait { /** * Tests \Drupal\Core\Config\Development\ConfigSchemaChecker. */ - public function testConfigSchemaChecker() { + public function testConfigSchemaChecker(): void { // Test a non-existing schema. $message = 'Expected SchemaIncompleteException thrown'; try { diff --git a/core/tests/Drupal/Tests/UnitTestCaseTest.php b/core/tests/Drupal/Tests/UnitTestCaseTest.php index ec22b183ab3..0ceeea843c5 100644 --- a/core/tests/Drupal/Tests/UnitTestCaseTest.php +++ b/core/tests/Drupal/Tests/UnitTestCaseTest.php @@ -14,7 +14,7 @@ class UnitTestCaseTest extends UnitTestCase { /** * Tests the dump() function in a test run in the same process. */ - public function testVarDumpSameProcess() { + public function testVarDumpSameProcess(): void { // Append the stream capturer to the STDERR stream, so that we can test the // dump() output and also prevent it from actually outputting in this // particular test. @@ -37,7 +37,7 @@ class UnitTestCaseTest extends UnitTestCase { * * @runInSeparateProcess */ - public function testVarDumpSeparateProcess() { + public function testVarDumpSeparateProcess(): void { // Append the stream capturer to the STDERR stream, so that we can test the // dump() output and also prevent it from actually outputting in this // particular test. |