Skip to content
Snippets Groups Projects
Unverified Commit 24bd8d58 authored by Mateu Aguiló Bosch's avatar Mateu Aguiló Bosch
Browse files

feat(test): test related post

parent a6fbee6d
No related branches found
No related tags found
No related merge requests found
......@@ -173,6 +173,22 @@ class JsonExtrasApiFunctionalTest extends JsonApiFunctionalTestBase {
$date = new \DateTime($body['data']['attributes']['updatedAt']);
$created_node = Node::load($created_response['data']['attributes']['internalId']);
$this->assertSame((int) $date->format('U'), (int) $created_node->getChangedTime());
// 2. Successful relationships PATCH.
$uuid = $created_response['data']['id'];
$relationships_url = Url::fromUserInput('/api/articles/' . $uuid . '/relationships/tags');
$body = [
'data' => [
['type' => 'taxonomy_term--tags', 'id' => $this->tags[2]->uuid()]
],
];
$response = $this->request('POST', $relationships_url, [
'body' => Json::encode($body),
'auth' => [$this->user->getUsername(), $this->user->pass_raw],
'headers' => ['Content-Type' => 'application/vnd.api+json'],
]);
$created_response = Json::decode((string) $response->getBody());
$this->assertCount(3, $created_response['data']);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment