Fix issues found during abnormal scenario testing. #727

This commit is contained in:
Korina Cordero 2023-01-13 08:09:23 +00:00
parent 987c865620
commit ff32ee6154
2 changed files with 9 additions and 7 deletions

View file

@ -23,7 +23,7 @@ class TestInsuranceConnectorCommand extends Command
{
$this->setName('test:create-insurance-application')
->setDescription('Test create insurance application service.')
->setHelp('Test the create insuranace application service.');
->setHelp('Test the create insurance application service.');
}
public function __construct(InsuranceConnector $insurance, InsuranceDataValidator $ins_validator)
@ -52,7 +52,7 @@ class TestInsuranceConnectorCommand extends Command
->setAddressBarangay('Legaspi Village')
->setAddressCity('Makati City')
->setAddressProvince('Metro Manila')
->setZipcode('1200')
->setZipcode(1200)
->setMobileNumber('09171234567')
->setEmailAddress('test.resq@gmail.com');
@ -83,5 +83,4 @@ class TestInsuranceConnectorCommand extends Command
return 0;
}
}

View file

@ -86,7 +86,7 @@ class InsuranceDataValidator
}
// zipcode is required
if (empty($client_data->getZipcode()))
if ($client_data->getZipcode() == 0)
{
$error = 'Zipcode is required.';
return $error;
@ -141,6 +141,8 @@ class InsuranceDataValidator
return $error;
}
// TODO: the insurance api doesn't care if the plate number is valid.
// do we still check for valid plate number?
// plate number is correct format
$is_valid_plate = $this->checkPlateNumber($client_data->getPlateNumber());
if (!($is_valid_plate))
@ -180,7 +182,7 @@ class InsuranceDataValidator
// motor vehicle type id is required
if ($client_data->getMvTypeID() == 0)
{
$error = 'Motor vehicle type must be set.';
$error = 'Motor vehicle type is required.';
return $error;
}
@ -220,7 +222,7 @@ class InsuranceDataValidator
// check line type and flag_public combination
// if line type is MCOC/private motorcycle, flag_public should be false
// if line type is LCOC/public motorcycle, flag_public should be true
if ($client_data->getLine() == LineType::PRIVATE_MOTORCYCLE)
if ($client_data->getLine() == LineType::PRIVATE_MOTORCYCLE)
{
if ($client_data->isPublic())
{
@ -229,7 +231,8 @@ class InsuranceDataValidator
}
}
if ($client_data->getLine() == LineType::PUBLIC_MOTORCYCLE)
if (($client_data->getLine() == LineType::PUBLIC_MOTORCYCLE) ||
($client_data->getLine() == LineType::COMMERCIAL_VEHICLE))
{
if (!($client_data->isPublic()))
{