diff options
author | catch <catch@35733.no-reply.drupal.org> | 2024-06-19 13:45:54 +0100 |
---|---|---|
committer | catch <catch@35733.no-reply.drupal.org> | 2024-06-19 13:45:54 +0100 |
commit | a9f3d0ec7eb7680b4b52c466c3e0868663bb77ab (patch) | |
tree | 960b957b08dd04e418275a307673cef262c09bc6 /core/modules/jsonapi | |
parent | e2d8242830e89fd465d88c1f3d81af39a76af02e (diff) | |
download | drupal-a9f3d0ec7eb7680b4b52c466c3e0868663bb77ab.tar.gz drupal-a9f3d0ec7eb7680b4b52c466c3e0868663bb77ab.zip |
Issue #3421418 by mstrelan, Spokje, xjm, mondrake, longwave, acbramley: Add void return typehints to all test methods
Diffstat (limited to 'core/modules/jsonapi')
48 files changed, 178 insertions, 178 deletions
diff --git a/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php b/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php index 0b9347d7c899..7d35326abc63 100644 --- a/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php +++ b/core/modules/jsonapi/tests/src/Functional/BlockContentTest.php @@ -260,7 +260,7 @@ class BlockContentTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $this->entity->setPublished()->save(); $this->doTestCollectionFilterAccessForPublishableEntities('info', NULL, 'administer block content'); } diff --git a/core/modules/jsonapi/tests/src/Functional/CommentTest.php b/core/modules/jsonapi/tests/src/Functional/CommentTest.php index a5f85fe90a00..da7d6a7d8224 100644 --- a/core/modules/jsonapi/tests/src/Functional/CommentTest.php +++ b/core/modules/jsonapi/tests/src/Functional/CommentTest.php @@ -322,7 +322,7 @@ class CommentTest extends ResourceTestBase { * - base fields that are marked as required, but yet can still result in * validation errors other than "missing required field". */ - public function testPostIndividualDxWithoutCriticalBaseFields() { + public function testPostIndividualDxWithoutCriticalBaseFields(): void { $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -362,7 +362,7 @@ class CommentTest extends ResourceTestBase { /** * Tests POSTing a comment with and without 'skip comment approval'. */ - public function testPostIndividualSkipCommentApproval() { + public function testPostIndividualSkipCommentApproval(): void { $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -425,7 +425,7 @@ class CommentTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { // Verify the expected behavior in the common case. $this->doTestCollectionFilterAccessForPublishableEntities('subject', 'access comments', 'administer comments'); @@ -468,7 +468,7 @@ class CommentTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testPatchIndividual() { + public function testPatchIndividual(): void { // Ensure ::getModifiedEntityForPatchTesting() can pick an alternative value // for the 'entity_id' field. EntityTest::create([ @@ -476,7 +476,7 @@ class CommentTest extends ResourceTestBase { 'type' => 'bar', ])->save(); - return parent::testPatchIndividual(); + parent::testPatchIndividual(); } } diff --git a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php index d5a6586125a9..9e170ba2c5be 100644 --- a/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php +++ b/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php @@ -122,7 +122,7 @@ class ConfigurableLanguageTest extends ConfigEntityResourceTestBase { * * @see https://www.drupal.org/project/drupal/issues/2915539 */ - public function testGetIndividualDefaultConfig() { + public function testGetIndividualDefaultConfig(): void { // @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463. $url = Url::fromRoute('jsonapi.configurable_language--configurable_language.individual', ['entity' => ConfigurableLanguage::load('en')->uuid()]); /* $url = ConfigurableLanguage::load('en')->toUrl('jsonapi'); */ diff --git a/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php b/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php index b43340850353..d6fc9884175a 100644 --- a/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php +++ b/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php @@ -40,7 +40,7 @@ class EntryPointTest extends BrowserTestBase { /** * Test GET to the entry point. */ - public function testEntryPoint() { + public function testEntryPoint(): void { $request_options = []; $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json'; $response = $this->request('GET', Url::fromUri('base://jsonapi'), $request_options); diff --git a/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php b/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php index c0b9131aff66..dfdadeedc973 100644 --- a/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php +++ b/core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php @@ -113,7 +113,7 @@ class ExternalNormalizersTest extends BrowserTestBase { * * @dataProvider providerTestFormatAgnosticNormalizers */ - public function testFormatAgnosticNormalizers($test_module, $expected_value_jsonapi_normalization, $expected_value_jsonapi_denormalization) { + public function testFormatAgnosticNormalizers($test_module, $expected_value_jsonapi_normalization, $expected_value_jsonapi_denormalization): void { assert(in_array($expected_value_jsonapi_normalization, [static::VALUE_ORIGINAL, static::VALUE_OVERRIDDEN], TRUE)); assert(in_array($expected_value_jsonapi_denormalization, [static::VALUE_ORIGINAL, static::VALUE_OVERRIDDEN], TRUE)); diff --git a/core/modules/jsonapi/tests/src/Functional/FileTest.php b/core/modules/jsonapi/tests/src/Functional/FileTest.php index b4a7b71676fe..899bcbdc78fe 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileTest.php @@ -203,7 +203,7 @@ class FileTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testPostIndividual() { + public function testPostIndividual(): void { // @todo https://www.drupal.org/node/1927648 $this->markTestSkipped(); } @@ -223,7 +223,7 @@ class FileTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $label_field_name = 'filename'; // Verify the expected behavior in the common case: when the file is public. $this->doTestCollectionFilterAccessBasedOnPermissions($label_field_name, 'access content'); diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php index dba03609038b..354904df3898 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -150,42 +150,42 @@ class FileUploadTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testGetIndividual() { + public function testGetIndividual(): void { $this->markTestSkipped('Irrelevant for this test'); } /** * {@inheritdoc} */ - public function testPostIndividual() { + public function testPostIndividual(): void { $this->markTestSkipped('Irrelevant for this test'); } /** * {@inheritdoc} */ - public function testPatchIndividual() { + public function testPatchIndividual(): void { $this->markTestSkipped('Irrelevant for this test'); } /** * {@inheritdoc} */ - public function testDeleteIndividual() { + public function testDeleteIndividual(): void { $this->markTestSkipped('Irrelevant for this test'); } /** * {@inheritdoc} */ - public function testCollection() { + public function testCollection(): void { $this->markTestSkipped('Irrelevant for this test'); } /** * {@inheritdoc} */ - public function testRelationships() { + public function testRelationships(): void { $this->markTestSkipped('Irrelevant for this test'); } @@ -207,7 +207,7 @@ class FileUploadTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testRelated() { + public function testRelated(): void { \Drupal::service('router.builder')->rebuild(); parent::testRelated(); } @@ -215,7 +215,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests using the file upload POST route; needs second request to "use" file. */ - public function testPostFileUpload() { + public function testPostFileUpload(): void { \Drupal::service('router.builder')->rebuild(); $uri = Url::fromUri('base:' . static::$postUri); @@ -280,7 +280,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests using the 'file upload and "use" file in single request" POST route. */ - public function testPostFileUploadAndUseInSingleRequest() { + public function testPostFileUploadAndUseInSingleRequest(): void { \Drupal::service('router.builder')->rebuild(); // Update the test entity so it already has a file. This allows verifying // that this route appends files, and does not replace them. @@ -431,7 +431,7 @@ class FileUploadTest extends ResourceTestBase { * * A new file should be created with a suffixed name. */ - public function testPostFileUploadDuplicateFile() { + public function testPostFileUploadDuplicateFile(): void { \Drupal::service('router.builder')->rebuild(); $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -472,7 +472,7 @@ class FileUploadTest extends ResourceTestBase { * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Directives */ - public function testFileUploadStrippedFilePath() { + public function testFileUploadStrippedFilePath(): void { \Drupal::service('router.builder')->rebuild(); $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -519,7 +519,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests invalid file uploads. */ - public function testInvalidFileUploads() { + public function testInvalidFileUploads(): void { \Drupal::service('router.builder')->rebuild(); $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -532,7 +532,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests using the file upload route with a unicode file name. */ - public function testFileUploadUnicodeFilename() { + public function testFileUploadUnicodeFilename(): void { \Drupal::service('router.builder')->rebuild(); $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -551,7 +551,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests using the file upload route with a zero byte file. */ - public function testFileUploadZeroByteFile() { + public function testFileUploadZeroByteFile(): void { \Drupal::service('router.builder')->rebuild(); $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -723,7 +723,7 @@ class FileUploadTest extends ResourceTestBase { /** * Tests using the file upload POST route no configuration. */ - public function testFileUploadNoConfiguration() { + public function testFileUploadNoConfiguration(): void { $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); diff --git a/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php b/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php index 09b9a18d6d53..e2e1481617cc 100644 --- a/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php +++ b/core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php @@ -91,7 +91,7 @@ class InternalEntitiesTest extends BrowserTestBase { /** * Ensures that internal resources types aren't present in the entry point. */ - public function testEntryPoint() { + public function testEntryPoint(): void { $document = $this->jsonapiGet('/jsonapi'); $this->assertArrayNotHasKey( "{$this->internalEntity->getEntityTypeId()}--{$this->internalEntity->bundle()}", @@ -103,7 +103,7 @@ class InternalEntitiesTest extends BrowserTestBase { /** * Ensures that internal resources types aren't present in the routes. */ - public function testRoutes() { + public function testRoutes(): void { // This cannot be in a data provider because it needs values created by the // setUp method. $paths = [ @@ -121,7 +121,7 @@ class InternalEntitiesTest extends BrowserTestBase { /** * Asserts that internal entities are not included in compound documents. */ - public function testIncludes() { + public function testIncludes(): void { $document = $this->getIndividual($this->referencingEntity, [ 'query' => ['include' => 'field_internal'], ]); @@ -135,7 +135,7 @@ class InternalEntitiesTest extends BrowserTestBase { /** * Asserts that links to internal relationships aren't generated. */ - public function testLinks() { + public function testLinks(): void { $document = $this->getIndividual($this->referencingEntity); $this->assertArrayNotHasKey( 'related', diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFilterRegressionTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFilterRegressionTest.php index b715e1198343..4b6af8d4d6a6 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiFilterRegressionTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFilterRegressionTest.php @@ -45,7 +45,7 @@ class JsonApiFilterRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2953207 */ - public function testBundleSpecificTargetEntityTypeFromIssue2953207() { + public function testBundleSpecificTargetEntityTypeFromIssue2953207(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['comment'], TRUE), 'Installed modules.'); $this->addDefaultCommentField('taxonomy_term', 'tags', 'comment', CommentItemInterface::OPEN, 'tcomment'); @@ -81,7 +81,7 @@ class JsonApiFilterRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3015759 */ - public function testFilterByIdFromIssue3015759() { + public function testFilterByIdFromIssue3015759(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['shortcut'], TRUE), 'Installed modules.'); $this->rebuildAll(); @@ -121,7 +121,7 @@ class JsonApiFilterRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/jsonapi/issues/3025372 */ - public function testEmptyRelationshipFilteringFromIssue3025372() { + public function testEmptyRelationshipFilteringFromIssue3025372(): void { // Set up data model. $this->drupalCreateContentType(['type' => 'folder']); $this->createEntityReferenceField( @@ -181,7 +181,7 @@ class JsonApiFilterRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3036593 */ - public function testFilteringEntitiesByEntityReferenceTargetId() { + public function testFilteringEntitiesByEntityReferenceTargetId(): void { // Create two config entities to be the config targets of an entity // reference. In this case, the `roles` field. $role_llamalovers = $this->drupalCreateRole([], 'llamalovers', 'Llama Lovers'); diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php index 8301d8a9fbdf..eebd9388af0c 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php @@ -55,7 +55,7 @@ class JsonApiFunctionalDateFieldTest extends JsonApiFunctionalTestBase { /** * Tests the GET method. */ - public function testRead() { + public function testRead(): void { /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ $date_formatter = $this->container->get('date.formatter'); diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php index d60a0e3df154..2b1992fb189d 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php @@ -66,7 +66,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase { /** * Tests reading multilingual content. */ - public function testReadMultilingual() { + public function testReadMultilingual(): void { // Different databases have different sort orders, so a sort is required so // test expectations do not need to vary per database. $default_sort = ['sort' => 'drupal_internal__nid']; @@ -99,7 +99,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase { /** * Tests updating a translation. */ - public function testPatchTranslation() { + public function testPatchTranslation(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $node = $this->nodes[0]; $uuid = $node->uuid(); @@ -198,7 +198,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase { /** * Tests updating a translation fallback. */ - public function testPatchTranslationFallback() { + public function testPatchTranslationFallback(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $node = $this->nodes[0]; $uuid = $node->uuid(); @@ -239,7 +239,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase { /** * Tests creating a translation. */ - public function testPostTranslation() { + public function testPostTranslation(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->grantPermissions(Role::load(RoleInterface::ANONYMOUS_ID), [ 'bypass node access', @@ -303,7 +303,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase { /** * Tests deleting multilingual content. */ - public function testDeleteMultilingual() { + public function testDeleteMultilingual(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->grantPermissions(Role::load(RoleInterface::ANONYMOUS_ID), [ 'bypass node access', diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php index 211eae283778..59908f19ac30 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php @@ -33,7 +33,7 @@ class JsonApiFunctionalTest extends JsonApiFunctionalTestBase { /** * Tests the GET method. */ - public function testRead() { + public function testRead(): void { $this->createDefaultContent(61, 5, TRUE, TRUE, static::IS_NOT_MULTILINGUAL, FALSE); // Unpublish the last entity, so we can check access. $this->nodes[60]->setUnpublished()->save(); @@ -554,7 +554,7 @@ class JsonApiFunctionalTest extends JsonApiFunctionalTestBase { /** * Tests the GET method on articles referencing the same tag twice. */ - public function testReferencingTwiceRead() { + public function testReferencingTwiceRead(): void { $this->createDefaultContent(1, 1, FALSE, FALSE, static::IS_NOT_MULTILINGUAL, TRUE); // 1. Load all articles (1st page). @@ -568,7 +568,7 @@ class JsonApiFunctionalTest extends JsonApiFunctionalTestBase { /** * Tests POST, PATCH and DELETE. */ - public function testWrite() { + public function testWrite(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->createDefaultContent(0, 3, FALSE, FALSE, static::IS_NOT_MULTILINGUAL, FALSE); diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiPatchRegressionTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiPatchRegressionTest.php index c2cd0d9e6cf7..b36cb8ce8aef 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiPatchRegressionTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiPatchRegressionTest.php @@ -48,7 +48,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2953207 */ - public function testBundleSpecificTargetEntityTypeFromIssue2953207() { + public function testBundleSpecificTargetEntityTypeFromIssue2953207(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['comment'], TRUE), 'Installed modules.'); $this->addDefaultCommentField('taxonomy_term', 'tags', 'comment', CommentItemInterface::OPEN, 'tcomment'); @@ -84,7 +84,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2976371 */ - public function testBundlelessRelationshipMutationFromIssue2973681() { + public function testBundlelessRelationshipMutationFromIssue2973681(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -135,7 +135,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2968972 */ - public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2968972() { + public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2968972(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -206,7 +206,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3021194 */ - public function testPatchingDateTimeFieldsFromIssue3021194() { + public function testPatchingDateTimeFieldsFromIssue3021194(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -289,7 +289,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3026030 */ - public function testPatchToIncludeUrlDoesNotReturnIncludeFromIssue3026030() { + public function testPatchToIncludeUrlDoesNotReturnIncludeFromIssue3026030(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -335,7 +335,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3043168 */ - public function testNonTranslatableEntityUpdatesFromIssue3043168() { + public function testNonTranslatableEntityUpdatesFromIssue3043168(): void { // Enable write-mode. $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set the site language to Russian. @@ -399,7 +399,7 @@ class JsonApiPatchRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3127883 */ - public function testPatchInvalidFieldPropertyFromIssue3127883() { + public function testPatchInvalidFieldPropertyFromIssue3127883(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php index d40774144c35..81bbf299067c 100644 --- a/core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php +++ b/core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php @@ -52,7 +52,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2973681 */ - public function testDeepNestedIncludeMultiTargetEntityTypeFieldFromIssue2973681() { + public function testDeepNestedIncludeMultiTargetEntityTypeFieldFromIssue2973681(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['comment'], TRUE), 'Installed modules.'); $this->addDefaultCommentField('node', 'article'); @@ -116,7 +116,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2977879 */ - public function testGetTermWhenMultipleVocabulariesExistFromIssue2977879() { + public function testGetTermWhenMultipleVocabulariesExistFromIssue2977879(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['taxonomy'], TRUE), 'Installed modules.'); Vocabulary::create([ @@ -152,7 +152,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2984964 */ - public function testGetNodeCollectionWithHookNodeGrantsImplementationsFromIssue2984964() { + public function testGetNodeCollectionWithHookNodeGrantsImplementationsFromIssue2984964(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['node_access_test'], TRUE), 'Installed modules.'); node_access_rebuild(); @@ -183,7 +183,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2984647 */ - public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2984647() { + public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2984647(): void { // Set up data model. $this->drupalCreateContentType(['type' => 'journal_issue']); $this->drupalCreateContentType(['type' => 'journal_conference']); @@ -317,7 +317,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2984886 */ - public function testThatRoutesAreRebuiltAfterDataModelChangesFromIssue2984886() { + public function testThatRoutesAreRebuiltAfterDataModelChangesFromIssue2984886(): void { $user = $this->drupalCreateUser(['access content']); $request_options = [ RequestOptions::AUTH => [ @@ -380,7 +380,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * @see https://www.drupal.org/project/drupal/issues/3007113 * @see https://www.drupal.org/project/jsonapi_extras/issues/3004582#comment-12817261 */ - public function testDenormalizeAliasedRelationshipFromIssue2953207() { + public function testDenormalizeAliasedRelationshipFromIssue2953207(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Since the JSON:API module does not have an explicit mechanism to set up @@ -437,7 +437,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3009596 */ - public function testPageCacheFromIssue3009596() { + public function testPageCacheFromIssue3009596(): void { $anonymous_role = Role::load(RoleInterface::ANONYMOUS_ID); $anonymous_role->grantPermission('access content'); $anonymous_role->trustData()->save(); @@ -475,7 +475,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/2999438 */ - public function testPatchingDateTimeNormalizedWrongTimeZoneIssue3021194() { + public function testPatchingDateTimeNormalizedWrongTimeZoneIssue3021194(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['datetime'], TRUE), 'Installed modules.'); $this->drupalCreateContentType(['type' => 'page']); @@ -524,7 +524,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3026030 */ - public function testPostToIncludeUrlDoesNotReturnIncludeFromIssue3026030() { + public function testPostToIncludeUrlDoesNotReturnIncludeFromIssue3026030(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -561,7 +561,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3040590 */ - public function testMapFieldTypeNormalizationFromIssue3040590() { + public function testMapFieldTypeNormalizationFromIssue3040590(): void { $this->assertTrue($this->container->get('module_installer')->install(['entity_test'], TRUE), 'Installed modules.'); // Create data. @@ -606,7 +606,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { /** * Tests that the response still has meaningful error messages. */ - public function testRecursionDetectedWhenResponseContainsViolationsFrom3042124() { + public function testRecursionDetectedWhenResponseContainsViolationsFrom3042124(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up default request. @@ -656,7 +656,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3052954 */ - public function testInvalidDataTriggersUnprocessableEntityErrorFromIssue3052954() { + public function testInvalidDataTriggersUnprocessableEntityErrorFromIssue3052954(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -686,7 +686,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { /** * Ensure optional `@FieldType=map` fields are denormalized correctly. */ - public function testEmptyMapFieldTypeDenormalization() { + public function testEmptyMapFieldTypeDenormalization(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); // Set up data model. @@ -727,7 +727,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { /** * Ensure EntityAccessDeniedHttpException cacheability is taken into account. */ - public function testLeakCacheMetadataInOmitted() { + public function testLeakCacheMetadataInOmitted(): void { $term = Term::create([ 'name' => 'Llama term', 'vid' => 'tags', @@ -787,7 +787,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * @see https://www.drupal.org/project/drupal/issues/3034786 * @see https://www.drupal.org/project/drupal/issues/3035544 */ - public function testAliasedFieldsWithVirtualRelationships() { + public function testAliasedFieldsWithVirtualRelationships(): void { // Set up the data model. $this->assertTrue($this->container->get('module_installer')->install([ 'taxonomy', @@ -834,7 +834,7 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase { * * @see https://www.drupal.org/project/drupal/issues/3072076 */ - public function testNonCacheableMethods() { + public function testNonCacheableMethods(): void { $this->container->get('module_installer')->install([ 'jsonapi_test_non_cacheable_methods', ], TRUE); diff --git a/core/modules/jsonapi/tests/src/Functional/MediaTest.php b/core/modules/jsonapi/tests/src/Functional/MediaTest.php index 055bc9319469..e733e773bc4e 100644 --- a/core/modules/jsonapi/tests/src/Functional/MediaTest.php +++ b/core/modules/jsonapi/tests/src/Functional/MediaTest.php @@ -360,7 +360,7 @@ class MediaTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testPostIndividual() { + public function testPostIndividual(): void { // @todo Mimic \Drupal\Tests\rest\Functional\EntityResource\Media\MediaResourceTestBase::testPost() // @todo Later, use https://www.drupal.org/project/drupal/issues/2958554 to upload files rather than the REST module. parent::testPostIndividual(); @@ -406,7 +406,7 @@ class MediaTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $this->doTestCollectionFilterAccessForPublishableEntities('name', 'view media', 'administer media'); } diff --git a/core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php b/core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php index b11309512638..93b3d8306800 100644 --- a/core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php +++ b/core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php @@ -187,7 +187,7 @@ class MenuLinkContentTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $this->doTestCollectionFilterAccessBasedOnPermissions('title', 'administer menu'); } @@ -196,7 +196,7 @@ class MenuLinkContentTest extends ResourceTestBase { * * @see https://security.drupal.org/node/161923 */ - public function testLinkOptionsSerialization() { + public function testLinkOptionsSerialization(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $document = $this->getPostDocument(); diff --git a/core/modules/jsonapi/tests/src/Functional/MessageTest.php b/core/modules/jsonapi/tests/src/Functional/MessageTest.php index d1ab23e2043c..ed23715b0735 100644 --- a/core/modules/jsonapi/tests/src/Functional/MessageTest.php +++ b/core/modules/jsonapi/tests/src/Functional/MessageTest.php @@ -121,7 +121,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testGetIndividual() { + public function testGetIndividual(): void { // Contact Message entities are not stored, so they cannot be retrieved. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.'); @@ -132,7 +132,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testPatchIndividual() { + public function testPatchIndividual(): void { // Contact Message entities are not stored, so they cannot be modified. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.'); @@ -143,7 +143,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testDeleteIndividual() { + public function testDeleteIndividual(): void { // Contact Message entities are not stored, so they cannot be deleted. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.'); @@ -154,7 +154,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testRelated() { + public function testRelated(): void { // Contact Message entities are not stored, so they cannot be retrieved. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.related" does not exist.'); @@ -165,7 +165,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testRelationships() { + public function testRelationships(): void { // Contact Message entities are not stored, so they cannot be retrieved. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.relationship.get" does not exist.'); @@ -176,7 +176,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollection() { + public function testCollection(): void { $collection_url = Url::fromRoute('jsonapi.contact_message--camelids.collection.post')->setAbsolute(TRUE); $request_options = []; $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json'; @@ -192,7 +192,7 @@ class MessageTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testRevisions() { + public function testRevisions(): void { // Contact Message entities are not stored, so they cannot be retrieved. $this->expectException(RouteNotFoundException::class); $this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.'); diff --git a/core/modules/jsonapi/tests/src/Functional/NodeTest.php b/core/modules/jsonapi/tests/src/Functional/NodeTest.php index d684c5833135..710fa6577f44 100644 --- a/core/modules/jsonapi/tests/src/Functional/NodeTest.php +++ b/core/modules/jsonapi/tests/src/Functional/NodeTest.php @@ -281,7 +281,7 @@ class NodeTest extends ResourceTestBase { * @see \Drupal\Tests\jsonapi\Functional\TermTest::testPatchPath() * @see \Drupal\Tests\rest\Functional\EntityResource\Term\TermResourceTestBase::testPatchPath() */ - public function testPatchPath() { + public function testPatchPath(): void { $this->setUpAuthorization('GET'); $this->setUpAuthorization('PATCH'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -319,7 +319,7 @@ class NodeTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testGetIndividual() { + public function testGetIndividual(): void { // Cacheable normalizations are written after the response is flushed to // the client. We use WaitTerminateTestTrait to wait for Drupal to perform // its termination work before continuing. @@ -429,7 +429,7 @@ class NodeTest extends ResourceTestBase { * * @see https://github.com/json-api/json-api/issues/1033 */ - public function testPostNonExistingAuthor() { + public function testPostNonExistingAuthor(): void { $this->setUpAuthorization('POST'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->grantPermissionsToTestedRole(['administer nodes']); @@ -470,7 +470,7 @@ class NodeTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $label_field_name = 'title'; $this->doTestCollectionFilterAccessForPublishableEntities($label_field_name, 'access content', 'bypass node access'); diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php index f54943a9b9dc..f95f4a4c1c39 100644 --- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php @@ -930,7 +930,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests GETting an individual resource, plus edge cases to ensure good DX. */ - public function testGetIndividual() { + public function testGetIndividual(): void { // The URL and Guzzle request options that will be used in this test. The // request options will be modified/expanded throughout this test: // - to first test all mistakes a developer might make, and assert that the @@ -1088,7 +1088,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests GETting a collection of resources. */ - public function testCollection() { + public function testCollection(): void { $entity_collection = $this->getData(); assert(count($entity_collection) > 1, 'A collection must have more that one entity in it.'); @@ -1318,7 +1318,7 @@ abstract class ResourceTestBase extends BrowserTestBase { * single expected ResourceResponse. This is repeated for every relationship * field of the resource type under test. */ - public function testRelated() { + public function testRelated(): void { $request_options = []; $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json'; $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions()); @@ -1337,7 +1337,7 @@ abstract class ResourceTestBase extends BrowserTestBase { * targeted resource and the target resource IDs. These type+ID combos are * referred to as "resource identifiers." */ - public function testRelationships() { + public function testRelationships(): void { if ($this->entity instanceof ConfigEntityInterface) { $this->markTestSkipped('Configuration entities cannot have relationships.'); } @@ -1984,7 +1984,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests POSTing an individual resource, plus edge cases to ensure good DX. */ - public function testPostIndividual() { + public function testPostIndividual(): void { // @todo Remove this in https://www.drupal.org/node/2300677. if ($this->entity instanceof ConfigEntityInterface) { $this->markTestSkipped('POSTing config entities is not yet supported.'); @@ -2199,7 +2199,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests PATCHing an individual resource, plus edge cases to ensure good DX. */ - public function testPatchIndividual() { + public function testPatchIndividual(): void { // @todo Remove this in https://www.drupal.org/node/2300677. if ($this->entity instanceof ConfigEntityInterface) { $this->markTestSkipped('PATCHing config entities is not yet supported.'); @@ -2527,7 +2527,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests DELETEing an individual resource, plus edge cases to ensure good DX. */ - public function testDeleteIndividual() { + public function testDeleteIndividual(): void { // @todo Remove this in https://www.drupal.org/node/2300677. if ($this->entity instanceof ConfigEntityInterface) { $this->markTestSkipped('DELETEing config entities is not yet supported.'); @@ -2804,7 +2804,7 @@ abstract class ResourceTestBase extends BrowserTestBase { /** * Tests individual and collection revisions. */ - public function testRevisions() { + public function testRevisions(): void { if (!$this->entity->getEntityType()->isRevisionable() || !$this->entity instanceof FieldableEntityInterface) { return; } diff --git a/core/modules/jsonapi/tests/src/Functional/RestExportJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestExportJsonApiUnsupported.php index 35b2d039affc..8d71894b92f9 100644 --- a/core/modules/jsonapi/tests/src/Functional/RestExportJsonApiUnsupported.php +++ b/core/modules/jsonapi/tests/src/Functional/RestExportJsonApiUnsupported.php @@ -42,7 +42,7 @@ class RestExportJsonApiUnsupported extends ViewTestBase { /** * Tests that 'api_json' is not a RestExport format option. */ - public function testFormatOptions() { + public function testFormatOptions(): void { $this->assertSame(['json' => 'serialization', 'xml' => 'serialization'], $this->container->getParameter('serializer.format_providers')); $this->drupalGet('admin/structure/views/nojs/display/test_serializer_display_entity/rest_export_1/style_options'); diff --git a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php index 22f5ff77b4f7..ade4cf3b6903 100644 --- a/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php +++ b/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php @@ -88,7 +88,7 @@ class RestJsonApiUnsupported extends ResourceTestBase { * * @see \Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator::validateQueryParams() */ - public function testApiJsonNotSupportedInRest() { + public function testApiJsonNotSupportedInRest(): void { $this->assertSame(['json', 'xml'], $this->container->getParameter('serializer.formats')); $this->provisionResource(['api_json'], []); diff --git a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php index 54f2ce2cef85..adaff9b9eba7 100644 --- a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php +++ b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php @@ -159,7 +159,7 @@ class ShortcutTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $label_field_name = 'title'; // Verify the expected behavior in the common case: default shortcut set. $this->grantPermissionsToTestedRole(['customize shortcut links']); diff --git a/core/modules/jsonapi/tests/src/Functional/TermTest.php b/core/modules/jsonapi/tests/src/Functional/TermTest.php index 3488320df324..2e8348f21567 100644 --- a/core/modules/jsonapi/tests/src/Functional/TermTest.php +++ b/core/modules/jsonapi/tests/src/Functional/TermTest.php @@ -401,7 +401,7 @@ class TermTest extends ResourceTestBase { * @see \Drupal\Tests\jsonapi\Functional\NodeTest::testPatchPath() * @see \Drupal\Tests\rest\Functional\EntityResource\Node\NodeResourceTestBase::testPatchPath() */ - public function testPatchPath() { + public function testPatchPath(): void { $this->setUpAuthorization('GET'); $this->setUpAuthorization('PATCH'); $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); @@ -460,7 +460,7 @@ class TermTest extends ResourceTestBase { * * @dataProvider providerTestGetIndividualTermWithParent */ - public function testGetIndividualTermWithParent(array $parent_term_ids) { + public function testGetIndividualTermWithParent(array $parent_term_ids): void { // Create all possible parent terms. Term::create(['vid' => Vocabulary::load('camelids')->id()]) ->setName('Lamoids') @@ -506,7 +506,7 @@ class TermTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { $this->doTestCollectionFilterAccessBasedOnPermissions('name', 'access content'); } diff --git a/core/modules/jsonapi/tests/src/Functional/UserTest.php b/core/modules/jsonapi/tests/src/Functional/UserTest.php index 2aa931dae097..a7db8bd9aa5f 100644 --- a/core/modules/jsonapi/tests/src/Functional/UserTest.php +++ b/core/modules/jsonapi/tests/src/Functional/UserTest.php @@ -128,7 +128,7 @@ class UserTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testDeleteIndividual() { + public function testDeleteIndividual(): void { $this->config('user.settings')->set('cancel_method', 'user_cancel_delete')->save(TRUE); parent::testDeleteIndividual(); @@ -217,7 +217,7 @@ class UserTest extends ResourceTestBase { /** * Tests PATCHing security-sensitive base fields of the logged in account. */ - public function testPatchDxForSecuritySensitiveBaseFields() { + public function testPatchDxForSecuritySensitiveBaseFields(): void { // @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463. $url = Url::fromRoute(sprintf('jsonapi.user--user.individual'), ['entity' => $this->account->uuid()]); /* $url = $this->account->toUrl('jsonapi'); */ @@ -337,7 +337,7 @@ class UserTest extends ResourceTestBase { /** * Tests PATCHing security-sensitive base fields to change other users. */ - public function testPatchSecurityOtherUser() { + public function testPatchSecurityOtherUser(): void { // @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463. $url = Url::fromRoute(sprintf('jsonapi.user--user.individual'), ['entity' => $this->account->uuid()]); /* $url = $this->account->toUrl('jsonapi'); */ @@ -378,7 +378,7 @@ class UserTest extends ResourceTestBase { /** * Tests GETting privacy-sensitive base fields. */ - public function testGetMailFieldOnlyVisibleToOwner() { + public function testGetMailFieldOnlyVisibleToOwner(): void { // Create user B, with the same roles (and hence permissions) as user A. $user_a = $this->account; $pass = \Drupal::service('password_generator')->generate(); @@ -446,7 +446,7 @@ class UserTest extends ResourceTestBase { /** * Tests good error DX when trying to filter users by role. */ - public function testQueryInvolvingRoles() { + public function testQueryInvolvingRoles(): void { $this->setUpAuthorization('GET'); $collection_url = Url::fromRoute('jsonapi.user--user.collection', [], ['query' => ['filter[roles.id][value]' => 'e9b1de3f-9517-4c27-bef0-0301229de792']]); @@ -465,7 +465,7 @@ class UserTest extends ResourceTestBase { /** * Tests that the collection contains the anonymous user. */ - public function testCollectionContainsAnonymousUser() { + public function testCollectionContainsAnonymousUser(): void { $url = Url::fromRoute('jsonapi.user--user.collection', [], ['query' => ['sort' => 'drupal_internal__uid']]); $request_options = []; $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json'; @@ -482,7 +482,7 @@ class UserTest extends ResourceTestBase { /** * {@inheritdoc} */ - public function testCollectionFilterAccess() { + public function testCollectionFilterAccess(): void { // Set up data model. $this->assertTrue($this->container->get('module_installer')->install(['node'], TRUE), 'Installed modules.'); FieldStorageConfig::create([ @@ -589,7 +589,7 @@ class UserTest extends ResourceTestBase { /** * Tests users with altered display names. */ - public function testResaveAccountName() { + public function testResaveAccountName(): void { $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->setUpAuthorization('PATCH'); @@ -617,7 +617,7 @@ class UserTest extends ResourceTestBase { /** * Tests if JSON:API respects user.settings.cancel_method: user_cancel_block. */ - public function testDeleteRespectsUserCancelBlock() { + public function testDeleteRespectsUserCancelBlock(): void { $cancel_method = 'user_cancel_block'; $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->config('user.settings')->set('cancel_method', $cancel_method)->save(TRUE); @@ -647,7 +647,7 @@ class UserTest extends ResourceTestBase { /** * Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish. */ - public function testDeleteRespectsUserCancelBlockUnpublish() { + public function testDeleteRespectsUserCancelBlockUnpublish(): void { $cancel_method = 'user_cancel_block_unpublish'; $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->config('user.settings')->set('cancel_method', $cancel_method)->save(TRUE); @@ -678,7 +678,7 @@ class UserTest extends ResourceTestBase { * Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish. * @group jsonapi */ - public function testDeleteRespectsUserCancelBlockUnpublishAndProcessesBatches() { + public function testDeleteRespectsUserCancelBlockUnpublishAndProcessesBatches(): void { $cancel_method = 'user_cancel_block_unpublish'; $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->config('user.settings')->set('cancel_method', $cancel_method)->save(TRUE); @@ -724,7 +724,7 @@ class UserTest extends ResourceTestBase { /** * Tests if JSON:API respects user.settings.cancel_method: user_cancel_reassign. */ - public function testDeleteRespectsUserCancelReassign() { + public function testDeleteRespectsUserCancelReassign(): void { $cancel_method = 'user_cancel_reassign'; $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->config('user.settings')->set('cancel_method', $cancel_method)->save(TRUE); @@ -755,7 +755,7 @@ class UserTest extends ResourceTestBase { /** * Tests if JSON:API respects user.settings.cancel_method: user_cancel_delete. */ - public function testDeleteRespectsUserCancelDelete() { + public function testDeleteRespectsUserCancelDelete(): void { $cancel_method = 'user_cancel_delete'; $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE); $this->config('user.settings')->set('cancel_method', $cancel_method)->save(TRUE); diff --git a/core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php b/core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php index 14c610f48b01..de7aed89105b 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php @@ -89,7 +89,7 @@ class FieldResolverTest extends JsonapiKernelTestBase { * @covers ::resolveInternalEntityQueryPath * @dataProvider resolveInternalIncludePathProvider */ - public function testResolveInternalIncludePath($expect, $external_path, $entity_type_id = 'entity_test_with_bundle', $bundle = 'bundle1') { + public function testResolveInternalIncludePath($expect, $external_path, $entity_type_id = 'entity_test_with_bundle', $bundle = 'bundle1'): void { $path_parts = explode('.', $external_path); $resource_type = $this->resourceTypeRepository->get($entity_type_id, $bundle); $this->assertEquals($expect, $this->sut->resolveInternalIncludePath($resource_type, $path_parts)); @@ -131,7 +131,7 @@ class FieldResolverTest extends JsonapiKernelTestBase { * @covers ::resolveInternalIncludePath * @dataProvider resolveInternalIncludePathErrorProvider */ - public function testResolveInternalIncludePathError($entity_type, $bundle, $external_path, $expected_message = '') { + public function testResolveInternalIncludePathError($entity_type, $bundle, $external_path, $expected_message = ''): void { $path_parts = explode('.', $external_path); $this->expectException(CacheableBadRequestHttpException::class); if (!empty($expected_message)) { @@ -174,7 +174,7 @@ class FieldResolverTest extends JsonapiKernelTestBase { * @covers ::resolveInternalEntityQueryPath * @dataProvider resolveInternalEntityQueryPathProvider */ - public function testResolveInternalEntityQueryPath($expect, $external_path, $entity_type_id = 'entity_test_with_bundle', $bundle = 'bundle1') { + public function testResolveInternalEntityQueryPath($expect, $external_path, $entity_type_id = 'entity_test_with_bundle', $bundle = 'bundle1'): void { $resource_type = $this->resourceTypeRepository->get($entity_type_id, $bundle); $this->assertEquals($expect, $this->sut->resolveInternalEntityQueryPath($resource_type, $external_path)); } @@ -255,7 +255,7 @@ class FieldResolverTest extends JsonapiKernelTestBase { * @covers ::resolveInternalEntityQueryPath * @dataProvider resolveInternalEntityQueryPathErrorProvider */ - public function testResolveInternalEntityQueryPathError($entity_type, $bundle, $external_path, $expected_message = '') { + public function testResolveInternalEntityQueryPathError($entity_type, $bundle, $external_path, $expected_message = ''): void { $this->expectException(CacheableBadRequestHttpException::class); if (!empty($expected_message)) { $this->expectExceptionMessage($expected_message); diff --git a/core/modules/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php b/core/modules/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php index 0c330e56a2ba..4c5291eb1d94 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php @@ -195,7 +195,7 @@ class EntityResourceTest extends JsonapiKernelTestBase { /** * @covers ::getCollection */ - public function testGetPagedCollection() { + public function testGetPagedCollection(): void { $request = Request::create('/jsonapi/node/article'); $request->query = new InputBag([ 'sort' => 'nid', @@ -224,7 +224,7 @@ class EntityResourceTest extends JsonapiKernelTestBase { /** * @covers ::getCollection */ - public function testGetEmptyCollection() { + public function testGetEmptyCollection(): void { $request = Request::create('/jsonapi/node/article'); $request->query = new InputBag(['filter' => ['id' => 'invalid']]); diff --git a/core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php b/core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php index a4ceba719cb0..14f4b8f2df45 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php @@ -89,7 +89,7 @@ class FileUploadTest extends JsonapiKernelTestBase { /** * @covers ::checkFileUploadAccess */ - public function testCheckFileUploadAccessWithBaseField() { + public function testCheckFileUploadAccessWithBaseField(): void { // Create a set of users for access testing. $article_editor = User::create([ 'name' => 'article editor', diff --git a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php index d3ad196bbb17..93ed8c7ddba2 100644 --- a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php @@ -75,7 +75,7 @@ class ResourceObjectNormalizerCacherTest extends KernelTestBase { * * @see https://www.drupal.org/project/drupal/issues/3077287 */ - public function testLinkNormalizationCacheability() { + public function testLinkNormalizationCacheability(): void { $user = User::create([ 'name' => $this->randomMachineName(), 'pass' => $this->randomString(), diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php index 9c6e07cb98a0..20a8ac792d75 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php @@ -261,7 +261,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * @covers ::normalize */ - public function testNormalize() { + public function testNormalize(): void { $resource_type = $this->container->get('jsonapi.resource_type.repository')->get('node', 'article'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); @@ -362,7 +362,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * @covers ::normalize */ - public function testNormalizeUuid() { + public function testNormalizeUuid(): void { $resource_type = $this->container->get('jsonapi.resource_type.repository')->get('node', 'article'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); $include_param = 'uid,field_tags'; @@ -403,7 +403,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * @covers ::normalize */ - public function testNormalizeException() { + public function testNormalizeException(): void { $normalized = $this ->container ->get('jsonapi.serializer') @@ -427,7 +427,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * Tests the message and exceptions when requesting a Label only resource. */ - public function testAliasFieldRouteException() { + public function testAliasFieldRouteException(): void { $this->assertSame('uid', $this->resourceTypeRepository->getByTypeName('node--article')->getPublicName('uid')); $this->assertSame('roles', $this->resourceTypeRepository->getByTypeName('user--user')->getPublicName('roles')); $resource_type_field_aliases = [ @@ -491,7 +491,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * @covers ::normalize */ - public function testNormalizeConfig() { + public function testNormalizeConfig(): void { $resource_type = $this->container->get('jsonapi.resource_type.repository')->get('node_type', 'node_type'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->nodeType); $document_wrapper = new JsonApiDocumentTopLevel(new ResourceObjectData([$resource_object], 1), new NullIncludedData(), new LinkCollection([])); @@ -522,7 +522,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { * * @covers ::denormalize */ - public function testDenormalize() { + public function testDenormalize(): void { $payload = '{"data":{"type":"article","attributes":{"title":"Testing article"}}}'; $resource_type = $this->container->get('jsonapi.resource_type.repository')->get('node', 'article'); @@ -540,7 +540,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { * * @covers ::denormalize */ - public function testDenormalizeUuid() { + public function testDenormalizeUuid(): void { $configurations = [ // Good data. [ @@ -634,7 +634,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { /** * Tests denormalization for related resources with missing or invalid types. */ - public function testDenormalizeInvalidTypeAndNoType() { + public function testDenormalizeInvalidTypeAndNoType(): void { $payload_data = [ 'data' => [ 'type' => 'node--article', @@ -758,7 +758,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase { * * @dataProvider testCacheableMetadataProvider */ - public function testCacheableMetadata(CacheableMetadata $expected_metadata) { + public function testCacheableMetadata(CacheableMetadata $expected_metadata): void { $resource_type = $this->container->get('jsonapi.resource_type.repository')->get('node', 'article'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); $context = [ diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php index 5f3dbb78b4b0..a4cdb4f5444c 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php @@ -77,7 +77,7 @@ class LinkCollectionNormalizerTest extends KernelTestBase { /** * Tests the link collection normalizer. */ - public function testNormalize() { + public function testNormalize(): void { $link_context = new ResourceObject(new CacheableMetadata(), new ResourceType('n/a', 'n/a', 'n/a'), 'n/a', NULL, [], new LinkCollection([])); $link_collection = (new LinkCollection([])) ->withLink('related', new Link(new CacheableMetadata(), Url::fromUri('http://example.com/post/42'), 'related', ['title' => 'Most viewed'])) @@ -110,7 +110,7 @@ class LinkCollectionNormalizerTest extends KernelTestBase { * * @dataProvider linkAccessTestData */ - public function testLinkAccess($current_user_id, $edit_form_uid, $expected_link_keys, $expected_cache_contexts) { + public function testLinkAccess($current_user_id, $edit_form_uid, $expected_link_keys, $expected_cache_contexts): void { // Get the current user and an edit-form URL. foreach ($this->testUsers as $user) { $uid = (int) $user->id(); diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/RelationshipNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/RelationshipNormalizerTest.php index 54dd005f68a4..86ca587adc17 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/RelationshipNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/RelationshipNormalizerTest.php @@ -224,7 +224,7 @@ class RelationshipNormalizerTest extends JsonapiKernelTestBase { * @covers ::normalize * @dataProvider normalizeProvider */ - public function testNormalize($entity_property_names, $field_name, $expected) { + public function testNormalize($entity_property_names, $field_name, $expected): void { // Links cannot be generated in the test provider because the container // has not yet been set. $expected['links'] = [ diff --git a/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php b/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php index 5de336554e0a..099b30ccc03c 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php @@ -89,7 +89,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueToMissingPropertyName() { + public function testInvalidFilterPathDueToMissingPropertyName(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The field `colors`, given in the path `colors` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -99,7 +99,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithMetaProperties() { + public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithMetaProperties(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The field `photo`, given in the path `photo` is incomplete, it must end with one of the following specifiers: `id`, `meta.drupal_internal__target_id`, `meta.alt`, `meta.title`, `meta.width`, `meta.height`.'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -109,7 +109,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueMissingMetaPrefixReferenceFieldWithMetaProperties() { + public function testInvalidFilterPathDueMissingMetaPrefixReferenceFieldWithMetaProperties(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The property `alt`, given in the path `photo.alt` belongs to the meta object of a relationship and must be preceded by `meta`.'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -119,7 +119,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithoutMetaProperties() { + public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithoutMetaProperties(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The field `uid`, given in the path `uid` is incomplete, it must end with one of the following specifiers: `id`, `meta.drupal_internal__target_id`.'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -129,7 +129,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueToNonexistentProperty() { + public function testInvalidFilterPathDueToNonexistentProperty(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The property `foobar`, given in the path `colors.foobar`, does not exist. Must be one of the following property names: `value`, `format`, `processed`.'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -139,7 +139,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testInvalidFilterPathDueToElidedSoleProperty() { + public function testInvalidFilterPathDueToElidedSoleProperty(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('Invalid nested filtering. The property `value`, given in the path `promote.value`, does not exist. Filter by `promote`, not `promote.value` (the JSON:API module elides property names from single-property fields).'); $resource_type = $this->resourceTypeRepository->get('node', 'painting'); @@ -149,7 +149,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::queryCondition */ - public function testQueryCondition() { + public function testQueryCondition(): void { // Can't use a data provider because we need access to the container. $data = $this->queryConditionData(); @@ -315,7 +315,7 @@ class FilterTest extends JsonapiKernelTestBase { * @covers ::createFromQueryParameter * @dataProvider parameterProvider */ - public function testCreateFromQueryParameter($case, $expected) { + public function testCreateFromQueryParameter($case, $expected): void { $resource_type = new ResourceType('foo', 'bar', NULL); $actual = Filter::createFromQueryParameter($case, $resource_type, $this->getFieldResolverMock($resource_type)); $conditions = $actual->root()->members(); @@ -345,7 +345,7 @@ class FilterTest extends JsonapiKernelTestBase { /** * @covers ::createFromQueryParameter */ - public function testCreateFromQueryParameterNested() { + public function testCreateFromQueryParameterNested(): void { $parameter = [ 'or-group' => ['group' => ['conjunction' => 'OR']], 'nested-or-group' => [ diff --git a/core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php b/core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php index 2d4277426888..5341b489cddf 100644 --- a/core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php @@ -115,7 +115,7 @@ class RelatedResourceTypesTest extends JsonapiKernelTestBase { * @covers ::getRelatableResourceTypes * @dataProvider getRelatableResourceTypesProvider */ - public function testGetRelatableResourceTypes($resource_type_name, $relatable_type_names) { + public function testGetRelatableResourceTypes($resource_type_name, $relatable_type_names): void { // We're only testing the fields that we set up. $test_fields = [ 'field_ref_foo', @@ -166,7 +166,7 @@ class RelatedResourceTypesTest extends JsonapiKernelTestBase { * @covers ::getRelatableResourceTypesByField * @dataProvider getRelatableResourceTypesByFieldProvider */ - public function testGetRelatableResourceTypesByField($entity_type_id, $bundle, $field) { + public function testGetRelatableResourceTypesByField($entity_type_id, $bundle, $field): void { $resource_type = $this->resourceTypeRepository->get($entity_type_id, $bundle); $relatable_types = $resource_type->getRelatableResourceTypes(); $this->assertSame( @@ -195,7 +195,7 @@ class RelatedResourceTypesTest extends JsonapiKernelTestBase { * * @link https://www.drupal.org/project/drupal/issues/2996114 */ - public function testGetRelatableResourceTypesFromFieldDefinition() { + public function testGetRelatableResourceTypesFromFieldDefinition(): void { $field_config_storage = $this->container->get('entity_type.manager')->getStorage('field_config'); static::assertCount(0, $this->resourceTypeRepository->get('node', 'foo')->getRelatableResourceTypesByField('field_relationship')); diff --git a/core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php b/core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php index 969ac85e9c66..de52302e039d 100644 --- a/core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php @@ -68,7 +68,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * @covers ::all */ - public function testAll() { + public function testAll(): void { // Make sure that there are resources being created. $all = $this->resourceTypeRepository->all(); $this->assertNotEmpty($all); @@ -83,7 +83,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { * @covers ::get * @dataProvider getProvider */ - public function testGet($entity_type_id, $bundle, $entity_class) { + public function testGet($entity_type_id, $bundle, $entity_class): void { // Make sure that there are resources being created. $resource_type = $this->resourceTypeRepository->get($entity_type_id, $bundle); $this->assertInstanceOf(ResourceType::class, $resource_type); @@ -111,7 +111,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * Ensures that the ResourceTypeRepository's cache does not become stale. */ - public function testCaching() { + public function testCaching(): void { $this->assertEmpty($this->resourceTypeRepository->get('node', 'article')->getRelatableResourceTypesByField('field_relationship')); $this->createEntityReferenceField('node', 'article', 'field_relationship', 'Related entity', 'node'); $this->assertCount(3, $this->resourceTypeRepository->get('node', 'article')->getRelatableResourceTypesByField('field_relationship')); @@ -128,7 +128,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { * @covers ::getFields * @dataProvider getFieldsProvider */ - public function testMappingNameConflictCheck($field_name_list) { + public function testMappingNameConflictCheck($field_name_list): void { $entity_type = \Drupal::entityTypeManager()->getDefinition('node'); $bundle = 'article'; $reflection_class = new \ReflectionClass($this->resourceTypeRepository); @@ -159,7 +159,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * Tests that resource types can be disabled by a build subscriber. */ - public function testResourceTypeDisabling() { + public function testResourceTypeDisabling(): void { $this->assertFalse($this->resourceTypeRepository->getByTypeName('node--article')->isInternal()); $this->assertFalse($this->resourceTypeRepository->getByTypeName('node--page')->isInternal()); $this->assertFalse($this->resourceTypeRepository->getByTypeName('user--user')->isInternal()); @@ -177,7 +177,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * Tests that resource type fields can be aliased per resource type. */ - public function testResourceTypeFieldAliasing() { + public function testResourceTypeFieldAliasing(): void { $this->assertSame($this->resourceTypeRepository->getByTypeName('node--article')->getPublicName('uid'), 'uid'); $this->assertSame($this->resourceTypeRepository->getByTypeName('node--page')->getPublicName('uid'), 'uid'); $resource_type_field_aliases = [ @@ -197,7 +197,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * Tests that resource type fields can be disabled per resource type. */ - public function testResourceTypeFieldDisabling() { + public function testResourceTypeFieldDisabling(): void { $this->assertTrue($this->resourceTypeRepository->getByTypeName('node--article')->isFieldEnabled('uid')); $this->assertTrue($this->resourceTypeRepository->getByTypeName('node--page')->isFieldEnabled('uid')); $disabled_resource_type_fields = [ @@ -217,7 +217,7 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase { /** * Tests that resource types can be renamed. */ - public function testResourceTypeRenaming() { + public function testResourceTypeRenaming(): void { \Drupal::state()->set('jsonapi_test_resource_type_builder.renamed_resource_types', [ 'node--article' => 'articles', 'node--page' => 'pages', diff --git a/core/modules/jsonapi/tests/src/Kernel/Revisions/VersionNegotiatorTest.php b/core/modules/jsonapi/tests/src/Kernel/Revisions/VersionNegotiatorTest.php index fd3370ad2ac8..11a2a1e00f2d 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Revisions/VersionNegotiatorTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Revisions/VersionNegotiatorTest.php @@ -128,7 +128,7 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Revisions\VersionById::getRevision */ - public function testOldRevision() { + public function testOldRevision(): void { $revision = $this->versionNegotiator->getRevision($this->node, 'id:' . $this->nodePreviousRevisionId); $this->assertEquals($this->node->id(), $revision->id()); $this->assertEquals($this->nodePreviousRevisionId, $revision->getRevisionId()); @@ -137,7 +137,7 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Revisions\VersionById::getRevision */ - public function testInvalidRevisionId() { + public function testInvalidRevisionId(): void { $this->expectException(CacheableNotFoundHttpException::class); $this->expectExceptionMessage(sprintf('The requested version, identified by `id:%s`, could not be found.', $this->node2->getRevisionId())); $this->versionNegotiator->getRevision($this->node, 'id:' . $this->node2->getRevisionId()); @@ -146,7 +146,7 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Revisions\VersionByRel::getRevision */ - public function testLatestVersion() { + public function testLatestVersion(): void { $revision = $this->versionNegotiator->getRevision($this->node, 'rel:' . VersionByRel::LATEST_VERSION); $this->assertEquals($this->node->id(), $revision->id()); $this->assertEquals($this->node->getRevisionId(), $revision->getRevisionId()); @@ -155,7 +155,7 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Revisions\VersionByRel::getRevision */ - public function testCurrentVersion() { + public function testCurrentVersion(): void { $revision = $this->versionNegotiator->getRevision($this->node, 'rel:' . VersionByRel::WORKING_COPY); $this->assertEquals($this->node->id(), $revision->id()); $this->assertEquals($this->node->id(), $revision->id()); @@ -165,7 +165,7 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Revisions\VersionByRel::getRevision */ - public function testInvalidRevisionRel() { + public function testInvalidRevisionRel(): void { $this->expectException(CacheableBadRequestHttpException::class); $this->expectExceptionMessage('An invalid resource version identifier, `rel:erroneous-revision-name`, was provided.'); $this->versionNegotiator->getRevision($this->node, 'rel:erroneous-revision-name'); diff --git a/core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php b/core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php index 61fb19e204e1..cba346114568 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php @@ -105,7 +105,7 @@ class SerializerTest extends JsonapiKernelTestBase { /** * @covers \Drupal\jsonapi\Serializer\Serializer::normalize */ - public function testFallbackNormalizer() { + public function testFallbackNormalizer(): void { $context = [ 'account' => $this->user, 'resource_object' => ResourceObject::createFromEntity($this->resourceType, $this->node), diff --git a/core/modules/jsonapi/tests/src/Kernel/TestCoverageTest.php b/core/modules/jsonapi/tests/src/Kernel/TestCoverageTest.php index b3c47abf213d..7fbfd6b32452 100644 --- a/core/modules/jsonapi/tests/src/Kernel/TestCoverageTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/TestCoverageTest.php @@ -62,7 +62,7 @@ class TestCoverageTest extends KernelTestBase { /** * Tests that all core entity types have JSON:API test coverage. */ - public function testEntityTypeRestTestCoverage() { + public function testEntityTypeRestTestCoverage(): void { $problems = []; foreach ($this->definitions as $entity_type_id => $info) { $class_name_full = $info->getClass(); diff --git a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php index 7ca219a3e417..5caf741ac014 100644 --- a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php +++ b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php @@ -58,7 +58,7 @@ class ResourceResponseValidatorTest extends UnitTestCase { * @covers ::validateResponse * @dataProvider validateResponseProvider */ - public function testValidateResponse($request, $response, $expected, $description) { + public function testValidateResponse($request, $response, $expected, $description): void { // Expose protected ResourceResponseSubscriber::validateResponse() method. $object = new \ReflectionObject($this->subscriber); $method = $object->getMethod('validateResponse'); diff --git a/core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php b/core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php index 6c5916bb4d2e..16154b64c637 100644 --- a/core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php +++ b/core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php @@ -122,7 +122,7 @@ class LinkTest extends UnitTestCase { /** * @covers ::getLinkRelationType */ - public function testGetLinkRelationType() { + public function testGetLinkRelationType(): void { $this->mockUrlAssembler(); $link = new Link((new CacheableMetadata())->addCacheTags(['foo']), Url::fromUri('https://jsonapi.org/foo'), 'self'); $this->assertSame('self', $link->getLinkRelationType()); diff --git a/core/modules/jsonapi/tests/src/Unit/JsonApiSpecTest.php b/core/modules/jsonapi/tests/src/Unit/JsonApiSpecTest.php index a761b5fb989b..f7dc9f64517b 100644 --- a/core/modules/jsonapi/tests/src/Unit/JsonApiSpecTest.php +++ b/core/modules/jsonapi/tests/src/Unit/JsonApiSpecTest.php @@ -23,7 +23,7 @@ class JsonApiSpecTest extends UnitTestCase { * @dataProvider providerTestIsValidMemberName * @covers ::isValidMemberName */ - public function testIsValidMemberName($member_name, $expected) { + public function testIsValidMemberName($member_name, $expected): void { $this->assertSame($expected, JsonApiSpec::isValidMemberName($member_name)); } @@ -104,7 +104,7 @@ class JsonApiSpecTest extends UnitTestCase { * @covers ::isValidCustomQueryParameter * @covers ::isValidMemberName */ - public function testIsValidCustomQueryParameter($custom_query_parameter, $expected) { + public function testIsValidCustomQueryParameter($custom_query_parameter, $expected): void { $this->assertSame($expected, JsonApiSpec::isValidCustomQueryParameter($custom_query_parameter)); } diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php index 30eddf58a10f..be112fb9e0e2 100644 --- a/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php @@ -25,7 +25,7 @@ class HttpExceptionNormalizerTest extends UnitTestCase { /** * @covers ::normalize */ - public function testNormalize() { + public function testNormalize(): void { $request_stack = $this->prophesize(RequestStack::class); $request_stack->getCurrentRequest()->willReturn(Request::create('http://localhost/')); $container = $this->prophesize(ContainerInterface::class); diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php index da5d2aeb44d7..55c6a1ef0b99 100644 --- a/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php @@ -89,7 +89,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends UnitTestCase { * @covers ::denormalize * @dataProvider denormalizeProvider */ - public function testDenormalize($input, $expected) { + public function testDenormalize($input, $expected): void { $resource_type = new ResourceType('node', 'article', FieldableEntityInterface::class); $resource_type->setRelatableResourceTypes([]); $context = ['resource_type' => $resource_type]; @@ -211,7 +211,7 @@ class JsonApiDocumentTopLevelNormalizerTest extends UnitTestCase { * @covers ::denormalize * @dataProvider denormalizeUuidProvider */ - public function testDenormalizeUuid($id, $expect_exception) { + public function testDenormalizeUuid($id, $expect_exception): void { $data['data'] = (isset($id)) ? ['type' => 'node--article', 'id' => $id] : ['type' => 'node--article']; diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php index fc78271bf3b3..63d005be306e 100644 --- a/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php @@ -111,7 +111,7 @@ class ResourceIdentifierNormalizerTest extends UnitTestCase { * @covers ::denormalize * @dataProvider denormalizeProvider */ - public function testDenormalize($input, $field_name, $expected) { + public function testDenormalize($input, $field_name, $expected): void { $entity = $this->prophesize(FieldableEntityInterface::class); $context = [ 'resource_type' => $this->resourceType, @@ -152,7 +152,7 @@ class ResourceIdentifierNormalizerTest extends UnitTestCase { * @covers ::denormalize * @dataProvider denormalizeInvalidResourceProvider */ - public function testDenormalizeInvalidResource($data, $field_name) { + public function testDenormalizeInvalidResource($data, $field_name): void { $context = [ 'resource_type' => $this->resourceType, 'related' => $field_name, diff --git a/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionGroupTest.php b/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionGroupTest.php index 5544e70012e0..8f3a4e5670e8 100644 --- a/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionGroupTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionGroupTest.php @@ -19,7 +19,7 @@ class EntityConditionGroupTest extends UnitTestCase { * @covers ::__construct * @dataProvider constructProvider */ - public function testConstruct($case) { + public function testConstruct($case): void { $group = new EntityConditionGroup($case['conjunction'], $case['members']); $this->assertEquals($case['conjunction'], $group->conjunction()); @@ -33,7 +33,7 @@ class EntityConditionGroupTest extends UnitTestCase { /** * @covers ::__construct */ - public function testConstructException() { + public function testConstructException(): void { $this->expectException(\InvalidArgumentException::class); new EntityConditionGroup('NOT_ALLOWED', []); } diff --git a/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionTest.php b/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionTest.php index adea6af9f0de..78aa37d8d13f 100644 --- a/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Query/EntityConditionTest.php @@ -37,7 +37,7 @@ class EntityConditionTest extends UnitTestCase { * @covers ::createFromQueryParameter * @dataProvider queryParameterProvider */ - public function testCreateFromQueryParameter($case) { + public function testCreateFromQueryParameter($case): void { $condition = EntityCondition::createFromQueryParameter($case); $this->assertEquals($case['path'], $condition->field()); $this->assertEquals($case['value'], $condition->value()); @@ -75,7 +75,7 @@ class EntityConditionTest extends UnitTestCase { * @covers ::validate * @dataProvider validationProvider */ - public function testValidation($input, $exception) { + public function testValidation($input, $exception): void { if ($exception) { $this->expectException(get_class($exception)); $this->expectExceptionMessage($exception->getMessage()); diff --git a/core/modules/jsonapi/tests/src/Unit/Query/OffsetPageTest.php b/core/modules/jsonapi/tests/src/Unit/Query/OffsetPageTest.php index 264d3bd7f615..e360fb65fe08 100644 --- a/core/modules/jsonapi/tests/src/Unit/Query/OffsetPageTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Query/OffsetPageTest.php @@ -37,7 +37,7 @@ class OffsetPageTest extends UnitTestCase { * @covers ::createFromQueryParameter * @dataProvider parameterProvider */ - public function testCreateFromQueryParameter($original, $expected) { + public function testCreateFromQueryParameter($original, $expected): void { $actual = OffsetPage::createFromQueryParameter($original); $this->assertEquals($expected['offset'], $actual->getOffset()); $this->assertEquals($expected['limit'], $actual->getSize()); @@ -59,7 +59,7 @@ class OffsetPageTest extends UnitTestCase { /** * @covers ::createFromQueryParameter */ - public function testCreateFromQueryParameterFail() { + public function testCreateFromQueryParameterFail(): void { $this->expectException(BadRequestHttpException::class); OffsetPage::createFromQueryParameter('lorem'); } diff --git a/core/modules/jsonapi/tests/src/Unit/Query/SortTest.php b/core/modules/jsonapi/tests/src/Unit/Query/SortTest.php index 14b3faa9f52b..352ba46d619c 100644 --- a/core/modules/jsonapi/tests/src/Unit/Query/SortTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Query/SortTest.php @@ -37,7 +37,7 @@ class SortTest extends UnitTestCase { * @covers ::createFromQueryParameter * @dataProvider parameterProvider */ - public function testCreateFromQueryParameter($input, $expected) { + public function testCreateFromQueryParameter($input, $expected): void { $sort = Sort::createFromQueryParameter($input); foreach ($sort->fields() as $index => $sort_field) { $this->assertEquals($expected[$index]['path'], $sort_field['path']); @@ -85,7 +85,7 @@ class SortTest extends UnitTestCase { * @covers ::createFromQueryParameter * @dataProvider badParameterProvider */ - public function testCreateFromQueryParameterFail($input) { + public function testCreateFromQueryParameterFail($input): void { $this->expectException(BadRequestHttpException::class); Sort::createFromQueryParameter($input); } diff --git a/core/modules/jsonapi/tests/src/Unit/Routing/RoutesTest.php b/core/modules/jsonapi/tests/src/Unit/Routing/RoutesTest.php index 59000936c3ef..80f38d545c79 100644 --- a/core/modules/jsonapi/tests/src/Unit/Routing/RoutesTest.php +++ b/core/modules/jsonapi/tests/src/Unit/Routing/RoutesTest.php @@ -68,7 +68,7 @@ class RoutesTest extends UnitTestCase { /** * @covers ::routes */ - public function testRoutesCollection() { + public function testRoutesCollection(): void { // Get the route collection and start making assertions. $routes = $this->routes['ok']->routes(); @@ -104,7 +104,7 @@ class RoutesTest extends UnitTestCase { /** * @covers ::routes */ - public function testRoutesIndividual() { + public function testRoutesIndividual(): void { // Get the route collection and start making assertions. $iterator = $this->routes['ok']->routes()->getIterator(); @@ -147,7 +147,7 @@ class RoutesTest extends UnitTestCase { /** * @covers ::routes */ - public function testRoutesRelated() { + public function testRoutesRelated(): void { // Get the route collection and start making assertions. $iterator = $this->routes['ok']->routes()->getIterator(); @@ -168,7 +168,7 @@ class RoutesTest extends UnitTestCase { /** * @covers ::routes */ - public function testRoutesRelationships() { + public function testRoutesRelationships(): void { // Get the route collection and start making assertions. $iterator = $this->routes['ok']->routes()->getIterator(); @@ -191,7 +191,7 @@ class RoutesTest extends UnitTestCase { * * @dataProvider expectedRoutes */ - public function testRoutes($route) { + public function testRoutes($route): void { $this->assertArrayHasKey($route, $this->routes['ok']->routes()->all()); } @@ -225,7 +225,7 @@ class RoutesTest extends UnitTestCase { * * @dataProvider notExpectedRoutes */ - public function testInternalRoutes($route) { + public function testInternalRoutes($route): void { $this->assertArrayNotHasKey($route, $this->routes['ok']->routes()->all()); } |