You are here

public function MultiformTestCase::testSubmitHandling in Multiple forms 7.2

Same name and namespace in other branches
  1. 7 tests/multiform.test \MultiformTestCase::testSubmitHandling()

Check various submit ops.

File

tests/multiform.test, line 35
@author Kálmán Hosszu - http://drupal.org/user/267481

Class

MultiformTestCase
@file

Code

public function testSubmitHandling() {

  // Go to the form page.
  $this
    ->drupalGet('multiform-test/1');

  // Check buttons.
  $this
    ->assertFieldByName('multiform[multiform_submits_form][op]', 'save');
  $this
    ->assertFieldByName('multiform[multiform_submits_form][op]', 'delete');

  // No more buttons.
  $submitButtons = $this
    ->xpath('//input[@type="submit" and @name!="op"]');
  $this
    ->assertEqual(count($submitButtons), 2, t('No more submit button.'));

  // Save button.
  $this
    ->drupalPost(NULL, array(), 'save');
  $this
    ->assertText('multiform_test1_1multiform_test1_submit_button', t('First form save message is found.'));
  $this
    ->assertText('multiform_test1_2multiform_test1_submit_button', t('Second form save message is found.'));

  // Delete button.
  $this
    ->drupalPost(NULL, array(), 'delete');
  $this
    ->assertText('multiform_test1_1multiform_test1_delete_button', t('First form delete message is found.'));
  $this
    ->assertText('multiform_test1_2multiform_test1_delete_button', t('Second form delete message is found.'));
}