protected function OpignoILTBrowserTestBase::createGroup in Opigno Instructor-led Trainings 8
Same name and namespace in other branches
- 3.x tests/src/Functional/OpignoILTBrowserTestBase.php \Drupal\Tests\opigno_ilt\Functional\OpignoILTBrowserTestBase::createGroup()
Creates a group.
Parameters
array $values: (optional) The values used to create the entity.
Return value
\Drupal\group\Entity\Group The created group entity.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
1 call to OpignoILTBrowserTestBase::createGroup()
- OpignoILTTest::testOpignoILTAccess in tests/
src/ Functional/ OpignoILTTest.php - Tests ILT access.
File
- tests/
src/ Functional/ OpignoILTBrowserTestBase.php, line 90
Class
- OpignoILTBrowserTestBase
- Provides a base class for Opigno ILT tests.
Namespace
Drupal\Tests\opigno_ilt\FunctionalCode
protected function createGroup(array $values = []) {
/* @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = \Drupal::service('entity_type.manager');
/* @var \Drupal\group\Entity\Group $group */
$group = $entity_type_manager
->getStorage('group')
->create($values + [
'type' => 'learning_path',
'label' => $this
->randomMachineName(),
]);
$group
->enforceIsNew();
$group
->save();
return $group;
}