You are here

protected function FeedsParaMapperTestBase::setUp in Feeds Paragraphs 8

Overrides BrowserTestBase::setUp

1 call to FeedsParaMapperTestBase::setUp()
ImportingTest::setUp in tests/src/Functional/ImportingTest.php
1 method overrides FeedsParaMapperTestBase::setUp()
ImportingTest::setUp in tests/src/Functional/ImportingTest.php

File

tests/src/Functional/FeedsParaMapperTestBase.php, line 46

Class

FeedsParaMapperTestBase
Test basic functionality via BrowserTestBase. @todo: tests are failing because some dependencies modules use PrivateTempStore, see https://www.drupal.org/project/feeds/issues/3012342 @todo: for now we applied the patch in the issue, waiting for module…

Namespace

Drupal\Tests\feeds_para_mapper\Functional

Code

protected 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];
  }
  $permissions = array(
    'bypass node access',
    'administer nodes',
    'administer feeds',
    'administer feeds_feed fields',
    'administer content types',
    'administer paragraphs types',
    'administer paragraph fields',
    'administer node fields',
  );

  // If we are testing multi valued fields, load Feeds Tamper module:
  if ($this->multiValued || $this->multiValuedParagraph) {
    self::$modules[] = "feeds_tamper";
    self::$modules[] = "feeds_tamper_ui";
    $permissions[] = "administer feeds_tamper";
  }
  parent::setUp();
  $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
    ->createCT($this->contentType, $this->paragraphField, $last_bundle);
  $this->feedType = "product_feed";
  $this
    ->createFeedType($this->contentType, $this->feedType);
}