<?php

namespace Tests\Unit\Payroll;

use App\Services\Payroll\EmployeePayrollCalculator;
use ReflectionMethod;
use Tests\TestCase;

class EmployeePayrollCalculatorTest extends TestCase
{
    public function test_extract_basic_matches_basic_salary_component_code(): void
    {
        $calculator = app(EmployeePayrollCalculator::class);
        $method = new ReflectionMethod($calculator, 'extractBasicFromEarnings');
        $method->setAccessible(true);

        $basic = $method->invoke($calculator, [
            ['code' => 'BASIC_SALARY', 'name' => 'Basic Salary', 'amount' => 99100.0],
            ['code' => 'HOUSE_RENT_ALLOWANCE', 'name' => 'House Rent Allowance', 'amount' => 39640.0],
        ]);

        $this->assertSame(99100.0, $basic);
    }
}
