You are here

function FieldMultipleLimitTestCase::addTestDataToPage in Field multiple limit 7

Set up a text field on the page content type so we can configure it.

See also

FieldInstanceCrudTestCase

1 call to FieldMultipleLimitTestCase::addTestDataToPage()
FieldMultipleLimitTestCase::testFieldDisplay in ./field_multiple_limit.test
Test that data added to the page shows up as expected.

File

./field_multiple_limit.test, line 59
Tests for Field Multiple Limit, based on examples from field.test

Class

FieldMultipleLimitTestCase
Test the field formatter settings work.

Code

function addTestDataToPage() {
  $this
    ->drupalGet('node/add/page');
  $langcode = LANGUAGE_NONE;
  $this
    ->assertFieldByName("{$this->field_name}[{$langcode}][0][value]", '', 'Widget is displayed');
  $edit = array(
    'title' => 'Test multiple fields',
    "{$this->field_name}[{$langcode}][0][value]" => 'Field data #0',
    "{$this->field_name}[{$langcode}][1][value]" => 'Field data #1',
    "{$this->field_name}[{$langcode}][2][value]" => 'Field data #2',
    "{$this->field_name}[{$langcode}][3][value]" => 'Field data #3',
    "{$this->field_name}[{$langcode}][4][value]" => 'Field data #4',
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));

  // According to a core example, this is how I should find the ID of the
  // thing I just made.
  if (preg_match('|node/(\\d+)|', $this->url, $match)) {
    $this->entity_id = $match[1];
  }
}