34 lines
1005 B
PHP
34 lines
1005 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\ClassPreparation;
|
|
|
|
use App\Services\ClassPreparation\ClassPreparationAdjustmentWriterService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ClassPreparationAdjustmentWriterServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_save_adjustments_persists_allowed_items(): void
|
|
{
|
|
$service = app(ClassPreparationAdjustmentWriterService::class);
|
|
|
|
$count = $service->saveAdjustments('101', '2025-2026', [
|
|
'Small Table' => 2,
|
|
'Unknown Item' => 5,
|
|
], ['Small Table']);
|
|
|
|
$this->assertSame(1, $count);
|
|
$this->assertDatabaseHas('class_prep_adjustments', [
|
|
'class_section_id' => '101',
|
|
'school_year' => '2025-2026',
|
|
'item_name' => 'Small Table',
|
|
'adjustment' => 2,
|
|
]);
|
|
$this->assertDatabaseMissing('class_prep_adjustments', [
|
|
'item_name' => 'Unknown Item',
|
|
]);
|
|
}
|
|
}
|