You are here

public function RngRegistrationAccessTest::testRegisterSelfNoPermission in RNG - Events and Registrations 8.2

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

Test register self no permission.

File

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

Class

RngRegistrationAccessTest
Tests ability to register for events..

Namespace

Drupal\Tests\rng\Kernel

Code

public function testRegisterSelfNoPermission() {
  $event_meta = $this
    ->createEvent();

  // Need to create a dummy role otherwise 'authenticated' is used.
  $role1 = $this
    ->createRole([]);
  $user1 = $this
    ->drupalCreateUser();
  $this
    ->setCurrentUser($user1);
  $this
    ->createUserRoleRules([
    $role1 => $role1,
  ], [
    'create' => TRUE,
  ]);
  $this
    ->assertFalse($event_meta
    ->identitiesCanRegister('user', [
    $user1
      ->id(),
  ]));
}