You are here

protected function TestSocialSimpleTestBase::setUp in Social simple 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/TestSocialSimpleTestBase.php \Drupal\Tests\social_simple\Functional\TestSocialSimpleTestBase::setUp()

Overrides BrowserTestBase::setUp

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

File

tests/src/Functional/TestSocialSimpleTestBase.php, line 105

Class

TestSocialSimpleTestBase
Provides common helper methods for Social simple module tests.

Namespace

Drupal\Tests\social_simple\Functional

Code

protected function setUp() {
  parent::setUp();

  // Create vocabulary and terms.
  $this->vocabulary = $this
    ->createVocabulary();
  $this->term1 = $this
    ->createTerm($this->vocabulary);
  $this->term2 = $this
    ->createTerm($this->vocabulary);
  if ($this->profile != 'standard') {
    $this
      ->createContentType([
      'type' => 'article',
      'name' => 'Article',
    ]);
    $field_name = 'field_tags';
    $handler_settings = [
      'target_bundles' => [
        $this->vocabulary
          ->id() => $this->vocabulary
          ->id(),
      ],
      'auto_create' => TRUE,
    ];
    $this
      ->createEntityReferenceField('node', 'article', $field_name, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
    $this
      ->setComponentFormDisplay('node.article.default', 'node', 'article', $field_name, 'entity_reference_autocomplete', []);
  }
  $title = 'Article1';
  $values = [
    'type' => 'article',
    'title' => $title,
    'body' => [
      'value' => 'Content body for ' . $title,
    ],
  ];
  $this->article = $this
    ->createNode($values);
}