mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-08 04:00:14 -05:00
refactor: prefer ::query() over laravel eloquent magic
Significantly improves DX with LSP compatibility. Now it's possible to navigate to the definition of these functions in laravel and get ide autocomplete.
This commit is contained in:
@@ -68,7 +68,7 @@ test('user registration is available when enabled', function (): void {
|
||||
Event::assertDispatched(Registered::class);
|
||||
|
||||
// Email verification for newly registered user
|
||||
$user = User::where('email', $email)->first();
|
||||
$user = User::query()->where('email', $email)->first();
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'verification.verify',
|
||||
now()->addMinutes(5),
|
||||
@@ -117,7 +117,7 @@ test('user can register using invite code', function (): void {
|
||||
Event::assertDispatched(Registered::class);
|
||||
|
||||
// Email verification for newly registered user
|
||||
$user = User::where('email', $email)->first();
|
||||
$user = User::query()->where('email', $email)->first();
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'verification.verify',
|
||||
now()->addMinutes(5),
|
||||
@@ -195,7 +195,7 @@ test('user cannot confirm email using invalid hash', function (): void {
|
||||
Event::assertDispatched(Registered::class);
|
||||
|
||||
// Email verification for newly registered user with invalid email
|
||||
$user = User::where('email', $email)->first();
|
||||
$user = User::query()->where('email', $email)->first();
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'verification.verify',
|
||||
now()->addMinutes(5),
|
||||
@@ -254,7 +254,7 @@ test('user can register using invite code with internal note assigned', function
|
||||
Event::assertDispatched(Registered::class);
|
||||
|
||||
// Email verification for newly registered user
|
||||
$user = User::where('email', $email)->first();
|
||||
$user = User::query()->where('email', $email)->first();
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'verification.verify',
|
||||
now()->addMinutes(5),
|
||||
|
||||
@@ -22,12 +22,12 @@ test('update returns an ok response', function (): void {
|
||||
$this->seed(GroupSeeder::class);
|
||||
User::factory()->times(3)->create([
|
||||
'email_verified_at' => null,
|
||||
'group_id' => Group::firstWhere('slug', 'validating')
|
||||
'group_id' => Group::query()->firstWhere('slug', 'validating')
|
||||
]);
|
||||
|
||||
$this->get(route('staff.mass-actions.validate'))
|
||||
->assertRedirect(route('staff.dashboard.index'));
|
||||
|
||||
expect(User::where('email_verified_at', '=', null)->count())
|
||||
expect(User::query()->where('email_verified_at', '=', null)->count())
|
||||
->toBe(0, 'All users should be validated');
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ test('user comments on article creates a notification for staff', function (): v
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$staff],
|
||||
@@ -119,7 +119,7 @@ test('staff comments on own article does not create a notification for staff', f
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -168,7 +168,7 @@ test('user comments on article does not a notification for staff user when all n
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ test('user tags user on article creates a notification for tagged user', functio
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$user],
|
||||
@@ -128,7 +128,7 @@ test('staff tags user on article creates a notification for tagged user even whe
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$user],
|
||||
@@ -183,7 +183,7 @@ test('user tags user on article creates a notification for tagged user when ment
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$user],
|
||||
@@ -236,7 +236,7 @@ test('user tags user on article does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -287,7 +287,7 @@ test('user tags user on article does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -339,7 +339,7 @@ test('user tags user on article does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
|
||||
@@ -69,7 +69,7 @@ test('comments on playlist creates a notification for playlist owner', function
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$owner],
|
||||
@@ -114,7 +114,7 @@ test('user comments on own playlist does not create a notification for self', fu
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -159,7 +159,7 @@ test('comments on playlist does not create a notification for playlist owner whe
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ test('comment own request does not create a notification for self', function ():
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -117,7 +117,7 @@ test('comment a request creates a notification for the requester', function ():
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$requester],
|
||||
@@ -172,7 +172,7 @@ test('comment a request creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$requester],
|
||||
@@ -225,7 +225,7 @@ test('comment a request creates a notification for the requester when all notifi
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -274,7 +274,7 @@ test('comment a request creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -324,7 +324,7 @@ test('comment a request creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ test('user comments own ticket does not create a notification for self but assig
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$staff],
|
||||
@@ -134,7 +134,7 @@ test('user comments own ticket does not create a notification for staff when non
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -185,7 +185,7 @@ test('staff comments a ticket creates a notification for the user but not staff'
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$user],
|
||||
@@ -242,7 +242,7 @@ test('staff comments a ticket create a notification for the user even when all n
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$user],
|
||||
|
||||
@@ -75,7 +75,7 @@ test('user tags user on ticket creates a notification for tagged user', function
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$staff],
|
||||
@@ -131,7 +131,7 @@ test('user tags user on ticket does not create a notification for tagged user wh
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$staff],
|
||||
|
||||
@@ -68,7 +68,7 @@ test('comment own torrent does not create a notification for self', function ():
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -117,7 +117,7 @@ test('comment a torrent creates a notification for the uploader', function (): v
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$uploader],
|
||||
@@ -172,7 +172,7 @@ test('comment a torrent creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
[$uploader],
|
||||
@@ -225,7 +225,7 @@ test('comment a torrent creates a notification for the requester when all notifi
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -274,7 +274,7 @@ test('comment a torrent creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
@@ -324,7 +324,7 @@ test('comment a torrent creates a notification for the requester when request co
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertCount(0);
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ test('user tags user on request creates a notification for tagged user', functio
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentTo(
|
||||
$user,
|
||||
@@ -126,7 +126,7 @@ test('user tags user on request creates a notification for tagged user when ment
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentToTimes(
|
||||
$user,
|
||||
@@ -178,7 +178,7 @@ test('user tags user on request does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -229,7 +229,7 @@ test('user tags user on request does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -281,7 +281,7 @@ test('user tags user on request does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
|
||||
@@ -72,7 +72,7 @@ test('user tags user on torrent creates a notification for tagged user', functio
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentToTimes(
|
||||
$user,
|
||||
@@ -126,7 +126,7 @@ test('user tags user on torrent creates a notification for tagged user when ment
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertSentToTimes(
|
||||
$user,
|
||||
@@ -178,7 +178,7 @@ test('user tags user on torrent does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -229,7 +229,7 @@ test('user tags user on torrent does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
@@ -281,7 +281,7 @@ test('user tags user on torrent does not create a notification for tagged user w
|
||||
->set('anon', false)
|
||||
->call('postComment');
|
||||
|
||||
$this->assertEquals(1, Comment::count());
|
||||
$this->assertEquals(1, Comment::query()->count());
|
||||
|
||||
Notification::assertNotSentTo(
|
||||
[$user],
|
||||
|
||||
Reference in New Issue
Block a user