protected function WorkflowTest::getExpectedDocument in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/WorkflowTest.php \Drupal\Tests\jsonapi\Functional\WorkflowTest::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/ WorkflowTest.php, line 68
Class
- WorkflowTest
- JSON API integration test for the "Workflow" config entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/workflow/workflow/' . $this->entity
->uuid())
->setAbsolute()
->toString(TRUE)
->getGeneratedUrl();
return [
'jsonapi' => [
'meta' => [
'links' => [
'self' => 'http://jsonapi.org/format/1.0/',
],
],
'version' => '1.0',
],
'links' => [
'self' => $self_url,
],
'data' => [
'id' => $this->entity
->uuid(),
'type' => 'workflow--workflow',
'links' => [
'self' => $self_url,
],
'attributes' => [
'dependencies' => [
'module' => [
'workflow_type_test',
],
],
'id' => 'rest_workflow',
'label' => 'REST Worklow',
'langcode' => 'en',
'status' => TRUE,
'type' => 'workflow_type_complex_test',
'type_settings' => [
'states' => [
'draft' => [
'extra' => 'bar',
'label' => 'Draft',
'weight' => 0,
],
'published' => [
'label' => 'Published',
'weight' => 1,
],
],
'transitions' => [],
'example_setting' => 'foo',
],
'uuid' => $this->entity
->uuid(),
],
],
];
}