72 lines
4.5 KiB
PHP
72 lines
4.5 KiB
PHP
<?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 GridType12PremiumCalculationTest.php extends CIUnitTestCase
|
|
{
|
|
public function testType12PremiumCalculation()
|
|
{
|
|
helper('excel_util_helper');
|
|
|
|
$slab_details = [ 'slab_rates' =>[
|
|
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 12, 'age_from' => null, 'age_to' => null, 'grade' => null, 'si' => 5000000, 'premium' => 50000, 'max_si' => 0,'premium_type' => 1, 'relationship' => 'self'],
|
|
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 25000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'spouse'],
|
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 20000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'child'],
|
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 18000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'father'],
|
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 15000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'mother'],
|
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 14000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'father-in-law'],
|
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => 4, 'age_from' => null, 'age_to' => null, 'grade' => '', 'si' => 5000000, 'premium' => 12000, 'max_si' => 0, 'premium_type' => 1, 'relationship' => 'mother-in-law']],
|
|
|
|
'grid_master' => ['id' => 4,'policy_type' => 'GMC','ui_type' => 12,'policy_grid_type' => 'Employees + Relationship','is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 0,'basicpay' => 0,'emp_band' => 0,]
|
|
];
|
|
// Sample family data
|
|
$family_details = [
|
|
[1, 'Jane Doe', '1990-01-01', 'F', 'Spouse', 10000, '2024-01-01', '2020-01-01', 50000, 'A', 'Manager', '1234567890', 'john.doe@example.com', 'None', '', '', ''],
|
|
[2, 'John Doe', '1990-01-01', 'M', 'Self', '', '', '', '', '', '', '', '', '', '', ''],
|
|
[3, 'Peter Doe', '1990-01-01', 'M', 'Father', '', '', '', '', '', '', '', '', '', '', ''],
|
|
[4, 'Mary Doe', '1990-01-01', 'F', 'Mother', '', '', '', '', '', '', '', '', '', '', ''],
|
|
[5, 'Grace Doe', '1990-01-01', 'F', 'Mother-in-law', '', '', '', '', '', '', '', '', '', '', ''],
|
|
[6, 'George Doe', '1990-01-01', 'M', 'Father-in-law', '', '', '', '', '', '', '', '', '', '', ''],
|
|
[7, 'Alice Doe', '1995-02-02', 'F', 'Daughter', 8000, '2024-02-01', '2021-01-01', 40000, 'B', 'Supervisor', '9876543210', '', '', '', ''],
|
|
[8, 'Bob Doe', '1995-02-02', 'M', 'Son', '', '', '', '', '', '', '', '', '', '', ''],
|
|
];
|
|
|
|
|
|
// Sample policy terms
|
|
$policy_terms = [
|
|
'family_floater' => true,
|
|
'family_floaters' => [
|
|
'childrens' => 2,
|
|
'spouse' => 1,
|
|
'either-parents-pil' => 0,
|
|
'parents' => 2,
|
|
'parents-in-law' => 2,
|
|
],
|
|
];
|
|
|
|
// Sample action array
|
|
$actionArr = 'addition';
|
|
|
|
// Call the function
|
|
$result = check_dependent_conflict($family_data, $policy_terms, $actionArr);
|
|
Kint::dump($result);
|
|
// Assert that the status is true (no conflicts)
|
|
$this->assertTrue($result['status']);
|
|
}
|
|
|
|
// public function testIsNull()
|
|
// {
|
|
// $i = null;
|
|
// $this->assertTrue($i);
|
|
|
|
// }
|
|
} |