protected function VocabularyTest::getExpectedDocument in JSON:API 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/VocabularyTest.php \Drupal\Tests\jsonapi\Functional\VocabularyTest::getExpectedDocument()
Returns the expected JSON:API document for the entity.
Return value
array A JSON:API response document.
Overrides ResourceTestBase::getExpectedDocument
See also
::createEntity()
File
- tests/
src/ Functional/ VocabularyTest.php, line 60
Class
- VocabularyTest
- JSON:API integration test for the "vocabulary" config entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/taxonomy_vocabulary/taxonomy_vocabulary/' . $this->entity
->uuid())
->setAbsolute()
->toString(TRUE)
->getGeneratedUrl();
$expected_document = [
'jsonapi' => [
'meta' => [
'links' => [
'self' => [
'href' => 'http://jsonapi.org/format/1.0/',
],
],
],
'version' => '1.0',
],
'links' => [
'self' => [
'href' => $self_url,
],
],
'data' => [
'id' => $this->entity
->uuid(),
'type' => 'taxonomy_vocabulary--taxonomy_vocabulary',
'links' => [
'self' => [
'href' => $self_url,
],
],
'attributes' => [
'langcode' => 'en',
'status' => TRUE,
'dependencies' => [],
'name' => 'Llama',
'description' => NULL,
'weight' => 0,
'drupal_internal__vid' => 'llama',
],
],
];
if (floatval(\Drupal::VERSION) < 8.699999999999999) {
$expected_document['data']['attributes']['hierarchy'] = 0;
}
return $expected_document;
}