diff --git a/src/Exception/InvalidInputException.php b/src/Exception/InvalidInputException.php new file mode 100644 index 0000000..25148e7 --- /dev/null +++ b/src/Exception/InvalidInputException.php @@ -0,0 +1,13 @@ +faultstring) { + 'INVALID_INPUT' => new InvalidInputException($e), + 'GLOBAL_MAX_CONCURRENT_REQ' => new MaxConcurrentRequestsException($e), + 'MS_MAX_CONCURRENT_REQ' => new MaxConcurrentStateRequestsException($e), + 'SERVICE_UNAVAILABLE' => new ServiceUnavailableException($e), + 'MS_UNAVAILABLE' => new StateServiceUnavailableException($e), + 'TIMEOUT' => new TimeoutException($e), + default => new ViesException($e), + }; } } diff --git a/tests/Vies/ClientTest.php b/tests/Vies/ClientTest.php index 6397d40..c6e324c 100644 --- a/tests/Vies/ClientTest.php +++ b/tests/Vies/ClientTest.php @@ -2,6 +2,7 @@ namespace Ddeboer\Vatin\Test\Vies; +use Ddeboer\Vatin\Exception\InvalidInputException; use Ddeboer\Vatin\Vies\Client; use PHPUnit\Framework\TestCase; @@ -19,4 +20,12 @@ public function testCheckVat(): void $this->assertEquals('---', $response->name); $this->assertEquals('---', $response->address); } + + public function testInvalidInputException(): void + { + $this->expectException(InvalidInputException::class); + + $client = new Client(); + $client->checkVat('XYZ', '123'); + } }