You are here

protected function OpignoILTBrowserTestBase::setUp in Opigno Instructor-led Trainings 3.x

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

Overrides BrowserTestBase::setUp

File

tests/src/Functional/OpignoILTBrowserTestBase.php, line 49

Class

OpignoILTBrowserTestBase
Provides a base class for Opigno ILT tests.

Namespace

Drupal\Tests\opigno_ilt\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);
}