You are here

public function FileFieldPathsPathautoCase::testUI in File (Field) Paths 7

Test File (Field) Paths Pathauto UI.

File

tests/pathauto.test, line 34
Pathauto module tests for the File (Field) Paths module.

Class

FileFieldPathsPathautoCase
Class FileFieldPathsPathautoCase

Code

public function testUI() {

  // Create a File field.
  $field_name = drupal_strtolower($this
    ->randomName());
  $this
    ->createFileField($field_name, $this->content_type);

  // Ensure File (Field) Paths Pathauto settings are present and available.
  $this
    ->drupalGet("admin/structure/types/manage/{$this->content_type}/fields/{$field_name}");
  foreach (array(
    'path',
    'name',
  ) as $field) {
    $this
      ->assertField("instance[settings][filefield_paths][file_{$field}][options][pathauto]", t('Pathauto checkbox is present in File @field settings.', array(
      '@field' => drupal_ucfirst($field),
    )));
    $element = $this
      ->xpath('//input[@name=:name]/@disabled', array(
      ':name' => "instance[settings][filefield_paths][file_{$field}][options][pathauto]",
    ));
    $this
      ->assert(empty($element), t('Pathauto checkbox is not disabled in File @field settings.', array(
      '@field' => drupal_ucfirst($field),
    )));
  }
}