function WorkspaceTest::getModifiedEntityForPostTesting
Gets the normalized POST entity with random values for its unique fields.
Return value
array An array structure as returned by ::getNormalizedPostEntity().
Overrides ResourceTestBase::getModifiedEntityForPostTesting
File
- 
              core/
modules/ jsonapi/ tests/ src/ Functional/ WorkspaceTest.php, line 199  
Class
- WorkspaceTest
 - JSON:API integration test for the "Workspace" content entity type.
 
Namespace
Drupal\Tests\jsonapi\FunctionalCode
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.