public function EntityLegalDocumentTestCase::testCreateForm in Entity Legal 7
Same name and namespace in other branches
- 7.2 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',
'path[alias]' => 'custom-legal-document-path',
), 'Next');
// Load a reset version of the entity.
$created_document = $this
->getUncachedEntity(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, $test_name);
$document_uri = $created_document
->uri();
$this
->assertTrue(!empty($created_document), 'Document was successfully created');
drupal_static_reset();
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');
$this
->assertEqual('custom-legal-document-path', drupal_get_path_alias($document_uri['path']), 'Path was set correctly');
}
}