From 987e262ac50da582d6576b2ca19a9439f334e17c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 25 Mar 2025 11:45:46 +1100 Subject: [PATCH] Fixes for tests --- app/Http/Requests/Client/StoreClientRequest.php | 8 ++++---- app/Http/Requests/Client/UpdateClientRequest.php | 8 ++++---- database/factories/ClientFactory.php | 2 +- tests/Feature/ClassificationTest.php | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index a76181281c..73c5310887 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -83,10 +83,10 @@ class StoreClientRequest extends Request $rules['shipping_country_id'] = 'integer|nullable|exists:countries,id'; $rules['number'] = ['sometimes', 'nullable', 'bail', Rule::unique('clients')->where('company_id', $user->company()->id)]; $rules['country_id'] = 'integer|nullable|exists:countries,id'; - $rules['custom_value1'] = 'bail|nullable|string'; - $rules['custom_value2'] = 'bail|nullable|string'; - $rules['custom_value3'] = 'bail|nullable|string'; - $rules['custom_value4'] = 'bail|nullable|string'; + $rules['custom_value1'] = 'bail|nullable|sometimes|string'; + $rules['custom_value2'] = 'bail|nullable|sometimes|string'; + $rules['custom_value3'] = 'bail|nullable|sometimes|string'; + $rules['custom_value4'] = 'bail|nullable|sometimes|string'; return $rules; } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 094fc5af14..b364aec78b 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -83,10 +83,10 @@ class UpdateClientRequest extends Request //'regex:/[@$!%*#?&.]/', // must contain a special character ]; - $rules['custom_value1'] = 'bail|nullable|string'; - $rules['custom_value2'] = 'bail|nullable|string'; - $rules['custom_value3'] = 'bail|nullable|string'; - $rules['custom_value4'] = 'bail|nullable|string'; + $rules['custom_value1'] = 'bail|nullable|sometimes|string'; + $rules['custom_value2'] = 'bail|nullable|sometimes|string'; + $rules['custom_value3'] = 'bail|nullable|sometimes|string'; + $rules['custom_value4'] = 'bail|nullable|sometimes|string'; return $rules; } diff --git a/database/factories/ClientFactory.php b/database/factories/ClientFactory.php index f979c8d7d3..5ec360f8f5 100644 --- a/database/factories/ClientFactory.php +++ b/database/factories/ClientFactory.php @@ -32,7 +32,7 @@ class ClientFactory extends Factory 'paid_to_date' => 0, 'vat_number' => $this->faker->numberBetween(123456789, 987654321), 'id_number' => $this->faker->iban(), - 'custom_value1' => $this->faker->dateTime(), + 'custom_value1' => $this->faker->date(), 'custom_value2' => $this->faker->colorName(), 'custom_value3' => $this->faker->word(), 'custom_value4' => $this->faker->email(), diff --git a/tests/Feature/ClassificationTest.php b/tests/Feature/ClassificationTest.php index ba72be59b8..ed94e39eab 100644 --- a/tests/Feature/ClassificationTest.php +++ b/tests/Feature/ClassificationTest.php @@ -74,6 +74,7 @@ class ClassificationTest extends TestCase { $this->client->classification = 'business'; + nlog($this->client->toArray()); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token,