You are here

protected function EntityformTestCase::entityformSubmit in Entityform 7.2

Same name and namespace in other branches
  1. 7 entityform.test \EntityformTestCase::entityformSubmit()
1 call to EntityformTestCase::entityformSubmit()
EntityformCRUDTestCase::testCreateEntityformType in ./entityform.test

File

./entityform.test, line 36

Class

EntityformTestCase

Code

protected function entityformSubmit($machine_name, $user, $submit_text = NULL) {
  $this
    ->drupalLogin($user);
  if (empty($submit_text)) {
    $submit_text = 'submitext-' . $user->name;
  }
  $form_url = 'eform/submit/' . str_replace('_', '-', $machine_name);
  $this
    ->drupalGet($form_url);
  $this
    ->assertText(t('Test Instructions'), 'Authenicated has access to Test Form.');
  $this
    ->assertText(t('Test Field'), 'field_text exists on Test Form.');

  // Post Test Form
  $edit = array();
  $edit['field_text[und][0][value]'] = $submit_text;
  $this
    ->drupalPost($form_url, $edit, t(ENTITYFORM_TEST_SUBMIT_TEXT));
  $entityform_type = entityform_type_load($machine_name);
  if ($entityform_type->data['redirect_path'] == '') {
    if ($this
      ->assertText(t(ENTITYFORM_TEST_SUBMISSION_TITLE), 'Authenicated user can submit.')) {
      $this->entityform_submission_count++;
      return TRUE;
    }
    return FALSE;
  }
}