From 682f6b55e923791db88fb69a56a2fdb6ee38055c Mon Sep 17 00:00:00 2001 From: KirinZero0 Date: Fri, 4 Oct 2024 15:10:25 +0800 Subject: [PATCH] Add delivery address to customer test --- tests/Feature/CrmTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/Feature/CrmTest.php b/tests/Feature/CrmTest.php index 457c694874..29d3f29592 100644 --- a/tests/Feature/CrmTest.php +++ b/tests/Feature/CrmTest.php @@ -5,6 +5,7 @@ * Copyright (c) 2024, Raul A Perusquia Flores */ +use App\Actions\CRM\Customer\AddDeliveryAddressToCustomer; use App\Actions\CRM\Customer\HydrateCustomers; use App\Actions\CRM\Customer\StoreCustomer; use App\Actions\CRM\Prospect\StoreProspect; @@ -16,6 +17,8 @@ use App\Enums\Mail\Outbox\OutboxTypeEnum; use App\Models\CRM\Customer; use App\Models\CRM\Prospect; +use App\Models\Helpers\Address; +use App\Models\Helpers\Country; use App\Models\Helpers\Query; use App\Models\Mail\Mailshot; use App\Models\Mail\Outbox; @@ -171,6 +174,26 @@ ->and($outbox->stats->number_mailshots)->toBe(1); }); +test('add delivery address to customer', function (Customer $customer) { + $country = Country::latest()->first(); + $customer = AddDeliveryAddressToCustomer::make()->action($customer, + [ + 'delivery_address' => [ + 'address_line_1' => fake()->streetAddress, + 'address_line_2' => fake()->buildingNumber, + 'sorting_code' => '', + 'postal_code' => fake()->postcode, + 'locality' => fake()->city, + 'dependent_locality' => '', + 'administrative_area' => fake('en_US')->state() , + 'country_id' => $country->id + ] + ]); + + expect($customer)->toBeInstanceOf(Customer::class) + ->and($customer->addresses->count())->toBe(2); +})->depends('create customer'); + test('can show list of prospects lists', function () { $shop = $this->shop; $response = get(route('grp.org.shops.show.crm.prospects.lists.index', [$shop->slug]));