From 4a0857f642ddd0eddf4f8324afa12b28f38b472a Mon Sep 17 00:00:00 2001 From: Mathias Palmqvist Date: Mon, 30 Jun 2025 11:29:29 +0200 Subject: [PATCH] Updated validation --- src/Validation/CustomerValidator.php | 2 +- tests/CustomerTest.php | 1 - tests/Responses/Customer/all.200.json | 24 ++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Validation/CustomerValidator.php b/src/Validation/CustomerValidator.php index 7269d73..9213b3d 100644 --- a/src/Validation/CustomerValidator.php +++ b/src/Validation/CustomerValidator.php @@ -11,7 +11,7 @@ class CustomerValidator { $validator = Validator::make($data, [ 'name' => 'required|string', - 'type' => 'required|string', + 'type' => 'required|string|in:company,private', 'vatNumber' => 'nullable|string', 'orgNumber' => 'nullable|string', 'paymentTerms' => 'nullable|string', diff --git a/tests/CustomerTest.php b/tests/CustomerTest.php index 502c4ea..30c3ebe 100644 --- a/tests/CustomerTest.php +++ b/tests/CustomerTest.php @@ -35,7 +35,6 @@ beforeEach(function () { it('can fetch a list of customers from Bokio', function () { $response = (new Customer($this->client))->all(); - expect($response->items)->toHaveCount(1); expect($response->items[0]->name)->toBe('customer 1'); }); diff --git a/tests/Responses/Customer/all.200.json b/tests/Responses/Customer/all.200.json index 0cbfad2..7182f31 100644 --- a/tests/Responses/Customer/all.200.json +++ b/tests/Responses/Customer/all.200.json @@ -26,6 +26,30 @@ "country": "SE" }, "language": "sv" + }, + { + "id": "55c899c5-82b2-47fa-9c51-e35fc9b26443", + "name": "customer 2", + "type": "private", + "vatNumber": null, + "orgNumber": "123456-7890", + "paymentTerms": "30", + "contactsDetails": [ + { + "name": "John Doe", + "email": "john@email.com", + "phone": "0927-5631505", + "isDefault": true + } + ], + "address": { + "line1": "Älvsborgsvägen 10", + "line2": null, + "city": "Göteborg", + "postalCode": "123 45", + "country": "SE" + }, + "language": "sv" } ] }