public function EntityLegalDocumentTestCase::testCreateForm in Entity Legal 7.2
Same name and namespace in other branches
- 7 tests/entity_legal.document.test \EntityLegalDocumentTestCase::testCreateForm()
Test the functionality of the create form.
File
- tests/
entity_legal.document.test, line 45 - Test file include for legal document.
Class
- EntityLegalDocumentTestCase
- Simpletest class for legal document entities.
Code
public function testCreateForm() {
$test_label = $this
->randomName();
$test_name = $this
->randomName();
$this
->drupalLogin($this->adminUser);
$this
->drupalPost('admin/structure/legal/add', array(
'label' => $test_label,
'name' => $test_name,
'settings[new_users][require]' => 1,
'settings[new_users][require_method]' => 'form_inline',
'settings[existing_users][require]' => 1,
'settings[existing_users][require_method]' => 'redirect',
), 'Next');
// Load a reset version of the entity.
$created_document = $this
->getUncachedEntity(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, $test_name);
$this
->assertTrue(!empty($created_document), 'Document was successfully created');
if ($created_document) {
$this
->assertEqual($test_label, $created_document
->label(), 'Label was saved correctly');
$this
->assertEqual($test_name, $created_document
->identifier(), 'Name was saved correctly');
$this
->assertEqual(1, $created_document->require_signup, 'Signup requirement was saved correctly');
$this
->assertEqual(1, $created_document->require_existing, 'Existing user requirement was saved correctly');
$this
->assertEqual('form_inline', $created_document
->getSetting('new_users', 'require_method'), 'Existing user requirement was saved correctly');
$this
->assertEqual('redirect', $created_document
->getSetting('existing_users', 'require_method'), 'Existing user requirement was saved correctly');
}
}