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

feat(test): test filter with renamed field

parent e7441fc7
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,8 @@ class JsonExtrasApiFunctionalTest extends JsonApiFunctionalTestBase {
// Make the link for node/3 to point to an entity.
$this->nodes[3]->field_link->setValue(['uri' => 'entity:node/' . $this->nodes[2]->id()]);
$this->nodes[3]->save();
$this->nodes[40]->uid->set(0, 1);
$this->nodes[40]->save();
// 1. Make sure the api root is under '/api' and not '/jsonapi'.
/** @var \Symfony\Component\Routing\RouteCollection $route_collection */
......@@ -176,6 +178,22 @@ class JsonExtrasApiFunctionalTest extends JsonApiFunctionalTestBase {
['query' => ['include' => 'vocabs,vid']]
));
$this->assertArrayNotHasKey('included', $output);
// 17. Test nested filters with renamed field.
$output = Json::decode($this->drupalGet(
'/api/articles',
[
'query' => [
'filter' => [
'owner.name' => [
'value' => User::load(1)->getAccountName(),
],
],
],
]
));
// There is only one article for the admin.
$this->assertSame($this->nodes[40]->uuid(), $output['data'][0]['id']);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment