add controllers, servoices
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Files;
|
||||
|
||||
use App\Services\Files\ExamDraftDownloadNameService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExamDraftDownloadNameServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_build_returns_slugified_name(): void
|
||||
{
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'class_section_name' => '2B',
|
||||
'class_id' => 1,
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
DB::table('exam_drafts')->insert([
|
||||
'id' => 1,
|
||||
'teacher_id' => 1,
|
||||
'class_section_id' => 1,
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'exam_type' => 'Final Exam',
|
||||
'draft_title' => 'Draft',
|
||||
'teacher_file' => 'draft2.pdf',
|
||||
'version' => 3,
|
||||
'status' => 'draft',
|
||||
]);
|
||||
|
||||
$service = new ExamDraftDownloadNameService();
|
||||
$name = $service->build('draft2.pdf', 'drafts');
|
||||
|
||||
$this->assertSame('2b_final_exam_v3', $name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user