Rename user sign up to registration
This commit is contained in:
parent
6564056f16
commit
9e3adf6179
|
@ -233,8 +233,8 @@ return [
|
||||||
// Users are able to sign up
|
// Users are able to sign up
|
||||||
'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true),
|
'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true),
|
||||||
|
|
||||||
// Required fields on sign-up page
|
// Required user fields
|
||||||
'signup_required_fields' => [
|
'required_user_fields' => [
|
||||||
'pronoun' => (bool) env('PRONOUN_REQUIRED', false),
|
'pronoun' => (bool) env('PRONOUN_REQUIRED', false),
|
||||||
'firstname' => (bool) env('FIRSTNAME_REQUIRED', false),
|
'firstname' => (bool) env('FIRSTNAME_REQUIRED', false),
|
||||||
'lastname' => (bool) env('LASTNAME_REQUIRED', false),
|
'lastname' => (bool) env('LASTNAME_REQUIRED', false),
|
||||||
|
|
|
@ -8,8 +8,8 @@ use FastRoute\RouteCollector;
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
$route->get('/', 'HomeController@index');
|
$route->get('/', 'HomeController@index');
|
||||||
$route->get('/register', 'SignUpController@view');
|
$route->get('/register', 'RegistrationController@view');
|
||||||
$route->post('/register', 'SignUpController@save');
|
$route->post('/register', 'RegistrationController@save');
|
||||||
$route->get('/credits', 'CreditsController@index');
|
$route->get('/credits', 'CreditsController@index');
|
||||||
$route->get('/health', 'HealthController@index');
|
$route->get('/health', 'HealthController@index');
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ function Users_view(
|
||||||
unset($user_table_headers[$key]);
|
unset($user_table_headers[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = button(url('register'), icon('plus-lg'), 'add');
|
$link = button(url('/register'), icon('plus-lg'), 'add');
|
||||||
return page_with_title(__('All users') . ' ' . $link, [
|
return page_with_title(__('All users') . ' ' . $link, [
|
||||||
msg(),
|
msg(),
|
||||||
table($user_table_headers, $usersList),
|
table($user_table_headers, $usersList),
|
||||||
|
@ -954,7 +954,7 @@ function render_user_tshirt_hint()
|
||||||
$goodie_tshirt = $goodie === GoodieType::Tshirt;
|
$goodie_tshirt = $goodie === GoodieType::Tshirt;
|
||||||
if (
|
if (
|
||||||
$goodie_tshirt
|
$goodie_tshirt
|
||||||
&& config('signup_required_fields')['tshirt_size']
|
&& config('required_user_fields')['tshirt_size']
|
||||||
&& !auth()->user()->personalData->shirt_size
|
&& !auth()->user()->personalData->shirt_size
|
||||||
) {
|
) {
|
||||||
$text = __('You need to specify a tshirt size in your settings!');
|
$text = __('You need to specify a tshirt size in your settings!');
|
||||||
|
|
|
@ -274,3 +274,9 @@ msgstr "Ort erfolgreich gelöscht."
|
||||||
|
|
||||||
msgid "validation.name.exists"
|
msgid "validation.name.exists"
|
||||||
msgstr "Der Name wird bereits verwendet."
|
msgstr "Der Name wird bereits verwendet."
|
||||||
|
|
||||||
|
msgid "registration.disabled"
|
||||||
|
msgstr "Die Registrierung ist deaktiviert."
|
||||||
|
|
||||||
|
msgid "registration.successful"
|
||||||
|
msgstr "Registrierung erfolgreich. Du kannst dich jetzt anmelden!"
|
||||||
|
|
|
@ -1988,23 +1988,17 @@ msgstr "Tag %1$d"
|
||||||
msgid "dashboard.day"
|
msgid "dashboard.day"
|
||||||
msgstr "Tag"
|
msgstr "Tag"
|
||||||
|
|
||||||
msgid "page.sign-up.title"
|
msgid "registration.title"
|
||||||
msgstr "Engelregistrierung"
|
msgstr "Engel-Registrierung"
|
||||||
|
|
||||||
msgid "page.sign-up.login-data"
|
msgid "registration.login_data"
|
||||||
msgstr "Anmeldedaten"
|
msgstr "Anmeldedaten"
|
||||||
|
|
||||||
msgid "page.sign-up.event-data"
|
msgid "registration.event_data"
|
||||||
msgstr "Eventdaten"
|
msgstr "Eventdaten"
|
||||||
|
|
||||||
msgid "page.sign-up.what-do-you-want-to-do"
|
msgid "registration.what_todo"
|
||||||
msgstr "Was möchtest Du machen?"
|
msgstr "Was möchtest Du machen?"
|
||||||
|
|
||||||
msgid "page.sign-up.sign-up"
|
msgid "registration.register"
|
||||||
msgstr "Registrieren"
|
msgstr "Registrieren"
|
||||||
|
|
||||||
msgid "pages.sign-up.disabled"
|
|
||||||
msgstr "Die Engelregistrierung ist deaktiviert"
|
|
||||||
|
|
||||||
msgid "pages.sign-up.successful"
|
|
||||||
msgstr "Engelregistrierung erfolgreich! Du kannst dich jetzt anmelden!"
|
|
||||||
|
|
|
@ -273,3 +273,9 @@ msgstr "Location successfully deleted."
|
||||||
|
|
||||||
msgid "validation.name.exists"
|
msgid "validation.name.exists"
|
||||||
msgstr "The name is already used."
|
msgstr "The name is already used."
|
||||||
|
|
||||||
|
msgid "registration.disabled"
|
||||||
|
msgstr "The registration is disabled."
|
||||||
|
|
||||||
|
msgid "registration.successful"
|
||||||
|
msgstr "Registration successful. You can now log in!"
|
||||||
|
|
|
@ -576,23 +576,17 @@ msgstr "Day %1$d"
|
||||||
msgid "dashboard.day"
|
msgid "dashboard.day"
|
||||||
msgstr "Day"
|
msgstr "Day"
|
||||||
|
|
||||||
msgid "page.sign-up.title"
|
msgid "registration.title"
|
||||||
msgstr "Angel registration"
|
msgstr "Angel registration"
|
||||||
|
|
||||||
msgid "page.sign-up.login-data"
|
msgid "registration.login_data"
|
||||||
msgstr "Login data"
|
msgstr "Login data"
|
||||||
|
|
||||||
msgid "page.sign-up.event-data"
|
msgid "registration.event_data"
|
||||||
msgstr "Event data"
|
msgstr "Event data"
|
||||||
|
|
||||||
msgid "page.sign-up.what-do-you-want-to-do"
|
msgid "registration.what_todo"
|
||||||
msgstr "What do you want to do?"
|
msgstr "What do you want to do?"
|
||||||
|
|
||||||
msgid "page.sign-up.sign-up"
|
msgid "registration.register"
|
||||||
msgstr "Register"
|
msgstr "Register"
|
||||||
|
|
||||||
msgid "pages.sign-up.disabled"
|
|
||||||
msgstr "The angel registration is disabled"
|
|
||||||
|
|
||||||
msgid "pages.sign-up.successful"
|
|
||||||
msgstr "Angel registration success. You can now log in."
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% import 'macros/base.twig' as m %}
|
{% import 'macros/base.twig' as m %}
|
||||||
{% import 'macros/form.twig' as f %}
|
{% import 'macros/form.twig' as f %}
|
||||||
|
|
||||||
{% block title %}{{ __('page.sign-up.title') }}{% endblock %}
|
{% block title %}{{ __('registration.title') }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm')
|
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm')
|
||||||
: ''
|
: ''
|
||||||
}}
|
}}
|
||||||
{{ __('page.sign-up.title') }}
|
{{ __('registration.title') }}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h2>{{ __('page.sign-up.login-data') }}</h2>
|
<h2>{{ __('registration.login_data') }}</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if isPronounEnabled %}
|
{% if isPronounEnabled %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h2>{{ __('page.sign-up.event-data') }}</h2>
|
<h2>{{ __('registration.event_data') }}</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if isGoodieEnabled %}
|
{% if isGoodieEnabled %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -284,7 +284,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h2>{{ __('page.sign-up.what-do-you-want-to-do') }}</h2>
|
<h2>{{ __('registration.what_todo') }}</h2>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{% for angelType in angelTypes %}
|
{% for angelType in angelTypes %}
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 col-xl-2">
|
<div class="col-sm-6 col-md-4 col-lg-3 col-xl-2">
|
||||||
|
@ -318,7 +318,7 @@
|
||||||
By assigning a name here, some magic™ will create a session var
|
By assigning a name here, some magic™ will create a session var
|
||||||
"form-data-register-submit" with the value 1 on submit.
|
"form-data-register-submit" with the value 1 on submit.
|
||||||
#}
|
#}
|
||||||
{{ f.submit(__('page.sign-up.sign-up'), {
|
{{ f.submit(__('registration.register'), {
|
||||||
'name': 'register-submit',
|
'name': 'register-submit',
|
||||||
}) }}
|
}) }}
|
||||||
</form>
|
</form>
|
|
@ -15,7 +15,7 @@ use Engelsystem\Http\Response;
|
||||||
use Engelsystem\Models\AngelType;
|
use Engelsystem\Models\AngelType;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
|
|
||||||
class SignUpController extends BaseController
|
class RegistrationController extends BaseController
|
||||||
{
|
{
|
||||||
use HasUserNotifications;
|
use HasUserNotifications;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class SignUpController extends BaseController
|
||||||
$rawData = $request->getParsedBody();
|
$rawData = $request->getParsedBody();
|
||||||
$user = $this->userFactory->createFromData($rawData);
|
$user = $this->userFactory->createFromData($rawData);
|
||||||
|
|
||||||
$this->addNotification('pages.sign-up.successful');
|
$this->addNotification('registration.successful');
|
||||||
|
|
||||||
if ($this->config->get('welcome_msg')) {
|
if ($this->config->get('welcome_msg')) {
|
||||||
// Set a session marker to display the welcome message on the next page
|
// Set a session marker to display the welcome message on the next page
|
||||||
|
@ -71,7 +71,7 @@ class SignUpController extends BaseController
|
||||||
|
|
||||||
private function notifySignUpDisabledAndRedirectToHome(): Response
|
private function notifySignUpDisabledAndRedirectToHome(): Response
|
||||||
{
|
{
|
||||||
$this->addNotification('pages.sign-up.disabled', NotificationType::INFORMATION);
|
$this->addNotification('registration.disabled', NotificationType::INFORMATION);
|
||||||
return $this->redirect->to('/');
|
return $this->redirect->to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class SignUpController extends BaseController
|
||||||
{
|
{
|
||||||
$goodieType = GoodieType::from($this->config->get('goodie_type'));
|
$goodieType = GoodieType::from($this->config->get('goodie_type'));
|
||||||
$preselectedAngelTypes = $this->determinePreselectedAngelTypes();
|
$preselectedAngelTypes = $this->determinePreselectedAngelTypes();
|
||||||
$requiredFields = $this->config->get('signup_required_fields');
|
$requiredFields = $this->config->get('required_user_fields');
|
||||||
|
|
||||||
// form-data-register-submit is a marker, that the form was submitted.
|
// form-data-register-submit is a marker, that the form was submitted.
|
||||||
// It will be used for instance to use the default angel types or the user selected ones.
|
// It will be used for instance to use the default angel types or the user selected ones.
|
||||||
|
@ -87,7 +87,7 @@ class SignUpController extends BaseController
|
||||||
$this->session->remove('form-data-register-submit');
|
$this->session->remove('form-data-register-submit');
|
||||||
|
|
||||||
return $this->response->withView(
|
return $this->response->withView(
|
||||||
'pages/sign-up',
|
'pages/registration',
|
||||||
[
|
[
|
||||||
'tShirtSizes' => $this->config->get('tshirt_sizes'),
|
'tShirtSizes' => $this->config->get('tshirt_sizes'),
|
||||||
'angelTypes' => AngelType::whereHideRegister(false)->get(),
|
'angelTypes' => AngelType::whereHideRegister(false)->get(),
|
|
@ -35,7 +35,7 @@ class SettingsController extends BaseController
|
||||||
public function profile(): Response
|
public function profile(): Response
|
||||||
{
|
{
|
||||||
$user = $this->auth->user();
|
$user = $this->auth->user();
|
||||||
$requiredFields = $this->config->get('signup_required_fields');
|
$requiredFields = $this->config->get('required_user_fields');
|
||||||
|
|
||||||
return $this->response->withView(
|
return $this->response->withView(
|
||||||
'pages/settings/profile',
|
'pages/settings/profile',
|
||||||
|
@ -368,7 +368,7 @@ class SettingsController extends BaseController
|
||||||
|
|
||||||
private function isRequired(string $key): string
|
private function isRequired(string $key): string
|
||||||
{
|
{
|
||||||
$requiredFields = $this->config->get('signup_required_fields');
|
$requiredFields = $this->config->get('required_user_fields');
|
||||||
return $requiredFields[$key] ? 'required' : 'optional';
|
return $requiredFields[$key] ? 'required' : 'optional';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class User
|
||||||
* Takes some arbitrary data, validates it and tries to create a user from it.
|
* Takes some arbitrary data, validates it and tries to create a user from it.
|
||||||
*
|
*
|
||||||
* @param Array<string, mixed> $rawData Raw data from which a user should be created
|
* @param Array<string, mixed> $rawData Raw data from which a user should be created
|
||||||
* @return The user if successful
|
* @return EngelsystemUser The user if successful
|
||||||
* @throws
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function createFromData(array $rawData): EngelsystemUser
|
public function createFromData(array $rawData): EngelsystemUser
|
||||||
|
@ -69,7 +69,7 @@ class User
|
||||||
|
|
||||||
private function isRequired(string $key): string
|
private function isRequired(string $key): string
|
||||||
{
|
{
|
||||||
$requiredFields = $this->config->get('signup_required_fields');
|
$requiredFields = $this->config->get('required_user_fields');
|
||||||
return $requiredFields[$key] ? 'required' : 'optional';
|
return $requiredFields[$key] ? 'required' : 'optional';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Engelsystem\Test\Feature\Controllers;
|
||||||
|
|
||||||
use Engelsystem\Application;
|
use Engelsystem\Application;
|
||||||
use Engelsystem\Config\Config;
|
use Engelsystem\Config\Config;
|
||||||
use Engelsystem\Controllers\SignUpController;
|
use Engelsystem\Controllers\RegistrationController;
|
||||||
use Engelsystem\Events\Listener\OAuth2;
|
use Engelsystem\Events\Listener\OAuth2;
|
||||||
use Engelsystem\Models\AngelType;
|
use Engelsystem\Models\AngelType;
|
||||||
use Engelsystem\Models\BaseModel;
|
use Engelsystem\Models\BaseModel;
|
||||||
|
@ -17,9 +17,9 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group sign-up-controller-tests
|
* @group registration-controller-tests
|
||||||
*/
|
*/
|
||||||
final class SignUpControllerTest extends ApplicationFeatureTest
|
final class RegistrationControllerTest extends ApplicationFeatureTest
|
||||||
{
|
{
|
||||||
private Application $application;
|
private Application $application;
|
||||||
private Config $config;
|
private Config $config;
|
||||||
|
@ -32,7 +32,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
* @var Array<BaseModel>
|
* @var Array<BaseModel>
|
||||||
*/
|
*/
|
||||||
private array $modelsToBeDeleted;
|
private array $modelsToBeDeleted;
|
||||||
private SignUpController $subject;
|
private RegistrationController $subject;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
$this->application->instance(OAuth2::class, $this->oauth);
|
$this->application->instance(OAuth2::class, $this->oauth);
|
||||||
$this->config = $this->application->get(Config::class);
|
$this->config = $this->application->get(Config::class);
|
||||||
$this->session = $this->application->get(SessionInterface::class);
|
$this->session = $this->application->get(SessionInterface::class);
|
||||||
$this->subject = $this->application->make(SignUpController::class);
|
$this->subject = $this->application->make(RegistrationController::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown(): void
|
public function tearDown(): void
|
||||||
|
@ -55,10 +55,10 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the sign-up page with a minimum fields config.
|
* Renders the registration page with a minimum fields config.
|
||||||
* Asserts that the basic fields are there while the other fields are not there.
|
* Asserts that the basic fields are there while the other fields are not there.
|
||||||
*
|
*
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewMinimumConfig(): void
|
public function testViewMinimumConfig(): void
|
||||||
{
|
{
|
||||||
|
@ -87,10 +87,10 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the sign-up page with a maximum fields config.
|
* Renders the registration page with a maximum fields config.
|
||||||
* Asserts that all fields are there.
|
* Asserts that all fields are there.
|
||||||
*
|
*
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewMaximumConfig(): void
|
public function testViewMaximumConfig(): void
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewAngelTypesOAuthPreselection(): void
|
public function testViewAngelTypesOAuthPreselection(): void
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewAngelTypesPreselection(): void
|
public function testViewAngelTypesPreselection(): void
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
/**
|
/**
|
||||||
* Asserts that values are prefilled after submit
|
* Asserts that values are prefilled after submit
|
||||||
*
|
*
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewValuesAfterSubmit(): void
|
public function testViewValuesAfterSubmit(): void
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
|
||||||
* Creates three angel types:
|
* Creates three angel types:
|
||||||
* - unrestricted
|
* - unrestricted
|
||||||
* - restricted
|
* - restricted
|
||||||
* - unrestricted, hidden on sign-up
|
* - unrestricted, hidden on registration
|
||||||
*
|
*
|
||||||
* @return Array<AngelType>
|
* @return Array<AngelType>
|
||||||
*/
|
*/
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Engelsystem\Test\Unit\Controllers;
|
namespace Engelsystem\Test\Unit\Controllers;
|
||||||
|
|
||||||
use Engelsystem\Controllers\SignUpController;
|
use Engelsystem\Controllers\RegistrationController;
|
||||||
use Engelsystem\Factories\User;
|
use Engelsystem\Factories\User;
|
||||||
use Engelsystem\Helpers\Authenticator;
|
use Engelsystem\Helpers\Authenticator;
|
||||||
use Engelsystem\Models\OAuth;
|
use Engelsystem\Models\OAuth;
|
||||||
|
@ -12,9 +12,9 @@ use Engelsystem\Models\User\User as EngelsystemUser;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group sign-up-controller-tests
|
* @group registration-controller-tests
|
||||||
*/
|
*/
|
||||||
final class SignUpControllerTest extends ControllerTest
|
final class RegistrationControllerTest extends ControllerTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Authenticator&MockObject
|
* @var Authenticator&MockObject
|
||||||
|
@ -26,7 +26,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
*/
|
*/
|
||||||
private User $userFactory;
|
private User $userFactory;
|
||||||
|
|
||||||
private SignUpController $subject;
|
private RegistrationController $subject;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
@ -44,11 +44,11 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->config->set('oauth', []);
|
$this->config->set('oauth', []);
|
||||||
$this->app->instance(User::class, $this->userFactory);
|
$this->app->instance(User::class, $this->userFactory);
|
||||||
$this->subject = $this->app->make(SignUpController::class);
|
$this->subject = $this->app->make(RegistrationController::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testSave(): void
|
public function testSave(): void
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
// Assert that the success notification is there
|
// Assert that the success notification is there
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'messages.message' => ['pages.sign-up.successful'],
|
'messages.message' => ['registration.successful'],
|
||||||
],
|
],
|
||||||
$this->session->all()
|
$this->session->all()
|
||||||
);
|
);
|
||||||
|
@ -86,7 +86,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testSaveAlreadyLoggedIn(): void
|
public function testSaveAlreadyLoggedIn(): void
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
// Fake logged in user
|
// Fake logged in user
|
||||||
$this->authenticator->method('user')->willReturn(new EngelsystemUser());
|
$this->authenticator->method('user')->willReturn(new EngelsystemUser());
|
||||||
|
|
||||||
// Assert that the user is redirected to /sign-up again
|
// Assert that the user is redirected to /register again
|
||||||
$this->response
|
$this->response
|
||||||
->expects(self::once())
|
->expects(self::once())
|
||||||
->method('redirectTo')
|
->method('redirectTo')
|
||||||
|
@ -106,7 +106,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testSaveOAuth(): void
|
public function testSaveOAuth(): void
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testSaveWithWelcomeMesssage(): void
|
public function testSaveWithWelcomeMesssage(): void
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testSaveRegistrationDisabled(): void
|
public function testSaveRegistrationDisabled(): void
|
||||||
{
|
{
|
||||||
|
@ -176,14 +176,14 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
// Assert that the error notification is there
|
// Assert that the error notification is there
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'messages.information' => ['pages.sign-up.disabled'],
|
'messages.information' => ['registration.disabled'],
|
||||||
],
|
],
|
||||||
$this->session->all()
|
$this->session->all()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\SignUpController
|
* @covers \Engelsystem\Controllers\RegistrationController
|
||||||
*/
|
*/
|
||||||
public function testViewRegistrationDisabled(): void
|
public function testViewRegistrationDisabled(): void
|
||||||
{
|
{
|
||||||
|
@ -206,7 +206,7 @@ final class SignUpControllerTest extends ControllerTest
|
||||||
// Assert that the error notification is there
|
// Assert that the error notification is there
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'messages.information' => ['pages.sign-up.disabled'],
|
'messages.information' => ['registration.disabled'],
|
||||||
],
|
],
|
||||||
$this->session->all()
|
$this->session->all()
|
||||||
);
|
);
|
|
@ -949,7 +949,7 @@ class SettingsControllerTest extends ControllerTest
|
||||||
'locales' => $languages,
|
'locales' => $languages,
|
||||||
'tshirt_sizes' => $tshirt_sizes,
|
'tshirt_sizes' => $tshirt_sizes,
|
||||||
'goodie_type' => GoodieType::Goodie->value,
|
'goodie_type' => GoodieType::Goodie->value,
|
||||||
'signup_required_fields' => $requiredFields,
|
'required_user_fields' => $requiredFields,
|
||||||
]);
|
]);
|
||||||
$this->app->instance('config', $this->config);
|
$this->app->instance('config', $this->config);
|
||||||
$this->app->instance(Config::class, $this->config);
|
$this->app->instance(Config::class, $this->config);
|
||||||
|
|
|
@ -337,7 +337,7 @@ class UserTest extends ServiceProviderTest
|
||||||
$user->userAngelTypes->contains('name', $angelTypes[0]->name)
|
$user->userAngelTypes->contains('name', $angelTypes[0]->name)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Do not expect an assignment of the angel type hidden on sign-up
|
// Do not expect an assignment of the angel type hidden on registration
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$user->userAngelTypes->contains('name', $angelTypes[1]->name)
|
$user->userAngelTypes->contains('name', $angelTypes[1]->name)
|
||||||
);
|
);
|
||||||
|
@ -461,7 +461,7 @@ class UserTest extends ServiceProviderTest
|
||||||
/**
|
/**
|
||||||
* Creates two AngelTypes:
|
* Creates two AngelTypes:
|
||||||
* 1. Normal angel type
|
* 1. Normal angel type
|
||||||
* 2. Angel type hidden on sign-up
|
* 2. Angel type hidden on registration
|
||||||
*
|
*
|
||||||
* @return Array<AngelType>
|
* @return Array<AngelType>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,7 +35,7 @@ final class SignUpConfig
|
||||||
$config->set('enable_user_name', true);
|
$config->set('enable_user_name', true);
|
||||||
$config->set('enable_mobile_show', true);
|
$config->set('enable_mobile_show', true);
|
||||||
$config->set('enable_dect', true);
|
$config->set('enable_dect', true);
|
||||||
$config->set('signup_required_fields', $requiredFields);
|
$config->set('required_user_fields', $requiredFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setMinimumConfig(Config $config): void
|
public static function setMinimumConfig(Config $config): void
|
||||||
|
@ -48,12 +48,6 @@ final class SignUpConfig
|
||||||
'mobile' => false,
|
'mobile' => false,
|
||||||
'dect' => false,
|
'dect' => false,
|
||||||
];
|
];
|
||||||
$requiredFields['pronoun'] = false;
|
|
||||||
$requiredFields['firstname'] = false;
|
|
||||||
$requiredFields['lastname'] = false;
|
|
||||||
$requiredFields['tshirt_size'] = true;
|
|
||||||
$requiredFields['mobile'] = false;
|
|
||||||
$requiredFields['dect'] = false;
|
|
||||||
$config->set('registration_enabled', true);
|
$config->set('registration_enabled', true);
|
||||||
$config->set('enable_password', true);
|
$config->set('enable_password', true);
|
||||||
$config->set('enable_pronoun', false);
|
$config->set('enable_pronoun', false);
|
||||||
|
@ -66,6 +60,6 @@ final class SignUpConfig
|
||||||
$config->set('enable_user_name', false);
|
$config->set('enable_user_name', false);
|
||||||
$config->set('enable_mobile_show', false);
|
$config->set('enable_mobile_show', false);
|
||||||
$config->set('enable_dect', false);
|
$config->set('enable_dect', false);
|
||||||
$config->set('signup_required_fields', $requiredFields);
|
$config->set('required_user_fields', $requiredFields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue