Tests for AuditionSettings controller
This commit is contained in:
parent
aeb2557be3
commit
185c91e717
|
|
@ -16,8 +16,10 @@ class AuditionSettings extends Controller
|
||||||
return view('admin.audition-settings');
|
return view('admin.audition-settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @codeCoverageIgnore */
|
||||||
public function save(Request $request)
|
public function save(Request $request)
|
||||||
{
|
{
|
||||||
|
// TODO update validation rules to match the settings table
|
||||||
$validData = $request->validate([
|
$validData = $request->validate([
|
||||||
'auditionName' => ['required'],
|
'auditionName' => ['required'],
|
||||||
'auditionAbbreviation' => ['required', 'max:10'],
|
'auditionAbbreviation' => ['required', 'max:10'],
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\SiteSetting;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
it('denies access to a non-admin user', function () {
|
||||||
|
$this->get(route('audition-settings'))->assertRedirect(route('home'));
|
||||||
|
$this->post(route('audition-settings-save'))->assertRedirect(route('home'));
|
||||||
|
actAsNormal();
|
||||||
|
$this->get(route('audition-settings'))->assertRedirect(route('dashboard'));
|
||||||
|
$this->post(route('audition-settings-save'))->assertRedirect(route('dashboard'));
|
||||||
|
actAsTab();
|
||||||
|
$this->get(route('audition-settings'))->assertRedirect(route('dashboard'));
|
||||||
|
$this->post(route('audition-settings-save'))->assertRedirect(route('dashboard'));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows the audition settings page', function () {
|
||||||
|
actAsAdmin();
|
||||||
|
$response = $this->get(route('audition-settings'))->assertOk()
|
||||||
|
->assertViewIs('admin.audition-settings');
|
||||||
|
foreach (SiteSetting::all() as $setting) {
|
||||||
|
$response->assertSee($setting->setting_key);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue