2023-03-19 05:09:50 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
2023-03-19 06:14:04 +01:00
|
|
|
namespace Tests\Unit\Tax;
|
2023-03-19 05:09:50 +01:00
|
|
|
|
|
|
|
use App\Services\Tax\VatNumberCheck;
|
2023-03-19 06:14:04 +01:00
|
|
|
use Tests\TestCase;
|
2023-03-19 05:09:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @test App\Services\Tax\VatNumberCheck
|
|
|
|
*/
|
|
|
|
class VatNumberTest extends TestCase
|
|
|
|
{
|
|
|
|
protected function setUp() :void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testVatNumber()
|
|
|
|
{
|
|
|
|
// Usage example
|
|
|
|
$country_code = "IE"; // Ireland
|
|
|
|
$vat_number = "1234567L"; // Example VAT number
|
|
|
|
$result = '';
|
|
|
|
|
|
|
|
$vat_checker = new VatNumberCheck($vat_number, $country_code);
|
|
|
|
$result = $vat_checker->run();
|
|
|
|
|
2023-03-19 06:14:04 +01:00
|
|
|
$this->assertFalse($result->isValid());
|
2023-03-19 05:09:50 +01:00
|
|
|
}
|
|
|
|
|
2023-03-19 06:14:04 +01:00
|
|
|
public function testValidVatNumber()
|
2023-03-19 05:09:50 +01:00
|
|
|
{
|
|
|
|
// Usage example
|
|
|
|
$country_code = "AT"; // Ireland
|
|
|
|
$vat_number = "U12345678"; // Example VAT number
|
|
|
|
$result = '';
|
|
|
|
|
|
|
|
$vat_checker = new VatNumberCheck($vat_number, $country_code);
|
|
|
|
$result = $vat_checker->run();
|
|
|
|
|
2023-03-19 06:14:04 +01:00
|
|
|
$this->assertFalse($result->isValid());
|
2023-03-19 05:09:50 +01:00
|
|
|
}
|
|
|
|
}
|