You are here

protected function MicrodataCoreFieldsUITestCase::subtestBodyField in Microdata 7

1 call to MicrodataCoreFieldsUITestCase::subtestBodyField()
MicrodataCoreFieldsUITestCase::testMicrodataUI in ./microdata.test
Tests the microdata UI for core fields.

File

./microdata.test, line 469
Tests for microdata.module.

Class

MicrodataCoreFieldsUITestCase

Code

protected function subtestBodyField($original_mapping) {
  $path = $this->field_admin . '/body';
  $fullbody_formfield_name = 'microdata[fields][body][subfields][value][itemprop]';
  $summary_formfield_name = 'microdata[fields][body][subfields][summary][itemprop]';
  $fullbody_itemprop = $original_mapping['body']['value']['#itemprop'][0];
  $summary_itemprop = $original_mapping['body']['summary']['#itemprop'][0];
  $new_fullbody_itemprop = $this
    ->randomName();
  $new_summary_itemprop = $this
    ->randomName();
  $this
    ->drupalGet($path);
  $this
    ->assertTrue($this
    ->xpath("//input[@name='{$fullbody_formfield_name}' and @value='{$fullbody_itemprop}']"), 'Existing mapping value displayed for full body.');
  $this
    ->assertTrue($this
    ->xpath("//input[@name='{$summary_formfield_name}' and @value='{$summary_itemprop}']"), 'Existing mapping value displayed for body summary.');
  $edit = array(
    $fullbody_formfield_name => $new_fullbody_itemprop,
    $summary_formfield_name => $new_summary_itemprop,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save settings'));
  $this
    ->drupalGet($path);
  $this
    ->assertTrue($this
    ->xpath("//input[@name='{$fullbody_formfield_name}' and @value='{$new_fullbody_itemprop}']"), 'Changing full body itemprop via UI works.');
  $this
    ->assertTrue($this
    ->xpath("//input[@name='{$summary_formfield_name}' and @value='{$new_summary_itemprop}']"), 'Changing body summary itemprop via UI works.');
}