LearningPathWebDriverTestBase.php in Opigno Learning path 3.x
File
tests/src/FunctionalJavascript/LearningPathWebDriverTestBase.php
View source
<?php
namespace Drupal\Tests\opigno_learning_path\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\opigno_learning_path\Functional\TrainingContentTrait;
abstract class LearningPathWebDriverTestBase extends WebDriverTestBase {
use TrainingContentTrait;
public static $modules = [
'opigno_learning_path',
'opigno_catalog',
'field_group',
'block',
'user',
];
protected $entityTypeManager;
protected $groupCreator;
protected $accountSwitcher;
protected $defaultTheme = 'stable';
protected function setUp() {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this->accountSwitcher = $this->container
->get('account_switcher');
$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);
}
protected function getGlobalPermissions() {
return [
'view the administration theme',
'access administration pages',
'create learning_path group',
];
}
}