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

61 lines
2.2 KiB
PHP

<?php
uses(RefreshDatabase::class);
test('index 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.peers.index', [$user]));
$response->assertOk();
$response->assertViewIs('user.peer.index');
$response->assertViewHas('user', $user);
$response->assertViewHas('history');
// TODO: perform additional assertions
});
test('index 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.peers.index', [$user]));
$response->assertForbidden();
});
test('mass destroy 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)->delete(route('users.peers.mass_destroy', [$user]));
$response->assertRedirect(withErrors('You can only flush twice a day!'));
// TODO: perform additional assertions
});
test('mass destroy 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)->delete(route('users.peers.mass_destroy', [$user]));
$response->assertForbidden();
});
// test cases...