You are here

protected function OpignoClassMembershipTest::setUp in Opigno class 3.x

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

Overrides BrowserTestBase::setUp

File

tests/src/Functional/OpignoClassMembershipTest.php, line 62

Class

OpignoClassMembershipTest
Tests Opigno Class membership.

Namespace

Drupal\Tests\opigno_class\Functional

Code

protected function setUp() {
  parent::setUp();
  \Drupal::service('module_installer')
    ->install([
    'opigno_learning_path',
  ]);
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->accountSwitcher = $this->container
    ->get('account_switcher');

  /* @var $entityFieldManager Drupal\Core\Entity\EntityFieldManager */
  $entityFieldManager = \Drupal::service('entity_field.manager');
  $fields = $entityFieldManager
    ->getFieldDefinitions('group', 'learning_path');
  if (isset($fields['field_learning_path_media_image'])) {
    $fields['field_learning_path_media_image']
      ->delete();
  }

  // Create logged administrator user.
  $this->user = $this
    ->drupalCreateUser([
    'administer site configuration',
  ]);
  $this
    ->drupalLogin($this->user);
}