31 lines
919 B
PHP
31 lines
919 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\ClassPreparation;
|
|
|
|
use App\Services\ClassPreparation\ClassPreparationAdjustmentService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class ClassPreparationAdjustmentServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_apply_adjustments_updates_counts(): void
|
|
{
|
|
DB::table('class_prep_adjustments')->insert([
|
|
'class_section_id' => 101,
|
|
'item_name' => 'Small Table',
|
|
'adjustment' => 2,
|
|
'school_year' => '2025-2026',
|
|
'adjustable' => 1,
|
|
]);
|
|
|
|
$service = new ClassPreparationAdjustmentService();
|
|
[$items, $adjMap] = $service->applyAdjustments(['Small Table' => 1], '101', '2025-2026');
|
|
|
|
$this->assertSame(3, $items['Small Table']);
|
|
$this->assertSame(2, $adjMap['Small Table']);
|
|
}
|
|
}
|