You are here

public function FeedsParaMapperWebTestCase::setUp in Feeds Paragraphs 7

Prepares the test environment.

Overrides DrupalWebTestCase::setUp

5 calls to FeedsParaMapperWebTestCase::setUp()
FeedsParaMapperMultiValuedImportingTestCase::setUp in tests/importing.test
Prepares the test environment.
FeedsParaMapperMultiValuedMappingTestCase::setUp in tests/mapping.test
Prepares the test environment.
FeedsParaMapperNestedImportTestCase::setUp in tests/importing.test
Prepares the test environment.
FeedsParaMapperNestedMappingTestCase::setUp in tests/mapping.test
Prepares the test environment.
FeedsParaMapperUpdatingTestCase::setUp in tests/importing.test
Prepares the test environment.
5 methods override FeedsParaMapperWebTestCase::setUp()
FeedsParaMapperMultiValuedImportingTestCase::setUp in tests/importing.test
Prepares the test environment.
FeedsParaMapperMultiValuedMappingTestCase::setUp in tests/mapping.test
Prepares the test environment.
FeedsParaMapperNestedImportTestCase::setUp in tests/importing.test
Prepares the test environment.
FeedsParaMapperNestedMappingTestCase::setUp in tests/mapping.test
Prepares the test environment.
FeedsParaMapperUpdatingTestCase::setUp in tests/importing.test
Prepares the test environment.

File

tests/FeedsParaMapperWebTestCase.test, line 26
Common functionality for all Paragraphs Mapper tests.

Class

FeedsParaMapperWebTestCase
Test basic functionality via DrupalWebTestCase.

Code

public function setUp() {
  $args = func_get_args();
  if (isset($args[0])) {
    $this->multiValued = $args[0];
  }
  if (isset($args[1])) {
    $this->multiValuedParagraph = $args[1];
  }
  if (isset($args[2])) {
    $this->nested = $args[2];
  }
  $modules = array(
    'field',
    'field_ui',
    'image',
    'paragraphs',
    'feeds',
    'feeds_ui',
    'feeds_para_mapper',
  );
  $permissions = array(
    'bypass node access',
    'administer nodes',
    'administer feeds',
    'administer content types',
    'administer fields',
    'administer paragraphs bundles',
  );

  // If we are testing multi valued fields, load Feeds Tamper module:
  if ($this->multiValued || $this->multiValuedParagraph) {
    $modules[] = "feeds_tamper";
    $modules[] = "feeds_tamper_ui";
    $permissions[] = "administer feeds_tamper";
  }
  parent::setUp($modules);
  $this->webUser = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($this->webUser);

  // Create paragraphs bundles:
  $this
    ->createBundles();

  // Create a content type with a paragraph field:
  $this->contentType = "product";
  $this->paragraphField = "details";
  $last_key = count($this->bundles) - 1;
  $last_bundle = array(
    $this->bundles[$last_key]['name'],
  );
  $this
    ->createContentType($this->contentType, $this->paragraphField, $last_bundle);

  // Create importer for the content type:
  $this->importer = "product";
  $this
    ->addImporter($this->importer, $this->contentType);
  if ($this->nested) {
    $this
      ->isNestedCorrectly();
  }

  // Make sure that all assets files exist:
  $this
    ->assetsFilesExist();

  // Copy the image to the public path:
  $this
    ->copyFile('/tests/assets/image.png', 'public://image.png');
}