You are here

protected function LearningPathWebDriverTestBase::setUp in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x tests/src/FunctionalJavascript/LearningPathWebDriverTestBase.php \Drupal\Tests\opigno_learning_path\FunctionalJavascript\LearningPathWebDriverTestBase::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/LearningPathWebDriverTestBase.php, line 50

Class

LearningPathWebDriverTestBase
Provides a base class for Learning path group functional tests.

Namespace

Drupal\Tests\opigno_learning_path\FunctionalJavascript

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);
}