Skip to content

Commit

Permalink
Test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
danielebarbaro committed Jun 17, 2024
1 parent 81efe8c commit 4374ee7
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:58:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumberFormat";a:6:{s:4:"name";s:15:"VatNumberFormat";s:14:"namespacedName";s:58:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumberFormat";s:9:"namespace";s:42:"Danielebarbaro\LaravelVatEuValidator\Rules";s:9:"startLine";i:8;s:7:"endLine";i:16;s:7:"methods";a:1:{s:8:"validate";a:6:{s:10:"methodName";s:8:"validate";s:9:"signature";s:62:"validate(string $attribute, mixed $value, Closure $fail): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:10;s:7:"endLine";i:15;s:3:"ccn";i:2;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:17;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:17;}s:15:"ignoredLinesFor";a:1:{i:0;i:8;}s:17:"executableLinesIn";a:2:{i:12;i:1;i:13;i:2;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:57:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumberExist";a:6:{s:4:"name";s:14:"VatNumberExist";s:14:"namespacedName";s:57:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumberExist";s:9:"namespace";s:42:"Danielebarbaro\LaravelVatEuValidator\Rules";s:9:"startLine";i:9;s:7:"endLine";i:17;s:7:"methods";a:1:{s:8:"validate";a:6:{s:10:"methodName";s:8:"validate";s:9:"signature";s:62:"validate(string $attribute, mixed $value, Closure $fail): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:11;s:7:"endLine";i:16;s:3:"ccn";i:2;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:18;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:18;}s:15:"ignoredLinesFor";a:1:{i:0;i:9;}s:17:"executableLinesIn";a:2:{i:13;i:1;i:14;i:2;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:52:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber";a:6:{s:4:"name";s:9:"VatNumber";s:14:"namespacedName";s:52:"Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber";s:9:"namespace";s:42:"Danielebarbaro\LaravelVatEuValidator\Rules";s:9:"startLine";i:8;s:7:"endLine";i:16;s:7:"methods";a:1:{s:8:"validate";a:6:{s:10:"methodName";s:8:"validate";s:9:"signature";s:62:"validate(string $attribute, mixed $value, Closure $fail): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:10;s:7:"endLine";i:15;s:3:"ccn";i:2;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:17;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:17;}s:15:"ignoredLinesFor";a:1:{i:0;i:8;}s:17:"executableLinesIn";a:2:{i:12;i:1;i:13;i:2;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:63:"Danielebarbaro\LaravelVatEuValidator\Facades\VatValidatorFacade";a:6:{s:4:"name";s:18:"VatValidatorFacade";s:14:"namespacedName";s:63:"Danielebarbaro\LaravelVatEuValidator\Facades\VatValidatorFacade";s:9:"namespace";s:44:"Danielebarbaro\LaravelVatEuValidator\Facades";s:9:"startLine";i:15;s:7:"endLine";i:26;s:7:"methods";a:1:{s:17:"getFacadeAccessor";a:6:{s:10:"methodName";s:17:"getFacadeAccessor";s:9:"signature";s:27:"getFacadeAccessor(): string";s:10:"visibility";s:9:"protected";s:9:"startLine";i:22;s:7:"endLine";i:25;s:3:"ccn";i:1;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:27;s:18:"commentLinesOfCode";i:12;s:21:"nonCommentLinesOfCode";i:15;}s:15:"ignoredLinesFor";a:1:{i:0;i:15;}s:17:"executableLinesIn";a:1:{i:24;i:1;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:64:"Danielebarbaro\LaravelVatEuValidator\VatValidatorServiceProvider";a:6:{s:4:"name";s:27:"VatValidatorServiceProvider";s:14:"namespacedName";s:64:"Danielebarbaro\LaravelVatEuValidator\VatValidatorServiceProvider";s:9:"namespace";s:36:"Danielebarbaro\LaravelVatEuValidator";s:9:"startLine";i:12;s:7:"endLine";i:51;s:7:"methods";a:2:{s:4:"boot";a:6:{s:10:"methodName";s:4:"boot";s:9:"signature";s:12:"boot(): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:17;s:7:"endLine";i:42;s:3:"ccn";i:1;}s:8:"register";a:6:{s:10:"methodName";s:8:"register";s:9:"signature";s:16:"register(): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:47;s:7:"endLine";i:50;s:3:"ccn";i:1;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:52;s:18:"commentLinesOfCode";i:15;s:21:"nonCommentLinesOfCode";i:37;}s:15:"ignoredLinesFor";a:1:{i:0;i:12;}s:17:"executableLinesIn";a:13:{i:22;i:1;i:25;i:1;i:23;i:2;i:24;i:3;i:30;i:4;i:33;i:4;i:31;i:5;i:32;i:6;i:38;i:7;i:41;i:7;i:39;i:8;i:40;i:9;i:49;i:10;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:55:"Danielebarbaro\LaravelVatEuValidator\Vies\ViesException";a:6:{s:4:"name";s:13:"ViesException";s:14:"namespacedName";s:55:"Danielebarbaro\LaravelVatEuValidator\Vies\ViesException";s:9:"namespace";s:41:"Danielebarbaro\LaravelVatEuValidator\Vies";s:9:"startLine";i:7;s:7:"endLine";i:10;s:7:"methods";a:0:{}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:11;s:18:"commentLinesOfCode";i:1;s:21:"nonCommentLinesOfCode";i:10;}s:15:"ignoredLinesFor";a:1:{i:0;i:7;}s:17:"executableLinesIn";a:0:{}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:49:"Danielebarbaro\LaravelVatEuValidator\VatValidator";a:6:{s:4:"name";s:12:"VatValidator";s:14:"namespacedName";s:49:"Danielebarbaro\LaravelVatEuValidator\VatValidator";s:9:"namespace";s:36:"Danielebarbaro\LaravelVatEuValidator";s:9:"startLine";i:7;s:7:"endLine";i:173;s:7:"methods";a:8:{s:11:"__construct";a:6:{s:10:"methodName";s:11:"__construct";s:9:"signature";s:70:"__construct(?Danielebarbaro\LaravelVatEuValidator\Vies\Client $client)";s:10:"visibility";s:6:"public";s:9:"startLine";i:50;s:7:"endLine";i:55;s:3:"ccn";i:2;}s:18:"countryIsSupported";a:6:{s:10:"methodName";s:18:"countryIsSupported";s:9:"signature";s:41:"countryIsSupported(string $country): bool";s:10:"visibility";s:6:"public";s:9:"startLine";i:62;s:7:"endLine";i:65;s:3:"ccn";i:1;}s:14:"validateFormat";a:6:{s:10:"methodName";s:14:"validateFormat";s:9:"signature";s:39:"validateFormat(string $vatNumber): bool";s:10:"visibility";s:6:"public";s:9:"startLine";i:72;s:7:"endLine";i:91;s:3:"ccn";i:4;}s:17:"validateExistence";a:6:{s:10:"methodName";s:17:"validateExistence";s:9:"signature";s:42:"validateExistence(string $vatNumber): bool";s:10:"visibility";s:6:"public";s:9:"startLine";i:99;s:7:"endLine";i:110;s:3:"ccn";i:2;}s:9:"luhnCheck";a:6:{s:10:"methodName";s:9:"luhnCheck";s:9:"signature";s:27:"luhnCheck(string $vat): int";s:10:"visibility";s:6:"public";s:9:"startLine";i:119;s:7:"endLine";i:137;s:3:"ccn";i:4;}s:8:"validate";a:6:{s:10:"methodName";s:8:"validate";s:9:"signature";s:33:"validate(string $vatNumber): bool";s:10:"visibility";s:6:"public";s:9:"startLine";i:146;s:7:"endLine";i:149;s:3:"ccn";i:2;}s:10:"vatCleaner";a:6:{s:10:"methodName";s:10:"vatCleaner";s:9:"signature";s:37:"vatCleaner(string $vatNumber): string";s:10:"visibility";s:7:"private";s:9:"startLine";i:155;s:7:"endLine";i:160;s:3:"ccn";i:1;}s:8:"splitVat";a:6:{s:10:"methodName";s:8:"splitVat";s:9:"signature";s:34:"splitVat(string $vatNumber): array";s:10:"visibility";s:7:"private";s:9:"startLine";i:166;s:7:"endLine";i:172;s:3:"ccn";i:1;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:174;s:18:"commentLinesOfCode";i:48;s:21:"nonCommentLinesOfCode";i:126;}s:15:"ignoredLinesFor";a:1:{i:0;i:7;}s:17:"executableLinesIn";a:36:{i:52;i:2;i:53;i:3;i:64;i:4;i:74;i:5;i:75;i:6;i:78;i:7;i:79;i:8;i:82;i:9;i:84;i:10;i:85;i:11;i:87;i:12;i:90;i:13;i:101;i:14;i:102;i:15;i:104;i:16;i:105;i:17;i:106;i:18;i:109;i:19;i:121;i:20;i:122;i:21;i:123;i:22;i:124;i:23;i:125;i:24;i:126;i:25;i:127;i:26;i:128;i:27;i:129;i:28;i:133;i:29;i:136;i:30;i:148;i:31;i:157;i:32;i:159;i:33;i:168;i:34;i:169;i:34;i:170;i:34;i:171;i:34;}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:6:{s:9:"classesIn";a:1:{s:48:"Danielebarbaro\LaravelVatEuValidator\Vies\Client";a:6:{s:4:"name";s:6:"Client";s:14:"namespacedName";s:48:"Danielebarbaro\LaravelVatEuValidator\Vies\Client";s:9:"namespace";s:41:"Danielebarbaro\LaravelVatEuValidator\Vies";s:9:"startLine";i:8;s:7:"endLine";i:63;s:7:"methods";a:3:{s:11:"__construct";a:6:{s:10:"methodName";s:11:"__construct";s:9:"signature";s:25:"__construct(int $timeout)";s:10:"visibility";s:6:"public";s:9:"startLine";i:22;s:7:"endLine";i:24;s:3:"ccn";i:1;}s:5:"check";a:6:{s:10:"methodName";s:5:"check";s:9:"signature";s:51:"check(string $countryCode, string $vatNumber): bool";s:10:"visibility";s:6:"public";s:9:"startLine";i:35;s:7:"endLine";i:49;s:3:"ccn";i:2;}s:9:"getClient";a:6:{s:10:"methodName";s:9:"getClient";s:9:"signature";s:23:"getClient(): SoapClient";s:10:"visibility";s:9:"protected";s:9:"startLine";i:55;s:7:"endLine";i:62;s:3:"ccn";i:2;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:64;s:18:"commentLinesOfCode";i:21;s:21:"nonCommentLinesOfCode";i:43;}s:15:"ignoredLinesFor";a:1:{i:0;i:8;}s:17:"executableLinesIn";a:13:{i:24;i:3;i:38;i:4;i:39;i:4;i:40;i:4;i:41;i:4;i:42;i:4;i:43;i:4;i:44;i:5;i:45;i:6;i:48;i:7;i:57;i:8;i:58;i:9;i:61;i:10;}}
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":[],"times":{"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\CountryIsSupportedTest::testCountryIsSupported":0.027,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\CountryIsSupportedTest::testCountryIsNotSupported":0.001,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberExistTest::testVatNumberExist":0.008,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberExistTest::testVatNumberDoesNotExist":0.003,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberFormatTest::testVatNumberFormat":0.002,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberFormatTest::testVatNumberFormatNotExist":0.001,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberTest::testVatNumber":0.002,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Rules\\VatNumberTest::testVatNumberNotExist":0.001,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorFacadeTest::testVatValidatorFacade":0.001,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testVatValidFormatFail":0,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testVatValidFormat":0,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testVatWrongFormat":0,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testVatExist":0,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testVatValid":0,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\VatValidatorTest::testLuhnCheck":0.001,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Vies\\ViesTest::testClientEmptyDataException":8.779,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Vies\\ViesTest::testClientEmptyVatNumberException":0.425,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Vies\\ViesTest::testClientEmptyCountryException":0.378,"Danielebarbaro\\LaravelVatEuValidator\\Tests\\Vies\\ViesTest::testFailExistResponse":2.054}}
4 changes: 4 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
Expand All @@ -25,6 +26,9 @@

\Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_82,
])
->withSkip([
StaticArrowFunctionRector::class,
])
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
]);
27 changes: 11 additions & 16 deletions src/VatValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,13 @@ class VatValidator
'SK' => '\d{10}',
];

/**
* Vies Client.
*/
private ?Client $client;

/**
* VatValidator constructor.
* @param Client|null $client
*/
public function __construct(Client $client = null)
public function __construct(private ?Client $client = null)
{
$this->client = $client;

if (! $this->client) {
if (!$this->client instanceof \Danielebarbaro\LaravelVatEuValidator\Vies\Client) {
$this->client = new Client();
}
}
Expand All @@ -79,15 +72,15 @@ public static function countryIsSupported(string $country): bool
public function validateFormat(string $vatNumber): bool
{
$vatNumber = $this->vatCleaner($vatNumber);
list($country, $number) = $this->splitVat($vatNumber);
[$country, $number] = $this->splitVat($vatNumber);

if (! isset(self::$pattern_expression[$country])) {
return false;
}

$validate_rule = preg_match('/^' . self::$pattern_expression[$country] . '$/', $number) > 0;
$validate_rule = preg_match('/^' . self::$pattern_expression[$country] . '$/', (string) $number) > 0;

if ($validate_rule === true && $country === 'IT') {
if ($validate_rule && $country === 'IT') {
$result = self::luhnCheck($number);

return $result % 10 == 0;
Expand All @@ -107,7 +100,7 @@ public function validateExistence(string $vatNumber): bool
$vatNumber = $this->vatCleaner($vatNumber);
$result = $this->validateFormat($vatNumber);
if ($result) {
list($country, $number) = $this->splitVat($vatNumber);
[$country, $number] = $this->splitVat($vatNumber);
$result = $this->client->check($country, $number);
}

Expand All @@ -125,14 +118,16 @@ public static function luhnCheck(string $vat): int
{
$sum = 0;
$vat_array = str_split($vat);
for ($index = 0; $index < count($vat_array); $index++) {
$counter = count($vat_array);
for ($index = 0; $index < $counter; ++$index) {
$value = intval($vat_array[$index]);
if ($index % 2) {
$value = $value * 2;
if ($index % 2 !== 0) {
$value *= 2;
if ($value > 9) {
$value = 1 + ($value % 10);
}
}

$sum += $value;
}

Expand Down
17 changes: 6 additions & 11 deletions src/VatValidatorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,38 @@ class VatValidatorServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
public function boot()
public function boot(): void
{
/**
* Register the "vat_number" validation rule.
*/
Validator::extend('vat_number', function ($attribute, $value, $parameters, $validator) {
Validator::extend('vat_number', static function ($attribute, $value, $parameters, $validator) : bool {
$rule = new VatNumber();

return $rule->passes($attribute, $value);
});

/**
* Register the "vat_number_exist" validation rule.
*/
Validator::extend('vat_number_exist', function ($attribute, $value, $parameters, $validator) {
Validator::extend('vat_number_exist', static function ($attribute, $value, $parameters, $validator) : bool {
$rule = new VatNumberExist();

return $rule->passes($attribute, $value);
});

/**
* Register the "vat_number_format" validation rule.
*/
Validator::extend('vat_number_format', function ($attribute, $value, $parameters, $validator) {
Validator::extend('vat_number_format', static function ($attribute, $value, $parameters, $validator) : bool {
$rule = new VatNumberFormat();

return $rule->passes($attribute, $value);
});
}

/**
* Register the application services.
*/
public function register()
public function register(): void
{
$this->app->singleton(VatValidator::class, function (Container $app) {
return new VatValidator();
});
$this->app->singleton(VatValidator::class, fn(Container $app): \Danielebarbaro\LaravelVatEuValidator\VatValidator => new VatValidator());
}
}
17 changes: 4 additions & 13 deletions src/Vies/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@ class Client
*/
public const URL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';

/**
* @var int
*/
protected $timeout;

/**
* @var SoapClient
*/
private $client;
private ?\SoapClient $client = null;

/**
* Client constructor.
*
* @param int $timeout
*/
public function __construct(int $timeout = 10)
public function __construct(protected int $timeout = 10)
{
$this->timeout = $timeout;
}

/**
Expand All @@ -50,8 +41,8 @@ public function check(string $countryCode, string $vatNumber): bool
'vatNumber' => $vatNumber,
]
);
} catch (SoapFault $e) {
throw new ViesException($e->getMessage(), $e->getCode());
} catch (SoapFault $soapFault) {
throw new ViesException($soapFault->getMessage(), $soapFault->getCode());
}

return $response->valid;
Expand Down
4 changes: 2 additions & 2 deletions tests/Rules/CountryIsSupportedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

class CountryIsSupportedTest extends TestCase
{
public function testCountryIsSupported()
public function testCountryIsSupported(): void
{
self::assertTrue(VatValidator::countryIsSupported('AT'));
}

public function testCountryIsNotSupported()
public function testCountryIsNotSupported(): void
{
self::assertFalse(VatValidator::countryIsSupported('US'));
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Rules/VatNumberExistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ class VatNumberExistTest extends TestCase

protected string $fake_vat;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

$this->rule = new VatNumberExist();
$this->fake_vat = 'IT12345678901';
}

public function testSuccessVatNumberFormatExist()
public function testSuccessVatNumberFormatExist(): void
{
self::assertFalse($this->rule->passes('vat_number_exist', $this->fake_vat));
}

public function testSuccessVatNumberFormatExistMessage()
public function testSuccessVatNumberFormatExistMessage(): void
{
self::assertStringContainsString(
'The :attribute must be write in a valid number format {country_name}{vat_number}.',
Expand Down
8 changes: 4 additions & 4 deletions tests/Rules/VatNumberFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ class VatNumberFormatTest extends TestCase

protected string $fake_vat;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

$this->rule = new VatNumberFormat();
$this->fake_vat = 'IT12345678901';
}

public function testSuccessVatNumberFormat()
public function testSuccessVatNumberFormat(): void
{
self::assertFalse($this->rule->passes('vat_number_format', $this->fake_vat));
self::assertTrue($this->rule->passes('vat_number_format', 'IT10648200011'));
}

public function testFailVatNumberFormat()
public function testFailVatNumberFormat(): void
{
self::assertFalse($this->rule->passes('vat_number_format', 'foo'));
}

public function testFailVatNumberFormatMessage()
public function testFailVatNumberFormatMessage(): void
{
self::assertStringContainsString('VAT number :attribute not exist.', $this->rule->message());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Rules/VatNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ class VatNumberTest extends TestCase

protected string $fake_vat;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

$this->rule = new VatNumber();
$this->fake_vat = 'IT12345678901';
}

public function testSuccessVatNumber()
public function testSuccessVatNumber(): void
{
self::assertFalse($this->rule->passes('vat_number', $this->fake_vat));
}

public function testSuccessVatNumberMessage()
public function testSuccessVatNumberMessage(): void
{
self::assertStringContainsString('The :attribute must be a valid VAT number.', $this->rule->message());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/VatValidatorFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class VatValidatorFacadeTest extends TestCase
{
public function testVatValidatorFacade()
public function testVatValidatorFacade(): void
{
$validator = new VatValidator();
$fake_vat = 'is_a_fake_vat_string';
Expand Down
Loading

0 comments on commit 4374ee7

Please sign in to comment.