function WorkflowTest::getExpectedDocument

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/WorkflowTest.php \Drupal\Tests\jsonapi\Functional\WorkflowTest::getExpectedDocument()
  2. 10 core/modules/jsonapi/tests/src/Functional/WorkflowTest.php \Drupal\Tests\jsonapi\Functional\WorkflowTest::getExpectedDocument()
  3. 11.x core/modules/jsonapi/tests/src/Functional/WorkflowTest.php \Drupal\Tests\jsonapi\Functional\WorkflowTest::getExpectedDocument()

Overrides ResourceTestBase::getExpectedDocument

File

core/modules/jsonapi/tests/src/Functional/WorkflowTest.php, line 73

Class

WorkflowTest
JSON:API integration test for the "Workflow" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedDocument() {
    $self_url = Url::fromUri('base:/jsonapi/workflow/workflow/' . $this->entity
        ->uuid())
        ->setAbsolute()
        ->toString(TRUE)
        ->getGeneratedUrl();
    return [
        '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' => 'workflow--workflow',
            'links' => [
                'self' => [
                    'href' => $self_url,
                ],
            ],
            'attributes' => [
                'dependencies' => [
                    'module' => [
                        'workflow_type_test',
                    ],
                ],
                'label' => 'REST Workflow',
                'langcode' => 'en',
                'status' => TRUE,
                'workflow_type' => 'workflow_type_complex_test',
                'type_settings' => [
                    'states' => [
                        'draft' => [
                            'extra' => 'bar',
                            'label' => 'Draft',
                            'weight' => 0,
                        ],
                        'published' => [
                            'label' => 'Published',
                            'weight' => 1,
                        ],
                    ],
                    'transitions' => [],
                    'example_setting' => 'foo',
                ],
                'drupal_internal__id' => 'rest_workflow',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.