43 lines
1.7 KiB
PHP
Executable File
43 lines
1.7 KiB
PHP
Executable File
<?php
|
|
|
|
|
|
namespace App\Tests;
|
|
|
|
use CodeIgniter\Test\CIUnitTestCase;
|
|
use Config\App;
|
|
use Config\Services;
|
|
use Tests\Support\Libraries\ConfigReader;
|
|
|
|
// use App\Helpers\excel_util_helper;
|
|
use Kint\Kint;
|
|
|
|
class CheckDefaultAgeRatioTest extends CIUnitTestCase
|
|
{
|
|
public function testRelationshipDefaultAgeRatio()
|
|
{
|
|
helper('excel_util_helper');
|
|
|
|
$general_relationships = [
|
|
'self' => ['name' => 'Self', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
|
'spouse' => ['name' => 'Spouse', 'gender' => 'F', 'age_min' => 18, 'age_max' => null],
|
|
'son' => ['name' => 'Son', 'gender' => 'M', 'age_min' => null, 'age_max' => 25],
|
|
'daughter' => ['name' => 'Daughter', 'gender' => 'F', 'age_min' => null, 'age_max' => 25],
|
|
'father' => ['name' => 'Father', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
|
'mother' => ['name' => 'Mother', 'gender' => 'F', 'age_min' => 18, 'age_max' => null],
|
|
'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
|
'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F', 'age_min' => 18, 'age_max' => null]
|
|
];
|
|
|
|
$default_age_ratio = [
|
|
"self" => ["min" => 0, "max" => 55],
|
|
"spouse" => ["min" => 0, "max" => 18],
|
|
"child" => ["min" => 0, "max" => 18],
|
|
"elders" => ["min" => 18, "max" => 53]
|
|
];
|
|
|
|
$employee_data = [1, 'EMPID001','John Doe', '01-Apr-1970', 'male', 'father-in-law','current_action' => 'I'];
|
|
$res = check_dob_diff($employee_data,$general_relationships,$default_age_ratio);
|
|
Kint::dump($res);
|
|
$this->assertTrue(!$res['status']);
|
|
}
|
|
} |