You are here

protected function SettingsTest::setUp in Acquia Lift Connector 8.4

Overrides BrowserTestBase::setUp

File

tests/src/Functional/SettingsTest.php, line 36

Class

SettingsTest
Test Acquia Lift Settings.

Namespace

Drupal\Tests\acquia_lift\Functional

Code

protected function setUp() {
  parent::setUp();
  $permissions = [
    'access administration pages',
    'administer acquia lift',
    'administer content types',
    'administer modules',
    'administer site configuration',
  ];

  // Create article content type.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);

  // Create a Node.
  $this
    ->drupalCreateNode([
    'nid' => 90210,
    'type' => 'article',
    'body' => [
      [
        'value' => $this
          ->randomMachineName(32),
        'format' => 'full_html',
      ],
    ],
  ]);

  // Create two vocabularies.
  $vocabulary1 = $this
    ->createVocabulary();
  $vocabulary2 = $this
    ->createVocabulary();
  $term_v1_t1 = $this
    ->createTerm($vocabulary1);
  $term_v1_t2 = $this
    ->createTerm($vocabulary1);
  $term_v2_t1 = $this
    ->createTerm($vocabulary2);
  $term_v2_t2 = $this
    ->createTerm($vocabulary2);
  $term_v2_t3 = $this
    ->createTerm($vocabulary2);
  $field_country = $this
    ->createFieldWithStorage('field_country', 'node', 'article', [
    $vocabulary1
      ->id() => $vocabulary1
      ->id(),
  ], [
    'target_type' => 'taxonomy_term',
  ], 'entity_reference');
  $field_people = $this
    ->createFieldWithStorage('field_people', 'node', 'article', [
    $vocabulary2
      ->id() => $vocabulary2
      ->id(),
  ], [
    'target_type' => 'taxonomy_term',
  ], 'entity_reference');
  $field_tags = $this
    ->createFieldWithStorage('field_tags', 'node', 'article', [
    $vocabulary2
      ->id() => $vocabulary2
      ->id(),
  ], [
    'target_type' => 'taxonomy_term',
  ], 'entity_reference');

  // User to set up acquia_lift.
  $this->admin_user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($this->admin_user);
}