You are here

protected function OpignoStatisticsBrowserTestBase::setUp in Opigno statistics 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/OpignoStatisticsBrowserTestBase.php \Drupal\Tests\opigno_statistics\Functional\OpignoStatisticsBrowserTestBase::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/OpignoStatisticsBrowserTestBase.php, line 47

Class

OpignoStatisticsBrowserTestBase
Provides a base class for Opigno Statistics tests.

Namespace

Drupal\Tests\opigno_statistics\Functional

Code

protected function setUp() {
  parent::setUp();
  $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();
  }
  $this->groupCreator = $this
    ->drupalCreateUser($this
    ->getGlobalPermissions());
  $this
    ->drupalLogin($this->groupCreator);
}