You are here

protected function EntityLegalTestCase::createDocument in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 tests/entity_legal.common.test \EntityLegalTestCase::createDocument()

Create a random legal document entity.

Parameters

bool $require_signup: Whether or not to require new users to agree.

bool $require_existing: Whether or not to require existing users to agree.

array $settings: Additional settings to pass through to the document.

Return value

EntityLegalDocument The created legal document.

12 calls to EntityLegalTestCase::createDocument()
EntityLegalDocumentAcceptanceTestCase::testSubmissionForm in tests/entity_legal.acceptance.test
Test that user has the ability to agree to legal documents.
EntityLegalDocumentTestCase::testAdminOverviewUi in tests/entity_legal.document.test
Test the overview page contains a list of entities.
EntityLegalDocumentTestCase::testDeleteForm in tests/entity_legal.document.test
Test the functionality of the delete form.
EntityLegalDocumentTestCase::testEditForm in tests/entity_legal.document.test
Test the functionality of the edit form.
EntityLegalDocumentVersionTestCase::testAdminOverviewUi in tests/entity_legal.version.test
Test the overview page contains a list of entities.

... See full list

File

tests/entity_legal.common.test, line 62
Common test class file.

Class

EntityLegalTestCase
Common Simpletest class for all legal tests.

Code

protected function createDocument($require_signup = FALSE, $require_existing = FALSE, $settings = array()) {
  $entity = entity_create(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, array(
    'name' => $this
      ->randomName(32),
    'label' => $this
      ->randomName(),
    'require_signup' => (int) $require_signup,
    'require_existing' => (int) $require_existing,
    'settings' => $settings,
  ));
  $entity
    ->save();

  // Reset permissions cache to make new document permissions available.
  $this
    ->checkPermissions(array(), TRUE);
  return $entity;
}