You are here

protected function TrainingContentTrait::addModuleToTraining in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/TrainingContentTrait.php \Drupal\Tests\opigno_learning_path\Functional\TrainingContentTrait::addModuleToTraining()

Add Module to a Training.

Parameters

\Drupal\group\Entity\Group $training: Group.

\Drupal\opigno_module\Entity\OpignoModule $module: Module.

int $is_mandatory: Content is required.

Return value

\Drupal\group\Entity\Group The training with contents.

5 calls to TrainingContentTrait::addModuleToTraining()
OpignoLinkConditionTest::testLinkCondition in tests/src/Functional/OpignoLinkConditionTest.php
Test.
OpignoModuleScoreTest::testModuleScoreDisplay in tests/src/Functional/OpignoModuleScoreTest.php
Test Opigno Module score on different pages (achievements, statistics etc).
TrainingCompleteTest::testTrainingComplete in tests/src/Functional/TrainingCompleteTest.php
Tests training visibility for users.
TrainingEditInterfaceAccessTest::testAccessEditPageTraining in tests/src/Functional/TrainingEditInterfaceAccessTest.php
Tests which users can subscribe and start a training.
TrainingEditInterfaceTest::testTrainingInterfaceAccess in tests/src/FunctionalJavascript/TrainingEditInterfaceTest.php
Tests Training Interface Access.

File

tests/src/Functional/TrainingContentTrait.php, line 58

Class

TrainingContentTrait
Trait TrainingContentTrait.

Namespace

Drupal\Tests\opigno_learning_path\Functional

Code

protected function addModuleToTraining(Group $training, OpignoModule $module, $is_mandatory = 1) {

  // Add module as a content to a training.
  $training = $this
    ->createContentForTraining($module, 'ContentTypeModule', $training, $is_mandatory);
  return $training;
}