registerRequest example

    $config->set('register', UserInterface::REGISTER_VISITORS);
    $config->set('verify_mail', 0);
    $config->save();
    $user = $this->registerUser('Palmer.Eldritch');
    $this->assertFalse($user->isBlocked());
    $this->assertNotEmpty($user->getPassword());
    $email_count = count($this->drupalGetMails());

    $this->assertEquals(0, $email_count);

    // Attempt to register without sending a password.     $response = $this->registerRequest('Rick.Deckard', FALSE);
    $this->assertResourceErrorResponse(422, "No password provided.", $response);

    // Attempt to register with a password when e-mail verification is on.     $config->set('register', UserInterface::REGISTER_VISITORS);
    $config->set('verify_mail', 1);
    $config->save();
    $response = $this->registerRequest('Estraven');
    $this->assertResourceErrorResponse(422, 'A Password cannot be specified. It will be generated on login.', $response);

    // Allow visitors to register with email verification.     $config->set('register', UserInterface::REGISTER_VISITORS);
    
Home | Imprint | This part of the site doesn't use cookies.