add controllers, servoices
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\ClassPreparation;
|
||||
|
||||
use App\Services\ClassPreparation\ClassPreparationCalculatorService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ClassPreparationCalculatorServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_get_class_level_by_section(): void
|
||||
{
|
||||
DB::table('classSection')->insert([
|
||||
'id' => 1,
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 101,
|
||||
'class_section_name' => '2-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new ClassPreparationCalculatorService();
|
||||
|
||||
$this->assertSame(2, $service->getClassLevelBySection('101'));
|
||||
$this->assertSame(1, $service->getClassLevelBySection('KG'));
|
||||
}
|
||||
|
||||
public function test_calculate_prep_items_for_lower_grades(): void
|
||||
{
|
||||
DB::table('configuration')->insert([
|
||||
['id' => 1, 'config_key' => 'school_year', 'config_value' => '2025-2026'],
|
||||
]);
|
||||
|
||||
DB::table('inventory_categories')->insert([
|
||||
['name' => 'Small Table', 'grade_min' => null, 'grade_max' => null, 'type' => 'classroom'],
|
||||
['name' => 'Small Chair', 'grade_min' => null, 'grade_max' => null, 'type' => 'classroom'],
|
||||
['name' => 'Teacher Chair', 'grade_min' => null, 'grade_max' => null, 'type' => 'classroom'],
|
||||
['name' => 'Grade Box', 'grade_min' => null, 'grade_max' => null, 'type' => 'classroom'],
|
||||
]);
|
||||
|
||||
DB::table('teacher_class')->insert([
|
||||
'class_section_id' => 101,
|
||||
'teacher_id' => 1,
|
||||
'position' => 'main',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new ClassPreparationCalculatorService();
|
||||
$items = $service->calculatePrepItems(6, 1, '101');
|
||||
|
||||
$this->assertSame(2, $items['Small Table']);
|
||||
$this->assertSame(6, $items['Small Chair']);
|
||||
$this->assertSame(1, $items['Teacher Chair']);
|
||||
$this->assertSame(1, $items['Grade Box']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user