add more controller
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\SchoolIds;
|
||||
|
||||
use App\Services\SchoolIds\SchoolIdGenerationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SchoolIdGenerationServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_generates_student_school_id_with_prefix(): void
|
||||
{
|
||||
$service = app(SchoolIdGenerationService::class);
|
||||
$schoolId = $service->generateStudentId();
|
||||
|
||||
$year = date('y');
|
||||
$this->assertStringStartsWith('STU' . $year, $schoolId);
|
||||
$this->assertSame(10, strlen($schoolId));
|
||||
}
|
||||
|
||||
public function test_generates_user_school_id_with_prefix(): void
|
||||
{
|
||||
$service = app(SchoolIdGenerationService::class);
|
||||
$schoolId = $service->generateUserId();
|
||||
|
||||
$year = date('y');
|
||||
$this->assertStringStartsWith($year, $schoolId);
|
||||
$this->assertSame(7, strlen($schoolId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user