Skip to content

Commit

Permalink
Remove unused variables from test stubs (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
alsterholm authored Apr 29, 2024
1 parent b360d9f commit 2ee2c38
Show file tree
Hide file tree
Showing 44 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/ApiTokenPermissionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'abilities' => ['create', 'read'],
]);

$response = $this->put('/user/api-tokens/'.$token->id, [
$this->put('/user/api-tokens/'.$token->id, [
'name' => $token->name,
'permissions' => [
'delete',
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/BrowserSessionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use App\Models\User;

test('other browser sessions can be logged out', function () {
$this->actingAs($user = User::factory()->create());
$this->actingAs(User::factory()->create());

$response = $this->delete('/user/other-browser-sessions', [
'password' => 'password',
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/CreateApiTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$this->actingAs($user = User::factory()->create());
}

$response = $this->post('/user/api-tokens', [
$this->post('/user/api-tokens', [
'name' => 'Test Token',
'permissions' => [
'read',
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/CreateTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
test('teams can be created', function () {
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->post('/teams', [
$this->post('/teams', [
'name' => 'Test Team',
]);

Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/inertia/DeleteAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
test('user accounts can be deleted', function () {
$this->actingAs($user = User::factory()->create());

$response = $this->delete('/user', [
$this->delete('/user', [
'password' => 'password',
]);

Expand All @@ -18,7 +18,7 @@
test('correct password must be provided before account can be deleted', function () {
$this->actingAs($user = User::factory()->create());

$response = $this->delete('/user', [
$this->delete('/user', [
'password' => 'wrong-password',
]);

Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/DeleteApiTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'abilities' => ['create', 'read'],
]);

$response = $this->delete('/user/api-tokens/'.$token->id);
$this->delete('/user/api-tokens/'.$token->id);

expect($user->fresh()->tokens)->toHaveCount(0);
})->skip(function () {
Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/inertia/DeleteTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$otherUser = User::factory()->create(), ['role' => 'test-role']
);

$response = $this->delete('/teams/'.$team->id);
$this->delete('/teams/'.$team->id);

expect($team->fresh())->toBeNull();
expect($otherUser->fresh()->teams)->toHaveCount(0);
Expand All @@ -23,7 +23,7 @@
test('personal teams cant be deleted', function () {
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->delete('/teams/'.$user->currentTeam->id);
$this->delete('/teams/'.$user->currentTeam->id);

expect($user->currentTeam->fresh())->not->toBeNull();
});
4 changes: 2 additions & 2 deletions stubs/pest-tests/inertia/InviteTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->post('/teams/'.$user->currentTeam->id.'/members', [
$this->post('/teams/'.$user->currentTeam->id.'/members', [
'email' => '[email protected]',
'role' => 'admin',
]);
Expand All @@ -32,7 +32,7 @@
'role' => 'admin',
]);

$response = $this->delete('/team-invitations/'.$invitation->id);
$this->delete('/team-invitations/'.$invitation->id);

expect($user->currentTeam->fresh()->teamInvitations)->toHaveCount(0);
})->skip(function () {
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/LeaveTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$this->actingAs($otherUser);

$response = $this->delete('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id);
$this->delete('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id);

expect($user->currentTeam->fresh()->users)->toHaveCount(0);
});
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/ProfileInformationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
test('profile information can be updated', function () {
$this->actingAs($user = User::factory()->create());

$response = $this->put('/user/profile-information', [
$this->put('/user/profile-information', [
'name' => 'Test Name',
'email' => '[email protected]',
]);
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/RemoveTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$otherUser = User::factory()->create(), ['role' => 'admin']
);

$response = $this->delete('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id);
$this->delete('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id);

expect($user->currentTeam->fresh()->users)->toHaveCount(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

$this->withSession(['auth.password_confirmed_at' => time()]);

$response = $this->post('/user/two-factor-authentication');
$this->post('/user/two-factor-authentication');

expect($user->fresh()->two_factor_secret)->not->toBeNull();
expect($user->fresh()->recoveryCodes())->toHaveCount(8);
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/UpdatePasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
test('password can be updated', function () {
$this->actingAs($user = User::factory()->create());

$response = $this->put('/user/password', [
$this->put('/user/password', [
'current_password' => 'password',
'password' => 'new-password',
'password_confirmation' => 'new-password',
Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/inertia/UpdateTeamMemberRoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$otherUser = User::factory()->create(), ['role' => 'admin']
);

$response = $this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
$this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
'role' => 'editor',
]);

Expand All @@ -27,7 +27,7 @@

$this->actingAs($otherUser);

$response = $this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
$this->put('/teams/'.$user->currentTeam->id.'/members/'.$otherUser->id, [
'role' => 'editor',
]);

Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/inertia/UpdateTeamNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
test('team names can be updated', function () {
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->put('/teams/'.$user->currentTeam->id, [
$this->put('/teams/'.$user->currentTeam->id, [
'name' => 'Test Team',
]);

Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/livewire/BrowserSessionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Livewire\Livewire;

test('other browser sessions can be logged out', function () {
$this->actingAs($user = User::factory()->create());
$this->actingAs(User::factory()->create());

Livewire::test(LogoutOtherBrowserSessionsForm::class)
->set('password', 'password')
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/livewire/DeleteAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
test('user accounts can be deleted', function () {
$this->actingAs($user = User::factory()->create());

$component = Livewire::test(DeleteUserForm::class)
Livewire::test(DeleteUserForm::class)
->set('password', 'password')
->call('deleteUser');

Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/livewire/DeleteTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$otherUser = User::factory()->create(), ['role' => 'test-role']
);

$component = Livewire::test(DeleteTeamForm::class, ['team' => $team->fresh()])
Livewire::test(DeleteTeamForm::class, ['team' => $team->fresh()])
->call('deleteTeam');

expect($team->fresh())->toBeNull();
Expand All @@ -26,7 +26,7 @@
test('personal teams cant be deleted', function () {
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$component = Livewire::test(DeleteTeamForm::class, ['team' => $user->currentTeam])
Livewire::test(DeleteTeamForm::class, ['team' => $user->currentTeam])
->call('deleteTeam')
->assertHasErrors(['team']);

Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/livewire/InviteTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->set('addTeamMemberForm', [
'email' => '[email protected]',
'role' => 'admin',
Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/livewire/LeaveTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$this->actingAs($otherUser);

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->call('leaveTeam');

expect($user->currentTeam->fresh()->users)->toHaveCount(0);
Expand All @@ -22,7 +22,7 @@
test('team owners cant leave their own team', function () {
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->call('leaveTeam')
->assertHasErrors(['team']);

Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/livewire/RemoveTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$otherUser = User::factory()->create(), ['role' => 'admin']
);

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->set('teamMemberIdBeingRemoved', $otherUser->id)
->call('removeTeamMember');

Expand All @@ -27,7 +27,7 @@

$this->actingAs($otherUser);

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->set('teamMemberIdBeingRemoved', $user->id)
->call('removeTeamMember')
->assertStatus(403);
Expand Down
4 changes: 2 additions & 2 deletions stubs/pest-tests/livewire/UpdateTeamMemberRoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$otherUser = User::factory()->create(), ['role' => 'admin']
);

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->set('managingRoleFor', $otherUser)
->set('currentRole', 'editor')
->call('updateRole');
Expand All @@ -30,7 +30,7 @@

$this->actingAs($otherUser);

$component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam])
->set('managingRoleFor', $otherUser)
->set('currentRole', 'editor')
->call('updateRole')
Expand Down
6 changes: 3 additions & 3 deletions stubs/tests/PasswordResetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function test_reset_password_link_can_be_requested(): void

$user = User::factory()->create();

$response = $this->post('/forgot-password', [
$this->post('/forgot-password', [
'email' => $user->email,
]);

Expand All @@ -51,7 +51,7 @@ public function test_reset_password_screen_can_be_rendered(): void

$user = User::factory()->create();

$response = $this->post('/forgot-password', [
$this->post('/forgot-password', [
'email' => $user->email,
]);

Expand All @@ -74,7 +74,7 @@ public function test_password_can_be_reset_with_valid_token(): void

$user = User::factory()->create();

$response = $this->post('/forgot-password', [
$this->post('/forgot-password', [
'email' => $user->email,
]);

Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/inertia/ApiTokenPermissionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_api_token_permissions_can_be_updated(): void
'abilities' => ['create', 'read'],
]);

$response = $this->put('/user/api-tokens/'.$token->id, [
$this->put('/user/api-tokens/'.$token->id, [
'name' => $token->name,
'permissions' => [
'delete',
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/inertia/BrowserSessionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BrowserSessionsTest extends TestCase

public function test_other_browser_sessions_can_be_logged_out(): void
{
$this->actingAs($user = User::factory()->create());
$this->actingAs(User::factory()->create());

$response = $this->delete('/user/other-browser-sessions', [
'password' => 'password',
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/inertia/CreateApiTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function test_api_tokens_can_be_created(): void

$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->post('/user/api-tokens', [
$this->post('/user/api-tokens', [
'name' => 'Test Token',
'permissions' => [
'read',
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/inertia/CreateTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function test_teams_can_be_created(): void
{
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->post('/teams', [
$this->post('/teams', [
'name' => 'Test Team',
]);

Expand Down
4 changes: 2 additions & 2 deletions stubs/tests/inertia/DeleteAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function test_user_accounts_can_be_deleted(): void

$this->actingAs($user = User::factory()->create());

$response = $this->delete('/user', [
$this->delete('/user', [
'password' => 'password',
]);

Expand All @@ -34,7 +34,7 @@ public function test_correct_password_must_be_provided_before_account_can_be_del

$this->actingAs($user = User::factory()->create());

$response = $this->delete('/user', [
$this->delete('/user', [
'password' => 'wrong-password',
]);

Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/inertia/DeleteApiTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_api_tokens_can_be_deleted(): void
'abilities' => ['create', 'read'],
]);

$response = $this->delete('/user/api-tokens/'.$token->id);
$this->delete('/user/api-tokens/'.$token->id);

$this->assertCount(0, $user->fresh()->tokens);
}
Expand Down
4 changes: 2 additions & 2 deletions stubs/tests/inertia/DeleteTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function test_teams_can_be_deleted(): void
$otherUser = User::factory()->create(), ['role' => 'test-role']
);

$response = $this->delete('/teams/'.$team->id);
$this->delete('/teams/'.$team->id);

$this->assertNull($team->fresh());
$this->assertCount(0, $otherUser->fresh()->teams);
Expand All @@ -33,7 +33,7 @@ public function test_personal_teams_cant_be_deleted(): void
{
$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->delete('/teams/'.$user->currentTeam->id);
$this->delete('/teams/'.$user->currentTeam->id);

$this->assertNotNull($user->currentTeam->fresh());
}
Expand Down
4 changes: 2 additions & 2 deletions stubs/tests/inertia/InviteTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function test_team_members_can_be_invited_to_team(): void

$this->actingAs($user = User::factory()->withPersonalTeam()->create());

$response = $this->post('/teams/'.$user->currentTeam->id.'/members', [
$this->post('/teams/'.$user->currentTeam->id.'/members', [
'email' => '[email protected]',
'role' => 'admin',
]);
Expand All @@ -48,7 +48,7 @@ public function test_team_member_invitations_can_be_cancelled(): void
'role' => 'admin',
]);

$response = $this->delete('/team-invitations/'.$invitation->id);
$this->delete('/team-invitations/'.$invitation->id);

$this->assertCount(0, $user->currentTeam->fresh()->teamInvitations);
}
Expand Down
Loading

0 comments on commit 2ee2c38

Please sign in to comment.