feat: add BankPaymentIdentificationNumberValidator

This commit is contained in:
2024-01-17 19:05:08 +01:00
parent 9b6844486d
commit a7c7d5ed99
4 changed files with 121 additions and 35 deletions

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\Tests\Validator;
use App\Validator\BankPaymentIdentificationNumber;
use App\Validator\BankPaymentIdentificationNumberValidator;
class BankPaymentIdentificationNumberValidatorTest extends ValidatorTestCase
{
/**
* @dataProvider successDp
* @param string $generatedValue
* @return void
*/
public function testSuccess(string $generatedValue): void {
$bankPaymentIdentificationValidator = new BankPaymentIdentificationNumberValidator();
$bankPaymentIdentificationValidator->initialize($this->createExecutionContext(false));
$bankPaymentIdentificationValidator->validate($generatedValue, new BankPaymentIdentificationNumber(['message' => 'foo']));
}
private function successDp(): array {
return [['122'], ['1234567890'], ['1']];
}
/**
* @dataProvider failureDp
* @param string $generatedValue
* @return void
*/
public function testFailure(string $generatedValue): void {
$bankPaymentIdentificationValidator = new BankPaymentIdentificationNumberValidator();
$bankPaymentIdentificationValidator->initialize($this->createExecutionContext(true));
$bankPaymentIdentificationValidator->validate($generatedValue, new BankPaymentIdentificationNumber(['message' => 'foo']));
}
private function failureDp(): array {
return [['122.b'], ['a.a'], ['a'], ['2.040'], ['2,a'], ['122.1'], ['12345678901']];
}
}