Unverified Commit 6d3ac6c7 authored by alexpott's avatar alexpott

Issue #3042745 by dwebpoint, Berdir, emacoti, jefftrnr, Wim Leers, alexpott,...

Issue #3042745 by dwebpoint, Berdir, emacoti, jefftrnr, Wim Leers, alexpott, voleger, sjhuda, bnjmnm: Remove group @legacy from jsonapi tests and fix deprecation messages
parent cfd99349
......@@ -15,7 +15,6 @@
* Tests JSON:API multilingual support.
*
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -11,7 +11,6 @@
* General functional test class.
*
* @group jsonapi
* @group legacy
*
* @internal
*/
......@@ -271,7 +270,7 @@ public function testRead() {
]);
$response = $this->request('GET', $user_url, [
'auth' => [
$this->userCanViewProfiles->getUsername(),
$this->userCanViewProfiles->getAccountName(),
$this->userCanViewProfiles->pass_raw,
],
]);
......@@ -564,7 +563,7 @@ public function testWrite() {
];
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$created_response = Json::decode($response->getBody()->__toString());
......@@ -587,7 +586,7 @@ public function testWrite() {
// 2.1 Authorization error with a user without create permissions.
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($body),
'auth' => [$this->userCanViewProfiles->getUsername(), $this->userCanViewProfiles->pass_raw],
'auth' => [$this->userCanViewProfiles->getAccountName(), $this->userCanViewProfiles->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$created_response = Json::decode($response->getBody()->__toString());
......@@ -598,7 +597,7 @@ public function testWrite() {
// 3. Missing Content-Type error.
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Accept' => 'application/vnd.api+json'],
]);
$created_response = Json::decode($response->getBody()->__toString());
......@@ -609,7 +608,7 @@ public function testWrite() {
$invalid_body['data']['id'] = Node::load(1)->uuid();
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($invalid_body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Accept' => 'application/vnd.api+json',
'Content-Type' => 'application/vnd.api+json',
......@@ -625,7 +624,7 @@ public function testWrite() {
$body_invalid_tags['data']['relationships']['field_tags']['data'][1]['id'] = 'ipsum';
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($body_invalid_tags),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$created_response = Json::decode($response->getBody()->__toString());
......@@ -633,7 +632,7 @@ public function testWrite() {
// 6. Decoding error.
$response = $this->request('POST', $collection_url, [
'body' => '{"bad json",,,}',
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
......@@ -646,7 +645,7 @@ public function testWrite() {
// 6.1 Denormalizing error.
$response = $this->request('POST', $collection_url, [
'body' => '{"data":{"type":"something"},"valid yet nonsensical json":[]}',
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
......@@ -662,7 +661,7 @@ public function testWrite() {
$malformed_body['relationships'] = $body['data']['relationships'];
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($malformed_body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Accept' => 'application/vnd.api+json',
'Content-Type' => 'application/vnd.api+json',
......@@ -678,7 +677,7 @@ public function testWrite() {
unset($missing_type['data']['type']);
$response = $this->request('POST', $collection_url, [
'body' => Json::encode($missing_type),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Accept' => 'application/vnd.api+json',
'Content-Type' => 'application/vnd.api+json',
......@@ -702,7 +701,7 @@ public function testWrite() {
]);
$response = $this->request('PATCH', $individual_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$updated_response = Json::decode($response->getBody()->__toString());
......@@ -722,7 +721,7 @@ public function testWrite() {
]);
$response = $this->request('PATCH', $individual_url, [
'body' => Json::encode($body),
'auth' => [$this->userCanViewProfiles->getUsername(), $this->userCanViewProfiles->pass_raw],
'auth' => [$this->userCanViewProfiles->getAccountName(), $this->userCanViewProfiles->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$this->assertEquals(403, $response->getStatusCode());
......@@ -740,7 +739,7 @@ public function testWrite() {
];
$response = $this->request('PATCH', $individual_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$updated_response = Json::decode($response->getBody()->__toString());
......@@ -764,7 +763,7 @@ public function testWrite() {
]);
$response = $this->request('POST', $relationship_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$updated_response = Json::decode($response->getBody()->__toString());
......@@ -783,7 +782,7 @@ public function testWrite() {
];
$response = $this->request('PATCH', $relationship_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$this->assertEquals(204, $response->getStatusCode());
......@@ -791,7 +790,7 @@ public function testWrite() {
// 11. Successful DELETE to related endpoint.
$response = $this->request('DELETE', $relationship_url, [
// Send a request with no body.
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
......@@ -812,7 +811,7 @@ public function testWrite() {
$response = $this->request('DELETE', $relationship_url, [
// Remove the existing relationship item.
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$this->assertEquals(204, $response->getStatusCode());
......@@ -834,7 +833,7 @@ public function testWrite() {
];
$response = $this->request('PATCH', $individual_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
......@@ -863,7 +862,7 @@ public function testWrite() {
];
$response = $this->request('PATCH', $individual_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
'headers' => [
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
......@@ -875,7 +874,7 @@ public function testWrite() {
$updated_response['errors']['0']['detail']);
// 14. Successful DELETE.
$response = $this->request('DELETE', $individual_url, [
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'auth' => [$this->user->getAccountName(), $this->user->pass_raw],
]);
$this->assertEquals(204, $response->getStatusCode());
$response = $this->request('GET', $individual_url, []);
......
......@@ -26,7 +26,6 @@
* JSON:API regression tests.
*
* @group jsonapi
* @group legacy
*
* @internal
*/
......@@ -70,7 +69,7 @@ public function testBundleSpecificTargetEntityTypeFromIssue2953207() {
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/comment/tcomment?include=entity_id&filter[entity_id.name]=foobar'), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -134,7 +133,7 @@ public function testDeepNestedIncludeMultiTargetEntityTypeFieldFromIssue2973681(
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/node/page?include=field_comment,field_comment.entity_id,field_comment.entity_id.uid'), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -181,7 +180,7 @@ public function testBundlelessRelationshipMutationFromIssue2973681() {
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
],
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
RequestOptions::JSON => [
'data' => [
['type' => 'user--user', 'id' => $target->uuid()],
......@@ -221,7 +220,7 @@ public function testGetTermWhenMultipleVocabulariesExistFromIssue2977879() {
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/taxonomy_term/one'), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -283,7 +282,7 @@ public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2968972()
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
],
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
RequestOptions::JSON => [
'data' => [
'type' => 'node--journal_article',
......@@ -322,7 +321,7 @@ public function testGetNodeCollectionWithHookNodeGrantsImplementationsFromIssue2
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/node/article'), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -408,7 +407,7 @@ public function testDanglingReferencesInAnEntityReferenceFieldFromIssue2984647()
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
],
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
];
$issue_node->delete();
$response = $this->request('GET', $url, $request_options);
......@@ -469,7 +468,7 @@ public function testThatRoutesAreRebuiltAfterDataModelChangesFromIssue2984886()
$user = $this->drupalCreateUser(['access content']);
$request_options = [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
];
......@@ -563,7 +562,7 @@ public function testDenormalizeAliasedRelationshipFromIssue2953207() {
// Test.
$response = $this->request('PATCH', Url::fromUri(sprintf('internal:/jsonapi/taxonomy_term/tags/%s/relationships/%s', Term::load(1)->uuid(), $public_relationship_field_name)), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
RequestOptions::HEADERS => [
......@@ -637,7 +636,7 @@ public function testFilterByIdFromIssue3015759() {
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/shortcut/default?filter[drupal_internal__id]=' . $shortcut->id()), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -689,7 +688,7 @@ public function testPatchingDateTimeNormalizedWrongTimeZoneIssue3021194() {
]);
$response = $this->request('GET', Url::fromUri('internal:/jsonapi/node/page/' . $page->uuid()), [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
]);
......@@ -757,7 +756,7 @@ public function testPatchingDateTimeFieldsFromIssue3021194() {
]);
$request_options = [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
RequestOptions::HEADERS => [
......@@ -801,7 +800,7 @@ public function testPostToIncludeUrlDoesNotReturnIncludeFromIssue3026030() {
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
],
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
RequestOptions::JSON => [
'data' => [
'type' => 'node--page',
......@@ -846,7 +845,7 @@ public function testPatchToIncludeUrlDoesNotReturnIncludeFromIssue3026030() {
'Content-Type' => 'application/vnd.api+json',
'Accept' => 'application/vnd.api+json',
],
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
RequestOptions::JSON => [
'data' => [
'type' => 'node--page',
......@@ -887,7 +886,7 @@ public function testMapFieldTypeNormalizationFromIssue3040590() {
// Test.
$url = Url::fromUri(sprintf('internal:/jsonapi/entity_test_map_field/entity_test_map_field', $entity->uuid()));
$request_options = [
RequestOptions::AUTH => [$user->getUsername(), $user->pass_raw],
RequestOptions::AUTH => [$user->getAccountName(), $user->pass_raw],
];
$response = $this->request('GET', $url, $request_options);
$this->assertSame(200, $response->getStatusCode());
......@@ -931,7 +930,7 @@ public function testRecursionDetectedWhenResponseContainsViolationsFrom3042124()
$admin = $this->drupalCreateUser([], 'Gandalf', TRUE);
// Make request as regular user.
$request_options[RequestOptions::AUTH] = [$user->getUsername(), $user->pass_raw];
$request_options[RequestOptions::AUTH] = [$user->getAccountName(), $user->pass_raw];
$this->request('POST', $url, $request_options);
$response = $this->request('POST', $url, $request_options);
......@@ -942,7 +941,7 @@ public function testRecursionDetectedWhenResponseContainsViolationsFrom3042124()
$this->assertSame(sprintf('title: This value should not be null.'), $data['errors'][0]['detail']);
// Make request as regular user.
$request_options[RequestOptions::AUTH] = [$admin->getUsername(), $admin->pass_raw];
$request_options[RequestOptions::AUTH] = [$admin->getAccountName(), $admin->pass_raw];
$this->request('POST', $url, $request_options);
$response = $this->request('POST', $url, $request_options);
......@@ -981,7 +980,7 @@ public function testLeakedCacheMetadataViaRdfFromIssue3053827() {
$user = $this->drupalCreateUser(['access comments']);
$request_options = [
RequestOptions::AUTH => [
$user->getUsername(),
$user->getAccountName(),
$user->pass_raw,
],
];
......
......@@ -9,7 +9,6 @@
* Ensures that the 'api_json' format is not supported by the REST module.
*
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -12,7 +12,6 @@
* Ensures that the 'api_json' format is not supported by the REST module.
*
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -11,7 +11,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Context\FieldResolver
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -10,7 +10,6 @@
use Drupal\jsonapi\JsonApiResource\ResourceIdentifier;
use Drupal\jsonapi\JsonApiResource\ResourceObject;
use Drupal\jsonapi\ResourceType\ResourceType;
use Drupal\jsonapi\Controller\EntityResource;
use Drupal\jsonapi\JsonApiResource\Data;
use Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel;
use Drupal\node\Entity\Node;
......@@ -27,7 +26,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Controller\EntityResource
* @group jsonapi
* @group legacy
*
* @internal
*/
......@@ -187,19 +185,7 @@ protected function setUp() {
* An EntityResource instance.
*/
protected function createEntityResource() {
return new EntityResource(
$this->container->get('entity_type.manager'),
$this->container->get('entity_field.manager'),
$this->container->get('jsonapi.resource_type.repository'),
$this->container->get('renderer'),
$this->container->get('entity.repository'),
$this->container->get('jsonapi.include_resolver'),
$this->container->get('jsonapi.entity_access_checker'),
$this->container->get('jsonapi.field_resolver'),
$this->container->get('jsonapi.serializer'),
$this->container->get('datetime.time'),
$this->container->get('current_user')
);
return $this->container->get('jsonapi.entity_resource');
}
/**
......@@ -422,7 +408,8 @@ public function testCreateIndividual() {
$response = $this->entityResource->createIndividual($resource_type, $request);
// As a side effect, the node will also be saved.
$this->assertInstanceOf(JsonApiDocumentTopLevel::class, $response->getResponseData());
$this->assertTrue(entity_load_multiple_by_properties('node', ['uuid' => $response->getResponseData()->getData()->getIterator()->offsetGet(0)->getId()]));
$entity_type_manager = $this->container->get('entity_type.manager');
$this->assertTrue($entity_type_manager->getStorage('node')->loadByProperties(['uuid' => $response->getResponseData()->getData()->getIterator()->offsetGet(0)->getId()]));
$this->assertEquals(201, $response->getStatusCode());
}
......
......@@ -31,7 +31,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -17,7 +17,6 @@
* @coversDefaultClass \Drupal\jsonapi\Query\Filter
* @group jsonapi
* @group jsonapi_query
* @group legacy
*
* @internal
*/
......
......@@ -9,7 +9,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -8,7 +8,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Query\EntityConditionGroup
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -12,7 +12,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Query\EntityCondition
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -12,7 +12,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Query\OffsetPage
* @group jsonapi
* @group legacy
*
* @internal
*/
......
......@@ -12,7 +12,6 @@
/**
* @coversDefaultClass \Drupal\jsonapi\Query\Sort
* @group jsonapi
* @group legacy
*
* @internal
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment