function WorkspaceResourceTestBase::getModifiedEntityForPostTesting

Same name in other branches
  1. 11.x core/modules/workspaces/tests/src/Functional/Rest/WorkspaceResourceTestBase.php \Drupal\Tests\workspaces\Functional\Rest\WorkspaceResourceTestBase::getModifiedEntityForPostTesting()

Overrides EntityResourceTestBase::getModifiedEntityForPostTesting

File

core/modules/workspaces/tests/src/Functional/Rest/WorkspaceResourceTestBase.php, line 195

Class

WorkspaceResourceTestBase
Base class for workspace EntityResource tests.

Namespace

Drupal\Tests\workspaces\Functional\Rest

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['id'] = [
        $this->randomMachineName(),
    ];
    return $modified;
}

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