build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon

This commit is contained in:
2026-08-10 13:45:18 +02:00
commit 717db65139
218 changed files with 28356 additions and 0 deletions
+145
View File
@@ -0,0 +1,145 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class WebDavTest extends TestCase
{
use RefreshDatabase;
public function test_webdav_index_requires_authentication(): void
{
$this->get(route('settings.webdav'))->assertRedirect(route('login'));
}
public function test_webdav_index_can_be_rendered(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->get(route('settings.webdav'))
->assertOk();
}
public function test_webdav_store_requires_authentication(): void
{
$this->post(route('settings.webdav.store'))->assertRedirect(route('login'));
}
public function test_webdav_store_validates_username(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->post(route('settings.webdav.store'), [])
->assertSessionHasErrors('username');
}
public function test_webdav_store_validates_password(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->post(route('settings.webdav.store'), [
'username' => 'testuser',
])
->assertSessionHasErrors('password');
}
public function test_webdav_store_requires_unique_username(): void
{
$user = User::factory()->create();
$user->webDavAccounts()->create([
'username' => 'existinguser',
'password_encrypted' => 'password123',
'enabled' => true,
'display_name' => 'existinguser',
]);
$this->actingAs($user)
->post(route('settings.webdav.store'), [
'username' => 'existinguser',
'password' => 'password123',
])
->assertSessionHasErrors('username');
}
public function test_webdav_store_requires_minimum_password_length(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->post(route('settings.webdav.store'), [
'username' => 'newuser',
'password' => 'short',
])
->assertSessionHasErrors('password');
}
public function test_webdav_account_can_be_created(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->post(route('settings.webdav.store'), [
'username' => 'newuser',
'password' => 'password123',
])
->assertRedirect();
$this->assertDatabaseHas('webdav_accounts', [
'username' => 'newuser',
]);
}
public function test_webdav_delete_requires_authentication(): void
{
$this->delete(route('settings.webdav.destroy', 1))
->assertRedirect(route('login'));
}
public function test_webdav_account_can_be_deleted(): void
{
$user = User::factory()->create();
$account = $user->webDavAccounts()->create([
'username' => 'deleteuser',
'password_encrypted' => 'password123',
'enabled' => true,
'display_name' => 'deleteuser',
]);
$this->actingAs($user)
->delete(route('settings.webdav.destroy', $account->id))
->assertRedirect();
$this->assertDatabaseMissing('webdav_accounts', [
'id' => $account->id,
]);
}
public function test_webdav_delete_only_allows_own_accounts(): void
{
$user1 = User::factory()->create();
$user2 = User::factory()->create();
$account = $user2->webDavAccounts()->create([
'username' => 'otheruser',
'password_encrypted' => 'password123',
'enabled' => true,
'display_name' => 'otheruser',
]);
$this->actingAs($user1)
->delete(route('settings.webdav.destroy', $account->id))
->assertNotFound();
$this->assertDatabaseHas('webdav_accounts', [
'id' => $account->id,
]);
}
}