first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-04-23 00:14:33 +06:00
commit 356f56eebd
197 changed files with 21536 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use App\Models\Document;
use App\Models\Project;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class DocumentUploadTest extends TestCase
{
use RefreshDatabase;
public function test_user_can_upload_document()
{
$user = User::factory()->create()->assignRole('project-manager');
$project = Project::factory()->create();
Storage::fake('documents');
$response = $this->actingAs($user)
->post(route('documents.store'), [
'files' => [
UploadedFile::fake()->create('document.pdf', 1024),
],
'project_id' => $project->id
]);
$response->assertRedirect();
$this->assertCount(1, Document::all());
Storage::disk('documents')->assertExists('projects/1/documents/document.pdf');
}
}