public function MessageTest::testRelated in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/MessageTest.php \Drupal\Tests\jsonapi\Functional\MessageTest::testRelated()
Tests GETing related resource of an individual resource.
Expected responses are built by making requests to 'relationship' routes. Using the fetched resource identifiers, if any, all targeted resources are fetched individually. These individual responses are then 'merged' into a single expected ResourceResponse. This is repeated for every relationship field of the resource type under test.
Overrides ResourceTestBase::testRelated
File
- tests/
src/ Functional/ MessageTest.php, line 146
Class
- MessageTest
- JSON API integration test for the "Message" content entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
public function testRelated() {
// Contact Message entities are not stored, so they cannot be retrieved.
$this
->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.related" does not exist.');
Url::fromRoute('jsonapi.contact_message--camelids.related')
->toString(TRUE);
}