41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
|
<?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']];
|
||
|
}
|
||
|
}
|