You are here

public function FppFileAccessTest::addPrivateImageField in Fieldable Panels Panes (FPP) 7

Add an image field to the FPP type that uses the private storage mechanism.

3 calls to FppFileAccessTest::addPrivateImageField()
FppFileAccessTest::testFileAccessWithCorrectAuth in tests/fpp.file_access.test
Confirm private file access works when the visitor DOES have access.
FppFileAccessTest::testFileAccessWithIncorrectAuth in tests/fpp.file_access.test
Confirm private file access works when the visitor does NOT have access.
FppFileAccessTest::testFileAccessWithoutAuth in tests/fpp.file_access.test
Confirm that the private file access works when no auth is defined.

File

tests/fpp.file_access.test, line 138
Tests for the Fieldable Panels Panes module to ensure file access works.

Class

FppFileAccessTest
Tests for the Fieldable Panels Panes module to ensure file access works.

Code

public function addPrivateImageField() {
  $this
    ->enablePrivateFileSupport();

  // Add a file field to the default FPP type.
  $this
    ->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/fields');
  $edit = array(
    'fields[_add_new_field][label]' => t('Image'),
    'fields[_add_new_field][field_name]' => 'fpp_image',
    'fields[_add_new_field][type]' => 'image',
    'fields[_add_new_field][widget_type]' => 'image_image',
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Upload destination'));
  $edit = array(
    'field[settings][uri_scheme]' => 'private',
  );
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Updated field @file field settings.', array(
    '@file' => t('Image'),
  )));
}