You are here

public function RngRegistrationAccessTest::testRegisterSelfWithDuplicates in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/RngRegistrationAccessTest.php \Drupal\Tests\rng\Kernel\RngRegistrationAccessTest::testRegisterSelfWithDuplicates()
  2. 3.x tests/src/Kernel/RngRegistrationAccessTest.php \Drupal\Tests\rng\Kernel\RngRegistrationAccessTest::testRegisterSelfWithDuplicates()

Test register self duplicates allowed

File

tests/src/Kernel/RngRegistrationAccessTest.php, line 136

Class

RngRegistrationAccessTest
Tests ability to register for events..

Namespace

Drupal\Tests\rng\Kernel

Code

public function testRegisterSelfWithDuplicates() {
  $event_meta = $this
    ->createEvent([
    EventManagerInterface::FIELD_ALLOW_DUPLICATE_REGISTRANTS => 1,
  ]);
  $this
    ->createUserRoleRules([], [
    'create' => TRUE,
  ]);
  $user1 = $this
    ->drupalCreateUser([
    'rng register self',
  ]);
  $this
    ->setCurrentUser($user1);
  $this
    ->assertTrue($event_meta
    ->identitiesCanRegister('user', [
    $user1
      ->id(),
  ]));
  $this
    ->createRegistration($event_meta
    ->getEvent(), $this->registrationType, [
    $user1,
  ]);
  $this
    ->assertTrue($event_meta
    ->identitiesCanRegister('user', [
    $user1
      ->id(),
  ]));
}