Revert "Using existing customer"

This reverts commit 93bc59409e927cb0b938972a2671b5f4d7987a18.
This commit is contained in:
EnesSacid-Buker 2022-02-16 18:19:26 +03:00
parent 93bc59409e
commit 24b2f14d84

View File

@ -5,6 +5,7 @@ namespace Tests\Feature;
use App\Models\Auth\User; use App\Models\Auth\User;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Document\Document; use App\Models\Document\Document;
use App\Jobs\Common\CreateContact;
use App\Jobs\Document\CreateDocument; use App\Jobs\Document\CreateDocument;
use App\Jobs\Setting\CreateCurrency; use App\Jobs\Setting\CreateCurrency;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
@ -51,7 +52,7 @@ class PaymentTestCase extends FeatureTestCase
$this->updateSetting(); $this->updateSetting();
$this->loginAsCustomer(); $this->createCustomer();
$this->createInvoice(); $this->createInvoice();
@ -139,11 +140,20 @@ class PaymentTestCase extends FeatureTestCase
$this->invoice = $this->dispatch(new CreateDocument($this->getInvoiceRequest())); $this->invoice = $this->dispatch(new CreateDocument($this->getInvoiceRequest()));
} }
public function loginAsCustomer() public function createCustomer()
{ {
$this->customer = Contact::customer()->first(); $password = $this->faker->password;
$this->customer_user = User::where('email', $this->customer->email)->first(); $request = Contact::factory()->customer()->enabled()->raw() + [
'create_user' => 'true',
'locale' => 'en-GB',
'password' => $password,
'password_confirmation' => $password,
];
$this->customer = $this->dispatch(new CreateContact($request));
$this->customer_user = User::where('email', $request['email'])->first();
} }
public function getInvoiceRequest() public function getInvoiceRequest()