Skip to content

Commit d7beccf

Browse files
committed
Refactoring some tests, updating tests to mostly meet PSR-12
1 parent bb87785 commit d7beccf

File tree

264 files changed

+4346
-4081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+4346
-4081
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/Console/Commands/SyncDiscordRoles.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace App\Console\Commands;
44

5-
use App\Models\Event;
65
use App\Models\LinkedAccount;
76
use App\Models\SocialProvider;
87
use App\Models\TicketType;
98
use App\Models\User;
109
use App\Services\DiscordApi;
11-
use Carbon\Carbon;
1210
use Illuminate\Console\Command;
1311
use Illuminate\Support\Facades\Log;
1412

app/Console/Commands/SyncTickets.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace App\Console\Commands;
44

5-
use App\Models\LinkedAccount;
65
use App\Models\TicketProvider;
7-
use App\Models\TicketType;
86
use Illuminate\Console\Command;
97
use Illuminate\Support\Facades\Log;
108

app/Console/Commands/UpdateEventSeatingLock.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class UpdateEventSeatingLock extends Command
2323
*
2424
*/
2525
protected $description = 'Update Event Seating Locks';
26+
2627
public function handle()
2728
{
2829
Event::where('seating_opens_at', '<=', Carbon::now())->chunk(100, function ($chunk) {

app/Console/Kernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Console;
44

5+
use App\Console\Commands\UpdateEventSeatingLock;
56
use Illuminate\Console\Scheduling\Schedule;
67
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
78

@@ -11,7 +12,7 @@ class Kernel extends ConsoleKernel
1112
* Define the application's commands.
1213
*/
1314
protected $commands = [
14-
\App\Console\Commands\UpdateEventSeatingLock::class,
15+
UpdateEventSeatingLock::class,
1516
];
1617

1718
/**

app/Http/Controllers/Admin/SeatGroupAssignmentController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use App\Http\Controllers\Controller;
66
use App\Http\Requests\Admin\DeleteRequest;
77
use App\Http\Requests\Admin\SeatGroupAssignmentUpdateRequest;
8-
use App\Http\Requests\Admin\SeatGroupUpdateRequest;
98
use App\Models\Event;
109
use App\Models\SeatGroup;
1110
use App\Models\SeatGroupAssignment;

app/Http/Controllers/Admin/SeatGroupController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use App\Http\Requests\Admin\DeleteRequest;
77
use App\Http\Requests\Admin\SeatGroupUpdateRequest;
88
use App\Models\Event;
9-
use App\Models\Seat;
109
use App\Models\SeatGroup;
1110
use Illuminate\Http\Request;
1211

app/Http/Controllers/Admin/SettingController.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use App\Models\SocialProvider;
1010
use App\Models\Theme;
1111
use App\Models\TicketProvider;
12+
use Exception;
1213

1314
class SettingController extends Controller
1415
{
@@ -51,6 +52,16 @@ public function addDiscord()
5152
return $provider->addBotToServer();
5253
}
5354

55+
/**
56+
* Return an instance of the configured Discord provider.
57+
* Extracted so tests can override or call provider retrieval directly.
58+
*/
59+
protected function getDiscordProvider(?string $redirectUrl = null)
60+
{
61+
$redirect = $redirectUrl ?? route('admin.settings.discord_return');
62+
return SocialProvider::whereCode('discord')->first()->getProvider($redirect);
63+
}
64+
5465
public function addDiscordReturn()
5566
{
5667
$serverName = Setting::whereCode('discord.server.name')->first();
@@ -60,7 +71,7 @@ public function addDiscordReturn()
6071
$serverName->value = $response->accessTokenResponseBody['guild']['name'];
6172
$serverId->value = $response->accessTokenResponseBody['guild']['id'];
6273
return response()->redirectToRoute('admin.settings.index')->with('successMessage', "Link to {{ $serverName->value }} has been successful");
63-
} catch (\Exception $ex) {
74+
} catch (Exception $ex) {
6475
$serverName->value = null;
6576
$serverId->value = null;
6677
return response()->redirectToRoute('admin.settings.index')->with('errorMessage', "Unable to link to Discord server");
@@ -70,16 +81,6 @@ public function addDiscordReturn()
7081
}
7182
}
7283

73-
/**
74-
* Return an instance of the configured Discord provider.
75-
* Extracted so tests can override or call provider retrieval directly.
76-
*/
77-
protected function getDiscordProvider(?string $redirectUrl = null)
78-
{
79-
$redirect = $redirectUrl ?? route('admin.settings.discord_return');
80-
return SocialProvider::whereCode('discord')->first()->getProvider($redirect);
81-
}
82-
8384
/**
8485
* Call the provider bot() flow and return the response object.
8586
* Extracted so tests can stub or call this method directly.

app/Http/Controllers/Admin/ThemeController.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@ public function store(ThemeUpdateRequest $request)
3232
return response()->redirectToRoute('admin.settings.index')->with('successMessage', 'The theme has been created');
3333
}
3434

35+
protected function updateObject(Theme $theme, Request $request)
36+
{
37+
$theme->active = (bool)$request->input('active');
38+
$theme->dark_mode = (bool)$request->input('dark_mode');
39+
if (!$theme->readonly) {
40+
$map = [
41+
'name',
42+
'css',
43+
'primary',
44+
'nav_background',
45+
'seat_available',
46+
'seat_disabled',
47+
'seat_taken',
48+
'seat_clan',
49+
'seat_selected',
50+
];
51+
foreach ($map as $prop) {
52+
$theme->{$prop} = $request->input($prop);
53+
}
54+
}
55+
$theme->save();
56+
}
57+
3558
public function edit(Theme $theme)
3659
{
3760
return view('admin.themes.edit', [
@@ -45,16 +68,6 @@ public function update(ThemeUpdateRequest $request, Theme $theme)
4568
return response()->redirectToRoute('admin.settings.index')->with('successMessage', 'The theme has been updated');
4669
}
4770

48-
public function delete(Theme $theme)
49-
{
50-
if ($theme->readonly) {
51-
abort(400);
52-
}
53-
return view('admin.themes.delete', [
54-
'theme' => $theme,
55-
]);
56-
}
57-
5871
public function destroy(Theme $theme)
5972
{
6073
if ($theme->readonly) {
@@ -64,26 +77,13 @@ public function destroy(Theme $theme)
6477
return response()->redirectToRoute('admin.settings.index')->with('successMessage', 'The theme has been deleted');
6578
}
6679

67-
protected function updateObject(Theme $theme, Request $request)
80+
public function delete(Theme $theme)
6881
{
69-
$theme->active = (bool)$request->input('active');
70-
$theme->dark_mode = (bool)$request->input('dark_mode');
71-
if (!$theme->readonly) {
72-
$map = [
73-
'name',
74-
'css',
75-
'primary',
76-
'nav_background',
77-
'seat_available',
78-
'seat_disabled',
79-
'seat_taken',
80-
'seat_clan',
81-
'seat_selected',
82-
];
83-
foreach ($map as $prop) {
84-
$theme->{$prop} = $request->input($prop);
85-
}
82+
if ($theme->readonly) {
83+
abort(400);
8684
}
87-
$theme->save();
85+
return view('admin.themes.delete', [
86+
'theme' => $theme,
87+
]);
8888
}
8989
}

app/Http/Controllers/Admin/TicketController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ public function delete(Ticket $ticket)
219219
]);
220220
}
221221

222-
public function import()
223-
{
224-
return view('admin.tickets.import');
225-
}
226-
227222
public function importShow(TicketImportRequest $request)
228223
{
229224
$csv = $request->file('csv')->get();
@@ -234,6 +229,11 @@ public function importShow(TicketImportRequest $request)
234229
]);
235230
}
236231

232+
public function import()
233+
{
234+
return view('admin.tickets.import');
235+
}
236+
237237
public function importProcess(Request $request)
238238
{
239239
$imports = $request->session()->get('imports');

0 commit comments

Comments
 (0)