protected function RngTestTrait::createRegistration in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Tests/RngTestTrait.php \Drupal\rng\Tests\RngTestTrait::createRegistration()
- 3.x src/Tests/RngTestTrait.php \Drupal\rng\Tests\RngTestTrait::createRegistration()
Create a registration and add an identity as a registrant.
Parameters
\Drupal\Core\Entity\EntityInterface $event: An event entity
\Drupal\rng\RegistrationTypeInterface $registration_type: A registration type.
\Drupal\Core\Entity\EntityInterface[] $identities: An array of identities.
Return value
\Drupal\rng\RegistrationInterface A saved registration
2 calls to RngTestTrait::createRegistration()
- RngRegistrationAccessTest::testRegisterSelfNoDuplicates in tests/
src/ Kernel/ RngRegistrationAccessTest.php - Test register self no duplicates.
- RngRegistrationAccessTest::testRegisterSelfWithDuplicates in tests/
src/ Kernel/ RngRegistrationAccessTest.php - Test register self duplicates allowed
1 method overrides RngTestTrait::createRegistration()
- RngWebTestBase::createRegistration in src/
Tests/ RngWebTestBase.php - Creates and saves a registration entity.
File
- src/
Tests/ RngTestTrait.php, line 86
Class
Namespace
Drupal\rng\TestsCode
protected function createRegistration(EntityInterface $event, RegistrationTypeInterface $registration_type, array $identities) {
$registration = Registration::create([
'type' => $registration_type
->id(),
]);
foreach ($identities as $identity) {
$registration
->addIdentity($identity);
}
$registration
->setEvent($event)
->save();
return $registration;
}