You are here

protected function EntityformTestCase::entityformSubmit in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.test \EntityformTestCase::entityformSubmit()
2 calls to EntityformTestCase::entityformSubmit()
EntityformCRUDTestCase::testCreateEntityformType in ./entityform.test
EntityformRulesTestCase::testSubmitWithRules in ./entityform.test
Tests Entityforms Invoking of Rules

File

./entityform.test, line 35

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));
  if ($this
    ->assertText(t(ENTITYFORM_TEST_SUBMISSION_TITLE), 'Authenicated user can submit.')) {
    $this->entityform_submission_count++;
    return TRUE;
  }
  return FALSE;
}