Files
UNIT3D/tests/Feature/Http/Controllers/User/UserControllerTest.php
2023-07-11 18:27:15 +00:00

122 lines
4.3 KiB
PHP

<?php
uses(RefreshDatabase::class);
test('accept rules returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
$response = $this->actingAs($authUser)->post(route('users.accept.rules', [$user]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
test('accept rules aborts with a 403', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($authUser)->post(route('users.accept.rules', [$user]), [
// TODO: send request data
]);
$response->assertForbidden();
});
test('edit returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
$response = $this->actingAs($authUser)->get(route('users.edit', [$user]));
$response->assertOk();
$response->assertViewIs('user.profile.edit');
$response->assertViewHas('user', $user);
// TODO: perform additional assertions
});
test('edit aborts with a 403', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($authUser)->get(route('users.edit', [$user]));
$response->assertForbidden();
});
test('show returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$invite = \App\Models\Invite::factory()->create();
$peer = \App\Models\Peer::factory()->create();
$authUser = \App\Models\User::factory()->create();
$response = $this->actingAs($authUser)->get(route('users.show', [$user]));
$response->assertOk();
$response->assertViewIs('user.profile.show');
$response->assertViewHas('user', $user);
$response->assertViewHas('followers');
$response->assertViewHas('history');
$response->assertViewHas('manualWarnings');
$response->assertViewHas('autoWarnings');
$response->assertViewHas('softDeletedWarnings');
$response->assertViewHas('boughtUpload');
$response->assertViewHas('invitedBy');
$response->assertViewHas('clients');
$response->assertViewHas('achievements');
$response->assertViewHas('peers');
$response->assertViewHas('watch');
// TODO: perform additional assertions
});
test('update returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
$response = $this->actingAs($authUser)->patch(route('users.update', [$user]), [
// TODO: send request data
]);
$response->assertOk();
// TODO: perform additional assertions
});
test('update aborts with a 403', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$user = \App\Models\User::factory()->create();
$authUser = \App\Models\User::factory()->create();
// TODO: perform additional setup to trigger `abort_unless(403)`...
$response = $this->actingAs($authUser)->patch(route('users.update', [$user]), [
// TODO: send request data
]);
$response->assertForbidden();
});
// test cases...