function WorkspaceResourceTestBase::getModifiedEntityForPostTesting
Gets the normalized POST entity with random values for its unique fields.
Return value
array An array structure as returned by ::getNormalizedPostEntity().
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\RestCode
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.