private function TrainingContentTrait::createActivities in Opigno Learning path 8
Same name and namespace in other branches
- 3.x tests/src/Functional/TrainingContentTrait.php \Drupal\Tests\opigno_learning_path\Functional\TrainingContentTrait::createActivities()
Create a list of activities.
Parameters
array $values: Array values.
int $number: Number of activities to be generated.
Return value
array An array of activities objects.
Throws
\Drupal\Core\Entity\EntityStorageException
1 call to TrainingContentTrait::createActivities()
- TrainingContentTrait::createOpignoModule in tests/
src/ Functional/ TrainingContentTrait.php - Create module with activities.
File
- tests/
src/ Functional/ TrainingContentTrait.php, line 134
Class
- TrainingContentTrait
- Trait TrainingContentTrait.
Namespace
Drupal\Tests\opigno_learning_path\FunctionalCode
private function createActivities(array $values, $number = 1) {
$activities = [];
// Long answer activity type considered as default.
for ($i = 0; $i < $number; $i++) {
$activity = OpignoActivity::create($values + [
'label' => $this
->randomString(),
]);
$activity
->save();
$activities[] = $activity;
}
return $activities;
}