function WorkspaceTest::getModifiedEntityForPostTesting

Same name in other branches
  1. 10 core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\jsonapi\Functional\WorkspaceTest::getModifiedEntityForPostTesting()

Overrides ResourceTestBase::getModifiedEntityForPostTesting

File

core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php, line 198

Class

WorkspaceTest
JSON:API integration test for the "Workspace" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getModifiedEntityForPostTesting() {
    $modified = parent::getModifiedEntityForPostTesting();
    // Even though the field type of the workspace ID is 'string', it acts as a
    // machine name through a custom constraint, so we need to ensure that we
    // generate a proper random value for it.
    // @see \Drupal\workspaces\Entity\Workspace::baseFieldDefinitions()
    $modified['data']['attributes']['id'] = $this->randomMachineName();
    return $modified;
}

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