Updating
This commit is contained in:
parent
3acc478143
commit
d12f2f2336
|
|
@ -27,6 +27,7 @@ class InvoiceDataServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
if (auditionSetting('fee_structure')) {
|
||||
$this->app->singleton(InvoiceDataService::class, function ($app) {
|
||||
return match (auditionSetting('fee_structure')) {
|
||||
'oneFeePerEntry' => new InvoiceOneFeePerEntry($app->make(EntryService::class)),
|
||||
|
|
@ -36,3 +37,4 @@ class InvoiceDataServiceProvider extends ServiceProvider
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ class UserFactory extends Factory
|
|||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$judingPrefPossibilities = ['woodwinds','flute','clarinet','saxophones', 'low clarinets','oboe','bassoon','double reeds','brass','low brass','trumpet','trombone','horn','tuba','euphonium','percussion'];
|
||||
$judingPrefPossibilities = [
|
||||
'woodwinds', 'flute', 'clarinet', 'saxophones', 'low clarinets', 'oboe', 'bassoon', 'double reeds', 'brass',
|
||||
'low brass', 'trumpet', 'trombone', 'horn', 'tuba', 'euphonium', 'percussion',
|
||||
];
|
||||
|
||||
return [
|
||||
'first_name' => fake()->firstName(),
|
||||
'last_name' => fake()->lastName(),
|
||||
|
|
@ -46,4 +50,18 @@ class UserFactory extends Factory
|
|||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function admin(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_admin' => 1,
|
||||
]);
|
||||
}
|
||||
|
||||
public function tab(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_tab' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
use function Pest\Laravel\get;
|
||||
|
|
@ -16,7 +17,7 @@ it('shows appropriate screens when not logged in', function () {
|
|||
]);
|
||||
});
|
||||
|
||||
it('shows a registration page', function () {
|
||||
it('shows a registration page only if not logged in', function () {
|
||||
// Act & Assert
|
||||
get('/register')
|
||||
->assertStatus(200)
|
||||
|
|
@ -24,13 +25,35 @@ it('shows a registration page', function () {
|
|||
'Registration Code',
|
||||
'Email address',
|
||||
]);
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
get('/register')
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('dashboard'));
|
||||
});
|
||||
|
||||
it('shows a login page', function () {
|
||||
it('shows a login page only if not logged in', function () {
|
||||
get('/login')
|
||||
->assertStatus(200)
|
||||
->assertSeeText([
|
||||
'Log In',
|
||||
'Click here to register',
|
||||
]);
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
get('/register')
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('dashboard'));
|
||||
});
|
||||
|
||||
it('shows dashboard only if logged in', function () {
|
||||
get(route('dashboard'))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('home'));
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
get(route('dashboard'))
|
||||
->assertStatus(200)
|
||||
->assertSeeText('My School')
|
||||
->assertSeeText('Dashboard');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue