summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php6
-rw-r--r--core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php3
-rw-r--r--core/modules/block/tests/src/Unit/BlockRepositoryTest.php3
-rw-r--r--core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php3
-rw-r--r--core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php18
-rw-r--r--core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php3
-rw-r--r--core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php6
-rw-r--r--core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php18
-rw-r--r--core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php3
-rw-r--r--core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php12
-rw-r--r--core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php3
-rw-r--r--core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php3
-rw-r--r--core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php9
-rw-r--r--core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php9
-rw-r--r--core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php9
-rw-r--r--core/modules/migrate/tests/src/Unit/TestSqlIdMap.php2
-rw-r--r--core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php6
-rw-r--r--core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php6
-rw-r--r--core/modules/mysql/tests/src/Unit/InstallTasksTest.php18
-rw-r--r--core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php3
-rw-r--r--core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php3
-rw-r--r--core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php3
-rw-r--r--core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php3
-rw-r--r--core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php3
-rw-r--r--core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php3
-rw-r--r--core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php3
-rw-r--r--core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php3
-rw-r--r--core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php3
-rw-r--r--core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php3
-rw-r--r--core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php9
-rw-r--r--core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php3
-rw-r--r--core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php3
-rw-r--r--core/modules/user/tests/src/Unit/PermissionHandlerTest.php12
-rw-r--r--core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php3
-rw-r--r--core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php6
-rw-r--r--core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php3
-rw-r--r--core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php3
-rw-r--r--core/modules/views/tests/src/Unit/PluginBaseTest.php3
-rw-r--r--core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php3
-rw-r--r--core/modules/views/tests/src/Unit/ViewsDataTest.php3
-rw-r--r--core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php3
-rw-r--r--core/phpcs.xml.dist1
42 files changed, 224 insertions, 1 deletions
diff --git a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
index 0ae2104b6ed7..69eca6473b49 100644
--- a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
@@ -42,6 +42,9 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
$big_pipe_response_attachments_processor->processAttachments($non_html_response);
}
+ /**
+ * Provides data to testNonHtmlResponse().
+ */
public static function nonHtmlResponseProvider() {
return [
'AjaxResponse, which implements AttachmentsInterface' => [AjaxResponse::class],
@@ -89,6 +92,9 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
$this->assertEquals('processed', $processed_big_pipe_response->getContent(), 'Content of returned (processed) response object MUST be changed.');
}
+ /**
+ * Provides data to testHtmlResponse().
+ */
public static function attachmentsProvider() {
$typical_cases = [
'no attachments' => [[]],
diff --git a/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php b/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php
index 3a6090b7afff..ec0cd6c9a3c5 100644
--- a/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php
@@ -37,6 +37,9 @@ final class ContentLengthTest extends UnitTestCase {
$this->assertSame((string) $expected_header, $response->headers->get('Content-Length'));
}
+ /**
+ * Provides data for testHandle().
+ */
public static function providerTestSetContentLengthHeader() {
$response = new Response('Test content', 200);
$response->headers->set('Content-Length', (string) strlen('Test content'));
diff --git a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
index 4d36f8aa36ce..dd1a70b76fc2 100644
--- a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
+++ b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php
@@ -112,6 +112,9 @@ class BlockRepositoryTest extends UnitTestCase {
$this->assertEquals($expected_blocks, $result);
}
+ /**
+ * Provides data to testGetVisibleBlocksPerRegion().
+ */
public static function providerBlocksConfig() {
$blocks_config = [
'block1' => [
diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
index d9648265184e..871af6072fd4 100644
--- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
+++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
@@ -66,6 +66,9 @@ class BlockPageVariantTest extends UnitTestCase {
return new BlockPageVariant($configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, ['config:block_list']);
}
+ /**
+ * Provides data to testBuild().
+ */
public static function providerBuild() {
$blocks_config = [
'block1' => [
diff --git a/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php b/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php
index 49621be87fd7..f512c008ceeb 100644
--- a/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php
+++ b/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php
@@ -28,6 +28,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertIsArray($restrictions->getAllowedElements(FALSE));
}
+ /**
+ * Provides data to testConstructor().
+ */
public static function providerConstruct(): \Generator {
// Fundamental structure.
yield 'INVALID: list instead of key-value pairs' => [
@@ -167,6 +170,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertCount($expected_concrete_plus_wildcard_count, $r->getAllowedElements(FALSE));
}
+ /**
+ * Provides data to testCounting().
+ */
public static function providerCounting(): \Generator {
yield 'empty' => [
[],
@@ -257,6 +263,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertSame($expected_raw + $filter_html_additional_expectations, HTMLRestrictions::fromFilterPluginInstance($filter_plugin_instance->reveal())->getAllowedElements(FALSE));
}
+ /**
+ * Provides data to testConvenienceConstructors().
+ */
public static function providerConvenienceConstructors(): \Generator {
// All empty cases.
yield 'empty string' => [
@@ -639,6 +648,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertSame($expected_ghs_config, $restrictions->toGeneralHtmlSupportConfig());
}
+ /**
+ * Provides data to testRepresentations().
+ */
public static function providerRepresentations(): \Generator {
yield 'empty set' => [
HTMLRestrictions::emptySet(),
@@ -920,6 +932,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertEquals($expected_union, $a->merge($b));
}
+ /**
+ * Provides data to testOperations().
+ */
public static function providerOperands(): \Generator {
// Empty set operand cases.
yield 'any set + empty set' => [
@@ -1678,6 +1693,9 @@ class HTMLRestrictionsTest extends UnitTestCase {
$this->assertEquals($expected_extracted_plain_tags_subset, $input->extractPlainTagsSubset());
}
+ /**
+ * Provides data to testSubsets().
+ */
public static function providerSubsets(): \Generator {
yield 'empty set' => [
new HTMLRestrictions([]),
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index d00c44595dac..76c3578a41a0 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -333,6 +333,9 @@ namespace Drupal\comment;
if (!function_exists('history_read')) {
+ /**
+ * Gets a timestamp for the current user's last view of a specified node.
+ */
function history_read($nid) {
return 0;
}
diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
index 07f2b29dd663..a638add1049e 100644
--- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
@@ -303,10 +303,16 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
*/
class DependencyFieldItem {
+ /**
+ * Gets the dependencies for this field item.
+ */
public static function calculateDependencies(FieldDefinitionInterface $definition) {
return ['module' => ['test_module3']];
}
+ /**
+ * Informs the entity that entities it depends on will be deleted.
+ */
public static function onDependencyRemoval($field_config, $dependencies) {
}
diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php
index ef3dfb4767e1..6fd395a23ef6 100644
--- a/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php
+++ b/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php
@@ -24,6 +24,9 @@ class FileUriTest extends MigrateTestCase {
'id' => 'test',
];
+ /**
+ * Tests with a public scheme.
+ */
public function testPublic(): void {
$value = [
'sites/default/files/foo.jpg',
@@ -34,6 +37,9 @@ class FileUriTest extends MigrateTestCase {
$this->assertEquals('public://foo.jpg', $this->doTransform($value));
}
+ /**
+ * Tests with a base path that is not known.
+ */
public function testPublicUnknownBasePath(): void {
$value = [
'/path/to/public/files/foo.jpg',
@@ -44,6 +50,9 @@ class FileUriTest extends MigrateTestCase {
$this->assertEquals('public://path/to/public/files/foo.jpg', $this->doTransform($value));
}
+ /**
+ * Tests with a private scheme.
+ */
public function testPrivate(): void {
$value = [
'sites/default/files/baz.gif',
@@ -54,6 +63,9 @@ class FileUriTest extends MigrateTestCase {
$this->assertEquals('private://baz.gif', $this->doTransform($value));
}
+ /**
+ * Tests with a private base path that is not known.
+ */
public function testPrivateUnknownBasePath(): void {
$value = [
'/path/to/private/files/baz.gif',
@@ -64,6 +76,9 @@ class FileUriTest extends MigrateTestCase {
$this->assertEquals('private://path/to/private/files/baz.gif', $this->doTransform($value));
}
+ /**
+ * Tests the temporary scheme.
+ */
public function testTemporary(): void {
$value = [
'/tmp/bar.png',
@@ -74,6 +89,9 @@ class FileUriTest extends MigrateTestCase {
$this->assertEquals('temporary://bar.png', $this->doTransform($value));
}
+ /**
+ * Performs the transform process.
+ */
protected function doTransform(array $value) {
$executable = new MigrateExecutable($this->getMigration());
$row = new Row();
diff --git a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
index e79c6d23b1bc..25d31c500c6e 100644
--- a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
+++ b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php
@@ -171,6 +171,9 @@ class FilterUninstallValidatorTest extends UnitTestCase {
*/
class FilterBaseTestableClass extends FilterBase {
+ /**
+ * {@inheritdoc}
+ */
public function process($text, $langcode) {
return new FilterProcessResult();
}
diff --git a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
index cf7388e7dccf..86236f3a47a5 100644
--- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
+++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
@@ -151,6 +151,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->assertSame($expected, $config->getDefaultLangcode());
}
+ /**
+ * Provides data to testDefaultLangcode().
+ */
public static function providerDefaultLangcode() {
$langcode = Random::machineName();
$config = new ContentLanguageSettings([
@@ -180,6 +183,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->assertSame($expected, $config->isLanguageAlterable());
}
+ /**
+ * Provides data to testLanguageAlterable().
+ */
public static function providerLanguageAlterable() {
$alterableConfig = new ContentLanguageSettings([
'target_entity_type_id' => 'test_entity_type',
@@ -214,6 +220,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->assertSame($expected, $config->isDefaultConfiguration());
}
+ /**
+ * Provides data to testIsDefaultConfiguration().
+ */
public static function providerIsDefaultConfiguration() {
$alteredLanguage = new ContentLanguageSettings([
'target_entity_type_id' => 'test_entity_type',
@@ -281,6 +290,9 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->assertSame($expected_language_alterable, $config->isLanguageAlterable());
}
+ /**
+ * Provides data to testLoadByEntityTypeBundle().
+ */
public static function providerLoadByEntityTypeBundle() {
$alteredLanguage = new ContentLanguageSettings([
'target_entity_type_id' => 'test_entity_type',
diff --git a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
index 0784b457a125..8fb765cdcaad 100644
--- a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
+++ b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php
@@ -345,6 +345,9 @@ namespace Drupal\language\Plugin\LanguageNegotiation;
if (!function_exists('base_path')) {
+ /**
+ * Returns the base path.
+ */
function base_path() {
return '/';
}
diff --git a/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php b/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php
index efa52a8ec67e..176ffa13292b 100644
--- a/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php
+++ b/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php
@@ -14,6 +14,9 @@ use Drupal\Tests\UnitTestCase;
*/
class LocaleBulkDeprecationTest extends UnitTestCase {
+ /**
+ * {@inheritdoc}
+ */
protected function setUp(): void {
parent::setUp();
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
index 6b18a1bacb83..1cabbebdde6f 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
@@ -122,14 +122,23 @@ class EntityTestDestination extends EntityContentBase {
*/
private $entity = NULL;
+ /**
+ * Sets the test entity.
+ */
public function setEntity($entity): void {
$this->entity = $entity;
}
+ /**
+ * Gets the test entity.
+ */
protected function getEntity(Row $row, array $old_destination_id_values) {
return $this->entity;
}
+ /**
+ * Gets the test entity ID.
+ */
public static function getEntityTypeId($plugin_id) {
return 'foo';
}
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php
index 610f5dbb5bf5..1dde373b8851 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php
@@ -110,14 +110,23 @@ class EntityRevisionTestDestination extends EntityRevision {
*/
private $entity = NULL;
+ /**
+ * Sets the test entity.
+ */
public function setEntity($entity): void {
$this->entity = $entity;
}
+ /**
+ * Gets the test entity.
+ */
protected function getEntity(Row $row, array $old_destination_id_values) {
return $this->entity;
}
+ /**
+ * Gets the test entity ID.
+ */
public static function getEntityTypeId($plugin_id) {
return 'foo';
}
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
index 4176c3935024..ff185911cccb 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
@@ -59,14 +59,23 @@ class EntityTestBase extends UnitTestCase {
*/
class BaseFieldDefinitionTest extends BaseFieldDefinition {
+ /**
+ * {@inheritdoc}
+ */
public static function create($type) {
return new static([]);
}
+ /**
+ * {@inheritdoc}
+ */
public function getSettings() {
return [];
}
+ /**
+ * {@inheritdoc}
+ */
public function getType() {
return 'integer';
}
diff --git a/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php b/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php
index 0ddee3085393..296d615f6e2d 100644
--- a/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php
+++ b/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php
@@ -82,7 +82,7 @@ class TestSqlIdMap extends Sql implements \Iterator {
/**
* {@inheritdoc}
*/
- // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
+ // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod, Drupal.Commenting.FunctionComment.Missing
public function ensureTables() {
parent::ensureTables();
}
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
index 0c2b729e8b66..bac47cde2f20 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
@@ -71,11 +71,17 @@ class TestPerComponentEntityDisplay extends ComponentEntityDisplayBase {
$this->entity = $entity;
}
+ /**
+ * Gets the test entity.
+ */
protected function getEntity($entity_type, $bundle, $view_mode) {
$this->testValues = func_get_args();
return $this->entity;
}
+ /**
+ * Gets the test values.
+ */
public function getTestValues() {
return $this->testValues;
}
diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
index 0ce3f69e6bb3..774ba999baf6 100644
--- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
+++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
@@ -71,11 +71,17 @@ class TestPerComponentEntityFormDisplay extends PerComponentEntityFormDisplay {
$this->entity = $entity;
}
+ /**
+ * Gets the test entity.
+ */
protected function getEntity($entity_type, $bundle, $form_mode) {
$this->testValues = func_get_args();
return $this->entity;
}
+ /**
+ * Gets the test values.
+ */
public function getTestValues() {
return $this->testValues;
}
diff --git a/core/modules/mysql/tests/src/Unit/InstallTasksTest.php b/core/modules/mysql/tests/src/Unit/InstallTasksTest.php
index a50a6f010c76..90305518bee2 100644
--- a/core/modules/mysql/tests/src/Unit/InstallTasksTest.php
+++ b/core/modules/mysql/tests/src/Unit/InstallTasksTest.php
@@ -55,14 +55,23 @@ class InstallTasksTest extends UnitTestCase {
$this->connection = $connection;
}
+ /**
+ * {@inheritdoc}
+ */
protected function isConnectionActive() {
return TRUE;
}
+ /**
+ * {@inheritdoc}
+ */
protected function getConnection() {
return $this->connection;
}
+ /**
+ * {@inheritdoc}
+ */
protected function t($string, array $args = [], array $options = []) {
return $string;
}
@@ -79,14 +88,23 @@ class InstallTasksTest extends UnitTestCase {
private function createTasksNoConnection(): Tasks {
return new class() extends Tasks {
+ /**
+ * {@inheritdoc}
+ */
protected function isConnectionActive() {
return FALSE;
}
+ /**
+ * {@inheritdoc}
+ */
protected function getConnection() {
return NULL;
}
+ /**
+ * {@inheritdoc}
+ */
protected function t($string, array $args = [], array $options = []) {
return $string;
}
diff --git a/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php b/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php
index af84befb7dab..b54e663179a4 100644
--- a/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php
+++ b/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php
@@ -18,6 +18,9 @@ use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
*/
class LoggingBeginnerTest extends UnitTestCase {
+ /**
+ * Tests the output of LoggingBeginner().
+ */
public function testDecoratedBeginnerIsCalled(): void {
$decorated = $this->createMock(BeginnerInterface::class);
diff --git a/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php b/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php
index 3d6ab55de0cf..83c19a1b8b66 100644
--- a/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php
+++ b/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php
@@ -18,6 +18,9 @@ use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
*/
class LoggingCommitterTest extends UnitTestCase {
+ /**
+ * Tests the output of LoggingCommitter().
+ */
public function testDecoratedCommitterIsCalled(): void {
$decorated = $this->createMock(CommitterInterface::class);
diff --git a/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php b/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php
index f21577c348d3..a7e6c050e173 100644
--- a/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php
+++ b/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php
@@ -18,6 +18,9 @@ use PhpTuf\ComposerStager\API\Process\Value\OutputTypeEnum;
*/
class LoggingStagerTest extends UnitTestCase {
+ /**
+ * Tests LoggingStager().
+ */
public function testDecoratedStagerIsCalled(): void {
$decorated = $this->createMock(StagerInterface::class);
diff --git a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php
index 5b1c0c400b54..7e0740473736 100644
--- a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php
+++ b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php
@@ -53,6 +53,9 @@ class ResourceResponseSubscriberTest extends UnitTestCase {
$this->assertEquals($expected_response !== FALSE ? $expected_response : Json::encode($data), $event->getResponse()->getContent());
}
+ /**
+ * Provides data to testSerialization().
+ */
public static function providerTestSerialization() {
return [
// The default data for \Drupal\rest\ResourceResponse.
diff --git a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
index ce67ed1e0056..fdc9754f3bd1 100644
--- a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
+++ b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
@@ -321,6 +321,9 @@ class TestSearchPage extends SearchPage {
}
}
+ /**
+ * {@inheritdoc}
+ */
public function label($langcode = NULL) {
return $this->label;
}
diff --git a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
index e4da1fbde1fe..99130000b404 100644
--- a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
+++ b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
@@ -108,6 +108,9 @@ class XmlEncoderTest extends UnitTestCase {
*/
class TestObject {
+ /**
+ * Return the characters "A".
+ */
public function getA() {
return 'A';
}
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php
index 4a805e19d6b3..9c6d8a52f5c8 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php
@@ -307,6 +307,9 @@ class DateTimeIso8601NormalizerTest extends UnitTestCase {
*/
class DateTimeIso8601NormalizerTestDrupalDateTime extends DrupalDateTime {
+ /**
+ * Sets the timezone.
+ */
public function setTimezone(\DateTimeZone $timezone) {
parent::setTimezone($timezone);
}
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php
index 3527c5ef6ffd..3082742e4a47 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php
@@ -232,6 +232,9 @@ class DateTimeNormalizerTest extends UnitTestCase {
*/
class DateTimeNormalizerTestDrupalDateTime extends DrupalDateTime {
+ /**
+ * Sets the timezone.
+ */
public function setTimezone(\DateTimeZone $timezone) {
parent::setTimezone($timezone);
}
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
index 905598fea786..02ee2585da87 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php
@@ -169,6 +169,9 @@ class EntityReferenceFieldItemNormalizerTest extends UnitTestCase {
$this->assertSame($expected, $normalized);
}
+ /**
+ * Tests normalizing with an entity reference field.
+ */
public function testNormalizeWithNewEntityReference(): void {
$test_url = '/test/100';
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php
index e0e4c991c470..60f6db35f7ce 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php
@@ -172,6 +172,9 @@ class TimestampNormalizerTest extends UnitTestCase {
*/
class TimestampNormalizerTestDrupalDateTime extends DrupalDateTime {
+ /**
+ * Sets the timezone.
+ */
public function setTimezone(\DateTimeZone $timezone) {
parent::setTimezone($timezone);
}
diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index e3745d487755..58a2a29e162c 100644
--- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@ -419,6 +419,9 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
->willReturn((new AccessResultAllowed())->cachePerPermissions());
}
+ /**
+ * Prepares the mock processInbound() method.
+ */
protected function setupStubPathProcessor(): void {
$this->pathProcessor->expects($this->any())
->method('processInbound')
@@ -437,11 +440,17 @@ class TestPathBasedBreadcrumbBuilder extends PathBasedBreadcrumbBuilder {
*/
protected LinkGeneratorInterface $linkGenerator;
+ /**
+ * {@inheritdoc}
+ */
public function setStringTranslation(TranslationInterface $string_translation) {
$this->stringTranslation = $string_translation;
return $this;
}
+ /**
+ * Sets the link generator.
+ */
public function setLinkGenerator(LinkGeneratorInterface $link_generator): void {
$this->linkGenerator = $link_generator;
}
diff --git a/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php b/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php
index 2f67aa7a609d..0486dffcc1e4 100644
--- a/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php
+++ b/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php
@@ -27,6 +27,9 @@ class FileTransferTest extends UnitTestCase {
$this->testConnection = TestFileTransfer::factory($this->root, []);
}
+ /**
+ * Tests the value returned by __get().
+ */
public function testFileTransferMagicMethods(): void {
// Test to ensure __get() preserves public access.
$this->assertInstanceOf(MockTestConnection::class, $this->testConnection->connection);
diff --git a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php b/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php
index 7cd8f89c11e0..bbb2c88a8897 100644
--- a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php
+++ b/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php
@@ -30,6 +30,9 @@ class AdminRouteSubscriberTest extends UnitTestCase {
$this->assertSame($is_admin, $route->getOption('_admin_route'));
}
+ /**
+ * Provides data to testAlterRoutes().
+ */
public static function providerTestAlterRoutes() {
$data = [];
$data['non-admin'] = [
diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
index 0a46196d1d46..c07756add0e1 100644
--- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
+++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php
@@ -358,12 +358,18 @@ EOF
*/
class TestPermissionCallbacks {
+ /**
+ * Callback that returns a single description.
+ */
public function singleDescription() {
return [
'access_module_a' => 'single_description',
];
}
+ /**
+ * Callback that returns the title and description.
+ */
public function titleDescription() {
return [
'access module b' => [
@@ -373,6 +379,9 @@ class TestPermissionCallbacks {
];
}
+ /**
+ * Callback that returns restricted access.
+ */
public function titleDescriptionRestrictAccess() {
return [
'access_module_c' => [
@@ -383,6 +392,9 @@ class TestPermissionCallbacks {
];
}
+ /**
+ * Callback that returns the title.
+ */
public function titleProvider() {
return [
'access module a via module b' => [
diff --git a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
index c7dbd103ea10..75f7305e8173 100644
--- a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php
@@ -307,6 +307,9 @@ namespace Drupal\views\Plugin\Block;
if (!function_exists('views_add_contextual_links')) {
+ /**
+ * Define method views_add_contextual_links for this test.
+ */
function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) {
}
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index f2afff8e31dd..489102c07eb9 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -972,6 +972,9 @@ class FieldPluginBaseTest extends UnitTestCase {
*/
class FieldPluginBaseTestField extends FieldPluginBase {
+ /**
+ * Set the link generator.
+ */
public function setLinkGenerator(LinkGeneratorInterface $link_generator): void {
$this->linkGenerator = $link_generator;
}
@@ -983,6 +986,9 @@ namespace Drupal\views\Plugin\views\field;
if (!function_exists('base_path')) {
+ /**
+ * Returns the base path.
+ */
function base_path() {
return '/';
}
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
index 128a5cefb7cf..d872bac6cac3 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php
@@ -762,6 +762,9 @@ class FieldTest extends UnitTestCase {
*/
class FieldTestEntityField extends EntityField {
+ /**
+ * {@inheritdoc}
+ */
public function executePrepareItemsByDelta(array $all_values) {
return $this->prepareItemsByDelta($all_values);
}
diff --git a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php
index 7dad710f4419..edd524d3039c 100644
--- a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php
@@ -36,6 +36,9 @@ class SqlBaseTest extends UnitTestCase {
*/
protected $display;
+ /**
+ * {@inheritdoc}
+ */
protected function setUp(): void {
parent::setUp();
diff --git a/core/modules/views/tests/src/Unit/PluginBaseTest.php b/core/modules/views/tests/src/Unit/PluginBaseTest.php
index b0b708a71d8e..a78824176272 100644
--- a/core/modules/views/tests/src/Unit/PluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/PluginBaseTest.php
@@ -290,6 +290,9 @@ class PluginBaseTest extends UnitTestCase {
$this->assertEquals($expected_storage, $storage);
}
+ /**
+ * Provides data to testFilterByDefinedOptions().
+ */
public static function providerTestFilterByDefinedOptions() {
$data = [];
diff --git a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
index 07e8894e7074..aef3e8c11dd8 100644
--- a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php
@@ -206,6 +206,9 @@ namespace Drupal\views\Routing;
if (!function_exists('views_add_contextual_links')) {
+ /**
+ * Define method views_add_contextual_links for this test.
+ */
function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) {
}
diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php
index d88891901899..aec182fb164d 100644
--- a/core/modules/views/tests/src/Unit/ViewsDataTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php
@@ -649,6 +649,9 @@ class ViewsDataTest extends UnitTestCase {
$this->viewsData->get($key);
}
+ /**
+ * Provides data to testGetEmptyKey().
+ */
public static function providerTestGetEmptyKey() {
return [
[NULL],
diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
index b6a878eb5486..b51d5f1018f1 100644
--- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
+++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
@@ -202,6 +202,9 @@ class ViewListBuilderTest extends UnitTestCase {
*/
class TestViewListBuilder extends ViewListBuilder {
+ /**
+ * {@inheritdoc}
+ */
public function buildOperations(EntityInterface $entity) {
return [];
}
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index 7d3de555897d..50039ecc1717 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -70,6 +70,7 @@
<include-pattern>*/FunctionalJavascript/*</include-pattern>
<include-pattern>*/Kernel/*</include-pattern>
<include-pattern>*/Functional/*</include-pattern>
+ <include-pattern>*/Unit/*</include-pattern>
</rule>
<rule ref="Drupal.Commenting.FunctionComment.MissingParamType"/>
<rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment">