diff options
Diffstat (limited to 'core/tests')
56 files changed, 116 insertions, 110 deletions
diff --git a/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php b/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php index 5c563016f52..8ab2b3b9fc7 100644 --- a/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php +++ b/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php @@ -36,7 +36,7 @@ abstract class ComposerBuildTestBase extends BuildTestBase { $this->assertFileExists($drupal_php_path); // Read back the Drupal version that was set and assert it matches - // expectations + // expectations. $this->executeCommand("php -r 'include \"$drupal_php_path\"; print \Drupal::VERSION;'"); $this->assertCommandSuccessful(); $this->assertCommandOutputContains($expectedVersion); diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php index f7155bbac01..74b32658ba2 100644 --- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php @@ -174,7 +174,7 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase { #[DataProvider('provideTemplateCreateProject')] public function testTemplateCreateProject($project, $package_dir, $docroot_dir): void { - // Make a working COMPOSER_HOME directory for setting global composer config + // Make a working COMPOSER_HOME directory for setting global composer config. $composer_home = $this->getWorkspaceDirectory() . '/composer-home'; mkdir($composer_home); // Create an empty global composer.json file, just to avoid warnings. @@ -430,7 +430,7 @@ JSON; } $stability = VersionParser::parseStability($version); if ($stability === 'dev') { - // Strip off "-dev"; + // Strip off "-dev". $version_towards = substr($version, 0, -4); if (!str_ends_with($version_towards, '.0')) { diff --git a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php index 7f97eb53027..388cc937254 100644 --- a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php +++ b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php @@ -196,7 +196,7 @@ class BuildTestTest extends BuildTestBase { $this->assertFileExists($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/default.settings.php'); $this->assertFileExists($full_path . DIRECTORY_SEPARATOR . 'vendor'); - // Verify expected files do not exist + // Verify expected files do not exist. $this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/settings.php'); $this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/settings.local.php'); $this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/files'); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php index 19cc4bf3a40..9bf96e4fbf4 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php @@ -79,6 +79,7 @@ class MachineNameTransliterationTest extends WebDriverTestBase { ['fr', 'ᐑ', 'wii'], // This test is not working with chromedriver as '𐌰𐌸' chars are not // accepted. + // phpcs:ignore Drupal.Commenting.InlineComment.InvalidEndChar // ['en', '𐌰𐌸', '__'], ['en', 'Ä Ö Ü Å Ø äöüåøhello', 'a_o_u_a_o_aouaohello'], ['de', 'Ä Ö Ü Å Ø äöüåøhello', 'ae_oe_ue_a_o_aeoeueaohello'], diff --git a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php index 0a14594369b..73365503305 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php @@ -107,7 +107,7 @@ class TableDragTest extends WebDriverTestBase { $session = $this->getSession(); $page = $session->getPage(); - // Confirm touchevents detection is loaded with Tabledrag + // Confirm touchevents detection is loaded with Tabledrag. $this->assertNotNull($this->assertSession()->waitForElement('css', 'html.no-touchevents')); $weight_select1 = $page->findField("table[1][weight]"); $weight_select2 = $page->findField("table[2][weight]"); diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index 248c70e2965..cac1c8bcedc 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -246,7 +246,7 @@ class UncaughtExceptionTest extends BrowserTestBase { $this->assertSession()->pageTextContains('The website encountered an unexpected error. Try again later.'); $this->assertSession()->pageTextContains($this->expectedExceptionMessage); - // Find fatal error logged to the error.log + // Find fatal error logged to the error.log. $errors = file(\Drupal::root() . '/' . $this->siteDirectory . '/error.log'); $this->assertCount(10, $errors, 'The error + the error that the logging service is broken has been written to the error log.'); $this->assertStringContainsString('Failed to log error', $errors[0], 'The error handling logs when an error could not be logged to the logger.'); diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php index 54bb662e211..ed4a7f750ba 100644 --- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -491,7 +491,7 @@ class BrowserTestBaseTest extends BrowserTestBase { */ public function testLocalTimeZone(): void { $expected = 'Australia/Sydney'; - // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php + // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php. $this->assertEquals($expected, date_default_timezone_get()); // The 'Australia/Sydney' time zone is also set in diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php index b1651400689..b6d86e2754e 100644 --- a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php @@ -121,7 +121,7 @@ class StandardRecipeTest extends StandardTest { // Ensure we have truly rebuilt the standard profile using recipes. // Uncomment the code below to see the differences in a single file. - // phpcs:ignore Drupal.Files.LineLength + // phpcs:ignore Drupal.Commenting.InlineComment.InvalidEndChar, Drupal.Files.LineLength // $this->assertSame($sync->read('node.settings'), $active->read('node.settings')); $comparer = $this->configImporter()->getStorageComparer(); $expected_list = $comparer->getEmptyChangelist(); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php index 80d8abf2d5b..62606ac87aa 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php @@ -32,7 +32,7 @@ class InstallerPostInstallTest extends InstallerTestBase { // Confirm that the install_profile is correct. $this->drupalGet('/system-test/get-install-profile'); $this->assertSession()->pageTextContains('minimal'); - // Make an anonymous visit to the installer + // Make an anonymous visit to the installer. $this->drupalLogout(); $this->visitInstaller(); // Ensure that the install profile is still correct. diff --git a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php index f375f6f3dd6..20f21373046 100644 --- a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php +++ b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php @@ -100,7 +100,6 @@ class MappingTest extends KernelTestBase { // Avoid showing "Powered by Drupal" on 404 responses. 'visibility' => [ 'I_CAN_CHOOSE_THIS' => [ - // This is what determines the 'id' => 'response_status', 'negate' => FALSE, 'status_codes' => [ @@ -219,7 +218,7 @@ class MappingTest extends KernelTestBase { // Special case: deprecated is needed for deprecated config schema: // - deprecated keys are treated as optional // - if a deprecated property path is itself a mapping, then the keys inside - // are not optional + // are not optional. yield 'No dynamic type: config_schema_deprecated_test.settings' => [ 'config_schema_deprecated_test.settings', NULL, diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index bbebfcf7ab4..00698b22a27 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -48,7 +48,7 @@ class ConfigDiffTest extends KernelTestBase { [$change_key . ': ' . $original_data[$change_key]], [$change_key . ': ' . $change_data]); - // Reset data back to original, and remove a key + // Reset data back to original, and remove a key. $sync_data = $original_data; unset($sync_data[$remove_key]); $sync->write($config_name, $sync_data); @@ -62,7 +62,7 @@ class ConfigDiffTest extends KernelTestBase { FALSE ); - // Reset data back to original and add a key + // Reset data back to original and add a key. $sync_data = $original_data; $sync_data[$add_key] = $add_data; $sync->write($config_name, $sync_data); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 4cd56888088..dcdc149c86a 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -459,9 +459,13 @@ class ConfigSchemaTest extends KernelTestBase { ]; // Save config which has a schema that enforces types. - $this->config('config_schema_test.schema_data_types') + $config_object = $this->config('config_schema_test.schema_data_types'); + $config_object ->setData($untyped_to_typed) ->save(); + // Ensure the schemaWrapper property is reset after saving to prevent a + // memory leak. + $this->assertNull((new \ReflectionObject($config_object))->getProperty('schemaWrapper')->getValue($config_object)); $this->assertSame($typed_values, $this->config('config_schema_test.schema_data_types')->get()); // Save config which does not have a schema that enforces types. diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php index 8eb71360bd3..ce38b4a5682 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php @@ -83,7 +83,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from exists()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -91,7 +91,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from read()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -99,7 +99,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from readMultiple()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -107,7 +107,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from deleteAll()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -115,7 +115,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from listAll()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -123,7 +123,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from deleteAll()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } try { @@ -131,7 +131,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase { $this->fail('Expected exception not thrown from getAllCollectionNames()'); } catch (DatabaseExceptionWrapper) { - // Exception was expected + // Exception was expected. } $this->assertTrue(TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php index a3b46ab67e1..07db421d76d 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php @@ -1292,7 +1292,7 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase $this->assertFalse($this->schema->fieldExists($table_name_new, $field_name)); $this->assertTrue($this->schema->fieldExists($table_name_new, $field_name_new)); - // Adding an unique key + // Adding an unique key. $unique_key_name = $unique_key_introspect_name = 'unique'; $this->schema->addUniqueKey($table_name_new, $unique_key_name, [$field_name_new]); @@ -1300,7 +1300,7 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase $introspect_index_schema = new \ReflectionMethod(get_class($this->schema), 'introspectIndexSchema'); $this->assertEquals([$field_name_new], $introspect_index_schema->invoke($this->schema, $table_name_new)['unique keys'][$unique_key_introspect_name]); - // Dropping an unique key + // Dropping an unique key. $this->schema->dropUniqueKey($table_name_new, $unique_key_name); // Dropping a field. diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php index 2a0f685d2ac..6f6571fa6b0 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php @@ -168,7 +168,7 @@ class InsertTest extends DatabaseTestBase { // INSERT INTO test (age, name, job) // SELECT tp.age AS age, tp.name AS name, tp.job AS job // FROM test_people tp - // WHERE tp.name = 'Meredith' + // WHERE tp.name = 'Meredith'. $this->connection->insert('test') ->from($query) ->execute(); @@ -189,7 +189,7 @@ class InsertTest extends DatabaseTestBase { // INSERT INTO test_people_copy // SELECT * // FROM test_people tp - // WHERE tp.name = 'Meredith' + // WHERE tp.name = 'Meredith'. $this->connection->insert('test_people_copy') ->from($query) ->execute(); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php index 15364ad53af..8dcefa33f43 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php @@ -35,7 +35,7 @@ class SelectCloneTest extends DatabaseTestBase { $clone_result = $clone->countQuery()->execute()->fetchField(); $query_result = $query->countQuery()->execute()->fetchField(); - // Make sure the cloned query has not been modified + // Make sure the cloned query has not been modified. $this->assertEquals(3, $clone_result, 'The cloned query returns the expected number of rows'); $this->assertEquals(2, $query_result, 'The query returns the expected number of rows'); } diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php index e1542a30c38..78f87858c37 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php @@ -92,7 +92,7 @@ class DrupalDateTimeTest extends KernelTestBase { * Tests the ability to override the time zone in the format method. */ public function testTimezoneFormat(): void { - // Create a date in UTC + // Create a date in UTC. $date = DrupalDateTime::createFromTimestamp(87654321, 'UTC'); // Verify that the date format method displays the default time zone. diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php index 54d72e9fbff..bc6368dadc7 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php @@ -248,7 +248,7 @@ class DrupalKernelTest extends KernelTestBase { $classloader = $this->prophesize(ClassLoader::class); // Assert that we call the setApcuPrefix on the classloader if - // class_loader_auto_detect is set to TRUE; + // class_loader_auto_detect is set to TRUE. if ($value) { $classloader->setApcuPrefix(Argument::type('string'))->shouldBeCalled(); } diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php index 76e6d2d9532..b54b3065955 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php @@ -28,7 +28,7 @@ class ServiceDestructionTest extends KernelTestBase { // The service has not been destructed yet. $this->assertNull(\Drupal::state()->get('service_provider_test.destructed')); - // Call the class and then terminate the kernel + // Call the class and then terminate the kernel. $this->container->get('service_provider_test_class'); $response = new Response(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php index f8c9848bfcf..9820f7f05d5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php @@ -42,7 +42,7 @@ class ConfigEntityAdapterTest extends KernelTestBase { $this->installConfig(static::$modules); // ConfigTest::create doesn't work with the following exception: - // "Multiple entity types found for Drupal\config_test\Entity\ConfigTest." + // "Multiple entity types found for Drupal\config_test\Entity\ConfigTest". $this->entity = \Drupal::entityTypeManager()->getStorage('config_test')->create([ 'id' => 'system', 'label' => 'foobar', diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 4dac0039460..2269e9151d5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -551,28 +551,28 @@ class ConfigEntityQueryTest extends KernelTestBase { ]; // Sort key: id - // Sorting with 'DESC' upper case + // Sorting with 'DESC' upper case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'DESC') ->execute(); $this->assertSame(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults)); - // Sorting with 'ASC' upper case + // Sorting with 'ASC' upper case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'ASC') ->execute(); $this->assertSame(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults)); - // Sorting with 'desc' lower case + // Sorting with 'desc' lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'desc') ->execute(); $this->assertSame(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults)); - // Sorting with 'asc' lower case + // Sorting with 'asc' lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'asc') @@ -580,28 +580,28 @@ class ConfigEntityQueryTest extends KernelTestBase { $this->assertSame(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults)); // Sort key: number - // Sorting with 'DeSc' mixed upper and lower case + // Sorting with 'DeSc' mixed upper and lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'DeSc') ->execute(); $this->assertSame(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults)); - // Sorting with 'AsC' mixed upper and lower case + // Sorting with 'AsC' mixed upper and lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'AsC') ->execute(); $this->assertSame(['6', '4', '1', '2', '5', '3', '7'], array_values($this->queryResults)); - // Sorting with 'dEsC' mixed upper and lower case + // Sorting with 'dEsC' mixed upper and lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'dEsC') ->execute(); $this->assertSame(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults)); - // Sorting with 'aSc' mixed upper and lower case + // Sorting with 'aSc' mixed upper and lower case. $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'aSc') diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php index bd7ec5c89c7..7beb22610fb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php @@ -296,7 +296,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements public function testInvalidEntityAutocompleteElement(): void { $form_builder = $this->container->get('form_builder'); - // Test 'single' with an entity label that doesn't exist + // Test 'single' with an entity label that doesn't exist. $form_state = (new FormState()) ->setValues([ 'single' => 'single - non-existent label', diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index 1c65e7f9642..4c5e2c966ae 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -254,7 +254,7 @@ class EntityFieldTest extends EntityKernelTestBase { // Test emptying a field by assigning an empty value, NULL and an empty // array behave the same. foreach ([NULL, [], 'unset'] as $empty) { - // Make sure a value is present + // Make sure a value is present. $entity->name->value = 'a value'; $this->assertTrue(isset($entity->name->value), "$entity_type: Name is set."); // Now, empty the field. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index 3140cab146b..920ddd114c1 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -426,6 +426,7 @@ class EntityQueryTest extends EntityKernelTestBase { // As we do not have any conditions, here are the possible colors and // language codes, already in order, with the first occurrence of the // entity id marked with *: + // 8 NULL pl * // 12 NULL pl * diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index 8b6d9ed52eb..5d04166e294 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -503,7 +503,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { $expected = 'short_entity_type_revision__short_field_name'; $this->assertEquals($expected, $this->tableMapping->getDedicatedRevisionTableName($field_storage)); - // Short entity type, long field name + // Short entity type, long field name. $entity_type = 'short_entity_type'; $field_name = 'long_field_name_abcdefghijklmnopqrstuvwxyz'; $field_storage = FieldStorageConfig::create([ @@ -516,7 +516,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { $expected = 'short_entity_type_r__' . substr(hash('sha256', $field_storage->uuid()), 0, 10); $this->assertEquals($expected, $this->tableMapping->getDedicatedRevisionTableName($field_storage)); - // Long entity type, short field name + // Long entity type, short field name. $entity_type = 'long_entity_type_all_forty_three_characters'; $field_name = 'short_field_name'; $field_storage = FieldStorageConfig::create([ diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php index 0981068243e..b3146ebb145 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php @@ -22,7 +22,7 @@ class ModuleExtensionListTest extends KernelTestBase { ->save(); // The installation profile is provided by a container parameter. - // Saving the configuration doesn't automatically trigger invalidation + // Saving the configuration doesn't automatically trigger invalidation. $this->container->get('kernel')->rebuildContainer(); /** @var \Drupal\Core\Extension\ModuleExtensionList $module_extension_list */ diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php index 0ccae25b155..5bf173aff86 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php @@ -22,7 +22,7 @@ class ThemeExtensionListTest extends KernelTestBase { ->save(); // The installation profile is provided by a container parameter. - // Saving the configuration doesn't automatically trigger invalidation + // Saving the configuration doesn't automatically trigger invalidation. $this->container->get('kernel')->rebuildContainer(); /** @var \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list */ diff --git a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php index 0262f800bc8..e9815b9a6b8 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php @@ -96,7 +96,8 @@ class BaseFieldOverrideTest extends KernelTestBase { ->setTargetEntityTypeId('entity_test') ->setReadOnly(TRUE) // Ensure that the internal property is inherited from the base field and - // not the parent class. @see FieldConfigBase::isInternal + // not the parent class. + // @see FieldConfigBase::isInternal ->setInternal(TRUE) ->setComputed(FALSE); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php index a7bf5b9dd70..56d26fdafdb 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php @@ -21,7 +21,7 @@ class FileCopyTest extends FileTestBase { * Copy a normal file. */ public function testNormal(): void { - // Create a file for testing + // Create a file for testing. $uri = $this->createUri(); // Copying to a new name. @@ -51,7 +51,7 @@ class FileCopyTest extends FileTestBase { * Copy a non-existent file. */ public function testNonExistent(): void { - // Copy non-existent file + // Copy non-existent file. $desired_filepath = $this->randomMachineName(); $this->assertFileDoesNotExist($desired_filepath); $this->expectException(FileNotExistsException::class); @@ -63,7 +63,7 @@ class FileCopyTest extends FileTestBase { * Copy a file onto itself. */ public function testOverwriteSelf(): void { - // Create a file for testing + // Create a file for testing. $uri = $this->createUri(); // Copy the file onto itself with renaming works. diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php index 8fa28491f6a..761e408a878 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php @@ -15,7 +15,7 @@ class FileDeleteRecursiveTest extends FileTestBase { * Delete a normal file. */ public function testSingleFile(): void { - // Create a file for testing + // Create a file for testing. $filepath = 'public://' . $this->randomMachineName(); file_put_contents($filepath, ''); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php index 27a76157bb0..aacba78f408 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php @@ -17,10 +17,10 @@ class FileDeleteTest extends FileTestBase { * Delete a normal file. */ public function testNormal(): void { - // Create a file for testing + // Create a file for testing. $uri = $this->createUri(); - // Delete a regular file + // Delete a regular file. $this->assertTrue(\Drupal::service('file_system')->delete($uri), 'Deleted worked.'); $this->assertFileDoesNotExist($uri); } @@ -29,7 +29,7 @@ class FileDeleteTest extends FileTestBase { * Try deleting a missing file. */ public function testMissing(): void { - // Try to delete a non-existing file + // 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.'); } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php index bc0d8073153..e9236bc918c 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php @@ -21,7 +21,7 @@ class FileMoveTest extends FileTestBase { * Move a normal file. */ public function testNormal(): void { - // Create a file for testing + // Create a file for testing. $uri = $this->createUri(); // Moving to a new name. diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php index 8cb96454408..df359c2873f 100644 --- a/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php @@ -60,7 +60,7 @@ class ExtensionMimeTypeGuesserLegacyTest extends KernelTestBase { ]; $this->expectDeprecation( - 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: file_deprecated_test_file_mimetype_mapping_alter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040' + 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: Drupal\file_deprecated_test\Hook\FileDeprecatedTestThemeHooks::fileMimetypeMappingAlter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040' ); /** @var \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser $guesser */ diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php index ae713fc27ae..2eb87a14242 100644 --- a/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php @@ -27,7 +27,7 @@ class LegacyMimeTypeTest extends KernelTestBase { */ public function testHookFileMimetypeMappingAlter(): void { $this->expectDeprecation( - 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: file_deprecated_test_file_mimetype_mapping_alter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040' + 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: Drupal\file_deprecated_test\Hook\FileDeprecatedTestThemeHooks::fileMimetypeMappingAlter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040' ); $map = \Drupal::service(MimeTypeMapInterface::class); diff --git a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php index 54f01270198..8bfcc728c64 100644 --- a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php @@ -38,51 +38,51 @@ class ReadOnlyStreamWrapperTest extends FileTestBase { // Checks that the stream wrapper type is declared as local. $this->assertSame(1, $type & StreamWrapperInterface::LOCAL); - // Generate a test file + // Generate a test file. $filename = $this->randomMachineName(); $site_path = $this->container->getParameter('site.path'); $filepath = $site_path . '/files/' . $filename; file_put_contents($filepath, $filename); - // Generate a read-only stream wrapper instance + // Generate a read-only stream wrapper instance. $uri = $this->scheme . '://' . $filename; \Drupal::service('stream_wrapper_manager')->getViaScheme($this->scheme); $file_system = \Drupal::service('file_system'); - // Attempt to open a file in read/write mode + // Attempt to open a file in read/write mode. $handle = @fopen($uri, 'r+'); $this->assertFalse($handle, 'Unable to open a file for reading and writing with the read-only stream wrapper.'); - // Attempt to open a file in binary read mode + // Attempt to open a file in binary read mode. $handle = fopen($uri, 'rb'); $this->assertNotFalse($handle, 'Able to open a file for reading in binary mode with the read-only stream wrapper.'); $this->assertTrue(fclose($handle), 'Able to close file opened in binary mode using the read_only stream wrapper.'); - // Attempt to open a file in text read mode + // Attempt to open a file in text read mode. $handle = fopen($uri, 'rt'); $this->assertNotFalse($handle, 'Able to open a file for reading in text mode with the read-only stream wrapper.'); $this->assertTrue(fclose($handle), 'Able to close file opened in text mode using the read_only stream wrapper.'); - // Attempt to open a file in read mode + // Attempt to open a file in read mode. $handle = fopen($uri, 'r'); $this->assertNotFalse($handle, 'Able to open a file for reading with the read-only stream wrapper.'); - // Attempt to change file permissions + // Attempt to change file permissions. $this->assertFalse(@chmod($uri, 0777), 'Unable to change file permissions when using read-only stream wrapper.'); - // Attempt to acquire an exclusive lock for writing + // Attempt to acquire an exclusive lock for writing. $this->assertFalse(@flock($handle, LOCK_EX | LOCK_NB), 'Unable to acquire an exclusive lock using the read-only stream wrapper.'); - // Attempt to obtain a shared lock + // Attempt to obtain a shared lock. $this->assertTrue(flock($handle, LOCK_SH | LOCK_NB), 'Able to acquire a shared lock using the read-only stream wrapper.'); - // Attempt to release a shared lock + // Attempt to release a shared lock. $this->assertTrue(flock($handle, LOCK_UN | LOCK_NB), 'Able to release a shared lock using the read-only stream wrapper.'); - // Attempt to truncate the file + // Attempt to truncate the file. $this->assertFalse(@ftruncate($handle, 0), 'Unable to truncate using the read-only stream wrapper.'); - // Attempt to write to the file + // Attempt to write to the file. $this->assertEquals(0, @fwrite($handle, $this->randomMachineName()), 'Unable to write to file using the read-only stream wrapper.'); - // Attempt to flush output to the file + // Attempt to flush output to the file. $this->assertFalse(@fflush($handle), 'Unable to flush output to file using the read-only stream wrapper.'); // Attempt to close the stream. (Suppress errors, as fclose triggers // fflush.) $this->assertTrue(fclose($handle), 'Able to close file using the read_only stream wrapper.'); - // Test the rename() function + // Test the rename() function. $this->assertFalse(@rename($uri, $this->scheme . '://new_name.txt'), 'Unable to rename files using the read-only stream wrapper.'); - // Test the unlink() function + // Test the unlink() function. $this->assertTrue(@$file_system->unlink($uri), 'Able to unlink file using read-only stream wrapper.'); $this->assertFileExists($filepath); @@ -93,7 +93,7 @@ class ReadOnlyStreamWrapperTest extends FileTestBase { /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); $this->assertFalse(@$file_system->mkdir($read_only_dir, 0775, 0), 'Unable to create directory with read-only stream wrapper.'); - // Create a temporary directory for testing purposes + // Create a temporary directory for testing purposes. $this->assertTrue($file_system->mkdir($dir), 'Test directory created.'); // Test the rmdir() function by attempting to remove the directory. $this->assertFalse(@$file_system->rmdir($read_only_dir), 'Unable to delete directory with read-only stream wrapper.'); diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php index 91af498b01c..f689e4d9124 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php @@ -38,7 +38,7 @@ abstract class StorageTestBase extends KernelTestBase { protected function setUp(): void { parent::setUp(); - // Define two data collections, + // Define two data collections. $this->collections = [0 => 'zero', 1 => 'one']; // Create several objects for testing. diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php index 4cc3a8148ef..5ef26929c46 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php @@ -706,7 +706,7 @@ class RouteProviderTest extends KernelTestBase { $this->assertEquals(0, $result->count()); $candidates = $provider->getCandidateOutlines(explode('/', trim($shortest, '/'))); $this->assertCount(7, $candidates); - // A longer patten is not found and returns no candidates + // A longer patten is not found and returns no candidates. $path_to_test = '/test/1/test2/2/test3/3/4/5/6/test4'; $result = $provider->getRoutesByPattern($path_to_test); $this->assertEquals(0, $result->count()); diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index c45e937d371..02a9abbc9ad 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -967,7 +967,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa ->save(); // The installation profile is provided by a container parameter. Saving - // the configuration doesn't automatically trigger invalidation + // the configuration doesn't automatically trigger invalidation. $this->container->get('kernel')->rebuildContainer(); } diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index db658255c82..80d3d18007b 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -250,7 +250,7 @@ class KernelTestBaseTest extends KernelTestBase { * Tests the assumption that local time is in 'Australia/Sydney'. */ public function testLocalTimeZone(): void { - // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php + // 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/TestSite/TestSiteClaroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php index 26cc8a29033..14f92944b31 100644 --- a/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php +++ b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php @@ -32,17 +32,17 @@ class TestSiteClaroInstallTestScript implements TestSetupInterface { $system_theme_config = \Drupal::configFactory()->getEditable('system.theme'); $system_theme_config->set('default', 'claro')->save(); - // Create an article that will have no comments + // Create an article that will have no comments. $article_no_comments = Node::create(['type' => 'article']); $article_no_comments->set('title', 'Article without comments'); - // Enable comments + // Enable comments. $article_no_comments->set('comment', 2); $article_no_comments->save(); - // Create an article that will have comments + // Create an article that will have comments. $article_with_comments = Node::create(['type' => 'article']); $article_with_comments->set('title', 'Article with comments'); - // Enable comments + // Enable comments. $article_with_comments->set('comment', 2); $article_with_comments->save(); @@ -60,7 +60,7 @@ class TestSiteClaroInstallTestScript implements TestSetupInterface { // Whether the comment is 'approved' or not. 'status' => 1, ]; - // Create comment entities out of our field values + // Create comment entities out of our field values. $comment1 = Comment::create($values); $comment1->save(); diff --git a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php index 02e945b7e2d..f175156ad05 100644 --- a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php +++ b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php @@ -32,17 +32,17 @@ class TestSiteOliveroInstallTestScript implements TestSetupInterface { $system_theme_config = \Drupal::configFactory()->getEditable('system.theme'); $system_theme_config->set('default', 'olivero')->save(); - // Create an article that will have no comments + // Create an article that will have no comments. $article_no_comments = Node::create(['type' => 'article']); $article_no_comments->set('title', 'Article without comments'); - // Enable comments + // Enable comments. $article_no_comments->set('comment', 2); $article_no_comments->save(); - // Create an article that will have comments + // Create an article that will have comments. $article_with_comments = Node::create(['type' => 'article']); $article_with_comments->set('title', 'Article with comments'); - // Enable comments + // Enable comments. $article_with_comments->set('comment', 2); $article_with_comments->save(); @@ -60,7 +60,7 @@ class TestSiteOliveroInstallTestScript implements TestSetupInterface { // Whether the comment is 'approved' or not. 'status' => 1, ]; - // Create comment entities out of our field values + // Create comment entities out of our field values. $comment1 = Comment::create($values); $comment1->save(); diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index b57d2740704..87cd766c288 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -988,7 +988,7 @@ class ContainerTest extends TestCase { 'configurator' => 'configurator_service_test_does_not_exist', ]; - // Raw argument + // Raw argument. $services['service_with_raw_argument'] = [ 'class' => '\Drupal\Tests\Component\DependencyInjection\MockInstantiationService', 'arguments' => $this->getCollection([$this->getRaw('ccc')]), diff --git a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php index 3e9169c5969..c36c4a619f9 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php +++ b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php @@ -53,7 +53,7 @@ class JsonTest extends TestCase { // Characters that must be escaped. // We check for unescaped " separately. $this->htmlUnsafe = ['<', '>', '\'', '&']; - // The following are the encoded forms of: < > ' & " + // The following are the encoded forms of '<', '>', "'", '&', and '"'. $this->htmlUnsafeEscaped = ['\u003C', '\u003E', '\u0027', '\u0026', '\u0022']; } @@ -110,7 +110,7 @@ class JsonTest extends TestCase { foreach ($this->htmlUnsafe as $char) { $this->assertStringNotContainsString($char, $json, sprintf('A JSON encoded string does not contain %s.', $char)); } - // Verify that JSON encoding escapes the HTML unsafe characters + // Verify that JSON encoding escapes the HTML unsafe characters. foreach ($this->htmlUnsafeEscaped as $char) { $this->assertStringContainsString($char, $json, sprintf('A JSON encoded string contains %s.', $char)); } diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php index 693a75d6f92..5857d2acf7d 100644 --- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php @@ -607,7 +607,7 @@ class XssTest extends TestCase { */ public static function providerTestFilterXssAdminNotNormalized() { return [ - // DRUPAL-SA-2008-044 + // DRUPAL-SA-2008-044. ['<object />', 'object', 'Admin HTML filter -- should not allow object tag.'], ['<script />', 'script', 'Admin HTML filter -- should not allow script tag.'], ]; diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index e44218405bb..1bcc9cab78d 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -207,7 +207,7 @@ class AccessResultTest extends UnitTestCase { $this->assertEquals('forbidden message', $access->getReason()); $this->assertDefaultCacheability($access); - // NEUTRAL && ALLOW == NEUTRAL + // NEUTRAL && ALLOW == NEUTRAL. $access = $neutral->andIf($allowed); $this->assertFalse($access->isAllowed()); $this->assertFalse($access->isForbidden()); @@ -231,7 +231,7 @@ class AccessResultTest extends UnitTestCase { $this->assertEquals('forbidden message', $access->getReason()); $this->assertDefaultCacheability($access); - // FORBIDDEN && ALLOWED = FORBIDDEN + // FORBIDDEN && ALLOWED = FORBIDDEN. $access = $forbidden->andIf($allowed); $this->assertFalse($access->isAllowed()); $this->assertTrue($access->isForbidden()); @@ -239,7 +239,7 @@ class AccessResultTest extends UnitTestCase { $this->assertEquals('forbidden message', $access->getReason()); $this->assertDefaultCacheability($access); - // FORBIDDEN && NEUTRAL = FORBIDDEN + // FORBIDDEN && NEUTRAL = FORBIDDEN. $access = $forbidden->andIf($neutral); $this->assertFalse($access->isAllowed()); $this->assertTrue($access->isForbidden()); @@ -247,7 +247,7 @@ class AccessResultTest extends UnitTestCase { $this->assertEquals('forbidden message', $access->getReason()); $this->assertDefaultCacheability($access); - // FORBIDDEN && FORBIDDEN = FORBIDDEN + // FORBIDDEN && FORBIDDEN = FORBIDDEN. $access = $forbidden->andIf($forbidden); $this->assertFalse($access->isAllowed()); $this->assertTrue($access->isForbidden()); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php index e313731c9eb..a0f6447554d 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php @@ -449,7 +449,7 @@ class ConfigTest extends UnitTestCase { 'Config object name ' . str_repeat('a', Config::MAX_NAME_LENGTH) . '. exceeds maximum allowed length of ' . Config::MAX_NAME_LENGTH . ' characters.', ], ]; - // Name must not contain : ? * < > " ' / \ + // Name must not contain ":", "?", "*", "<", ">", """, "'", "/", or "\". foreach ([':', '?', '*', '<', '>', '"', "'", '/', '\\'] as $char) { $name = 'name.' . $char; $return[] = [ diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 2e8125f331d..e99ce613883 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -660,7 +660,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::set */ public function testSet(): void { - // Exercise set(), check if it returns $this + // Exercise set(), check if it returns $this. $this->assertSame( $this->entity, $this->entity->set('id', 0) diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index af2743a8072..4bb5c1f1ec3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -280,7 +280,7 @@ class EntityFieldManagerTest extends UnitTestCase { $this->assertSame($expected, $this->entityFieldManager->getFieldDefinitions('test_entity_type', 'test_entity_bundle')); // Test that base fields and bundle fields from the bundle class and - // entity class are retrieved + // entity class are retrieved. $expected = [ 'id' => $field_definition, 'some_extra_field' => $bundle_fields['the_entity_id']['test_entity_bundle_class']['some_extra_field'], @@ -620,11 +620,11 @@ class EntityFieldManagerTest extends UnitTestCase { $storage->loadMultiple(Argument::type('array'))->willReturn([]); // By default, make the storage entity class lookup return the - // EntityTypeManagerTestEntity class + // EntityTypeManagerTestEntity class. $storage->getEntityClass(NULL)->willReturn(EntityTypeManagerTestEntity::class); $storage->getEntityClass(Argument::type('string'))->willReturn(EntityTypeManagerTestEntity::class); // When using the "test_entity_bundle_class" bundle, return the - // EntityTypeManagerTestEntityBundle class + // EntityTypeManagerTestEntityBundle class. $storage->getEntityClass('test_entity_bundle_class')->willReturn(EntityTypeManagerTestEntityBundle::class); $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index 2381b64b83a..9dbc2308b2d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -610,7 +610,7 @@ class KeyValueEntityStorageTest extends UnitTestCase { */ protected function getMockEntity(string $class = EntityBaseTest::class, array $arguments = [], array $methods = []): EntityInterface&MockObject { // Ensure the entity is passed at least an array of values and an entity - // type ID + // type ID. if (!isset($arguments[0])) { $arguments[0] = []; } diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php index 5c7ad53788d..73acc7f5ade 100644 --- a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php @@ -357,7 +357,7 @@ class ConfigTargetTest extends UnitTestCase { 'second', ], // In case of multiple targets, the return value must be an array with the - // keys matching + // keys matching. // @see ::testMultiTarget() fromConfig: fn (int $first, int $second): string => "$first|$second", toConfig: fn (): mixed => $toConfigReturnValue, diff --git a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php index 887aa67098b..06629fdc6ff 100644 --- a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php @@ -53,7 +53,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase { $data[] = [['test1' => ['parent' => 'test0']], 'test1', ['parent' => 'test0']]; // Non existing ID. $data[] = [['test1' => ['parent' => 'test0']], 'test2', []]; - // Ensure that the ID is encoded properly + // Ensure that the ID is encoded properly. $data[] = [['test1__la___ma' => ['parent' => 'test0']], 'test1.la__ma', ['parent' => 'test0']]; return $data; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index 91e21361a0f..6685372e507 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -535,7 +535,7 @@ class RendererBubblingTest extends RendererTestBase { $this->setUpRequest(); $this->setUpMemoryCache(); - // Ensure a logic exception + // Ensure a logic exception. $data = [ '#cache' => [ 'keys' => ['llama', 'bar'], diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php index 60a7e0c9573..f19eb9541e9 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php @@ -104,7 +104,7 @@ class RedirectDestinationTest extends UnitTestCase { // A request with a destination query. $data[] = [$request, '/example']; - // A request without a destination query, + // A request without a destination query. $request = Request::create('/'); $data[] = [$request, '/current-path']; diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php index 8f597af977f..3a3287c357a 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php @@ -51,15 +51,15 @@ class ByteSizeMarkupTest extends UnitTestCase { ['1 ZB', pow($kb, 7)], ['1 YB', pow($kb, 8)], ['1024 YB', pow($kb, 9)], - // Rounded to 1 MB - not 1000 or 1024 kilobytes + // Rounded to 1 MB - not 1000 or 1024 kilobytes. ['1 MB', ($kb * $kb) - 1], ['-1 MB', -(($kb * $kb) - 1)], - // Decimal Megabytes + // Decimal Megabytes. ['3.46 MB', 3623651], ['3.77 GB', 4053371676], - // Decimal Petabytes + // Decimal Petabytes. ['59.72 PB', 67234178751368124], - // Decimal Yottabytes + // Decimal Yottabytes. ['194.67 YB', 235346823821125814962843827], ]; } diff --git a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php index db4ccefa9cb..0de9aa85ce9 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php @@ -15,7 +15,7 @@ class TestSuiteBaseTest extends TestCase { * Tests the assumption that local time is in 'Australia/Sydney'. */ public function testLocalTimeZone(): void { - // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php + // 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/DrupalTestBrowser.php b/core/tests/Drupal/Tests/DrupalTestBrowser.php index 6c9b10b3ff1..663779fde1a 100644 --- a/core/tests/Drupal/Tests/DrupalTestBrowser.php +++ b/core/tests/Drupal/Tests/DrupalTestBrowser.php @@ -94,7 +94,7 @@ class DrupalTestBrowser extends AbstractBrowser { if (str_starts_with($key, 'http-')) { $headers[substr($key, 5)] = $val; } - // CONTENT_* are not prefixed with HTTP_ + // "CONTENT_*" are not prefixed with "HTTP_". elseif (isset($content_headers[$key])) { $headers[$key] = $val; } @@ -134,7 +134,7 @@ class DrupalTestBrowser extends AbstractBrowser { $method = $request->getMethod(); $uri = $request->getUri(); - // Let BrowserKit handle redirects + // Let BrowserKit handle redirects. try { $response = $this->getClient()->request($method, $uri, $request_options); } |